@agent-deck/backend 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/config/oauth-redirect.d.ts +6 -1
- package/dist/config/oauth-redirect.d.ts.map +1 -1
- package/dist/config/oauth-redirect.js +29 -3
- package/dist/config/oauth-redirect.js.map +1 -1
- package/dist/data/default-mcp-services.d.ts +3 -0
- package/dist/data/default-mcp-services.d.ts.map +1 -1
- package/dist/data/default-mcp-services.js +4 -29
- package/dist/data/default-mcp-services.js.map +1 -1
- package/dist/data/oauth-provider-guides.d.ts +14 -2
- package/dist/data/oauth-provider-guides.d.ts.map +1 -1
- package/dist/data/oauth-provider-guides.js +143 -25
- package/dist/data/oauth-provider-guides.js.map +1 -1
- package/dist/lib/mcp-connection-error.d.ts +4 -0
- package/dist/lib/mcp-connection-error.d.ts.map +1 -0
- package/dist/lib/mcp-connection-error.js +45 -0
- package/dist/lib/mcp-connection-error.js.map +1 -0
- package/dist/lib/oauth-token-response.d.ts +11 -0
- package/dist/lib/oauth-token-response.d.ts.map +1 -0
- package/dist/lib/oauth-token-response.js +48 -0
- package/dist/lib/oauth-token-response.js.map +1 -0
- package/dist/mcp-server.d.ts +4 -3
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +128 -32
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-session-binding.d.ts +29 -0
- package/dist/mcp-session-binding.d.ts.map +1 -0
- package/dist/mcp-session-binding.js +74 -0
- package/dist/mcp-session-binding.js.map +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/services/config-manager.d.ts.map +1 -1
- package/dist/services/config-manager.js +5 -5
- package/dist/services/config-manager.js.map +1 -1
- package/dist/services/mcp-client-manager.d.ts.map +1 -1
- package/dist/services/mcp-client-manager.js +6 -1
- package/dist/services/mcp-client-manager.js.map +1 -1
- package/dist/services/oauth-connect-service.d.ts.map +1 -1
- package/dist/services/oauth-connect-service.js +21 -3
- package/dist/services/oauth-connect-service.js.map +1 -1
- package/dist/services/oauth-manager.d.ts.map +1 -1
- package/dist/services/oauth-manager.js +5 -8
- package/dist/services/oauth-manager.js.map +1 -1
- package/dist/services/service-manager.d.ts +2 -0
- package/dist/services/service-manager.d.ts.map +1 -1
- package/dist/services/service-manager.js +22 -3
- package/dist/services/service-manager.js.map +1 -1
- package/package.json +2 -2
- package/static-ui/assets/AgentDeckLogo3-CEDxeHlz.png +0 -0
- package/static-ui/assets/{index-CExp-xnm.js → index-CPNBMDJn.js} +74 -64
- package/static-ui/assets/index-Df5pC3f-.css +1 -0
- package/static-ui/favicon.png +0 -0
- package/static-ui/index.html +2 -2
- package/static-ui/assets/AgentDeckLogo2-z3pVqJJ3.png +0 -0
- package/static-ui/assets/index-C9xsIiR9.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var bC=Object.defineProperty;var yg=t=>{throw TypeError(t)};var SC=(t,e,r)=>e in t?bC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ln=(t,e,r)=>SC(t,typeof e!="symbol"?e+"":e,r),ef=(t,e,r)=>e.has(t)||yg("Cannot "+r);var O=(t,e,r)=>(ef(t,e,"read from private field"),r?r.call(t):e.get(t)),be=(t,e,r)=>e.has(t)?yg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ie=(t,e,r,s)=>(ef(t,e,"write to private field"),s?s.call(t,r):e.set(t,r),r),Le=(t,e,r)=>(ef(t,e,"access private method"),r);var nc=(t,e,r,s)=>({set _(n){ie(t,e,n,r)},get _(){return O(t,e,s)}});function _C(t,e){for(var r=0;r<e.length;r++){const s=e[r];if(typeof s!="string"&&!Array.isArray(s)){for(const n in s)if(n!=="default"&&!(n in t)){const a=Object.getOwnPropertyDescriptor(s,n);a&&Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>s[n]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const a of n)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function r(n){const a={};return n.integrity&&(a.integrity=n.integrity),n.referrerPolicy&&(a.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?a.credentials="include":n.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(n){if(n.ep)return;n.ep=!0;const a=r(n);fetch(n.href,a)}})();var EC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cx={exports:{}},id={},ux={exports:{}},qe={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var vC=Object.defineProperty;var vg=t=>{throw TypeError(t)};var gC=(t,e,r)=>e in
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Ml=Symbol.for("react.element"),CC=Symbol.for("react.portal"),PC=Symbol.for("react.fragment"),kC=Symbol.for("react.strict_mode"),NC=Symbol.for("react.profiler"),jC=Symbol.for("react.provider"),RC=Symbol.for("react.context"),TC=Symbol.for("react.forward_ref"),AC=Symbol.for("react.suspense"),OC=Symbol.for("react.memo"),IC=Symbol.for("react.lazy"),xg=Symbol.iterator;function DC(t){return t===null||typeof t!="object"?null:(t=xg&&t[xg]||t["@@iterator"],typeof t=="function"?t:null)}var dx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},fx=Object.assign,hx={};function yi(t,e,r){this.props=t,this.context=e,this.refs=hx,this.updater=r||dx}yi.prototype.isReactComponent={};yi.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};yi.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function px(){}px.prototype=yi.prototype;function hm(t,e,r){this.props=t,this.context=e,this.refs=hx,this.updater=r||dx}var pm=hm.prototype=new px;pm.constructor=hm;fx(pm,yi.prototype);pm.isPureReactComponent=!0;var wg=Array.isArray,mx=Object.prototype.hasOwnProperty,mm={current:null},vx={key:!0,ref:!0,__self:!0,__source:!0};function gx(t,e,r){var s,n={},a=null,o=null;if(e!=null)for(s in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(a=""+e.key),e)mx.call(e,s)&&!vx.hasOwnProperty(s)&&(n[s]=e[s]);var i=arguments.length-2;if(i===1)n.children=r;else if(1<i){for(var c=Array(i),u=0;u<i;u++)c[u]=arguments[u+2];n.children=c}if(t&&t.defaultProps)for(s in i=t.defaultProps,i)n[s]===void 0&&(n[s]=i[s]);return{$$typeof:Ml,type:t,key:a,ref:o,props:n,_owner:mm.current}}function MC(t,e){return{$$typeof:Ml,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function vm(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ml}function $C(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var bg=/\/+/g;function tf(t,e){return typeof t=="object"&&t!==null&&t.key!=null?$C(""+t.key):e.toString(36)}function Ic(t,e,r,s,n){var a=typeof t;(a==="undefined"||a==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Ml:case CC:o=!0}}if(o)return o=t,n=n(o),t=s===""?"."+tf(o,0):s,wg(n)?(r="",t!=null&&(r=t.replace(bg,"$&/")+"/"),Ic(n,e,r,"",function(u){return u})):n!=null&&(vm(n)&&(n=MC(n,r+(!n.key||o&&o.key===n.key?"":(""+n.key).replace(bg,"$&/")+"/")+t)),e.push(n)),1;if(o=0,s=s===""?".":s+":",wg(t))for(var i=0;i<t.length;i++){a=t[i];var c=s+tf(a,i);o+=Ic(a,e,r,c,n)}else if(c=DC(t),typeof c=="function")for(t=c.call(t),i=0;!(a=t.next()).done;)a=a.value,c=s+tf(a,i++),o+=Ic(a,e,r,c,n);else if(a==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function sc(t,e,r){if(t==null)return t;var s=[],n=0;return Ic(t,s,"","",function(a){return e.call(r,a,n++)}),s}function FC(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var sr={current:null},Dc={transition:null},LC={ReactCurrentDispatcher:sr,ReactCurrentBatchConfig:Dc,ReactCurrentOwner:mm};function yx(){throw Error("act(...) is not supported in production builds of React.")}qe.Children={map:sc,forEach:function(t,e,r){sc(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return sc(t,function(){e++}),e},toArray:function(t){return sc(t,function(e){return e})||[]},only:function(t){if(!vm(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};qe.Component=yi;qe.Fragment=PC;qe.Profiler=NC;qe.PureComponent=hm;qe.StrictMode=kC;qe.Suspense=AC;qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=LC;qe.act=yx;qe.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var s=fx({},t.props),n=t.key,a=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(a=e.ref,o=mm.current),e.key!==void 0&&(n=""+e.key),t.type&&t.type.defaultProps)var i=t.type.defaultProps;for(c in e)mx.call(e,c)&&!vx.hasOwnProperty(c)&&(s[c]=e[c]===void 0&&i!==void 0?i[c]:e[c])}var c=arguments.length-2;if(c===1)s.children=r;else if(1<c){i=Array(c);for(var u=0;u<c;u++)i[u]=arguments[u+2];s.children=i}return{$$typeof:Ml,type:t.type,key:n,ref:a,props:s,_owner:o}};qe.createContext=function(t){return t={$$typeof:RC,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:jC,_context:t},t.Consumer=t};qe.createElement=gx;qe.createFactory=function(t){var e=gx.bind(null,t);return e.type=t,e};qe.createRef=function(){return{current:null}};qe.forwardRef=function(t){return{$$typeof:TC,render:t}};qe.isValidElement=vm;qe.lazy=function(t){return{$$typeof:IC,_payload:{_status:-1,_result:t},_init:FC}};qe.memo=function(t,e){return{$$typeof:OC,type:t,compare:e===void 0?null:e}};qe.startTransition=function(t){var e=Dc.transition;Dc.transition={};try{t()}finally{Dc.transition=e}};qe.unstable_act=yx;qe.useCallback=function(t,e){return sr.current.useCallback(t,e)};qe.useContext=function(t){return sr.current.useContext(t)};qe.useDebugValue=function(){};qe.useDeferredValue=function(t){return sr.current.useDeferredValue(t)};qe.useEffect=function(t,e){return sr.current.useEffect(t,e)};qe.useId=function(){return sr.current.useId()};qe.useImperativeHandle=function(t,e,r){return sr.current.useImperativeHandle(t,e,r)};qe.useInsertionEffect=function(t,e){return sr.current.useInsertionEffect(t,e)};qe.useLayoutEffect=function(t,e){return sr.current.useLayoutEffect(t,e)};qe.useMemo=function(t,e){return sr.current.useMemo(t,e)};qe.useReducer=function(t,e,r){return sr.current.useReducer(t,e,r)};qe.useRef=function(t){return sr.current.useRef(t)};qe.useState=function(t){return sr.current.useState(t)};qe.useSyncExternalStore=function(t,e,r){return sr.current.useSyncExternalStore(t,e,r)};qe.useTransition=function(){return sr.current.useTransition()};qe.version="18.3.1";ux.exports=qe;var x=ux.exports;const mn=fm(x),gm=_C({__proto__:null,default:mn},[x]);/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var vC=Object.defineProperty;var vg=t=>{throw TypeError(t)};var gC=(t,e,r)=>e in
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var UC=x,zC=Symbol.for("react.element"),VC=Symbol.for("react.fragment"),qC=Object.prototype.hasOwnProperty,HC=UC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,BC={key:!0,ref:!0,__self:!0,__source:!0};function xx(t,e,r){var s,n={},a=null,o=null;r!==void 0&&(a=""+r),e.key!==void 0&&(a=""+e.key),e.ref!==void 0&&(o=e.ref);for(s in e)qC.call(e,s)&&!BC.hasOwnProperty(s)&&(n[s]=e[s]);if(t&&t.defaultProps)for(s in e=t.defaultProps,e)n[s]===void 0&&(n[s]=e[s]);return{$$typeof:zC,type:t,key:a,ref:o,props:n,_owner:HC.current}}id.Fragment=VC;id.jsx=xx;id.jsxs=xx;cx.exports=id;var l=cx.exports,wx={exports:{}},kr={},bx={exports:{}},Sx={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.min.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var vC=Object.defineProperty;var vg=t=>{throw TypeError(t)};var gC=(t,e,r)=>e in
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(t){function e(P,D){var L=P.length;P.push(D);e:for(;0<L;){var
|
|
25
|
+
*/(function(t){function e(P,D){var L=P.length;P.push(D);e:for(;0<L;){var X=L-1>>>1,G=P[X];if(0<n(G,D))P[X]=D,P[L]=G,L=X;else break e}}function r(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var D=P[0],L=P.pop();if(L!==D){P[0]=L;e:for(var X=0,G=P.length,B=G>>>1;X<B;){var oe=2*(X+1)-1,ve=P[oe],ge=oe+1,re=P[ge];if(0>n(ve,L))ge<G&&0>n(re,ve)?(P[X]=re,P[ge]=L,X=ge):(P[X]=ve,P[oe]=L,X=oe);else if(ge<G&&0>n(re,L))P[X]=re,P[ge]=L,X=ge;else break e}}return D}function n(P,D){var L=P.sortIndex-D.sortIndex;return L!==0?L:P.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,i=o.now();t.unstable_now=function(){return o.now()-i}}var c=[],u=[],d=1,h=null,m=3,f=!1,w=!1,p=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(P){for(var D=r(u);D!==null;){if(D.callback===null)s(u);else if(D.startTime<=P)s(u),D.sortIndex=D.expirationTime,e(c,D);else break;D=r(u)}}function S(P){if(p=!1,b(P),!w)if(r(c)!==null)w=!0,U(E);else{var D=r(u);D!==null&&K(S,D.startTime-P)}}function E(P,D){w=!1,p&&(p=!1,g(R),R=-1),f=!0;var L=m;try{for(b(D),h=r(c);h!==null&&(!(h.expirationTime>D)||P&&!T());){var X=h.callback;if(typeof X=="function"){h.callback=null,m=h.priorityLevel;var G=X(h.expirationTime<=D);D=t.unstable_now(),typeof G=="function"?h.callback=G:h===r(c)&&s(c),b(D)}else s(c);h=r(c)}if(h!==null)var B=!0;else{var oe=r(u);oe!==null&&K(S,oe.startTime-D),B=!1}return B}finally{h=null,m=L,f=!1}}var N=!1,j=null,R=-1,A=5,F=-1;function T(){return!(t.unstable_now()-F<A)}function _(){if(j!==null){var P=t.unstable_now();F=P;var D=!0;try{D=j(!0,P)}finally{D?I():(N=!1,j=null)}}else N=!1}var I;if(typeof v=="function")I=function(){v(_)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,z=C.port2;C.port1.onmessage=_,I=function(){z.postMessage(null)}}else I=function(){y(_,0)};function U(P){j=P,N||(N=!0,I())}function K(P,D){R=y(function(){P(t.unstable_now())},D)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_continueExecution=function(){w||f||(w=!0,U(E))},t.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<P?Math.floor(1e3/P):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(P){switch(m){case 1:case 2:case 3:var D=3;break;default:D=m}var L=m;m=D;try{return P()}finally{m=L}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(P,D){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var L=m;m=P;try{return D()}finally{m=L}},t.unstable_scheduleCallback=function(P,D,L){var X=t.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?X+L:X):L=X,P){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=L+G,P={id:d++,callback:D,priorityLevel:P,startTime:L,expirationTime:G,sortIndex:-1},L>X?(P.sortIndex=L,e(u,P),r(c)===null&&P===r(u)&&(p?(g(R),R=-1):p=!0,K(S,L-X))):(P.sortIndex=G,e(c,P),w||f||(w=!0,U(E))),P},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(P){var D=m;return function(){var L=m;m=D;try{return P.apply(this,arguments)}finally{m=L}}}})(Sx);bx.exports=Sx;var KC=bx.exports;/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,14 +30,14 @@ var vC=Object.defineProperty;var vg=t=>{throw TypeError(t)};var gC=(t,e,r)=>e in
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var
|
|
34
|
-
`+
|
|
33
|
+
*/var WC=x,Pr=KC;function Q(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var _x=new Set,ul={};function ro(t,e){si(t,e),si(t+"Capture",e)}function si(t,e){for(ul[t]=e,t=0;t<e.length;t++)_x.add(e[t])}var ns=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),th=Object.prototype.hasOwnProperty,QC=/^[: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]*$/,Sg={},_g={};function GC(t){return th.call(_g,t)?!0:th.call(Sg,t)?!1:QC.test(t)?_g[t]=!0:(Sg[t]=!0,!1)}function ZC(t,e,r,s){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return s?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function YC(t,e,r,s){if(e===null||typeof e>"u"||ZC(t,e,r,s))return!0;if(s)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ar(t,e,r,s,n,a,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=s,this.attributeNamespace=n,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=a,this.removeEmptyString=o}var Ht={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ht[t]=new ar(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ht[e]=new ar(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ht[t]=new ar(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ht[t]=new ar(t,2,!1,t,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(t){Ht[t]=new ar(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ht[t]=new ar(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ht[t]=new ar(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ht[t]=new ar(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ht[t]=new ar(t,5,!1,t.toLowerCase(),null,!1,!1)});var ym=/[\-:]([a-z])/g;function xm(t){return t[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(t){var e=t.replace(ym,xm);Ht[e]=new ar(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ym,xm);Ht[e]=new ar(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ym,xm);Ht[e]=new ar(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ht[t]=new ar(t,1,!1,t.toLowerCase(),null,!1,!1)});Ht.xlinkHref=new ar("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ht[t]=new ar(t,1,!1,t.toLowerCase(),null,!0,!0)});function wm(t,e,r,s){var n=Ht.hasOwnProperty(e)?Ht[e]:null;(n!==null?n.type!==0:s||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(YC(e,r,n,s)&&(r=null),s||n===null?GC(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):n.mustUseProperty?t[n.propertyName]=r===null?n.type===3?!1:"":r:(e=n.attributeName,s=n.attributeNamespace,r===null?t.removeAttribute(e):(n=n.type,r=n===3||n===4&&r===!0?"":""+r,s?t.setAttributeNS(s,e,r):t.setAttribute(e,r))))}var ds=WC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ac=Symbol.for("react.element"),xo=Symbol.for("react.portal"),wo=Symbol.for("react.fragment"),bm=Symbol.for("react.strict_mode"),rh=Symbol.for("react.profiler"),Ex=Symbol.for("react.provider"),Cx=Symbol.for("react.context"),Sm=Symbol.for("react.forward_ref"),nh=Symbol.for("react.suspense"),sh=Symbol.for("react.suspense_list"),_m=Symbol.for("react.memo"),_s=Symbol.for("react.lazy"),Px=Symbol.for("react.offscreen"),Eg=Symbol.iterator;function Ri(t){return t===null||typeof t!="object"?null:(t=Eg&&t[Eg]||t["@@iterator"],typeof t=="function"?t:null)}var gt=Object.assign,rf;function zi(t){if(rf===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);rf=e&&e[1]||""}return`
|
|
34
|
+
`+rf+t}var nf=!1;function sf(t,e){if(!t||nf)return"";nf=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var s=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){s=u}t.call(e.prototype)}else{try{throw Error()}catch(u){s=u}t()}}catch(u){if(u&&s&&typeof u.stack=="string"){for(var n=u.stack.split(`
|
|
35
35
|
`),a=s.stack.split(`
|
|
36
36
|
`),o=n.length-1,i=a.length-1;1<=o&&0<=i&&n[o]!==a[i];)i--;for(;1<=o&&0<=i;o--,i--)if(n[o]!==a[i]){if(o!==1||i!==1)do if(o--,i--,0>i||n[o]!==a[i]){var c=`
|
|
37
|
-
`+n[o].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=o&&0<=i);break}}}finally{rf=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?zi(t):""}function WC(t){switch(t.tag){case 5:return zi(t.type);case 16:return zi("Lazy");case 13:return zi("Suspense");case 19:return zi("SuspenseList");case 0:case 2:case 15:return t=nf(t.type,!1),t;case 11:return t=nf(t.type.render,!1),t;case 1:return t=nf(t.type,!0),t;default:return""}}function nh(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case wo:return"Fragment";case xo:return"Portal";case eh:return"Profiler";case xm:return"StrictMode";case th:return"Suspense";case rh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case bx:return(t.displayName||"Context")+".Consumer";case wx:return(t._context.displayName||"Context")+".Provider";case wm:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case bm:return e=t.displayName||null,e!==null?e:nh(t.type)||"Memo";case Ss:e=t._payload,t=t._init;try{return nh(t(e))}catch{}}return null}function QC(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return nh(e);case 8:return e===xm?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function na(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function _x(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function GC(t){var e=_x(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),s=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var n=r.get,a=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return n.call(this)},set:function(o){s=""+o,a.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function ac(t){t._valueTracker||(t._valueTracker=GC(t))}function Ex(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),s="";return t&&(s=_x(t)?t.checked?"true":"false":t.value),t=s,t!==r?(e.setValue(t),!0):!1}function nu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function sh(t,e){var r=e.checked;return gt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function _g(t,e){var r=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;r=na(e.value!=null?e.value:r),t._wrapperState={initialChecked:s,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Cx(t,e){e=e.checked,e!=null&&ym(t,"checked",e,!1)}function ah(t,e){Cx(t,e);var r=na(e.value),s=e.type;if(r!=null)s==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(s==="submit"||s==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?oh(t,e.type,r):e.hasOwnProperty("defaultValue")&&oh(t,e.type,na(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Eg(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var s=e.type;if(!(s!=="submit"&&s!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function oh(t,e,r){(e!=="number"||nu(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Vi=Array.isArray;function Io(t,e,r,s){if(t=t.options,e){e={};for(var n=0;n<r.length;n++)e["$"+r[n]]=!0;for(r=0;r<t.length;r++)n=e.hasOwnProperty("$"+t[r].value),t[r].selected!==n&&(t[r].selected=n),n&&s&&(t[r].defaultSelected=!0)}else{for(r=""+na(r),e=null,n=0;n<t.length;n++){if(t[n].value===r){t[n].selected=!0,s&&(t[n].defaultSelected=!0);return}e!==null||t[n].disabled||(e=t[n])}e!==null&&(e.selected=!0)}}function ih(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Q(91));return gt({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Cg(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(Q(92));if(Vi(r)){if(1<r.length)throw Error(Q(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:na(r)}}function Px(t,e){var r=na(e.value),s=na(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),s!=null&&(t.defaultValue=""+s)}function Pg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function kx(t){switch(t){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 lh(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?kx(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var oc,Nx=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,s,n){MSApp.execUnsafeLocalFunction(function(){return t(e,r,s,n)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(oc=oc||document.createElement("div"),oc.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=oc.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function ul(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var Yi={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},ZC=["Webkit","ms","Moz","O"];Object.keys(Yi).forEach(function(t){ZC.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Yi[e]=Yi[t]})});function jx(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Yi.hasOwnProperty(t)&&Yi[t]?(""+e).trim():e+"px"}function Rx(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var s=r.indexOf("--")===0,n=jx(r,e[r],s);r==="float"&&(r="cssFloat"),s?t.setProperty(r,n):t[r]=n}}var YC=gt({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 ch(t,e){if(e){if(YC[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Q(62))}}function uh(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var dh=null;function Sm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var fh=null,Do=null,Mo=null;function kg(t){if(t=Fl(t)){if(typeof fh!="function")throw Error(Q(280));var e=t.stateNode;e&&(e=dd(e),fh(t.stateNode,t.type,e))}}function Tx(t){Do?Mo?Mo.push(t):Mo=[t]:Do=t}function Ax(){if(Do){var t=Do,e=Mo;if(Mo=Do=null,kg(t),e)for(t=0;t<e.length;t++)kg(e[t])}}function Ox(t,e){return t(e)}function Ix(){}var sf=!1;function Dx(t,e,r){if(sf)return t(e,r);sf=!0;try{return Ox(t,e,r)}finally{sf=!1,(Do!==null||Mo!==null)&&(Ix(),Ax())}}function dl(t,e){var r=t.stateNode;if(r===null)return null;var s=dd(r);if(s===null)return null;r=s[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(t=t.type,s=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!s;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(Q(231,e,typeof r));return r}var hh=!1;if(rs)try{var Ti={};Object.defineProperty(Ti,"passive",{get:function(){hh=!0}}),window.addEventListener("test",Ti,Ti),window.removeEventListener("test",Ti,Ti)}catch{hh=!1}function JC(t,e,r,s,n,a,o,i,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(r,u)}catch(d){this.onError(d)}}var Ji=!1,su=null,au=!1,ph=null,XC={onError:function(t){Ji=!0,su=t}};function eP(t,e,r,s,n,a,o,i,c){Ji=!1,su=null,JC.apply(XC,arguments)}function tP(t,e,r,s,n,a,o,i,c){if(eP.apply(this,arguments),Ji){if(Ji){var u=su;Ji=!1,su=null}else throw Error(Q(198));au||(au=!0,ph=u)}}function no(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function Mx(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Ng(t){if(no(t)!==t)throw Error(Q(188))}function rP(t){var e=t.alternate;if(!e){if(e=no(t),e===null)throw Error(Q(188));return e!==t?null:t}for(var r=t,s=e;;){var n=r.return;if(n===null)break;var a=n.alternate;if(a===null){if(s=n.return,s!==null){r=s;continue}break}if(n.child===a.child){for(a=n.child;a;){if(a===r)return Ng(n),t;if(a===s)return Ng(n),e;a=a.sibling}throw Error(Q(188))}if(r.return!==s.return)r=n,s=a;else{for(var o=!1,i=n.child;i;){if(i===r){o=!0,r=n,s=a;break}if(i===s){o=!0,s=n,r=a;break}i=i.sibling}if(!o){for(i=a.child;i;){if(i===r){o=!0,r=a,s=n;break}if(i===s){o=!0,s=a,r=n;break}i=i.sibling}if(!o)throw Error(Q(189))}}if(r.alternate!==s)throw Error(Q(190))}if(r.tag!==3)throw Error(Q(188));return r.stateNode.current===r?t:e}function $x(t){return t=rP(t),t!==null?Fx(t):null}function Fx(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Fx(t);if(e!==null)return e;t=t.sibling}return null}var Lx=Pr.unstable_scheduleCallback,jg=Pr.unstable_cancelCallback,nP=Pr.unstable_shouldYield,sP=Pr.unstable_requestPaint,_t=Pr.unstable_now,aP=Pr.unstable_getCurrentPriorityLevel,_m=Pr.unstable_ImmediatePriority,Ux=Pr.unstable_UserBlockingPriority,ou=Pr.unstable_NormalPriority,oP=Pr.unstable_LowPriority,zx=Pr.unstable_IdlePriority,id=null,kn=null;function iP(t){if(kn&&typeof kn.onCommitFiberRoot=="function")try{kn.onCommitFiberRoot(id,t,void 0,(t.current.flags&128)===128)}catch{}}var rn=Math.clz32?Math.clz32:uP,lP=Math.log,cP=Math.LN2;function uP(t){return t>>>=0,t===0?32:31-(lP(t)/cP|0)|0}var ic=64,lc=4194304;function qi(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function iu(t,e){var r=t.pendingLanes;if(r===0)return 0;var s=0,n=t.suspendedLanes,a=t.pingedLanes,o=r&268435455;if(o!==0){var i=o&~n;i!==0?s=qi(i):(a&=o,a!==0&&(s=qi(a)))}else o=r&~n,o!==0?s=qi(o):a!==0&&(s=qi(a));if(s===0)return 0;if(e!==0&&e!==s&&!(e&n)&&(n=s&-s,a=e&-e,n>=a||n===16&&(a&4194240)!==0))return e;if(s&4&&(s|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=s;0<e;)r=31-rn(e),n=1<<r,s|=t[r],e&=~n;return s}function dP(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 fP(t,e){for(var r=t.suspendedLanes,s=t.pingedLanes,n=t.expirationTimes,a=t.pendingLanes;0<a;){var o=31-rn(a),i=1<<o,c=n[o];c===-1?(!(i&r)||i&s)&&(n[o]=dP(i,e)):c<=e&&(t.expiredLanes|=i),a&=~i}}function mh(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Vx(){var t=ic;return ic<<=1,!(ic&4194240)&&(ic=64),t}function af(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function Ml(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-rn(e),t[e]=r}function hP(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var s=t.eventTimes;for(t=t.expirationTimes;0<r;){var n=31-rn(r),a=1<<n;e[n]=0,s[n]=-1,t[n]=-1,r&=~a}}function Em(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var s=31-rn(r),n=1<<s;n&e|t[s]&e&&(t[s]|=e),r&=~n}}var Xe=0;function qx(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Hx,Cm,Bx,Kx,Wx,vh=!1,cc=[],Bs=null,Ks=null,Ws=null,fl=new Map,hl=new Map,ks=[],pP="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 Rg(t,e){switch(t){case"focusin":case"focusout":Bs=null;break;case"dragenter":case"dragleave":Ks=null;break;case"mouseover":case"mouseout":Ws=null;break;case"pointerover":case"pointerout":fl.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":hl.delete(e.pointerId)}}function Ai(t,e,r,s,n,a){return t===null||t.nativeEvent!==a?(t={blockedOn:e,domEventName:r,eventSystemFlags:s,nativeEvent:a,targetContainers:[n]},e!==null&&(e=Fl(e),e!==null&&Cm(e)),t):(t.eventSystemFlags|=s,e=t.targetContainers,n!==null&&e.indexOf(n)===-1&&e.push(n),t)}function mP(t,e,r,s,n){switch(e){case"focusin":return Bs=Ai(Bs,t,e,r,s,n),!0;case"dragenter":return Ks=Ai(Ks,t,e,r,s,n),!0;case"mouseover":return Ws=Ai(Ws,t,e,r,s,n),!0;case"pointerover":var a=n.pointerId;return fl.set(a,Ai(fl.get(a)||null,t,e,r,s,n)),!0;case"gotpointercapture":return a=n.pointerId,hl.set(a,Ai(hl.get(a)||null,t,e,r,s,n)),!0}return!1}function Qx(t){var e=Pa(t.target);if(e!==null){var r=no(e);if(r!==null){if(e=r.tag,e===13){if(e=Mx(r),e!==null){t.blockedOn=e,Wx(t.priority,function(){Bx(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Dc(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=gh(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var s=new r.constructor(r.type,r);dh=s,r.target.dispatchEvent(s),dh=null}else return e=Fl(r),e!==null&&Cm(e),t.blockedOn=r,!1;e.shift()}return!0}function Tg(t,e,r){Dc(t)&&r.delete(e)}function vP(){vh=!1,Bs!==null&&Dc(Bs)&&(Bs=null),Ks!==null&&Dc(Ks)&&(Ks=null),Ws!==null&&Dc(Ws)&&(Ws=null),fl.forEach(Tg),hl.forEach(Tg)}function Oi(t,e){t.blockedOn===e&&(t.blockedOn=null,vh||(vh=!0,Pr.unstable_scheduleCallback(Pr.unstable_NormalPriority,vP)))}function pl(t){function e(n){return Oi(n,t)}if(0<cc.length){Oi(cc[0],t);for(var r=1;r<cc.length;r++){var s=cc[r];s.blockedOn===t&&(s.blockedOn=null)}}for(Bs!==null&&Oi(Bs,t),Ks!==null&&Oi(Ks,t),Ws!==null&&Oi(Ws,t),fl.forEach(e),hl.forEach(e),r=0;r<ks.length;r++)s=ks[r],s.blockedOn===t&&(s.blockedOn=null);for(;0<ks.length&&(r=ks[0],r.blockedOn===null);)Qx(r),r.blockedOn===null&&ks.shift()}var $o=us.ReactCurrentBatchConfig,lu=!0;function gP(t,e,r,s){var n=Xe,a=$o.transition;$o.transition=null;try{Xe=1,Pm(t,e,r,s)}finally{Xe=n,$o.transition=a}}function yP(t,e,r,s){var n=Xe,a=$o.transition;$o.transition=null;try{Xe=4,Pm(t,e,r,s)}finally{Xe=n,$o.transition=a}}function Pm(t,e,r,s){if(lu){var n=gh(t,e,r,s);if(n===null)vf(t,e,s,cu,r),Rg(t,s);else if(mP(n,t,e,r,s))s.stopPropagation();else if(Rg(t,s),e&4&&-1<pP.indexOf(t)){for(;n!==null;){var a=Fl(n);if(a!==null&&Hx(a),a=gh(t,e,r,s),a===null&&vf(t,e,s,cu,r),a===n)break;n=a}n!==null&&s.stopPropagation()}else vf(t,e,s,null,r)}}var cu=null;function gh(t,e,r,s){if(cu=null,t=Sm(s),t=Pa(t),t!==null)if(e=no(t),e===null)t=null;else if(r=e.tag,r===13){if(t=Mx(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return cu=t,null}function Gx(t){switch(t){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(aP()){case _m:return 1;case Ux:return 4;case ou:case oP:return 16;case zx:return 536870912;default:return 16}default:return 16}}var Ls=null,km=null,Mc=null;function Zx(){if(Mc)return Mc;var t,e=km,r=e.length,s,n="value"in Ls?Ls.value:Ls.textContent,a=n.length;for(t=0;t<r&&e[t]===n[t];t++);var o=r-t;for(s=1;s<=o&&e[r-s]===n[a-s];s++);return Mc=n.slice(t,1<s?1-s:void 0)}function $c(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function uc(){return!0}function Ag(){return!1}function Nr(t){function e(r,s,n,a,o){this._reactName=r,this._targetInst=n,this.type=s,this.nativeEvent=a,this.target=o,this.currentTarget=null;for(var i in t)t.hasOwnProperty(i)&&(r=t[i],this[i]=r?r(a):a[i]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?uc:Ag,this.isPropagationStopped=Ag,this}return gt(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=uc)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=uc)},persist:function(){},isPersistent:uc}),e}var xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nm=Nr(xi),$l=gt({},xi,{view:0,detail:0}),xP=Nr($l),of,lf,Ii,ld=gt({},$l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jm,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ii&&(Ii&&t.type==="mousemove"?(of=t.screenX-Ii.screenX,lf=t.screenY-Ii.screenY):lf=of=0,Ii=t),of)},movementY:function(t){return"movementY"in t?t.movementY:lf}}),Og=Nr(ld),wP=gt({},ld,{dataTransfer:0}),bP=Nr(wP),SP=gt({},$l,{relatedTarget:0}),cf=Nr(SP),_P=gt({},xi,{animationName:0,elapsedTime:0,pseudoElement:0}),EP=Nr(_P),CP=gt({},xi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),PP=Nr(CP),kP=gt({},xi,{data:0}),Ig=Nr(kP),NP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jP={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"},RP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function TP(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=RP[t])?!!e[t]:!1}function jm(){return TP}var AP=gt({},$l,{key:function(t){if(t.key){var e=NP[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=$c(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?jP[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jm,charCode:function(t){return t.type==="keypress"?$c(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?$c(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),OP=Nr(AP),IP=gt({},ld,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dg=Nr(IP),DP=gt({},$l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jm}),MP=Nr(DP),$P=gt({},xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),FP=Nr($P),LP=gt({},ld,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),UP=Nr(LP),zP=[9,13,27,32],Rm=rs&&"CompositionEvent"in window,Xi=null;rs&&"documentMode"in document&&(Xi=document.documentMode);var VP=rs&&"TextEvent"in window&&!Xi,Yx=rs&&(!Rm||Xi&&8<Xi&&11>=Xi),Mg=" ",$g=!1;function Jx(t,e){switch(t){case"keyup":return zP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var bo=!1;function qP(t,e){switch(t){case"compositionend":return Xx(e);case"keypress":return e.which!==32?null:($g=!0,Mg);case"textInput":return t=e.data,t===Mg&&$g?null:t;default:return null}}function HP(t,e){if(bo)return t==="compositionend"||!Rm&&Jx(t,e)?(t=Zx(),Mc=km=Ls=null,bo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Yx&&e.locale!=="ko"?null:e.data;default:return null}}var BP={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 Fg(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!BP[t.type]:e==="textarea"}function ew(t,e,r,s){Tx(s),e=uu(e,"onChange"),0<e.length&&(r=new Nm("onChange","change",null,r,s),t.push({event:r,listeners:e}))}var el=null,ml=null;function KP(t){dw(t,0)}function cd(t){var e=Eo(t);if(Ex(e))return t}function WP(t,e){if(t==="change")return e}var tw=!1;if(rs){var uf;if(rs){var df="oninput"in document;if(!df){var Lg=document.createElement("div");Lg.setAttribute("oninput","return;"),df=typeof Lg.oninput=="function"}uf=df}else uf=!1;tw=uf&&(!document.documentMode||9<document.documentMode)}function Ug(){el&&(el.detachEvent("onpropertychange",rw),ml=el=null)}function rw(t){if(t.propertyName==="value"&&cd(ml)){var e=[];ew(e,ml,t,Sm(t)),Dx(KP,e)}}function QP(t,e,r){t==="focusin"?(Ug(),el=e,ml=r,el.attachEvent("onpropertychange",rw)):t==="focusout"&&Ug()}function GP(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return cd(ml)}function ZP(t,e){if(t==="click")return cd(e)}function YP(t,e){if(t==="input"||t==="change")return cd(e)}function JP(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var sn=typeof Object.is=="function"?Object.is:JP;function vl(t,e){if(sn(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(s=0;s<r.length;s++){var n=r[s];if(!Xf.call(e,n)||!sn(t[n],e[n]))return!1}return!0}function zg(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vg(t,e){var r=zg(t);t=0;for(var s;r;){if(r.nodeType===3){if(s=t+r.textContent.length,t<=e&&s>=e)return{node:r,offset:e-t};t=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=zg(r)}}function nw(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?nw(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function sw(){for(var t=window,e=nu();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=nu(t.document)}return e}function Tm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function XP(t){var e=sw(),r=t.focusedElem,s=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&nw(r.ownerDocument.documentElement,r)){if(s!==null&&Tm(r)){if(e=s.start,t=s.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var n=r.textContent.length,a=Math.min(s.start,n);s=s.end===void 0?a:Math.min(s.end,n),!t.extend&&a>s&&(n=s,s=a,a=n),n=Vg(r,a);var o=Vg(r,s);n&&o&&(t.rangeCount!==1||t.anchorNode!==n.node||t.anchorOffset!==n.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(n.node,n.offset),t.removeAllRanges(),a>s?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var ek=rs&&"documentMode"in document&&11>=document.documentMode,So=null,yh=null,tl=null,xh=!1;function qg(t,e,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;xh||So==null||So!==nu(s)||(s=So,"selectionStart"in s&&Tm(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),tl&&vl(tl,s)||(tl=s,s=uu(yh,"onSelect"),0<s.length&&(e=new Nm("onSelect","select",null,e,r),t.push({event:e,listeners:s}),e.target=So)))}function dc(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var _o={animationend:dc("Animation","AnimationEnd"),animationiteration:dc("Animation","AnimationIteration"),animationstart:dc("Animation","AnimationStart"),transitionend:dc("Transition","TransitionEnd")},ff={},aw={};rs&&(aw=document.createElement("div").style,"AnimationEvent"in window||(delete _o.animationend.animation,delete _o.animationiteration.animation,delete _o.animationstart.animation),"TransitionEvent"in window||delete _o.transitionend.transition);function ud(t){if(ff[t])return ff[t];if(!_o[t])return t;var e=_o[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in aw)return ff[t]=e[r];return t}var ow=ud("animationend"),iw=ud("animationiteration"),lw=ud("animationstart"),cw=ud("transitionend"),uw=new Map,Hg="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 la(t,e){uw.set(t,e),ro(e,[t])}for(var hf=0;hf<Hg.length;hf++){var pf=Hg[hf],tk=pf.toLowerCase(),rk=pf[0].toUpperCase()+pf.slice(1);la(tk,"on"+rk)}la(ow,"onAnimationEnd");la(iw,"onAnimationIteration");la(lw,"onAnimationStart");la("dblclick","onDoubleClick");la("focusin","onFocus");la("focusout","onBlur");la(cw,"onTransitionEnd");si("onMouseEnter",["mouseout","mouseover"]);si("onMouseLeave",["mouseout","mouseover"]);si("onPointerEnter",["pointerout","pointerover"]);si("onPointerLeave",["pointerout","pointerover"]);ro("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ro("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ro("onBeforeInput",["compositionend","keypress","textInput","paste"]);ro("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ro("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ro("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hi="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(" "),nk=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hi));function Bg(t,e,r){var s=t.type||"unknown-event";t.currentTarget=r,tP(s,e,void 0,t),t.currentTarget=null}function dw(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var s=t[r],n=s.event;s=s.listeners;e:{var a=void 0;if(e)for(var o=s.length-1;0<=o;o--){var i=s[o],c=i.instance,u=i.currentTarget;if(i=i.listener,c!==a&&n.isPropagationStopped())break e;Bg(n,i,u),a=c}else for(o=0;o<s.length;o++){if(i=s[o],c=i.instance,u=i.currentTarget,i=i.listener,c!==a&&n.isPropagationStopped())break e;Bg(n,i,u),a=c}}}if(au)throw t=ph,au=!1,ph=null,t}function lt(t,e){var r=e[Eh];r===void 0&&(r=e[Eh]=new Set);var s=t+"__bubble";r.has(s)||(fw(e,t,2,!1),r.add(s))}function mf(t,e,r){var s=0;e&&(s|=4),fw(r,t,s,e)}var fc="_reactListening"+Math.random().toString(36).slice(2);function gl(t){if(!t[fc]){t[fc]=!0,xx.forEach(function(r){r!=="selectionchange"&&(nk.has(r)||mf(r,!1,t),mf(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[fc]||(e[fc]=!0,mf("selectionchange",!1,e))}}function fw(t,e,r,s){switch(Gx(e)){case 1:var n=gP;break;case 4:n=yP;break;default:n=Pm}r=n.bind(null,e,r,t),n=void 0,!hh||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(n=!0),s?n!==void 0?t.addEventListener(e,r,{capture:!0,passive:n}):t.addEventListener(e,r,!0):n!==void 0?t.addEventListener(e,r,{passive:n}):t.addEventListener(e,r,!1)}function vf(t,e,r,s,n){var a=s;if(!(e&1)&&!(e&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var i=s.stateNode.containerInfo;if(i===n||i.nodeType===8&&i.parentNode===n)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===n||c.nodeType===8&&c.parentNode===n))return;o=o.return}for(;i!==null;){if(o=Pa(i),o===null)return;if(c=o.tag,c===5||c===6){s=a=o;continue e}i=i.parentNode}}s=s.return}Dx(function(){var u=a,d=Sm(r),h=[];e:{var m=uw.get(t);if(m!==void 0){var f=Nm,w=t;switch(t){case"keypress":if($c(r)===0)break e;case"keydown":case"keyup":f=OP;break;case"focusin":w="focus",f=cf;break;case"focusout":w="blur",f=cf;break;case"beforeblur":case"afterblur":f=cf;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":f=Og;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=bP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=MP;break;case ow:case iw:case lw:f=EP;break;case cw:f=FP;break;case"scroll":f=xP;break;case"wheel":f=UP;break;case"copy":case"cut":case"paste":f=PP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Dg}var p=(e&4)!==0,v=!p&&t==="scroll",y=p?m!==null?m+"Capture":null:m;p=[];for(var g=u,b;g!==null;){b=g;var S=b.stateNode;if(b.tag===5&&S!==null&&(b=S,y!==null&&(S=dl(g,y),S!=null&&p.push(yl(g,S,b)))),v)break;g=g.return}0<p.length&&(m=new f(m,w,null,r,d),h.push({event:m,listeners:p}))}}if(!(e&7)){e:{if(m=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",m&&r!==dh&&(w=r.relatedTarget||r.fromElement)&&(Pa(w)||w[ns]))break e;if((f||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,f?(w=r.relatedTarget||r.toElement,f=u,w=w?Pa(w):null,w!==null&&(v=no(w),w!==v||w.tag!==5&&w.tag!==6)&&(w=null)):(f=null,w=u),f!==w)){if(p=Og,S="onMouseLeave",y="onMouseEnter",g="mouse",(t==="pointerout"||t==="pointerover")&&(p=Dg,S="onPointerLeave",y="onPointerEnter",g="pointer"),v=f==null?m:Eo(f),b=w==null?m:Eo(w),m=new p(S,g+"leave",f,r,d),m.target=v,m.relatedTarget=b,S=null,Pa(d)===u&&(p=new p(y,g+"enter",w,r,d),p.target=b,p.relatedTarget=v,S=p),v=S,f&&w)t:{for(p=f,y=w,g=0,b=p;b;b=lo(b))g++;for(b=0,S=y;S;S=lo(S))b++;for(;0<g-b;)p=lo(p),g--;for(;0<b-g;)y=lo(y),b--;for(;g--;){if(p===y||y!==null&&p===y.alternate)break t;p=lo(p),y=lo(y)}p=null}else p=null;f!==null&&Kg(h,m,f,p,!1),w!==null&&v!==null&&Kg(h,v,w,p,!0)}}e:{if(m=u?Eo(u):window,f=m.nodeName&&m.nodeName.toLowerCase(),f==="select"||f==="input"&&m.type==="file")var E=WP;else if(Fg(m))if(tw)E=YP;else{E=GP;var N=QP}else(f=m.nodeName)&&f.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(E=ZP);if(E&&(E=E(t,u))){ew(h,E,r,d);break e}N&&N(t,m,u),t==="focusout"&&(N=m._wrapperState)&&N.controlled&&m.type==="number"&&oh(m,"number",m.value)}switch(N=u?Eo(u):window,t){case"focusin":(Fg(N)||N.contentEditable==="true")&&(So=N,yh=u,tl=null);break;case"focusout":tl=yh=So=null;break;case"mousedown":xh=!0;break;case"contextmenu":case"mouseup":case"dragend":xh=!1,qg(h,r,d);break;case"selectionchange":if(ek)break;case"keydown":case"keyup":qg(h,r,d)}var j;if(Rm)e:{switch(t){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else bo?Jx(t,r)&&(R="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(R="onCompositionStart");R&&(Yx&&r.locale!=="ko"&&(bo||R!=="onCompositionStart"?R==="onCompositionEnd"&&bo&&(j=Zx()):(Ls=d,km="value"in Ls?Ls.value:Ls.textContent,bo=!0)),N=uu(u,R),0<N.length&&(R=new Ig(R,t,null,r,d),h.push({event:R,listeners:N}),j?R.data=j:(j=Xx(r),j!==null&&(R.data=j)))),(j=VP?qP(t,r):HP(t,r))&&(u=uu(u,"onBeforeInput"),0<u.length&&(d=new Ig("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=j))}dw(h,e)})}function yl(t,e,r){return{instance:t,listener:e,currentTarget:r}}function uu(t,e){for(var r=e+"Capture",s=[];t!==null;){var n=t,a=n.stateNode;n.tag===5&&a!==null&&(n=a,a=dl(t,r),a!=null&&s.unshift(yl(t,a,n)),a=dl(t,e),a!=null&&s.push(yl(t,a,n))),t=t.return}return s}function lo(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Kg(t,e,r,s,n){for(var a=e._reactName,o=[];r!==null&&r!==s;){var i=r,c=i.alternate,u=i.stateNode;if(c!==null&&c===s)break;i.tag===5&&u!==null&&(i=u,n?(c=dl(r,a),c!=null&&o.unshift(yl(r,c,i))):n||(c=dl(r,a),c!=null&&o.push(yl(r,c,i)))),r=r.return}o.length!==0&&t.push({event:e,listeners:o})}var sk=/\r\n?/g,ak=/\u0000|\uFFFD/g;function Wg(t){return(typeof t=="string"?t:""+t).replace(sk,`
|
|
38
|
-
`).replace(ak,"")}function hc(t,e,r){if(e=Wg(e),Wg(t)!==e&&r)throw Error(Q(425))}function du(){}var wh=null,bh=null;function Sh(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var _h=typeof setTimeout=="function"?setTimeout:void 0,ok=typeof clearTimeout=="function"?clearTimeout:void 0,Qg=typeof Promise=="function"?Promise:void 0,ik=typeof queueMicrotask=="function"?queueMicrotask:typeof Qg<"u"?function(t){return Qg.resolve(null).then(t).catch(lk)}:_h;function lk(t){setTimeout(function(){throw t})}function gf(t,e){var r=e,s=0;do{var n=r.nextSibling;if(t.removeChild(r),n&&n.nodeType===8)if(r=n.data,r==="/$"){if(s===0){t.removeChild(n),pl(e);return}s--}else r!=="$"&&r!=="$?"&&r!=="$!"||s++;r=n}while(r);pl(e)}function Qs(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Gg(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var wi=Math.random().toString(36).slice(2),xn="__reactFiber$"+wi,xl="__reactProps$"+wi,ns="__reactContainer$"+wi,Eh="__reactEvents$"+wi,ck="__reactListeners$"+wi,uk="__reactHandles$"+wi;function Pa(t){var e=t[xn];if(e)return e;for(var r=t.parentNode;r;){if(e=r[ns]||r[xn]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=Gg(t);t!==null;){if(r=t[xn])return r;t=Gg(t)}return e}t=r,r=t.parentNode}return null}function Fl(t){return t=t[xn]||t[ns],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Eo(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Q(33))}function dd(t){return t[xl]||null}var Ch=[],Co=-1;function ca(t){return{current:t}}function ct(t){0>Co||(t.current=Ch[Co],Ch[Co]=null,Co--)}function st(t,e){Co++,Ch[Co]=t.current,t.current=e}var sa={},Zt=ca(sa),mr=ca(!1),Ua=sa;function ai(t,e){var r=t.type.contextTypes;if(!r)return sa;var s=t.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===e)return s.__reactInternalMemoizedMaskedChildContext;var n={},a;for(a in r)n[a]=e[a];return s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=n),n}function vr(t){return t=t.childContextTypes,t!=null}function fu(){ct(mr),ct(Zt)}function Zg(t,e,r){if(Zt.current!==sa)throw Error(Q(168));st(Zt,e),st(mr,r)}function hw(t,e,r){var s=t.stateNode;if(e=e.childContextTypes,typeof s.getChildContext!="function")return r;s=s.getChildContext();for(var n in s)if(!(n in e))throw Error(Q(108,QC(t)||"Unknown",n));return gt({},r,s)}function hu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||sa,Ua=Zt.current,st(Zt,t),st(mr,mr.current),!0}function Yg(t,e,r){var s=t.stateNode;if(!s)throw Error(Q(169));r?(t=hw(t,e,Ua),s.__reactInternalMemoizedMergedChildContext=t,ct(mr),ct(Zt),st(Zt,t)):ct(mr),st(mr,r)}var Bn=null,fd=!1,yf=!1;function pw(t){Bn===null?Bn=[t]:Bn.push(t)}function dk(t){fd=!0,pw(t)}function ua(){if(!yf&&Bn!==null){yf=!0;var t=0,e=Xe;try{var r=Bn;for(Xe=1;t<r.length;t++){var s=r[t];do s=s(!0);while(s!==null)}Bn=null,fd=!1}catch(n){throw Bn!==null&&(Bn=Bn.slice(t+1)),Lx(_m,ua),n}finally{Xe=e,yf=!1}}return null}var Po=[],ko=0,pu=null,mu=0,Or=[],Ir=0,za=null,Zn=1,Yn="";function ba(t,e){Po[ko++]=mu,Po[ko++]=pu,pu=t,mu=e}function mw(t,e,r){Or[Ir++]=Zn,Or[Ir++]=Yn,Or[Ir++]=za,za=t;var s=Zn;t=Yn;var n=32-rn(s)-1;s&=~(1<<n),r+=1;var a=32-rn(e)+n;if(30<a){var o=n-n%5;a=(s&(1<<o)-1).toString(32),s>>=o,n-=o,Zn=1<<32-rn(e)+n|r<<n|s,Yn=a+t}else Zn=1<<a|r<<n|s,Yn=t}function Am(t){t.return!==null&&(ba(t,1),mw(t,1,0))}function Om(t){for(;t===pu;)pu=Po[--ko],Po[ko]=null,mu=Po[--ko],Po[ko]=null;for(;t===za;)za=Or[--Ir],Or[Ir]=null,Yn=Or[--Ir],Or[Ir]=null,Zn=Or[--Ir],Or[Ir]=null}var Er=null,_r=null,ht=!1,tn=null;function vw(t,e){var r=Mr(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function Jg(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Er=t,_r=Qs(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Er=t,_r=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=za!==null?{id:Zn,overflow:Yn}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=Mr(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Er=t,_r=null,!0):!1;default:return!1}}function Ph(t){return(t.mode&1)!==0&&(t.flags&128)===0}function kh(t){if(ht){var e=_r;if(e){var r=e;if(!Jg(t,e)){if(Ph(t))throw Error(Q(418));e=Qs(r.nextSibling);var s=Er;e&&Jg(t,e)?vw(s,r):(t.flags=t.flags&-4097|2,ht=!1,Er=t)}}else{if(Ph(t))throw Error(Q(418));t.flags=t.flags&-4097|2,ht=!1,Er=t}}}function Xg(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Er=t}function pc(t){if(t!==Er)return!1;if(!ht)return Xg(t),ht=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Sh(t.type,t.memoizedProps)),e&&(e=_r)){if(Ph(t))throw gw(),Error(Q(418));for(;e;)vw(t,e),e=Qs(e.nextSibling)}if(Xg(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Q(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){_r=Qs(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}_r=null}}else _r=Er?Qs(t.stateNode.nextSibling):null;return!0}function gw(){for(var t=_r;t;)t=Qs(t.nextSibling)}function oi(){_r=Er=null,ht=!1}function Im(t){tn===null?tn=[t]:tn.push(t)}var fk=us.ReactCurrentBatchConfig;function Di(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Q(309));var s=r.stateNode}if(!s)throw Error(Q(147,t));var n=s,a=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===a?e.ref:(e=function(o){var i=n.refs;o===null?delete i[a]:i[a]=o},e._stringRef=a,e)}if(typeof t!="string")throw Error(Q(284));if(!r._owner)throw Error(Q(290,t))}return t}function mc(t,e){throw t=Object.prototype.toString.call(e),Error(Q(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function ey(t){var e=t._init;return e(t._payload)}function yw(t){function e(y,g){if(t){var b=y.deletions;b===null?(y.deletions=[g],y.flags|=16):b.push(g)}}function r(y,g){if(!t)return null;for(;g!==null;)e(y,g),g=g.sibling;return null}function s(y,g){for(y=new Map;g!==null;)g.key!==null?y.set(g.key,g):y.set(g.index,g),g=g.sibling;return y}function n(y,g){return y=Js(y,g),y.index=0,y.sibling=null,y}function a(y,g,b){return y.index=b,t?(b=y.alternate,b!==null?(b=b.index,b<g?(y.flags|=2,g):b):(y.flags|=2,g)):(y.flags|=1048576,g)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function i(y,g,b,S){return g===null||g.tag!==6?(g=Cf(b,y.mode,S),g.return=y,g):(g=n(g,b),g.return=y,g)}function c(y,g,b,S){var E=b.type;return E===wo?d(y,g,b.props.children,S,b.key):g!==null&&(g.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ss&&ey(E)===g.type)?(S=n(g,b.props),S.ref=Di(y,g,b),S.return=y,S):(S=Hc(b.type,b.key,b.props,null,y.mode,S),S.ref=Di(y,g,b),S.return=y,S)}function u(y,g,b,S){return g===null||g.tag!==4||g.stateNode.containerInfo!==b.containerInfo||g.stateNode.implementation!==b.implementation?(g=Pf(b,y.mode,S),g.return=y,g):(g=n(g,b.children||[]),g.return=y,g)}function d(y,g,b,S,E){return g===null||g.tag!==7?(g=Fa(b,y.mode,S,E),g.return=y,g):(g=n(g,b),g.return=y,g)}function h(y,g,b){if(typeof g=="string"&&g!==""||typeof g=="number")return g=Cf(""+g,y.mode,b),g.return=y,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case sc:return b=Hc(g.type,g.key,g.props,null,y.mode,b),b.ref=Di(y,null,g),b.return=y,b;case xo:return g=Pf(g,y.mode,b),g.return=y,g;case Ss:var S=g._init;return h(y,S(g._payload),b)}if(Vi(g)||Ri(g))return g=Fa(g,y.mode,b,null),g.return=y,g;mc(y,g)}return null}function m(y,g,b,S){var E=g!==null?g.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return E!==null?null:i(y,g,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case sc:return b.key===E?c(y,g,b,S):null;case xo:return b.key===E?u(y,g,b,S):null;case Ss:return E=b._init,m(y,g,E(b._payload),S)}if(Vi(b)||Ri(b))return E!==null?null:d(y,g,b,S,null);mc(y,b)}return null}function f(y,g,b,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(b)||null,i(g,y,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case sc:return y=y.get(S.key===null?b:S.key)||null,c(g,y,S,E);case xo:return y=y.get(S.key===null?b:S.key)||null,u(g,y,S,E);case Ss:var N=S._init;return f(y,g,b,N(S._payload),E)}if(Vi(S)||Ri(S))return y=y.get(b)||null,d(g,y,S,E,null);mc(g,S)}return null}function w(y,g,b,S){for(var E=null,N=null,j=g,R=g=0,A=null;j!==null&&R<b.length;R++){j.index>R?(A=j,j=null):A=j.sibling;var F=m(y,j,b[R],S);if(F===null){j===null&&(j=A);break}t&&j&&F.alternate===null&&e(y,j),g=a(F,g,R),N===null?E=F:N.sibling=F,N=F,j=A}if(R===b.length)return r(y,j),ht&&ba(y,R),E;if(j===null){for(;R<b.length;R++)j=h(y,b[R],S),j!==null&&(g=a(j,g,R),N===null?E=j:N.sibling=j,N=j);return ht&&ba(y,R),E}for(j=s(y,j);R<b.length;R++)A=f(j,y,R,b[R],S),A!==null&&(t&&A.alternate!==null&&j.delete(A.key===null?R:A.key),g=a(A,g,R),N===null?E=A:N.sibling=A,N=A);return t&&j.forEach(function(T){return e(y,T)}),ht&&ba(y,R),E}function p(y,g,b,S){var E=Ri(b);if(typeof E!="function")throw Error(Q(150));if(b=E.call(b),b==null)throw Error(Q(151));for(var N=E=null,j=g,R=g=0,A=null,F=b.next();j!==null&&!F.done;R++,F=b.next()){j.index>R?(A=j,j=null):A=j.sibling;var T=m(y,j,F.value,S);if(T===null){j===null&&(j=A);break}t&&j&&T.alternate===null&&e(y,j),g=a(T,g,R),N===null?E=T:N.sibling=T,N=T,j=A}if(F.done)return r(y,j),ht&&ba(y,R),E;if(j===null){for(;!F.done;R++,F=b.next())F=h(y,F.value,S),F!==null&&(g=a(F,g,R),N===null?E=F:N.sibling=F,N=F);return ht&&ba(y,R),E}for(j=s(y,j);!F.done;R++,F=b.next())F=f(j,y,R,F.value,S),F!==null&&(t&&F.alternate!==null&&j.delete(F.key===null?R:F.key),g=a(F,g,R),N===null?E=F:N.sibling=F,N=F);return t&&j.forEach(function(_){return e(y,_)}),ht&&ba(y,R),E}function v(y,g,b,S){if(typeof b=="object"&&b!==null&&b.type===wo&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case sc:e:{for(var E=b.key,N=g;N!==null;){if(N.key===E){if(E=b.type,E===wo){if(N.tag===7){r(y,N.sibling),g=n(N,b.props.children),g.return=y,y=g;break e}}else if(N.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ss&&ey(E)===N.type){r(y,N.sibling),g=n(N,b.props),g.ref=Di(y,N,b),g.return=y,y=g;break e}r(y,N);break}else e(y,N);N=N.sibling}b.type===wo?(g=Fa(b.props.children,y.mode,S,b.key),g.return=y,y=g):(S=Hc(b.type,b.key,b.props,null,y.mode,S),S.ref=Di(y,g,b),S.return=y,y=S)}return o(y);case xo:e:{for(N=b.key;g!==null;){if(g.key===N)if(g.tag===4&&g.stateNode.containerInfo===b.containerInfo&&g.stateNode.implementation===b.implementation){r(y,g.sibling),g=n(g,b.children||[]),g.return=y,y=g;break e}else{r(y,g);break}else e(y,g);g=g.sibling}g=Pf(b,y.mode,S),g.return=y,y=g}return o(y);case Ss:return N=b._init,v(y,g,N(b._payload),S)}if(Vi(b))return w(y,g,b,S);if(Ri(b))return p(y,g,b,S);mc(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,g!==null&&g.tag===6?(r(y,g.sibling),g=n(g,b),g.return=y,y=g):(r(y,g),g=Cf(b,y.mode,S),g.return=y,y=g),o(y)):r(y,g)}return v}var ii=yw(!0),xw=yw(!1),vu=ca(null),gu=null,No=null,Dm=null;function Mm(){Dm=No=gu=null}function $m(t){var e=vu.current;ct(vu),t._currentValue=e}function Nh(t,e,r){for(;t!==null;){var s=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,s!==null&&(s.childLanes|=e)):s!==null&&(s.childLanes&e)!==e&&(s.childLanes|=e),t===r)break;t=t.return}}function Fo(t,e){gu=t,Dm=No=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(pr=!0),t.firstContext=null)}function Fr(t){var e=t._currentValue;if(Dm!==t)if(t={context:t,memoizedValue:e,next:null},No===null){if(gu===null)throw Error(Q(308));No=t,gu.dependencies={lanes:0,firstContext:t}}else No=No.next=t;return e}var ka=null;function Fm(t){ka===null?ka=[t]:ka.push(t)}function ww(t,e,r,s){var n=e.interleaved;return n===null?(r.next=r,Fm(e)):(r.next=n.next,n.next=r),e.interleaved=r,ss(t,s)}function ss(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var _s=!1;function Lm(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bw(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Xn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Gs(t,e,r){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,Ze&2){var n=s.pending;return n===null?e.next=e:(e.next=n.next,n.next=e),s.pending=e,ss(t,r)}return n=s.interleaved,n===null?(e.next=e,Fm(s)):(e.next=n.next,n.next=e),s.interleaved=e,ss(t,r)}function Fc(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var s=e.lanes;s&=t.pendingLanes,r|=s,e.lanes=r,Em(t,r)}}function ty(t,e){var r=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var n=null,a=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};a===null?n=a=o:a=a.next=o,r=r.next}while(r!==null);a===null?n=a=e:a=a.next=e}else n=a=e;r={baseState:s.baseState,firstBaseUpdate:n,lastBaseUpdate:a,shared:s.shared,effects:s.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function yu(t,e,r,s){var n=t.updateQueue;_s=!1;var a=n.firstBaseUpdate,o=n.lastBaseUpdate,i=n.shared.pending;if(i!==null){n.shared.pending=null;var c=i,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=t.alternate;d!==null&&(d=d.updateQueue,i=d.lastBaseUpdate,i!==o&&(i===null?d.firstBaseUpdate=u:i.next=u,d.lastBaseUpdate=c))}if(a!==null){var h=n.baseState;o=0,d=u=c=null,i=a;do{var m=i.lane,f=i.eventTime;if((s&m)===m){d!==null&&(d=d.next={eventTime:f,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var w=t,p=i;switch(m=e,f=r,p.tag){case 1:if(w=p.payload,typeof w=="function"){h=w.call(f,h,m);break e}h=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=p.payload,m=typeof w=="function"?w.call(f,h,m):w,m==null)break e;h=gt({},h,m);break e;case 2:_s=!0}}i.callback!==null&&i.lane!==0&&(t.flags|=64,m=n.effects,m===null?n.effects=[i]:m.push(i))}else f={eventTime:f,lane:m,tag:i.tag,payload:i.payload,callback:i.callback,next:null},d===null?(u=d=f,c=h):d=d.next=f,o|=m;if(i=i.next,i===null){if(i=n.shared.pending,i===null)break;m=i,i=m.next,m.next=null,n.lastBaseUpdate=m,n.shared.pending=null}}while(!0);if(d===null&&(c=h),n.baseState=c,n.firstBaseUpdate=u,n.lastBaseUpdate=d,e=n.shared.interleaved,e!==null){n=e;do o|=n.lane,n=n.next;while(n!==e)}else a===null&&(n.shared.lanes=0);qa|=o,t.lanes=o,t.memoizedState=h}}function ry(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var s=t[e],n=s.callback;if(n!==null){if(s.callback=null,s=r,typeof n!="function")throw Error(Q(191,n));n.call(s)}}}var Ll={},Nn=ca(Ll),wl=ca(Ll),bl=ca(Ll);function Na(t){if(t===Ll)throw Error(Q(174));return t}function Um(t,e){switch(st(bl,e),st(wl,t),st(Nn,Ll),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:lh(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=lh(e,t)}ct(Nn),st(Nn,e)}function li(){ct(Nn),ct(wl),ct(bl)}function Sw(t){Na(bl.current);var e=Na(Nn.current),r=lh(e,t.type);e!==r&&(st(wl,t),st(Nn,r))}function zm(t){wl.current===t&&(ct(Nn),ct(wl))}var mt=ca(0);function xu(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var xf=[];function Vm(){for(var t=0;t<xf.length;t++)xf[t]._workInProgressVersionPrimary=null;xf.length=0}var Lc=us.ReactCurrentDispatcher,wf=us.ReactCurrentBatchConfig,Va=0,vt=null,Rt=null,$t=null,wu=!1,rl=!1,Sl=0,hk=0;function Wt(){throw Error(Q(321))}function qm(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!sn(t[r],e[r]))return!1;return!0}function Hm(t,e,r,s,n,a){if(Va=a,vt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Lc.current=t===null||t.memoizedState===null?gk:yk,t=r(s,n),rl){a=0;do{if(rl=!1,Sl=0,25<=a)throw Error(Q(301));a+=1,$t=Rt=null,e.updateQueue=null,Lc.current=xk,t=r(s,n)}while(rl)}if(Lc.current=bu,e=Rt!==null&&Rt.next!==null,Va=0,$t=Rt=vt=null,wu=!1,e)throw Error(Q(300));return t}function Bm(){var t=Sl!==0;return Sl=0,t}function pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?vt.memoizedState=$t=t:$t=$t.next=t,$t}function Lr(){if(Rt===null){var t=vt.alternate;t=t!==null?t.memoizedState:null}else t=Rt.next;var e=$t===null?vt.memoizedState:$t.next;if(e!==null)$t=e,Rt=t;else{if(t===null)throw Error(Q(310));Rt=t,t={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},$t===null?vt.memoizedState=$t=t:$t=$t.next=t}return $t}function _l(t,e){return typeof e=="function"?e(t):e}function bf(t){var e=Lr(),r=e.queue;if(r===null)throw Error(Q(311));r.lastRenderedReducer=t;var s=Rt,n=s.baseQueue,a=r.pending;if(a!==null){if(n!==null){var o=n.next;n.next=a.next,a.next=o}s.baseQueue=n=a,r.pending=null}if(n!==null){a=n.next,s=s.baseState;var i=o=null,c=null,u=a;do{var d=u.lane;if((Va&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),s=u.hasEagerState?u.eagerState:t(s,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(i=c=h,o=s):c=c.next=h,vt.lanes|=d,qa|=d}u=u.next}while(u!==null&&u!==a);c===null?o=s:c.next=i,sn(s,e.memoizedState)||(pr=!0),e.memoizedState=s,e.baseState=o,e.baseQueue=c,r.lastRenderedState=s}if(t=r.interleaved,t!==null){n=t;do a=n.lane,vt.lanes|=a,qa|=a,n=n.next;while(n!==t)}else n===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function Sf(t){var e=Lr(),r=e.queue;if(r===null)throw Error(Q(311));r.lastRenderedReducer=t;var s=r.dispatch,n=r.pending,a=e.memoizedState;if(n!==null){r.pending=null;var o=n=n.next;do a=t(a,o.action),o=o.next;while(o!==n);sn(a,e.memoizedState)||(pr=!0),e.memoizedState=a,e.baseQueue===null&&(e.baseState=a),r.lastRenderedState=a}return[a,s]}function _w(){}function Ew(t,e){var r=vt,s=Lr(),n=e(),a=!sn(s.memoizedState,n);if(a&&(s.memoizedState=n,pr=!0),s=s.queue,Km(kw.bind(null,r,s,t),[t]),s.getSnapshot!==e||a||$t!==null&&$t.memoizedState.tag&1){if(r.flags|=2048,El(9,Pw.bind(null,r,s,n,e),void 0,null),Lt===null)throw Error(Q(349));Va&30||Cw(r,e,n)}return n}function Cw(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=vt.updateQueue,e===null?(e={lastEffect:null,stores:null},vt.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function Pw(t,e,r,s){e.value=r,e.getSnapshot=s,Nw(e)&&jw(t)}function kw(t,e,r){return r(function(){Nw(e)&&jw(t)})}function Nw(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!sn(t,r)}catch{return!0}}function jw(t){var e=ss(t,1);e!==null&&nn(e,t,1,-1)}function ny(t){var e=pn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_l,lastRenderedState:t},e.queue=t,t=t.dispatch=vk.bind(null,vt,t),[e.memoizedState,t]}function El(t,e,r,s){return t={tag:t,create:e,destroy:r,deps:s,next:null},e=vt.updateQueue,e===null?(e={lastEffect:null,stores:null},vt.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(s=r.next,r.next=t,t.next=s,e.lastEffect=t)),t}function Rw(){return Lr().memoizedState}function Uc(t,e,r,s){var n=pn();vt.flags|=t,n.memoizedState=El(1|e,r,void 0,s===void 0?null:s)}function hd(t,e,r,s){var n=Lr();s=s===void 0?null:s;var a=void 0;if(Rt!==null){var o=Rt.memoizedState;if(a=o.destroy,s!==null&&qm(s,o.deps)){n.memoizedState=El(e,r,a,s);return}}vt.flags|=t,n.memoizedState=El(1|e,r,a,s)}function sy(t,e){return Uc(8390656,8,t,e)}function Km(t,e){return hd(2048,8,t,e)}function Tw(t,e){return hd(4,2,t,e)}function Aw(t,e){return hd(4,4,t,e)}function Ow(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Iw(t,e,r){return r=r!=null?r.concat([t]):null,hd(4,4,Ow.bind(null,e,t),r)}function Wm(){}function Dw(t,e){var r=Lr();e=e===void 0?null:e;var s=r.memoizedState;return s!==null&&e!==null&&qm(e,s[1])?s[0]:(r.memoizedState=[t,e],t)}function Mw(t,e){var r=Lr();e=e===void 0?null:e;var s=r.memoizedState;return s!==null&&e!==null&&qm(e,s[1])?s[0]:(t=t(),r.memoizedState=[t,e],t)}function $w(t,e,r){return Va&21?(sn(r,e)||(r=Vx(),vt.lanes|=r,qa|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,pr=!0),t.memoizedState=r)}function pk(t,e){var r=Xe;Xe=r!==0&&4>r?r:4,t(!0);var s=wf.transition;wf.transition={};try{t(!1),e()}finally{Xe=r,wf.transition=s}}function Fw(){return Lr().memoizedState}function mk(t,e,r){var s=Ys(t);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},Lw(t))Uw(e,r);else if(r=ww(t,e,r,s),r!==null){var n=rr();nn(r,t,s,n),zw(r,e,s)}}function vk(t,e,r){var s=Ys(t),n={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(Lw(t))Uw(e,n);else{var a=t.alternate;if(t.lanes===0&&(a===null||a.lanes===0)&&(a=e.lastRenderedReducer,a!==null))try{var o=e.lastRenderedState,i=a(o,r);if(n.hasEagerState=!0,n.eagerState=i,sn(i,o)){var c=e.interleaved;c===null?(n.next=n,Fm(e)):(n.next=c.next,c.next=n),e.interleaved=n;return}}catch{}finally{}r=ww(t,e,n,s),r!==null&&(n=rr(),nn(r,t,s,n),zw(r,e,s))}}function Lw(t){var e=t.alternate;return t===vt||e!==null&&e===vt}function Uw(t,e){rl=wu=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function zw(t,e,r){if(r&4194240){var s=e.lanes;s&=t.pendingLanes,r|=s,e.lanes=r,Em(t,r)}}var bu={readContext:Fr,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useInsertionEffect:Wt,useLayoutEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useMutableSource:Wt,useSyncExternalStore:Wt,useId:Wt,unstable_isNewReconciler:!1},gk={readContext:Fr,useCallback:function(t,e){return pn().memoizedState=[t,e===void 0?null:e],t},useContext:Fr,useEffect:sy,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Uc(4194308,4,Ow.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Uc(4194308,4,t,e)},useInsertionEffect:function(t,e){return Uc(4,2,t,e)},useMemo:function(t,e){var r=pn();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var s=pn();return e=r!==void 0?r(e):e,s.memoizedState=s.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},s.queue=t,t=t.dispatch=mk.bind(null,vt,t),[s.memoizedState,t]},useRef:function(t){var e=pn();return t={current:t},e.memoizedState=t},useState:ny,useDebugValue:Wm,useDeferredValue:function(t){return pn().memoizedState=t},useTransition:function(){var t=ny(!1),e=t[0];return t=pk.bind(null,t[1]),pn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var s=vt,n=pn();if(ht){if(r===void 0)throw Error(Q(407));r=r()}else{if(r=e(),Lt===null)throw Error(Q(349));Va&30||Cw(s,e,r)}n.memoizedState=r;var a={value:r,getSnapshot:e};return n.queue=a,sy(kw.bind(null,s,a,t),[t]),s.flags|=2048,El(9,Pw.bind(null,s,a,r,e),void 0,null),r},useId:function(){var t=pn(),e=Lt.identifierPrefix;if(ht){var r=Yn,s=Zn;r=(s&~(1<<32-rn(s)-1)).toString(32)+r,e=":"+e+"R"+r,r=Sl++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=hk++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},yk={readContext:Fr,useCallback:Dw,useContext:Fr,useEffect:Km,useImperativeHandle:Iw,useInsertionEffect:Tw,useLayoutEffect:Aw,useMemo:Mw,useReducer:bf,useRef:Rw,useState:function(){return bf(_l)},useDebugValue:Wm,useDeferredValue:function(t){var e=Lr();return $w(e,Rt.memoizedState,t)},useTransition:function(){var t=bf(_l)[0],e=Lr().memoizedState;return[t,e]},useMutableSource:_w,useSyncExternalStore:Ew,useId:Fw,unstable_isNewReconciler:!1},xk={readContext:Fr,useCallback:Dw,useContext:Fr,useEffect:Km,useImperativeHandle:Iw,useInsertionEffect:Tw,useLayoutEffect:Aw,useMemo:Mw,useReducer:Sf,useRef:Rw,useState:function(){return Sf(_l)},useDebugValue:Wm,useDeferredValue:function(t){var e=Lr();return Rt===null?e.memoizedState=t:$w(e,Rt.memoizedState,t)},useTransition:function(){var t=Sf(_l)[0],e=Lr().memoizedState;return[t,e]},useMutableSource:_w,useSyncExternalStore:Ew,useId:Fw,unstable_isNewReconciler:!1};function Zr(t,e){if(t&&t.defaultProps){e=gt({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function jh(t,e,r,s){e=t.memoizedState,r=r(s,e),r=r==null?e:gt({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var pd={isMounted:function(t){return(t=t._reactInternals)?no(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var s=rr(),n=Ys(t),a=Xn(s,n);a.payload=e,r!=null&&(a.callback=r),e=Gs(t,a,n),e!==null&&(nn(e,t,n,s),Fc(e,t,n))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var s=rr(),n=Ys(t),a=Xn(s,n);a.tag=1,a.payload=e,r!=null&&(a.callback=r),e=Gs(t,a,n),e!==null&&(nn(e,t,n,s),Fc(e,t,n))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=rr(),s=Ys(t),n=Xn(r,s);n.tag=2,e!=null&&(n.callback=e),e=Gs(t,n,s),e!==null&&(nn(e,t,s,r),Fc(e,t,s))}};function ay(t,e,r,s,n,a,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(s,a,o):e.prototype&&e.prototype.isPureReactComponent?!vl(r,s)||!vl(n,a):!0}function Vw(t,e,r){var s=!1,n=sa,a=e.contextType;return typeof a=="object"&&a!==null?a=Fr(a):(n=vr(e)?Ua:Zt.current,s=e.contextTypes,a=(s=s!=null)?ai(t,n):sa),e=new e(r,a),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=pd,t.stateNode=e,e._reactInternals=t,s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=a),e}function oy(t,e,r,s){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,s),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,s),e.state!==t&&pd.enqueueReplaceState(e,e.state,null)}function Rh(t,e,r,s){var n=t.stateNode;n.props=r,n.state=t.memoizedState,n.refs={},Lm(t);var a=e.contextType;typeof a=="object"&&a!==null?n.context=Fr(a):(a=vr(e)?Ua:Zt.current,n.context=ai(t,a)),n.state=t.memoizedState,a=e.getDerivedStateFromProps,typeof a=="function"&&(jh(t,e,a,r),n.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(e=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),e!==n.state&&pd.enqueueReplaceState(n,n.state,null),yu(t,r,n,s),n.state=t.memoizedState),typeof n.componentDidMount=="function"&&(t.flags|=4194308)}function ci(t,e){try{var r="",s=e;do r+=WC(s),s=s.return;while(s);var n=r}catch(a){n=`
|
|
37
|
+
`+n[o].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=o&&0<=i);break}}}finally{nf=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?zi(t):""}function JC(t){switch(t.tag){case 5:return zi(t.type);case 16:return zi("Lazy");case 13:return zi("Suspense");case 19:return zi("SuspenseList");case 0:case 2:case 15:return t=sf(t.type,!1),t;case 11:return t=sf(t.type.render,!1),t;case 1:return t=sf(t.type,!0),t;default:return""}}function ah(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case wo:return"Fragment";case xo:return"Portal";case rh:return"Profiler";case bm:return"StrictMode";case nh:return"Suspense";case sh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Cx:return(t.displayName||"Context")+".Consumer";case Ex:return(t._context.displayName||"Context")+".Provider";case Sm:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case _m:return e=t.displayName||null,e!==null?e:ah(t.type)||"Memo";case _s:e=t._payload,t=t._init;try{return ah(t(e))}catch{}}return null}function XC(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ah(e);case 8:return e===bm?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function na(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function kx(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function eP(t){var e=kx(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),s=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var n=r.get,a=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return n.call(this)},set:function(o){s=""+o,a.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function oc(t){t._valueTracker||(t._valueTracker=eP(t))}function Nx(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),s="";return t&&(s=kx(t)?t.checked?"true":"false":t.value),t=s,t!==r?(e.setValue(t),!0):!1}function su(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function oh(t,e){var r=e.checked;return gt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Cg(t,e){var r=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;r=na(e.value!=null?e.value:r),t._wrapperState={initialChecked:s,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function jx(t,e){e=e.checked,e!=null&&wm(t,"checked",e,!1)}function ih(t,e){jx(t,e);var r=na(e.value),s=e.type;if(r!=null)s==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(s==="submit"||s==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?lh(t,e.type,r):e.hasOwnProperty("defaultValue")&&lh(t,e.type,na(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Pg(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var s=e.type;if(!(s!=="submit"&&s!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function lh(t,e,r){(e!=="number"||su(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Vi=Array.isArray;function Io(t,e,r,s){if(t=t.options,e){e={};for(var n=0;n<r.length;n++)e["$"+r[n]]=!0;for(r=0;r<t.length;r++)n=e.hasOwnProperty("$"+t[r].value),t[r].selected!==n&&(t[r].selected=n),n&&s&&(t[r].defaultSelected=!0)}else{for(r=""+na(r),e=null,n=0;n<t.length;n++){if(t[n].value===r){t[n].selected=!0,s&&(t[n].defaultSelected=!0);return}e!==null||t[n].disabled||(e=t[n])}e!==null&&(e.selected=!0)}}function ch(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Q(91));return gt({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function kg(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(Q(92));if(Vi(r)){if(1<r.length)throw Error(Q(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:na(r)}}function Rx(t,e){var r=na(e.value),s=na(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),s!=null&&(t.defaultValue=""+s)}function Ng(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Tx(t){switch(t){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 uh(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Tx(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var ic,Ax=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,s,n){MSApp.execUnsafeLocalFunction(function(){return t(e,r,s,n)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(ic=ic||document.createElement("div"),ic.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=ic.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function dl(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var Yi={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},tP=["Webkit","ms","Moz","O"];Object.keys(Yi).forEach(function(t){tP.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Yi[e]=Yi[t]})});function Ox(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Yi.hasOwnProperty(t)&&Yi[t]?(""+e).trim():e+"px"}function Ix(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var s=r.indexOf("--")===0,n=Ox(r,e[r],s);r==="float"&&(r="cssFloat"),s?t.setProperty(r,n):t[r]=n}}var rP=gt({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 dh(t,e){if(e){if(rP[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Q(62))}}function fh(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hh=null;function Em(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ph=null,Do=null,Mo=null;function jg(t){if(t=Ll(t)){if(typeof ph!="function")throw Error(Q(280));var e=t.stateNode;e&&(e=fd(e),ph(t.stateNode,t.type,e))}}function Dx(t){Do?Mo?Mo.push(t):Mo=[t]:Do=t}function Mx(){if(Do){var t=Do,e=Mo;if(Mo=Do=null,jg(t),e)for(t=0;t<e.length;t++)jg(e[t])}}function $x(t,e){return t(e)}function Fx(){}var af=!1;function Lx(t,e,r){if(af)return t(e,r);af=!0;try{return $x(t,e,r)}finally{af=!1,(Do!==null||Mo!==null)&&(Fx(),Mx())}}function fl(t,e){var r=t.stateNode;if(r===null)return null;var s=fd(r);if(s===null)return null;r=s[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(t=t.type,s=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!s;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(Q(231,e,typeof r));return r}var mh=!1;if(ns)try{var Ti={};Object.defineProperty(Ti,"passive",{get:function(){mh=!0}}),window.addEventListener("test",Ti,Ti),window.removeEventListener("test",Ti,Ti)}catch{mh=!1}function nP(t,e,r,s,n,a,o,i,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(r,u)}catch(d){this.onError(d)}}var Ji=!1,au=null,ou=!1,vh=null,sP={onError:function(t){Ji=!0,au=t}};function aP(t,e,r,s,n,a,o,i,c){Ji=!1,au=null,nP.apply(sP,arguments)}function oP(t,e,r,s,n,a,o,i,c){if(aP.apply(this,arguments),Ji){if(Ji){var u=au;Ji=!1,au=null}else throw Error(Q(198));ou||(ou=!0,vh=u)}}function no(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function Ux(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Rg(t){if(no(t)!==t)throw Error(Q(188))}function iP(t){var e=t.alternate;if(!e){if(e=no(t),e===null)throw Error(Q(188));return e!==t?null:t}for(var r=t,s=e;;){var n=r.return;if(n===null)break;var a=n.alternate;if(a===null){if(s=n.return,s!==null){r=s;continue}break}if(n.child===a.child){for(a=n.child;a;){if(a===r)return Rg(n),t;if(a===s)return Rg(n),e;a=a.sibling}throw Error(Q(188))}if(r.return!==s.return)r=n,s=a;else{for(var o=!1,i=n.child;i;){if(i===r){o=!0,r=n,s=a;break}if(i===s){o=!0,s=n,r=a;break}i=i.sibling}if(!o){for(i=a.child;i;){if(i===r){o=!0,r=a,s=n;break}if(i===s){o=!0,s=a,r=n;break}i=i.sibling}if(!o)throw Error(Q(189))}}if(r.alternate!==s)throw Error(Q(190))}if(r.tag!==3)throw Error(Q(188));return r.stateNode.current===r?t:e}function zx(t){return t=iP(t),t!==null?Vx(t):null}function Vx(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Vx(t);if(e!==null)return e;t=t.sibling}return null}var qx=Pr.unstable_scheduleCallback,Tg=Pr.unstable_cancelCallback,lP=Pr.unstable_shouldYield,cP=Pr.unstable_requestPaint,_t=Pr.unstable_now,uP=Pr.unstable_getCurrentPriorityLevel,Cm=Pr.unstable_ImmediatePriority,Hx=Pr.unstable_UserBlockingPriority,iu=Pr.unstable_NormalPriority,dP=Pr.unstable_LowPriority,Bx=Pr.unstable_IdlePriority,ld=null,kn=null;function fP(t){if(kn&&typeof kn.onCommitFiberRoot=="function")try{kn.onCommitFiberRoot(ld,t,void 0,(t.current.flags&128)===128)}catch{}}var rn=Math.clz32?Math.clz32:mP,hP=Math.log,pP=Math.LN2;function mP(t){return t>>>=0,t===0?32:31-(hP(t)/pP|0)|0}var lc=64,cc=4194304;function qi(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function lu(t,e){var r=t.pendingLanes;if(r===0)return 0;var s=0,n=t.suspendedLanes,a=t.pingedLanes,o=r&268435455;if(o!==0){var i=o&~n;i!==0?s=qi(i):(a&=o,a!==0&&(s=qi(a)))}else o=r&~n,o!==0?s=qi(o):a!==0&&(s=qi(a));if(s===0)return 0;if(e!==0&&e!==s&&!(e&n)&&(n=s&-s,a=e&-e,n>=a||n===16&&(a&4194240)!==0))return e;if(s&4&&(s|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=s;0<e;)r=31-rn(e),n=1<<r,s|=t[r],e&=~n;return s}function vP(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 gP(t,e){for(var r=t.suspendedLanes,s=t.pingedLanes,n=t.expirationTimes,a=t.pendingLanes;0<a;){var o=31-rn(a),i=1<<o,c=n[o];c===-1?(!(i&r)||i&s)&&(n[o]=vP(i,e)):c<=e&&(t.expiredLanes|=i),a&=~i}}function gh(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Kx(){var t=lc;return lc<<=1,!(lc&4194240)&&(lc=64),t}function of(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function $l(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-rn(e),t[e]=r}function yP(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var s=t.eventTimes;for(t=t.expirationTimes;0<r;){var n=31-rn(r),a=1<<n;e[n]=0,s[n]=-1,t[n]=-1,r&=~a}}function Pm(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var s=31-rn(r),n=1<<s;n&e|t[s]&e&&(t[s]|=e),r&=~n}}var Xe=0;function Wx(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Qx,km,Gx,Zx,Yx,yh=!1,uc=[],Bs=null,Ks=null,Ws=null,hl=new Map,pl=new Map,Ns=[],xP="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 Ag(t,e){switch(t){case"focusin":case"focusout":Bs=null;break;case"dragenter":case"dragleave":Ks=null;break;case"mouseover":case"mouseout":Ws=null;break;case"pointerover":case"pointerout":hl.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":pl.delete(e.pointerId)}}function Ai(t,e,r,s,n,a){return t===null||t.nativeEvent!==a?(t={blockedOn:e,domEventName:r,eventSystemFlags:s,nativeEvent:a,targetContainers:[n]},e!==null&&(e=Ll(e),e!==null&&km(e)),t):(t.eventSystemFlags|=s,e=t.targetContainers,n!==null&&e.indexOf(n)===-1&&e.push(n),t)}function wP(t,e,r,s,n){switch(e){case"focusin":return Bs=Ai(Bs,t,e,r,s,n),!0;case"dragenter":return Ks=Ai(Ks,t,e,r,s,n),!0;case"mouseover":return Ws=Ai(Ws,t,e,r,s,n),!0;case"pointerover":var a=n.pointerId;return hl.set(a,Ai(hl.get(a)||null,t,e,r,s,n)),!0;case"gotpointercapture":return a=n.pointerId,pl.set(a,Ai(pl.get(a)||null,t,e,r,s,n)),!0}return!1}function Jx(t){var e=Pa(t.target);if(e!==null){var r=no(e);if(r!==null){if(e=r.tag,e===13){if(e=Ux(r),e!==null){t.blockedOn=e,Yx(t.priority,function(){Gx(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Mc(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=xh(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var s=new r.constructor(r.type,r);hh=s,r.target.dispatchEvent(s),hh=null}else return e=Ll(r),e!==null&&km(e),t.blockedOn=r,!1;e.shift()}return!0}function Og(t,e,r){Mc(t)&&r.delete(e)}function bP(){yh=!1,Bs!==null&&Mc(Bs)&&(Bs=null),Ks!==null&&Mc(Ks)&&(Ks=null),Ws!==null&&Mc(Ws)&&(Ws=null),hl.forEach(Og),pl.forEach(Og)}function Oi(t,e){t.blockedOn===e&&(t.blockedOn=null,yh||(yh=!0,Pr.unstable_scheduleCallback(Pr.unstable_NormalPriority,bP)))}function ml(t){function e(n){return Oi(n,t)}if(0<uc.length){Oi(uc[0],t);for(var r=1;r<uc.length;r++){var s=uc[r];s.blockedOn===t&&(s.blockedOn=null)}}for(Bs!==null&&Oi(Bs,t),Ks!==null&&Oi(Ks,t),Ws!==null&&Oi(Ws,t),hl.forEach(e),pl.forEach(e),r=0;r<Ns.length;r++)s=Ns[r],s.blockedOn===t&&(s.blockedOn=null);for(;0<Ns.length&&(r=Ns[0],r.blockedOn===null);)Jx(r),r.blockedOn===null&&Ns.shift()}var $o=ds.ReactCurrentBatchConfig,cu=!0;function SP(t,e,r,s){var n=Xe,a=$o.transition;$o.transition=null;try{Xe=1,Nm(t,e,r,s)}finally{Xe=n,$o.transition=a}}function _P(t,e,r,s){var n=Xe,a=$o.transition;$o.transition=null;try{Xe=4,Nm(t,e,r,s)}finally{Xe=n,$o.transition=a}}function Nm(t,e,r,s){if(cu){var n=xh(t,e,r,s);if(n===null)gf(t,e,s,uu,r),Ag(t,s);else if(wP(n,t,e,r,s))s.stopPropagation();else if(Ag(t,s),e&4&&-1<xP.indexOf(t)){for(;n!==null;){var a=Ll(n);if(a!==null&&Qx(a),a=xh(t,e,r,s),a===null&&gf(t,e,s,uu,r),a===n)break;n=a}n!==null&&s.stopPropagation()}else gf(t,e,s,null,r)}}var uu=null;function xh(t,e,r,s){if(uu=null,t=Em(s),t=Pa(t),t!==null)if(e=no(t),e===null)t=null;else if(r=e.tag,r===13){if(t=Ux(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return uu=t,null}function Xx(t){switch(t){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(uP()){case Cm:return 1;case Hx:return 4;case iu:case dP:return 16;case Bx:return 536870912;default:return 16}default:return 16}}var Us=null,jm=null,$c=null;function ew(){if($c)return $c;var t,e=jm,r=e.length,s,n="value"in Us?Us.value:Us.textContent,a=n.length;for(t=0;t<r&&e[t]===n[t];t++);var o=r-t;for(s=1;s<=o&&e[r-s]===n[a-s];s++);return $c=n.slice(t,1<s?1-s:void 0)}function Fc(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function dc(){return!0}function Ig(){return!1}function Nr(t){function e(r,s,n,a,o){this._reactName=r,this._targetInst=n,this.type=s,this.nativeEvent=a,this.target=o,this.currentTarget=null;for(var i in t)t.hasOwnProperty(i)&&(r=t[i],this[i]=r?r(a):a[i]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?dc:Ig,this.isPropagationStopped=Ig,this}return gt(e.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}),e}var xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Rm=Nr(xi),Fl=gt({},xi,{view:0,detail:0}),EP=Nr(Fl),lf,cf,Ii,cd=gt({},Fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tm,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ii&&(Ii&&t.type==="mousemove"?(lf=t.screenX-Ii.screenX,cf=t.screenY-Ii.screenY):cf=lf=0,Ii=t),lf)},movementY:function(t){return"movementY"in t?t.movementY:cf}}),Dg=Nr(cd),CP=gt({},cd,{dataTransfer:0}),PP=Nr(CP),kP=gt({},Fl,{relatedTarget:0}),uf=Nr(kP),NP=gt({},xi,{animationName:0,elapsedTime:0,pseudoElement:0}),jP=Nr(NP),RP=gt({},xi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),TP=Nr(RP),AP=gt({},xi,{data:0}),Mg=Nr(AP),OP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IP={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"},DP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function MP(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=DP[t])?!!e[t]:!1}function Tm(){return MP}var $P=gt({},Fl,{key:function(t){if(t.key){var e=OP[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Fc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?IP[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tm,charCode:function(t){return t.type==="keypress"?Fc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Fc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),FP=Nr($P),LP=gt({},cd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$g=Nr(LP),UP=gt({},Fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tm}),zP=Nr(UP),VP=gt({},xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),qP=Nr(VP),HP=gt({},cd,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),BP=Nr(HP),KP=[9,13,27,32],Am=ns&&"CompositionEvent"in window,Xi=null;ns&&"documentMode"in document&&(Xi=document.documentMode);var WP=ns&&"TextEvent"in window&&!Xi,tw=ns&&(!Am||Xi&&8<Xi&&11>=Xi),Fg=" ",Lg=!1;function rw(t,e){switch(t){case"keyup":return KP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nw(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var bo=!1;function QP(t,e){switch(t){case"compositionend":return nw(e);case"keypress":return e.which!==32?null:(Lg=!0,Fg);case"textInput":return t=e.data,t===Fg&&Lg?null:t;default:return null}}function GP(t,e){if(bo)return t==="compositionend"||!Am&&rw(t,e)?(t=ew(),$c=jm=Us=null,bo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return tw&&e.locale!=="ko"?null:e.data;default:return null}}var ZP={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 Ug(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!ZP[t.type]:e==="textarea"}function sw(t,e,r,s){Dx(s),e=du(e,"onChange"),0<e.length&&(r=new Rm("onChange","change",null,r,s),t.push({event:r,listeners:e}))}var el=null,vl=null;function YP(t){mw(t,0)}function ud(t){var e=Eo(t);if(Nx(e))return t}function JP(t,e){if(t==="change")return e}var aw=!1;if(ns){var df;if(ns){var ff="oninput"in document;if(!ff){var zg=document.createElement("div");zg.setAttribute("oninput","return;"),ff=typeof zg.oninput=="function"}df=ff}else df=!1;aw=df&&(!document.documentMode||9<document.documentMode)}function Vg(){el&&(el.detachEvent("onpropertychange",ow),vl=el=null)}function ow(t){if(t.propertyName==="value"&&ud(vl)){var e=[];sw(e,vl,t,Em(t)),Lx(YP,e)}}function XP(t,e,r){t==="focusin"?(Vg(),el=e,vl=r,el.attachEvent("onpropertychange",ow)):t==="focusout"&&Vg()}function ek(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ud(vl)}function tk(t,e){if(t==="click")return ud(e)}function rk(t,e){if(t==="input"||t==="change")return ud(e)}function nk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var sn=typeof Object.is=="function"?Object.is:nk;function gl(t,e){if(sn(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(s=0;s<r.length;s++){var n=r[s];if(!th.call(e,n)||!sn(t[n],e[n]))return!1}return!0}function qg(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Hg(t,e){var r=qg(t);t=0;for(var s;r;){if(r.nodeType===3){if(s=t+r.textContent.length,t<=e&&s>=e)return{node:r,offset:e-t};t=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=qg(r)}}function iw(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?iw(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function lw(){for(var t=window,e=su();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=su(t.document)}return e}function Om(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function sk(t){var e=lw(),r=t.focusedElem,s=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&iw(r.ownerDocument.documentElement,r)){if(s!==null&&Om(r)){if(e=s.start,t=s.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var n=r.textContent.length,a=Math.min(s.start,n);s=s.end===void 0?a:Math.min(s.end,n),!t.extend&&a>s&&(n=s,s=a,a=n),n=Hg(r,a);var o=Hg(r,s);n&&o&&(t.rangeCount!==1||t.anchorNode!==n.node||t.anchorOffset!==n.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(n.node,n.offset),t.removeAllRanges(),a>s?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var ak=ns&&"documentMode"in document&&11>=document.documentMode,So=null,wh=null,tl=null,bh=!1;function Bg(t,e,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;bh||So==null||So!==su(s)||(s=So,"selectionStart"in s&&Om(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),tl&&gl(tl,s)||(tl=s,s=du(wh,"onSelect"),0<s.length&&(e=new Rm("onSelect","select",null,e,r),t.push({event:e,listeners:s}),e.target=So)))}function fc(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var _o={animationend:fc("Animation","AnimationEnd"),animationiteration:fc("Animation","AnimationIteration"),animationstart:fc("Animation","AnimationStart"),transitionend:fc("Transition","TransitionEnd")},hf={},cw={};ns&&(cw=document.createElement("div").style,"AnimationEvent"in window||(delete _o.animationend.animation,delete _o.animationiteration.animation,delete _o.animationstart.animation),"TransitionEvent"in window||delete _o.transitionend.transition);function dd(t){if(hf[t])return hf[t];if(!_o[t])return t;var e=_o[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in cw)return hf[t]=e[r];return t}var uw=dd("animationend"),dw=dd("animationiteration"),fw=dd("animationstart"),hw=dd("transitionend"),pw=new Map,Kg="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 la(t,e){pw.set(t,e),ro(e,[t])}for(var pf=0;pf<Kg.length;pf++){var mf=Kg[pf],ok=mf.toLowerCase(),ik=mf[0].toUpperCase()+mf.slice(1);la(ok,"on"+ik)}la(uw,"onAnimationEnd");la(dw,"onAnimationIteration");la(fw,"onAnimationStart");la("dblclick","onDoubleClick");la("focusin","onFocus");la("focusout","onBlur");la(hw,"onTransitionEnd");si("onMouseEnter",["mouseout","mouseover"]);si("onMouseLeave",["mouseout","mouseover"]);si("onPointerEnter",["pointerout","pointerover"]);si("onPointerLeave",["pointerout","pointerover"]);ro("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ro("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ro("onBeforeInput",["compositionend","keypress","textInput","paste"]);ro("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ro("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ro("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hi="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(" "),lk=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hi));function Wg(t,e,r){var s=t.type||"unknown-event";t.currentTarget=r,oP(s,e,void 0,t),t.currentTarget=null}function mw(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var s=t[r],n=s.event;s=s.listeners;e:{var a=void 0;if(e)for(var o=s.length-1;0<=o;o--){var i=s[o],c=i.instance,u=i.currentTarget;if(i=i.listener,c!==a&&n.isPropagationStopped())break e;Wg(n,i,u),a=c}else for(o=0;o<s.length;o++){if(i=s[o],c=i.instance,u=i.currentTarget,i=i.listener,c!==a&&n.isPropagationStopped())break e;Wg(n,i,u),a=c}}}if(ou)throw t=vh,ou=!1,vh=null,t}function lt(t,e){var r=e[Ph];r===void 0&&(r=e[Ph]=new Set);var s=t+"__bubble";r.has(s)||(vw(e,t,2,!1),r.add(s))}function vf(t,e,r){var s=0;e&&(s|=4),vw(r,t,s,e)}var hc="_reactListening"+Math.random().toString(36).slice(2);function yl(t){if(!t[hc]){t[hc]=!0,_x.forEach(function(r){r!=="selectionchange"&&(lk.has(r)||vf(r,!1,t),vf(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[hc]||(e[hc]=!0,vf("selectionchange",!1,e))}}function vw(t,e,r,s){switch(Xx(e)){case 1:var n=SP;break;case 4:n=_P;break;default:n=Nm}r=n.bind(null,e,r,t),n=void 0,!mh||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(n=!0),s?n!==void 0?t.addEventListener(e,r,{capture:!0,passive:n}):t.addEventListener(e,r,!0):n!==void 0?t.addEventListener(e,r,{passive:n}):t.addEventListener(e,r,!1)}function gf(t,e,r,s,n){var a=s;if(!(e&1)&&!(e&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var i=s.stateNode.containerInfo;if(i===n||i.nodeType===8&&i.parentNode===n)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===n||c.nodeType===8&&c.parentNode===n))return;o=o.return}for(;i!==null;){if(o=Pa(i),o===null)return;if(c=o.tag,c===5||c===6){s=a=o;continue e}i=i.parentNode}}s=s.return}Lx(function(){var u=a,d=Em(r),h=[];e:{var m=pw.get(t);if(m!==void 0){var f=Rm,w=t;switch(t){case"keypress":if(Fc(r)===0)break e;case"keydown":case"keyup":f=FP;break;case"focusin":w="focus",f=uf;break;case"focusout":w="blur",f=uf;break;case"beforeblur":case"afterblur":f=uf;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":f=Dg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=PP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=zP;break;case uw:case dw:case fw:f=jP;break;case hw:f=qP;break;case"scroll":f=EP;break;case"wheel":f=BP;break;case"copy":case"cut":case"paste":f=TP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=$g}var p=(e&4)!==0,y=!p&&t==="scroll",g=p?m!==null?m+"Capture":null:m;p=[];for(var v=u,b;v!==null;){b=v;var S=b.stateNode;if(b.tag===5&&S!==null&&(b=S,g!==null&&(S=fl(v,g),S!=null&&p.push(xl(v,S,b)))),y)break;v=v.return}0<p.length&&(m=new f(m,w,null,r,d),h.push({event:m,listeners:p}))}}if(!(e&7)){e:{if(m=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",m&&r!==hh&&(w=r.relatedTarget||r.fromElement)&&(Pa(w)||w[ss]))break e;if((f||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,f?(w=r.relatedTarget||r.toElement,f=u,w=w?Pa(w):null,w!==null&&(y=no(w),w!==y||w.tag!==5&&w.tag!==6)&&(w=null)):(f=null,w=u),f!==w)){if(p=Dg,S="onMouseLeave",g="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(p=$g,S="onPointerLeave",g="onPointerEnter",v="pointer"),y=f==null?m:Eo(f),b=w==null?m:Eo(w),m=new p(S,v+"leave",f,r,d),m.target=y,m.relatedTarget=b,S=null,Pa(d)===u&&(p=new p(g,v+"enter",w,r,d),p.target=b,p.relatedTarget=y,S=p),y=S,f&&w)t:{for(p=f,g=w,v=0,b=p;b;b=lo(b))v++;for(b=0,S=g;S;S=lo(S))b++;for(;0<v-b;)p=lo(p),v--;for(;0<b-v;)g=lo(g),b--;for(;v--;){if(p===g||g!==null&&p===g.alternate)break t;p=lo(p),g=lo(g)}p=null}else p=null;f!==null&&Qg(h,m,f,p,!1),w!==null&&y!==null&&Qg(h,y,w,p,!0)}}e:{if(m=u?Eo(u):window,f=m.nodeName&&m.nodeName.toLowerCase(),f==="select"||f==="input"&&m.type==="file")var E=JP;else if(Ug(m))if(aw)E=rk;else{E=ek;var N=XP}else(f=m.nodeName)&&f.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(E=tk);if(E&&(E=E(t,u))){sw(h,E,r,d);break e}N&&N(t,m,u),t==="focusout"&&(N=m._wrapperState)&&N.controlled&&m.type==="number"&&lh(m,"number",m.value)}switch(N=u?Eo(u):window,t){case"focusin":(Ug(N)||N.contentEditable==="true")&&(So=N,wh=u,tl=null);break;case"focusout":tl=wh=So=null;break;case"mousedown":bh=!0;break;case"contextmenu":case"mouseup":case"dragend":bh=!1,Bg(h,r,d);break;case"selectionchange":if(ak)break;case"keydown":case"keyup":Bg(h,r,d)}var j;if(Am)e:{switch(t){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else bo?rw(t,r)&&(R="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(R="onCompositionStart");R&&(tw&&r.locale!=="ko"&&(bo||R!=="onCompositionStart"?R==="onCompositionEnd"&&bo&&(j=ew()):(Us=d,jm="value"in Us?Us.value:Us.textContent,bo=!0)),N=du(u,R),0<N.length&&(R=new Mg(R,t,null,r,d),h.push({event:R,listeners:N}),j?R.data=j:(j=nw(r),j!==null&&(R.data=j)))),(j=WP?QP(t,r):GP(t,r))&&(u=du(u,"onBeforeInput"),0<u.length&&(d=new Mg("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=j))}mw(h,e)})}function xl(t,e,r){return{instance:t,listener:e,currentTarget:r}}function du(t,e){for(var r=e+"Capture",s=[];t!==null;){var n=t,a=n.stateNode;n.tag===5&&a!==null&&(n=a,a=fl(t,r),a!=null&&s.unshift(xl(t,a,n)),a=fl(t,e),a!=null&&s.push(xl(t,a,n))),t=t.return}return s}function lo(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Qg(t,e,r,s,n){for(var a=e._reactName,o=[];r!==null&&r!==s;){var i=r,c=i.alternate,u=i.stateNode;if(c!==null&&c===s)break;i.tag===5&&u!==null&&(i=u,n?(c=fl(r,a),c!=null&&o.unshift(xl(r,c,i))):n||(c=fl(r,a),c!=null&&o.push(xl(r,c,i)))),r=r.return}o.length!==0&&t.push({event:e,listeners:o})}var ck=/\r\n?/g,uk=/\u0000|\uFFFD/g;function Gg(t){return(typeof t=="string"?t:""+t).replace(ck,`
|
|
38
|
+
`).replace(uk,"")}function pc(t,e,r){if(e=Gg(e),Gg(t)!==e&&r)throw Error(Q(425))}function fu(){}var Sh=null,_h=null;function Eh(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Ch=typeof setTimeout=="function"?setTimeout:void 0,dk=typeof clearTimeout=="function"?clearTimeout:void 0,Zg=typeof Promise=="function"?Promise:void 0,fk=typeof queueMicrotask=="function"?queueMicrotask:typeof Zg<"u"?function(t){return Zg.resolve(null).then(t).catch(hk)}:Ch;function hk(t){setTimeout(function(){throw t})}function yf(t,e){var r=e,s=0;do{var n=r.nextSibling;if(t.removeChild(r),n&&n.nodeType===8)if(r=n.data,r==="/$"){if(s===0){t.removeChild(n),ml(e);return}s--}else r!=="$"&&r!=="$?"&&r!=="$!"||s++;r=n}while(r);ml(e)}function Qs(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Yg(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var wi=Math.random().toString(36).slice(2),xn="__reactFiber$"+wi,wl="__reactProps$"+wi,ss="__reactContainer$"+wi,Ph="__reactEvents$"+wi,pk="__reactListeners$"+wi,mk="__reactHandles$"+wi;function Pa(t){var e=t[xn];if(e)return e;for(var r=t.parentNode;r;){if(e=r[ss]||r[xn]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=Yg(t);t!==null;){if(r=t[xn])return r;t=Yg(t)}return e}t=r,r=t.parentNode}return null}function Ll(t){return t=t[xn]||t[ss],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Eo(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Q(33))}function fd(t){return t[wl]||null}var kh=[],Co=-1;function ca(t){return{current:t}}function ct(t){0>Co||(t.current=kh[Co],kh[Co]=null,Co--)}function st(t,e){Co++,kh[Co]=t.current,t.current=e}var sa={},Zt=ca(sa),mr=ca(!1),Ua=sa;function ai(t,e){var r=t.type.contextTypes;if(!r)return sa;var s=t.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===e)return s.__reactInternalMemoizedMaskedChildContext;var n={},a;for(a in r)n[a]=e[a];return s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=n),n}function vr(t){return t=t.childContextTypes,t!=null}function hu(){ct(mr),ct(Zt)}function Jg(t,e,r){if(Zt.current!==sa)throw Error(Q(168));st(Zt,e),st(mr,r)}function gw(t,e,r){var s=t.stateNode;if(e=e.childContextTypes,typeof s.getChildContext!="function")return r;s=s.getChildContext();for(var n in s)if(!(n in e))throw Error(Q(108,XC(t)||"Unknown",n));return gt({},r,s)}function pu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||sa,Ua=Zt.current,st(Zt,t),st(mr,mr.current),!0}function Xg(t,e,r){var s=t.stateNode;if(!s)throw Error(Q(169));r?(t=gw(t,e,Ua),s.__reactInternalMemoizedMergedChildContext=t,ct(mr),ct(Zt),st(Zt,t)):ct(mr),st(mr,r)}var Bn=null,hd=!1,xf=!1;function yw(t){Bn===null?Bn=[t]:Bn.push(t)}function vk(t){hd=!0,yw(t)}function ua(){if(!xf&&Bn!==null){xf=!0;var t=0,e=Xe;try{var r=Bn;for(Xe=1;t<r.length;t++){var s=r[t];do s=s(!0);while(s!==null)}Bn=null,hd=!1}catch(n){throw Bn!==null&&(Bn=Bn.slice(t+1)),qx(Cm,ua),n}finally{Xe=e,xf=!1}}return null}var Po=[],ko=0,mu=null,vu=0,Or=[],Ir=0,za=null,Zn=1,Yn="";function ba(t,e){Po[ko++]=vu,Po[ko++]=mu,mu=t,vu=e}function xw(t,e,r){Or[Ir++]=Zn,Or[Ir++]=Yn,Or[Ir++]=za,za=t;var s=Zn;t=Yn;var n=32-rn(s)-1;s&=~(1<<n),r+=1;var a=32-rn(e)+n;if(30<a){var o=n-n%5;a=(s&(1<<o)-1).toString(32),s>>=o,n-=o,Zn=1<<32-rn(e)+n|r<<n|s,Yn=a+t}else Zn=1<<a|r<<n|s,Yn=t}function Im(t){t.return!==null&&(ba(t,1),xw(t,1,0))}function Dm(t){for(;t===mu;)mu=Po[--ko],Po[ko]=null,vu=Po[--ko],Po[ko]=null;for(;t===za;)za=Or[--Ir],Or[Ir]=null,Yn=Or[--Ir],Or[Ir]=null,Zn=Or[--Ir],Or[Ir]=null}var Er=null,_r=null,ht=!1,tn=null;function ww(t,e){var r=Mr(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function ey(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Er=t,_r=Qs(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Er=t,_r=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=za!==null?{id:Zn,overflow:Yn}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=Mr(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Er=t,_r=null,!0):!1;default:return!1}}function Nh(t){return(t.mode&1)!==0&&(t.flags&128)===0}function jh(t){if(ht){var e=_r;if(e){var r=e;if(!ey(t,e)){if(Nh(t))throw Error(Q(418));e=Qs(r.nextSibling);var s=Er;e&&ey(t,e)?ww(s,r):(t.flags=t.flags&-4097|2,ht=!1,Er=t)}}else{if(Nh(t))throw Error(Q(418));t.flags=t.flags&-4097|2,ht=!1,Er=t}}}function ty(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Er=t}function mc(t){if(t!==Er)return!1;if(!ht)return ty(t),ht=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Eh(t.type,t.memoizedProps)),e&&(e=_r)){if(Nh(t))throw bw(),Error(Q(418));for(;e;)ww(t,e),e=Qs(e.nextSibling)}if(ty(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Q(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){_r=Qs(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}_r=null}}else _r=Er?Qs(t.stateNode.nextSibling):null;return!0}function bw(){for(var t=_r;t;)t=Qs(t.nextSibling)}function oi(){_r=Er=null,ht=!1}function Mm(t){tn===null?tn=[t]:tn.push(t)}var gk=ds.ReactCurrentBatchConfig;function Di(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Q(309));var s=r.stateNode}if(!s)throw Error(Q(147,t));var n=s,a=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===a?e.ref:(e=function(o){var i=n.refs;o===null?delete i[a]:i[a]=o},e._stringRef=a,e)}if(typeof t!="string")throw Error(Q(284));if(!r._owner)throw Error(Q(290,t))}return t}function vc(t,e){throw t=Object.prototype.toString.call(e),Error(Q(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function ry(t){var e=t._init;return e(t._payload)}function Sw(t){function e(g,v){if(t){var b=g.deletions;b===null?(g.deletions=[v],g.flags|=16):b.push(v)}}function r(g,v){if(!t)return null;for(;v!==null;)e(g,v),v=v.sibling;return null}function s(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function n(g,v){return g=Js(g,v),g.index=0,g.sibling=null,g}function a(g,v,b){return g.index=b,t?(b=g.alternate,b!==null?(b=b.index,b<v?(g.flags|=2,v):b):(g.flags|=2,v)):(g.flags|=1048576,v)}function o(g){return t&&g.alternate===null&&(g.flags|=2),g}function i(g,v,b,S){return v===null||v.tag!==6?(v=Pf(b,g.mode,S),v.return=g,v):(v=n(v,b),v.return=g,v)}function c(g,v,b,S){var E=b.type;return E===wo?d(g,v,b.props.children,S,b.key):v!==null&&(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===_s&&ry(E)===v.type)?(S=n(v,b.props),S.ref=Di(g,v,b),S.return=g,S):(S=Bc(b.type,b.key,b.props,null,g.mode,S),S.ref=Di(g,v,b),S.return=g,S)}function u(g,v,b,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=kf(b,g.mode,S),v.return=g,v):(v=n(v,b.children||[]),v.return=g,v)}function d(g,v,b,S,E){return v===null||v.tag!==7?(v=Fa(b,g.mode,S,E),v.return=g,v):(v=n(v,b),v.return=g,v)}function h(g,v,b){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Pf(""+v,g.mode,b),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ac:return b=Bc(v.type,v.key,v.props,null,g.mode,b),b.ref=Di(g,null,v),b.return=g,b;case xo:return v=kf(v,g.mode,b),v.return=g,v;case _s:var S=v._init;return h(g,S(v._payload),b)}if(Vi(v)||Ri(v))return v=Fa(v,g.mode,b,null),v.return=g,v;vc(g,v)}return null}function m(g,v,b,S){var E=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return E!==null?null:i(g,v,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ac:return b.key===E?c(g,v,b,S):null;case xo:return b.key===E?u(g,v,b,S):null;case _s:return E=b._init,m(g,v,E(b._payload),S)}if(Vi(b)||Ri(b))return E!==null?null:d(g,v,b,S,null);vc(g,b)}return null}function f(g,v,b,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return g=g.get(b)||null,i(v,g,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ac:return g=g.get(S.key===null?b:S.key)||null,c(v,g,S,E);case xo:return g=g.get(S.key===null?b:S.key)||null,u(v,g,S,E);case _s:var N=S._init;return f(g,v,b,N(S._payload),E)}if(Vi(S)||Ri(S))return g=g.get(b)||null,d(v,g,S,E,null);vc(v,S)}return null}function w(g,v,b,S){for(var E=null,N=null,j=v,R=v=0,A=null;j!==null&&R<b.length;R++){j.index>R?(A=j,j=null):A=j.sibling;var F=m(g,j,b[R],S);if(F===null){j===null&&(j=A);break}t&&j&&F.alternate===null&&e(g,j),v=a(F,v,R),N===null?E=F:N.sibling=F,N=F,j=A}if(R===b.length)return r(g,j),ht&&ba(g,R),E;if(j===null){for(;R<b.length;R++)j=h(g,b[R],S),j!==null&&(v=a(j,v,R),N===null?E=j:N.sibling=j,N=j);return ht&&ba(g,R),E}for(j=s(g,j);R<b.length;R++)A=f(j,g,R,b[R],S),A!==null&&(t&&A.alternate!==null&&j.delete(A.key===null?R:A.key),v=a(A,v,R),N===null?E=A:N.sibling=A,N=A);return t&&j.forEach(function(T){return e(g,T)}),ht&&ba(g,R),E}function p(g,v,b,S){var E=Ri(b);if(typeof E!="function")throw Error(Q(150));if(b=E.call(b),b==null)throw Error(Q(151));for(var N=E=null,j=v,R=v=0,A=null,F=b.next();j!==null&&!F.done;R++,F=b.next()){j.index>R?(A=j,j=null):A=j.sibling;var T=m(g,j,F.value,S);if(T===null){j===null&&(j=A);break}t&&j&&T.alternate===null&&e(g,j),v=a(T,v,R),N===null?E=T:N.sibling=T,N=T,j=A}if(F.done)return r(g,j),ht&&ba(g,R),E;if(j===null){for(;!F.done;R++,F=b.next())F=h(g,F.value,S),F!==null&&(v=a(F,v,R),N===null?E=F:N.sibling=F,N=F);return ht&&ba(g,R),E}for(j=s(g,j);!F.done;R++,F=b.next())F=f(j,g,R,F.value,S),F!==null&&(t&&F.alternate!==null&&j.delete(F.key===null?R:F.key),v=a(F,v,R),N===null?E=F:N.sibling=F,N=F);return t&&j.forEach(function(_){return e(g,_)}),ht&&ba(g,R),E}function y(g,v,b,S){if(typeof b=="object"&&b!==null&&b.type===wo&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case ac:e:{for(var E=b.key,N=v;N!==null;){if(N.key===E){if(E=b.type,E===wo){if(N.tag===7){r(g,N.sibling),v=n(N,b.props.children),v.return=g,g=v;break e}}else if(N.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===_s&&ry(E)===N.type){r(g,N.sibling),v=n(N,b.props),v.ref=Di(g,N,b),v.return=g,g=v;break e}r(g,N);break}else e(g,N);N=N.sibling}b.type===wo?(v=Fa(b.props.children,g.mode,S,b.key),v.return=g,g=v):(S=Bc(b.type,b.key,b.props,null,g.mode,S),S.ref=Di(g,v,b),S.return=g,g=S)}return o(g);case xo:e:{for(N=b.key;v!==null;){if(v.key===N)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){r(g,v.sibling),v=n(v,b.children||[]),v.return=g,g=v;break e}else{r(g,v);break}else e(g,v);v=v.sibling}v=kf(b,g.mode,S),v.return=g,g=v}return o(g);case _s:return N=b._init,y(g,v,N(b._payload),S)}if(Vi(b))return w(g,v,b,S);if(Ri(b))return p(g,v,b,S);vc(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(r(g,v.sibling),v=n(v,b),v.return=g,g=v):(r(g,v),v=Pf(b,g.mode,S),v.return=g,g=v),o(g)):r(g,v)}return y}var ii=Sw(!0),_w=Sw(!1),gu=ca(null),yu=null,No=null,$m=null;function Fm(){$m=No=yu=null}function Lm(t){var e=gu.current;ct(gu),t._currentValue=e}function Rh(t,e,r){for(;t!==null;){var s=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,s!==null&&(s.childLanes|=e)):s!==null&&(s.childLanes&e)!==e&&(s.childLanes|=e),t===r)break;t=t.return}}function Fo(t,e){yu=t,$m=No=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(pr=!0),t.firstContext=null)}function Fr(t){var e=t._currentValue;if($m!==t)if(t={context:t,memoizedValue:e,next:null},No===null){if(yu===null)throw Error(Q(308));No=t,yu.dependencies={lanes:0,firstContext:t}}else No=No.next=t;return e}var ka=null;function Um(t){ka===null?ka=[t]:ka.push(t)}function Ew(t,e,r,s){var n=e.interleaved;return n===null?(r.next=r,Um(e)):(r.next=n.next,n.next=r),e.interleaved=r,as(t,s)}function as(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var Es=!1;function zm(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cw(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function es(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Gs(t,e,r){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,Ze&2){var n=s.pending;return n===null?e.next=e:(e.next=n.next,n.next=e),s.pending=e,as(t,r)}return n=s.interleaved,n===null?(e.next=e,Um(s)):(e.next=n.next,n.next=e),s.interleaved=e,as(t,r)}function Lc(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var s=e.lanes;s&=t.pendingLanes,r|=s,e.lanes=r,Pm(t,r)}}function ny(t,e){var r=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var n=null,a=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};a===null?n=a=o:a=a.next=o,r=r.next}while(r!==null);a===null?n=a=e:a=a.next=e}else n=a=e;r={baseState:s.baseState,firstBaseUpdate:n,lastBaseUpdate:a,shared:s.shared,effects:s.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function xu(t,e,r,s){var n=t.updateQueue;Es=!1;var a=n.firstBaseUpdate,o=n.lastBaseUpdate,i=n.shared.pending;if(i!==null){n.shared.pending=null;var c=i,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=t.alternate;d!==null&&(d=d.updateQueue,i=d.lastBaseUpdate,i!==o&&(i===null?d.firstBaseUpdate=u:i.next=u,d.lastBaseUpdate=c))}if(a!==null){var h=n.baseState;o=0,d=u=c=null,i=a;do{var m=i.lane,f=i.eventTime;if((s&m)===m){d!==null&&(d=d.next={eventTime:f,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var w=t,p=i;switch(m=e,f=r,p.tag){case 1:if(w=p.payload,typeof w=="function"){h=w.call(f,h,m);break e}h=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=p.payload,m=typeof w=="function"?w.call(f,h,m):w,m==null)break e;h=gt({},h,m);break e;case 2:Es=!0}}i.callback!==null&&i.lane!==0&&(t.flags|=64,m=n.effects,m===null?n.effects=[i]:m.push(i))}else f={eventTime:f,lane:m,tag:i.tag,payload:i.payload,callback:i.callback,next:null},d===null?(u=d=f,c=h):d=d.next=f,o|=m;if(i=i.next,i===null){if(i=n.shared.pending,i===null)break;m=i,i=m.next,m.next=null,n.lastBaseUpdate=m,n.shared.pending=null}}while(!0);if(d===null&&(c=h),n.baseState=c,n.firstBaseUpdate=u,n.lastBaseUpdate=d,e=n.shared.interleaved,e!==null){n=e;do o|=n.lane,n=n.next;while(n!==e)}else a===null&&(n.shared.lanes=0);qa|=o,t.lanes=o,t.memoizedState=h}}function sy(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var s=t[e],n=s.callback;if(n!==null){if(s.callback=null,s=r,typeof n!="function")throw Error(Q(191,n));n.call(s)}}}var Ul={},Nn=ca(Ul),bl=ca(Ul),Sl=ca(Ul);function Na(t){if(t===Ul)throw Error(Q(174));return t}function Vm(t,e){switch(st(Sl,e),st(bl,t),st(Nn,Ul),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:uh(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=uh(e,t)}ct(Nn),st(Nn,e)}function li(){ct(Nn),ct(bl),ct(Sl)}function Pw(t){Na(Sl.current);var e=Na(Nn.current),r=uh(e,t.type);e!==r&&(st(bl,t),st(Nn,r))}function qm(t){bl.current===t&&(ct(Nn),ct(bl))}var mt=ca(0);function wu(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var wf=[];function Hm(){for(var t=0;t<wf.length;t++)wf[t]._workInProgressVersionPrimary=null;wf.length=0}var Uc=ds.ReactCurrentDispatcher,bf=ds.ReactCurrentBatchConfig,Va=0,vt=null,Rt=null,$t=null,bu=!1,rl=!1,_l=0,yk=0;function Wt(){throw Error(Q(321))}function Bm(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!sn(t[r],e[r]))return!1;return!0}function Km(t,e,r,s,n,a){if(Va=a,vt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Uc.current=t===null||t.memoizedState===null?Sk:_k,t=r(s,n),rl){a=0;do{if(rl=!1,_l=0,25<=a)throw Error(Q(301));a+=1,$t=Rt=null,e.updateQueue=null,Uc.current=Ek,t=r(s,n)}while(rl)}if(Uc.current=Su,e=Rt!==null&&Rt.next!==null,Va=0,$t=Rt=vt=null,bu=!1,e)throw Error(Q(300));return t}function Wm(){var t=_l!==0;return _l=0,t}function pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?vt.memoizedState=$t=t:$t=$t.next=t,$t}function Lr(){if(Rt===null){var t=vt.alternate;t=t!==null?t.memoizedState:null}else t=Rt.next;var e=$t===null?vt.memoizedState:$t.next;if(e!==null)$t=e,Rt=t;else{if(t===null)throw Error(Q(310));Rt=t,t={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},$t===null?vt.memoizedState=$t=t:$t=$t.next=t}return $t}function El(t,e){return typeof e=="function"?e(t):e}function Sf(t){var e=Lr(),r=e.queue;if(r===null)throw Error(Q(311));r.lastRenderedReducer=t;var s=Rt,n=s.baseQueue,a=r.pending;if(a!==null){if(n!==null){var o=n.next;n.next=a.next,a.next=o}s.baseQueue=n=a,r.pending=null}if(n!==null){a=n.next,s=s.baseState;var i=o=null,c=null,u=a;do{var d=u.lane;if((Va&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),s=u.hasEagerState?u.eagerState:t(s,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(i=c=h,o=s):c=c.next=h,vt.lanes|=d,qa|=d}u=u.next}while(u!==null&&u!==a);c===null?o=s:c.next=i,sn(s,e.memoizedState)||(pr=!0),e.memoizedState=s,e.baseState=o,e.baseQueue=c,r.lastRenderedState=s}if(t=r.interleaved,t!==null){n=t;do a=n.lane,vt.lanes|=a,qa|=a,n=n.next;while(n!==t)}else n===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function _f(t){var e=Lr(),r=e.queue;if(r===null)throw Error(Q(311));r.lastRenderedReducer=t;var s=r.dispatch,n=r.pending,a=e.memoizedState;if(n!==null){r.pending=null;var o=n=n.next;do a=t(a,o.action),o=o.next;while(o!==n);sn(a,e.memoizedState)||(pr=!0),e.memoizedState=a,e.baseQueue===null&&(e.baseState=a),r.lastRenderedState=a}return[a,s]}function kw(){}function Nw(t,e){var r=vt,s=Lr(),n=e(),a=!sn(s.memoizedState,n);if(a&&(s.memoizedState=n,pr=!0),s=s.queue,Qm(Tw.bind(null,r,s,t),[t]),s.getSnapshot!==e||a||$t!==null&&$t.memoizedState.tag&1){if(r.flags|=2048,Cl(9,Rw.bind(null,r,s,n,e),void 0,null),Lt===null)throw Error(Q(349));Va&30||jw(r,e,n)}return n}function jw(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=vt.updateQueue,e===null?(e={lastEffect:null,stores:null},vt.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function Rw(t,e,r,s){e.value=r,e.getSnapshot=s,Aw(e)&&Ow(t)}function Tw(t,e,r){return r(function(){Aw(e)&&Ow(t)})}function Aw(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!sn(t,r)}catch{return!0}}function Ow(t){var e=as(t,1);e!==null&&nn(e,t,1,-1)}function ay(t){var e=pn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:El,lastRenderedState:t},e.queue=t,t=t.dispatch=bk.bind(null,vt,t),[e.memoizedState,t]}function Cl(t,e,r,s){return t={tag:t,create:e,destroy:r,deps:s,next:null},e=vt.updateQueue,e===null?(e={lastEffect:null,stores:null},vt.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(s=r.next,r.next=t,t.next=s,e.lastEffect=t)),t}function Iw(){return Lr().memoizedState}function zc(t,e,r,s){var n=pn();vt.flags|=t,n.memoizedState=Cl(1|e,r,void 0,s===void 0?null:s)}function pd(t,e,r,s){var n=Lr();s=s===void 0?null:s;var a=void 0;if(Rt!==null){var o=Rt.memoizedState;if(a=o.destroy,s!==null&&Bm(s,o.deps)){n.memoizedState=Cl(e,r,a,s);return}}vt.flags|=t,n.memoizedState=Cl(1|e,r,a,s)}function oy(t,e){return zc(8390656,8,t,e)}function Qm(t,e){return pd(2048,8,t,e)}function Dw(t,e){return pd(4,2,t,e)}function Mw(t,e){return pd(4,4,t,e)}function $w(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Fw(t,e,r){return r=r!=null?r.concat([t]):null,pd(4,4,$w.bind(null,e,t),r)}function Gm(){}function Lw(t,e){var r=Lr();e=e===void 0?null:e;var s=r.memoizedState;return s!==null&&e!==null&&Bm(e,s[1])?s[0]:(r.memoizedState=[t,e],t)}function Uw(t,e){var r=Lr();e=e===void 0?null:e;var s=r.memoizedState;return s!==null&&e!==null&&Bm(e,s[1])?s[0]:(t=t(),r.memoizedState=[t,e],t)}function zw(t,e,r){return Va&21?(sn(r,e)||(r=Kx(),vt.lanes|=r,qa|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,pr=!0),t.memoizedState=r)}function xk(t,e){var r=Xe;Xe=r!==0&&4>r?r:4,t(!0);var s=bf.transition;bf.transition={};try{t(!1),e()}finally{Xe=r,bf.transition=s}}function Vw(){return Lr().memoizedState}function wk(t,e,r){var s=Ys(t);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},qw(t))Hw(e,r);else if(r=Ew(t,e,r,s),r!==null){var n=rr();nn(r,t,s,n),Bw(r,e,s)}}function bk(t,e,r){var s=Ys(t),n={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(qw(t))Hw(e,n);else{var a=t.alternate;if(t.lanes===0&&(a===null||a.lanes===0)&&(a=e.lastRenderedReducer,a!==null))try{var o=e.lastRenderedState,i=a(o,r);if(n.hasEagerState=!0,n.eagerState=i,sn(i,o)){var c=e.interleaved;c===null?(n.next=n,Um(e)):(n.next=c.next,c.next=n),e.interleaved=n;return}}catch{}finally{}r=Ew(t,e,n,s),r!==null&&(n=rr(),nn(r,t,s,n),Bw(r,e,s))}}function qw(t){var e=t.alternate;return t===vt||e!==null&&e===vt}function Hw(t,e){rl=bu=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Bw(t,e,r){if(r&4194240){var s=e.lanes;s&=t.pendingLanes,r|=s,e.lanes=r,Pm(t,r)}}var Su={readContext:Fr,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useInsertionEffect:Wt,useLayoutEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useMutableSource:Wt,useSyncExternalStore:Wt,useId:Wt,unstable_isNewReconciler:!1},Sk={readContext:Fr,useCallback:function(t,e){return pn().memoizedState=[t,e===void 0?null:e],t},useContext:Fr,useEffect:oy,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,zc(4194308,4,$w.bind(null,e,t),r)},useLayoutEffect:function(t,e){return zc(4194308,4,t,e)},useInsertionEffect:function(t,e){return zc(4,2,t,e)},useMemo:function(t,e){var r=pn();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var s=pn();return e=r!==void 0?r(e):e,s.memoizedState=s.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},s.queue=t,t=t.dispatch=wk.bind(null,vt,t),[s.memoizedState,t]},useRef:function(t){var e=pn();return t={current:t},e.memoizedState=t},useState:ay,useDebugValue:Gm,useDeferredValue:function(t){return pn().memoizedState=t},useTransition:function(){var t=ay(!1),e=t[0];return t=xk.bind(null,t[1]),pn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var s=vt,n=pn();if(ht){if(r===void 0)throw Error(Q(407));r=r()}else{if(r=e(),Lt===null)throw Error(Q(349));Va&30||jw(s,e,r)}n.memoizedState=r;var a={value:r,getSnapshot:e};return n.queue=a,oy(Tw.bind(null,s,a,t),[t]),s.flags|=2048,Cl(9,Rw.bind(null,s,a,r,e),void 0,null),r},useId:function(){var t=pn(),e=Lt.identifierPrefix;if(ht){var r=Yn,s=Zn;r=(s&~(1<<32-rn(s)-1)).toString(32)+r,e=":"+e+"R"+r,r=_l++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=yk++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},_k={readContext:Fr,useCallback:Lw,useContext:Fr,useEffect:Qm,useImperativeHandle:Fw,useInsertionEffect:Dw,useLayoutEffect:Mw,useMemo:Uw,useReducer:Sf,useRef:Iw,useState:function(){return Sf(El)},useDebugValue:Gm,useDeferredValue:function(t){var e=Lr();return zw(e,Rt.memoizedState,t)},useTransition:function(){var t=Sf(El)[0],e=Lr().memoizedState;return[t,e]},useMutableSource:kw,useSyncExternalStore:Nw,useId:Vw,unstable_isNewReconciler:!1},Ek={readContext:Fr,useCallback:Lw,useContext:Fr,useEffect:Qm,useImperativeHandle:Fw,useInsertionEffect:Dw,useLayoutEffect:Mw,useMemo:Uw,useReducer:_f,useRef:Iw,useState:function(){return _f(El)},useDebugValue:Gm,useDeferredValue:function(t){var e=Lr();return Rt===null?e.memoizedState=t:zw(e,Rt.memoizedState,t)},useTransition:function(){var t=_f(El)[0],e=Lr().memoizedState;return[t,e]},useMutableSource:kw,useSyncExternalStore:Nw,useId:Vw,unstable_isNewReconciler:!1};function Zr(t,e){if(t&&t.defaultProps){e=gt({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function Th(t,e,r,s){e=t.memoizedState,r=r(s,e),r=r==null?e:gt({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var md={isMounted:function(t){return(t=t._reactInternals)?no(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var s=rr(),n=Ys(t),a=es(s,n);a.payload=e,r!=null&&(a.callback=r),e=Gs(t,a,n),e!==null&&(nn(e,t,n,s),Lc(e,t,n))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var s=rr(),n=Ys(t),a=es(s,n);a.tag=1,a.payload=e,r!=null&&(a.callback=r),e=Gs(t,a,n),e!==null&&(nn(e,t,n,s),Lc(e,t,n))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=rr(),s=Ys(t),n=es(r,s);n.tag=2,e!=null&&(n.callback=e),e=Gs(t,n,s),e!==null&&(nn(e,t,s,r),Lc(e,t,s))}};function iy(t,e,r,s,n,a,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(s,a,o):e.prototype&&e.prototype.isPureReactComponent?!gl(r,s)||!gl(n,a):!0}function Kw(t,e,r){var s=!1,n=sa,a=e.contextType;return typeof a=="object"&&a!==null?a=Fr(a):(n=vr(e)?Ua:Zt.current,s=e.contextTypes,a=(s=s!=null)?ai(t,n):sa),e=new e(r,a),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=md,t.stateNode=e,e._reactInternals=t,s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=a),e}function ly(t,e,r,s){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,s),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,s),e.state!==t&&md.enqueueReplaceState(e,e.state,null)}function Ah(t,e,r,s){var n=t.stateNode;n.props=r,n.state=t.memoizedState,n.refs={},zm(t);var a=e.contextType;typeof a=="object"&&a!==null?n.context=Fr(a):(a=vr(e)?Ua:Zt.current,n.context=ai(t,a)),n.state=t.memoizedState,a=e.getDerivedStateFromProps,typeof a=="function"&&(Th(t,e,a,r),n.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(e=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),e!==n.state&&md.enqueueReplaceState(n,n.state,null),xu(t,r,n,s),n.state=t.memoizedState),typeof n.componentDidMount=="function"&&(t.flags|=4194308)}function ci(t,e){try{var r="",s=e;do r+=JC(s),s=s.return;while(s);var n=r}catch(a){n=`
|
|
39
39
|
Error generating stack: `+a.message+`
|
|
40
|
-
`+a.stack}return{value:t,source:e,stack:n,digest:null}}function _f(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Th(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var wk=typeof WeakMap=="function"?WeakMap:Map;function qw(t,e,r){r=Xn(-1,r),r.tag=3,r.payload={element:null};var s=e.value;return r.callback=function(){_u||(_u=!0,zh=s),Th(t,e)},r}function Hw(t,e,r){r=Xn(-1,r),r.tag=3;var s=t.type.getDerivedStateFromError;if(typeof s=="function"){var n=e.value;r.payload=function(){return s(n)},r.callback=function(){Th(t,e)}}var a=t.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(r.callback=function(){Th(t,e),typeof s!="function"&&(Zs===null?Zs=new Set([this]):Zs.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function iy(t,e,r){var s=t.pingCache;if(s===null){s=t.pingCache=new wk;var n=new Set;s.set(e,n)}else n=s.get(e),n===void 0&&(n=new Set,s.set(e,n));n.has(r)||(n.add(r),t=Ik.bind(null,t,e,r),e.then(t,t))}function ly(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function cy(t,e,r,s,n){return t.mode&1?(t.flags|=65536,t.lanes=n,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=Xn(-1,1),e.tag=2,Gs(r,e,1))),r.lanes|=1),t)}var bk=us.ReactCurrentOwner,pr=!1;function er(t,e,r,s){e.child=t===null?xw(e,null,r,s):ii(e,t.child,r,s)}function uy(t,e,r,s,n){r=r.render;var a=e.ref;return Fo(e,n),s=Hm(t,e,r,s,a,n),r=Bm(),t!==null&&!pr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n,as(t,e,n)):(ht&&r&&Am(e),e.flags|=1,er(t,e,s,n),e.child)}function dy(t,e,r,s,n){if(t===null){var a=r.type;return typeof a=="function"&&!tv(a)&&a.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=a,Bw(t,e,a,s,n)):(t=Hc(r.type,null,s,e,e.mode,n),t.ref=e.ref,t.return=e,e.child=t)}if(a=t.child,!(t.lanes&n)){var o=a.memoizedProps;if(r=r.compare,r=r!==null?r:vl,r(o,s)&&t.ref===e.ref)return as(t,e,n)}return e.flags|=1,t=Js(a,s),t.ref=e.ref,t.return=e,e.child=t}function Bw(t,e,r,s,n){if(t!==null){var a=t.memoizedProps;if(vl(a,s)&&t.ref===e.ref)if(pr=!1,e.pendingProps=s=a,(t.lanes&n)!==0)t.flags&131072&&(pr=!0);else return e.lanes=t.lanes,as(t,e,n)}return Ah(t,e,r,s,n)}function Kw(t,e,r){var s=e.pendingProps,n=s.children,a=t!==null?t.memoizedState:null;if(s.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},st(Ro,br),br|=r;else{if(!(r&1073741824))return t=a!==null?a.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,st(Ro,br),br|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=a!==null?a.baseLanes:r,st(Ro,br),br|=s}else a!==null?(s=a.baseLanes|r,e.memoizedState=null):s=r,st(Ro,br),br|=s;return er(t,e,n,r),e.child}function Ww(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function Ah(t,e,r,s,n){var a=vr(r)?Ua:Zt.current;return a=ai(e,a),Fo(e,n),r=Hm(t,e,r,s,a,n),s=Bm(),t!==null&&!pr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n,as(t,e,n)):(ht&&s&&Am(e),e.flags|=1,er(t,e,r,n),e.child)}function fy(t,e,r,s,n){if(vr(r)){var a=!0;hu(e)}else a=!1;if(Fo(e,n),e.stateNode===null)zc(t,e),Vw(e,r,s),Rh(e,r,s,n),s=!0;else if(t===null){var o=e.stateNode,i=e.memoizedProps;o.props=i;var c=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=Fr(u):(u=vr(r)?Ua:Zt.current,u=ai(e,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==s||c!==u)&&oy(e,o,s,u),_s=!1;var m=e.memoizedState;o.state=m,yu(e,s,o,n),c=e.memoizedState,i!==s||m!==c||mr.current||_s?(typeof d=="function"&&(jh(e,r,d,s),c=e.memoizedState),(i=_s||ay(e,r,i,s,m,c,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=s,e.memoizedState=c),o.props=s,o.state=c,o.context=u,s=i):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),s=!1)}else{o=e.stateNode,bw(t,e),i=e.memoizedProps,u=e.type===e.elementType?i:Zr(e.type,i),o.props=u,h=e.pendingProps,m=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=Fr(c):(c=vr(r)?Ua:Zt.current,c=ai(e,c));var f=r.getDerivedStateFromProps;(d=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==h||m!==c)&&oy(e,o,s,c),_s=!1,m=e.memoizedState,o.state=m,yu(e,s,o,n);var w=e.memoizedState;i!==h||m!==w||mr.current||_s?(typeof f=="function"&&(jh(e,r,f,s),w=e.memoizedState),(u=_s||ay(e,r,u,s,m,w,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,w,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,w,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||i===t.memoizedProps&&m===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===t.memoizedProps&&m===t.memoizedState||(e.flags|=1024),e.memoizedProps=s,e.memoizedState=w),o.props=s,o.state=w,o.context=c,s=u):(typeof o.componentDidUpdate!="function"||i===t.memoizedProps&&m===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===t.memoizedProps&&m===t.memoizedState||(e.flags|=1024),s=!1)}return Oh(t,e,r,s,a,n)}function Oh(t,e,r,s,n,a){Ww(t,e);var o=(e.flags&128)!==0;if(!s&&!o)return n&&Yg(e,r,!1),as(t,e,a);s=e.stateNode,bk.current=e;var i=o&&typeof r.getDerivedStateFromError!="function"?null:s.render();return e.flags|=1,t!==null&&o?(e.child=ii(e,t.child,null,a),e.child=ii(e,null,i,a)):er(t,e,i,a),e.memoizedState=s.state,n&&Yg(e,r,!0),e.child}function Qw(t){var e=t.stateNode;e.pendingContext?Zg(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Zg(t,e.context,!1),Um(t,e.containerInfo)}function hy(t,e,r,s,n){return oi(),Im(n),e.flags|=256,er(t,e,r,s),e.child}var Ih={dehydrated:null,treeContext:null,retryLane:0};function Dh(t){return{baseLanes:t,cachePool:null,transitions:null}}function Gw(t,e,r){var s=e.pendingProps,n=mt.current,a=!1,o=(e.flags&128)!==0,i;if((i=o)||(i=t!==null&&t.memoizedState===null?!1:(n&2)!==0),i?(a=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(n|=1),st(mt,n&1),t===null)return kh(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=s.children,t=s.fallback,a?(s=e.mode,a=e.child,o={mode:"hidden",children:o},!(s&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=gd(o,s,0,null),t=Fa(t,s,r,null),a.return=e,t.return=e,a.sibling=t,e.child=a,e.child.memoizedState=Dh(r),e.memoizedState=Ih,t):Qm(e,o));if(n=t.memoizedState,n!==null&&(i=n.dehydrated,i!==null))return Sk(t,e,o,s,i,n,r);if(a){a=s.fallback,o=e.mode,n=t.child,i=n.sibling;var c={mode:"hidden",children:s.children};return!(o&1)&&e.child!==n?(s=e.child,s.childLanes=0,s.pendingProps=c,e.deletions=null):(s=Js(n,c),s.subtreeFlags=n.subtreeFlags&14680064),i!==null?a=Js(i,a):(a=Fa(a,o,r,null),a.flags|=2),a.return=e,s.return=e,s.sibling=a,e.child=s,s=a,a=e.child,o=t.child.memoizedState,o=o===null?Dh(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=t.childLanes&~r,e.memoizedState=Ih,s}return a=t.child,t=a.sibling,s=Js(a,{mode:"visible",children:s.children}),!(e.mode&1)&&(s.lanes=r),s.return=e,s.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=s,e.memoizedState=null,s}function Qm(t,e){return e=gd({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function vc(t,e,r,s){return s!==null&&Im(s),ii(e,t.child,null,r),t=Qm(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Sk(t,e,r,s,n,a,o){if(r)return e.flags&256?(e.flags&=-257,s=_f(Error(Q(422))),vc(t,e,o,s)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(a=s.fallback,n=e.mode,s=gd({mode:"visible",children:s.children},n,0,null),a=Fa(a,n,o,null),a.flags|=2,s.return=e,a.return=e,s.sibling=a,e.child=s,e.mode&1&&ii(e,t.child,null,o),e.child.memoizedState=Dh(o),e.memoizedState=Ih,a);if(!(e.mode&1))return vc(t,e,o,null);if(n.data==="$!"){if(s=n.nextSibling&&n.nextSibling.dataset,s)var i=s.dgst;return s=i,a=Error(Q(419)),s=_f(a,s,void 0),vc(t,e,o,s)}if(i=(o&t.childLanes)!==0,pr||i){if(s=Lt,s!==null){switch(o&-o){case 4:n=2;break;case 16:n=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:n=32;break;case 536870912:n=268435456;break;default:n=0}n=n&(s.suspendedLanes|o)?0:n,n!==0&&n!==a.retryLane&&(a.retryLane=n,ss(t,n),nn(s,t,n,-1))}return ev(),s=_f(Error(Q(421))),vc(t,e,o,s)}return n.data==="$?"?(e.flags|=128,e.child=t.child,e=Dk.bind(null,t),n._reactRetry=e,null):(t=a.treeContext,_r=Qs(n.nextSibling),Er=e,ht=!0,tn=null,t!==null&&(Or[Ir++]=Zn,Or[Ir++]=Yn,Or[Ir++]=za,Zn=t.id,Yn=t.overflow,za=e),e=Qm(e,s.children),e.flags|=4096,e)}function py(t,e,r){t.lanes|=e;var s=t.alternate;s!==null&&(s.lanes|=e),Nh(t.return,e,r)}function Ef(t,e,r,s,n){var a=t.memoizedState;a===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:n}:(a.isBackwards=e,a.rendering=null,a.renderingStartTime=0,a.last=s,a.tail=r,a.tailMode=n)}function Zw(t,e,r){var s=e.pendingProps,n=s.revealOrder,a=s.tail;if(er(t,e,s.children,r),s=mt.current,s&2)s=s&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&py(t,r,e);else if(t.tag===19)py(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}s&=1}if(st(mt,s),!(e.mode&1))e.memoizedState=null;else switch(n){case"forwards":for(r=e.child,n=null;r!==null;)t=r.alternate,t!==null&&xu(t)===null&&(n=r),r=r.sibling;r=n,r===null?(n=e.child,e.child=null):(n=r.sibling,r.sibling=null),Ef(e,!1,n,r,a);break;case"backwards":for(r=null,n=e.child,e.child=null;n!==null;){if(t=n.alternate,t!==null&&xu(t)===null){e.child=n;break}t=n.sibling,n.sibling=r,r=n,n=t}Ef(e,!0,r,null,a);break;case"together":Ef(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function zc(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function as(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),qa|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Q(153));if(e.child!==null){for(t=e.child,r=Js(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=Js(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function _k(t,e,r){switch(e.tag){case 3:Qw(e),oi();break;case 5:Sw(e);break;case 1:vr(e.type)&&hu(e);break;case 4:Um(e,e.stateNode.containerInfo);break;case 10:var s=e.type._context,n=e.memoizedProps.value;st(vu,s._currentValue),s._currentValue=n;break;case 13:if(s=e.memoizedState,s!==null)return s.dehydrated!==null?(st(mt,mt.current&1),e.flags|=128,null):r&e.child.childLanes?Gw(t,e,r):(st(mt,mt.current&1),t=as(t,e,r),t!==null?t.sibling:null);st(mt,mt.current&1);break;case 19:if(s=(r&e.childLanes)!==0,t.flags&128){if(s)return Zw(t,e,r);e.flags|=128}if(n=e.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),st(mt,mt.current),s)break;return null;case 22:case 23:return e.lanes=0,Kw(t,e,r)}return as(t,e,r)}var Yw,Mh,Jw,Xw;Yw=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Mh=function(){};Jw=function(t,e,r,s){var n=t.memoizedProps;if(n!==s){t=e.stateNode,Na(Nn.current);var a=null;switch(r){case"input":n=sh(t,n),s=sh(t,s),a=[];break;case"select":n=gt({},n,{value:void 0}),s=gt({},s,{value:void 0}),a=[];break;case"textarea":n=ih(t,n),s=ih(t,s),a=[];break;default:typeof n.onClick!="function"&&typeof s.onClick=="function"&&(t.onclick=du)}ch(r,s);var o;r=null;for(u in n)if(!s.hasOwnProperty(u)&&n.hasOwnProperty(u)&&n[u]!=null)if(u==="style"){var i=n[u];for(o in i)i.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(cl.hasOwnProperty(u)?a||(a=[]):(a=a||[]).push(u,null));for(u in s){var c=s[u];if(i=n!=null?n[u]:void 0,s.hasOwnProperty(u)&&c!==i&&(c!=null||i!=null))if(u==="style")if(i){for(o in i)!i.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&i[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(a||(a=[]),a.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,i=i?i.__html:void 0,c!=null&&i!==c&&(a=a||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(cl.hasOwnProperty(u)?(c!=null&&u==="onScroll"&<("scroll",t),a||i===c||(a=[])):(a=a||[]).push(u,c))}r&&(a=a||[]).push("style",r);var u=a;(e.updateQueue=u)&&(e.flags|=4)}};Xw=function(t,e,r,s){r!==s&&(e.flags|=4)};function Mi(t,e){if(!ht)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:s.sibling=null}}function Qt(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,s=0;if(e)for(var n=t.child;n!==null;)r|=n.lanes|n.childLanes,s|=n.subtreeFlags&14680064,s|=n.flags&14680064,n.return=t,n=n.sibling;else for(n=t.child;n!==null;)r|=n.lanes|n.childLanes,s|=n.subtreeFlags,s|=n.flags,n.return=t,n=n.sibling;return t.subtreeFlags|=s,t.childLanes=r,e}function Ek(t,e,r){var s=e.pendingProps;switch(Om(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(e),null;case 1:return vr(e.type)&&fu(),Qt(e),null;case 3:return s=e.stateNode,li(),ct(mr),ct(Zt),Vm(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(pc(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,tn!==null&&(Hh(tn),tn=null))),Mh(t,e),Qt(e),null;case 5:zm(e);var n=Na(bl.current);if(r=e.type,t!==null&&e.stateNode!=null)Jw(t,e,r,s,n),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!s){if(e.stateNode===null)throw Error(Q(166));return Qt(e),null}if(t=Na(Nn.current),pc(e)){s=e.stateNode,r=e.type;var a=e.memoizedProps;switch(s[xn]=e,s[xl]=a,t=(e.mode&1)!==0,r){case"dialog":lt("cancel",s),lt("close",s);break;case"iframe":case"object":case"embed":lt("load",s);break;case"video":case"audio":for(n=0;n<Hi.length;n++)lt(Hi[n],s);break;case"source":lt("error",s);break;case"img":case"image":case"link":lt("error",s),lt("load",s);break;case"details":lt("toggle",s);break;case"input":_g(s,a),lt("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!a.multiple},lt("invalid",s);break;case"textarea":Cg(s,a),lt("invalid",s)}ch(r,a),n=null;for(var o in a)if(a.hasOwnProperty(o)){var i=a[o];o==="children"?typeof i=="string"?s.textContent!==i&&(a.suppressHydrationWarning!==!0&&hc(s.textContent,i,t),n=["children",i]):typeof i=="number"&&s.textContent!==""+i&&(a.suppressHydrationWarning!==!0&&hc(s.textContent,i,t),n=["children",""+i]):cl.hasOwnProperty(o)&&i!=null&&o==="onScroll"&<("scroll",s)}switch(r){case"input":ac(s),Eg(s,a,!0);break;case"textarea":ac(s),Pg(s);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(s.onclick=du)}s=n,e.updateQueue=s,s!==null&&(e.flags|=4)}else{o=n.nodeType===9?n:n.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=kx(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof s.is=="string"?t=o.createElement(r,{is:s.is}):(t=o.createElement(r),r==="select"&&(o=t,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):t=o.createElementNS(t,r),t[xn]=e,t[xl]=s,Yw(t,e,!1,!1),e.stateNode=t;e:{switch(o=uh(r,s),r){case"dialog":lt("cancel",t),lt("close",t),n=s;break;case"iframe":case"object":case"embed":lt("load",t),n=s;break;case"video":case"audio":for(n=0;n<Hi.length;n++)lt(Hi[n],t);n=s;break;case"source":lt("error",t),n=s;break;case"img":case"image":case"link":lt("error",t),lt("load",t),n=s;break;case"details":lt("toggle",t),n=s;break;case"input":_g(t,s),n=sh(t,s),lt("invalid",t);break;case"option":n=s;break;case"select":t._wrapperState={wasMultiple:!!s.multiple},n=gt({},s,{value:void 0}),lt("invalid",t);break;case"textarea":Cg(t,s),n=ih(t,s),lt("invalid",t);break;default:n=s}ch(r,n),i=n;for(a in i)if(i.hasOwnProperty(a)){var c=i[a];a==="style"?Rx(t,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Nx(t,c)):a==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&ul(t,c):typeof c=="number"&&ul(t,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(cl.hasOwnProperty(a)?c!=null&&a==="onScroll"&<("scroll",t):c!=null&&ym(t,a,c,o))}switch(r){case"input":ac(t),Eg(t,s,!1);break;case"textarea":ac(t),Pg(t);break;case"option":s.value!=null&&t.setAttribute("value",""+na(s.value));break;case"select":t.multiple=!!s.multiple,a=s.value,a!=null?Io(t,!!s.multiple,a,!1):s.defaultValue!=null&&Io(t,!!s.multiple,s.defaultValue,!0);break;default:typeof n.onClick=="function"&&(t.onclick=du)}switch(r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Qt(e),null;case 6:if(t&&e.stateNode!=null)Xw(t,e,t.memoizedProps,s);else{if(typeof s!="string"&&e.stateNode===null)throw Error(Q(166));if(r=Na(bl.current),Na(Nn.current),pc(e)){if(s=e.stateNode,r=e.memoizedProps,s[xn]=e,(a=s.nodeValue!==r)&&(t=Er,t!==null))switch(t.tag){case 3:hc(s.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&hc(s.nodeValue,r,(t.mode&1)!==0)}a&&(e.flags|=4)}else s=(r.nodeType===9?r:r.ownerDocument).createTextNode(s),s[xn]=e,e.stateNode=s}return Qt(e),null;case 13:if(ct(mt),s=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ht&&_r!==null&&e.mode&1&&!(e.flags&128))gw(),oi(),e.flags|=98560,a=!1;else if(a=pc(e),s!==null&&s.dehydrated!==null){if(t===null){if(!a)throw Error(Q(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(Q(317));a[xn]=e}else oi(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Qt(e),a=!1}else tn!==null&&(Hh(tn),tn=null),a=!0;if(!a)return e.flags&65536?e:null}return e.flags&128?(e.lanes=r,e):(s=s!==null,s!==(t!==null&&t.memoizedState!==null)&&s&&(e.child.flags|=8192,e.mode&1&&(t===null||mt.current&1?Ot===0&&(Ot=3):ev())),e.updateQueue!==null&&(e.flags|=4),Qt(e),null);case 4:return li(),Mh(t,e),t===null&&gl(e.stateNode.containerInfo),Qt(e),null;case 10:return $m(e.type._context),Qt(e),null;case 17:return vr(e.type)&&fu(),Qt(e),null;case 19:if(ct(mt),a=e.memoizedState,a===null)return Qt(e),null;if(s=(e.flags&128)!==0,o=a.rendering,o===null)if(s)Mi(a,!1);else{if(Ot!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=xu(t),o!==null){for(e.flags|=128,Mi(a,!1),s=o.updateQueue,s!==null&&(e.updateQueue=s,e.flags|=4),e.subtreeFlags=0,s=r,r=e.child;r!==null;)a=r,t=s,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=t,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,t=o.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return st(mt,mt.current&1|2),e.child}t=t.sibling}a.tail!==null&&_t()>ui&&(e.flags|=128,s=!0,Mi(a,!1),e.lanes=4194304)}else{if(!s)if(t=xu(o),t!==null){if(e.flags|=128,s=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Mi(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!ht)return Qt(e),null}else 2*_t()-a.renderingStartTime>ui&&r!==1073741824&&(e.flags|=128,s=!0,Mi(a,!1),e.lanes=4194304);a.isBackwards?(o.sibling=e.child,e.child=o):(r=a.last,r!==null?r.sibling=o:e.child=o,a.last=o)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=_t(),e.sibling=null,r=mt.current,st(mt,s?r&1|2:r&1),e):(Qt(e),null);case 22:case 23:return Xm(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?br&1073741824&&(Qt(e),e.subtreeFlags&6&&(e.flags|=8192)):Qt(e),null;case 24:return null;case 25:return null}throw Error(Q(156,e.tag))}function Ck(t,e){switch(Om(e),e.tag){case 1:return vr(e.type)&&fu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return li(),ct(mr),ct(Zt),Vm(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return zm(e),null;case 13:if(ct(mt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Q(340));oi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ct(mt),null;case 4:return li(),null;case 10:return $m(e.type._context),null;case 22:case 23:return Xm(),null;case 24:return null;default:return null}}var gc=!1,Gt=!1,Pk=typeof WeakSet=="function"?WeakSet:Set,ue=null;function jo(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){xt(t,e,s)}else r.current=null}function $h(t,e,r){try{r()}catch(s){xt(t,e,s)}}var my=!1;function kk(t,e){if(wh=lu,t=sw(),Tm(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var n=s.anchorOffset,a=s.focusNode;s=s.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var o=0,i=-1,c=-1,u=0,d=0,h=t,m=null;t:for(;;){for(var f;h!==r||n!==0&&h.nodeType!==3||(i=o+n),h!==a||s!==0&&h.nodeType!==3||(c=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)m=h,h=f;for(;;){if(h===t)break t;if(m===r&&++u===n&&(i=o),m===a&&++d===s&&(c=o),(f=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=f}r=i===-1||c===-1?null:{start:i,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(bh={focusedElem:t,selectionRange:r},lu=!1,ue=e;ue!==null;)if(e=ue,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ue=t;else for(;ue!==null;){e=ue;try{var w=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var p=w.memoizedProps,v=w.memoizedState,y=e.stateNode,g=y.getSnapshotBeforeUpdate(e.elementType===e.type?p:Zr(e.type,p),v);y.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(S){xt(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,ue=t;break}ue=e.return}return w=my,my=!1,w}function nl(t,e,r){var s=e.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var n=s=s.next;do{if((n.tag&t)===t){var a=n.destroy;n.destroy=void 0,a!==void 0&&$h(e,r,a)}n=n.next}while(n!==s)}}function md(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var s=r.create;r.destroy=s()}r=r.next}while(r!==e)}}function Fh(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function eb(t){var e=t.alternate;e!==null&&(t.alternate=null,eb(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[xn],delete e[xl],delete e[Eh],delete e[ck],delete e[uk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function tb(t){return t.tag===5||t.tag===3||t.tag===4}function vy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||tb(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Lh(t,e,r){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=du));else if(s!==4&&(t=t.child,t!==null))for(Lh(t,e,r),t=t.sibling;t!==null;)Lh(t,e,r),t=t.sibling}function Uh(t,e,r){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(s!==4&&(t=t.child,t!==null))for(Uh(t,e,r),t=t.sibling;t!==null;)Uh(t,e,r),t=t.sibling}var Vt=null,en=!1;function gs(t,e,r){for(r=r.child;r!==null;)rb(t,e,r),r=r.sibling}function rb(t,e,r){if(kn&&typeof kn.onCommitFiberUnmount=="function")try{kn.onCommitFiberUnmount(id,r)}catch{}switch(r.tag){case 5:Gt||jo(r,e);case 6:var s=Vt,n=en;Vt=null,gs(t,e,r),Vt=s,en=n,Vt!==null&&(en?(t=Vt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Vt.removeChild(r.stateNode));break;case 18:Vt!==null&&(en?(t=Vt,r=r.stateNode,t.nodeType===8?gf(t.parentNode,r):t.nodeType===1&&gf(t,r),pl(t)):gf(Vt,r.stateNode));break;case 4:s=Vt,n=en,Vt=r.stateNode.containerInfo,en=!0,gs(t,e,r),Vt=s,en=n;break;case 0:case 11:case 14:case 15:if(!Gt&&(s=r.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){n=s=s.next;do{var a=n,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&$h(r,e,o),n=n.next}while(n!==s)}gs(t,e,r);break;case 1:if(!Gt&&(jo(r,e),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(i){xt(r,e,i)}gs(t,e,r);break;case 21:gs(t,e,r);break;case 22:r.mode&1?(Gt=(s=Gt)||r.memoizedState!==null,gs(t,e,r),Gt=s):gs(t,e,r);break;default:gs(t,e,r)}}function gy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new Pk),e.forEach(function(s){var n=Mk.bind(null,t,s);r.has(s)||(r.add(s),s.then(n,n))})}}function Kr(t,e){var r=e.deletions;if(r!==null)for(var s=0;s<r.length;s++){var n=r[s];try{var a=t,o=e,i=o;e:for(;i!==null;){switch(i.tag){case 5:Vt=i.stateNode,en=!1;break e;case 3:Vt=i.stateNode.containerInfo,en=!0;break e;case 4:Vt=i.stateNode.containerInfo,en=!0;break e}i=i.return}if(Vt===null)throw Error(Q(160));rb(a,o,n),Vt=null,en=!1;var c=n.alternate;c!==null&&(c.return=null),n.return=null}catch(u){xt(n,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)nb(e,t),e=e.sibling}function nb(t,e){var r=t.alternate,s=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Kr(e,t),fn(t),s&4){try{nl(3,t,t.return),md(3,t)}catch(p){xt(t,t.return,p)}try{nl(5,t,t.return)}catch(p){xt(t,t.return,p)}}break;case 1:Kr(e,t),fn(t),s&512&&r!==null&&jo(r,r.return);break;case 5:if(Kr(e,t),fn(t),s&512&&r!==null&&jo(r,r.return),t.flags&32){var n=t.stateNode;try{ul(n,"")}catch(p){xt(t,t.return,p)}}if(s&4&&(n=t.stateNode,n!=null)){var a=t.memoizedProps,o=r!==null?r.memoizedProps:a,i=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{i==="input"&&a.type==="radio"&&a.name!=null&&Cx(n,a),uh(i,o);var u=uh(i,a);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?Rx(n,h):d==="dangerouslySetInnerHTML"?Nx(n,h):d==="children"?ul(n,h):ym(n,d,h,u)}switch(i){case"input":ah(n,a);break;case"textarea":Px(n,a);break;case"select":var m=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!a.multiple;var f=a.value;f!=null?Io(n,!!a.multiple,f,!1):m!==!!a.multiple&&(a.defaultValue!=null?Io(n,!!a.multiple,a.defaultValue,!0):Io(n,!!a.multiple,a.multiple?[]:"",!1))}n[xl]=a}catch(p){xt(t,t.return,p)}}break;case 6:if(Kr(e,t),fn(t),s&4){if(t.stateNode===null)throw Error(Q(162));n=t.stateNode,a=t.memoizedProps;try{n.nodeValue=a}catch(p){xt(t,t.return,p)}}break;case 3:if(Kr(e,t),fn(t),s&4&&r!==null&&r.memoizedState.isDehydrated)try{pl(e.containerInfo)}catch(p){xt(t,t.return,p)}break;case 4:Kr(e,t),fn(t);break;case 13:Kr(e,t),fn(t),n=t.child,n.flags&8192&&(a=n.memoizedState!==null,n.stateNode.isHidden=a,!a||n.alternate!==null&&n.alternate.memoizedState!==null||(Ym=_t())),s&4&&gy(t);break;case 22:if(d=r!==null&&r.memoizedState!==null,t.mode&1?(Gt=(u=Gt)||d,Kr(e,t),Gt=u):Kr(e,t),fn(t),s&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(ue=t,d=t.child;d!==null;){for(h=ue=d;ue!==null;){switch(m=ue,f=m.child,m.tag){case 0:case 11:case 14:case 15:nl(4,m,m.return);break;case 1:jo(m,m.return);var w=m.stateNode;if(typeof w.componentWillUnmount=="function"){s=m,r=m.return;try{e=s,w.props=e.memoizedProps,w.state=e.memoizedState,w.componentWillUnmount()}catch(p){xt(s,r,p)}}break;case 5:jo(m,m.return);break;case 22:if(m.memoizedState!==null){xy(h);continue}}f!==null?(f.return=m,ue=f):xy(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{n=h.stateNode,u?(a=n.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(i=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,i.style.display=jx("display",o))}catch(p){xt(t,t.return,p)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(p){xt(t,t.return,p)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Kr(e,t),fn(t),s&4&&gy(t);break;case 21:break;default:Kr(e,t),fn(t)}}function fn(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(tb(r)){var s=r;break e}r=r.return}throw Error(Q(160))}switch(s.tag){case 5:var n=s.stateNode;s.flags&32&&(ul(n,""),s.flags&=-33);var a=vy(t);Uh(t,a,n);break;case 3:case 4:var o=s.stateNode.containerInfo,i=vy(t);Lh(t,i,o);break;default:throw Error(Q(161))}}catch(c){xt(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Nk(t,e,r){ue=t,sb(t)}function sb(t,e,r){for(var s=(t.mode&1)!==0;ue!==null;){var n=ue,a=n.child;if(n.tag===22&&s){var o=n.memoizedState!==null||gc;if(!o){var i=n.alternate,c=i!==null&&i.memoizedState!==null||Gt;i=gc;var u=Gt;if(gc=o,(Gt=c)&&!u)for(ue=n;ue!==null;)o=ue,c=o.child,o.tag===22&&o.memoizedState!==null?wy(n):c!==null?(c.return=o,ue=c):wy(n);for(;a!==null;)ue=a,sb(a),a=a.sibling;ue=n,gc=i,Gt=u}yy(t)}else n.subtreeFlags&8772&&a!==null?(a.return=n,ue=a):yy(t)}}function yy(t){for(;ue!==null;){var e=ue;if(e.flags&8772){var r=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Gt||md(5,e);break;case 1:var s=e.stateNode;if(e.flags&4&&!Gt)if(r===null)s.componentDidMount();else{var n=e.elementType===e.type?r.memoizedProps:Zr(e.type,r.memoizedProps);s.componentDidUpdate(n,r.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var a=e.updateQueue;a!==null&&ry(e,a,s);break;case 3:var o=e.updateQueue;if(o!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}ry(e,o,r)}break;case 5:var i=e.stateNode;if(r===null&&e.flags&4){r=i;var c=e.memoizedProps;switch(e.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(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&pl(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}Gt||e.flags&512&&Fh(e)}catch(m){xt(e,e.return,m)}}if(e===t){ue=null;break}if(r=e.sibling,r!==null){r.return=e.return,ue=r;break}ue=e.return}}function xy(t){for(;ue!==null;){var e=ue;if(e===t){ue=null;break}var r=e.sibling;if(r!==null){r.return=e.return,ue=r;break}ue=e.return}}function wy(t){for(;ue!==null;){var e=ue;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{md(4,e)}catch(c){xt(e,r,c)}break;case 1:var s=e.stateNode;if(typeof s.componentDidMount=="function"){var n=e.return;try{s.componentDidMount()}catch(c){xt(e,n,c)}}var a=e.return;try{Fh(e)}catch(c){xt(e,a,c)}break;case 5:var o=e.return;try{Fh(e)}catch(c){xt(e,o,c)}}}catch(c){xt(e,e.return,c)}if(e===t){ue=null;break}var i=e.sibling;if(i!==null){i.return=e.return,ue=i;break}ue=e.return}}var jk=Math.ceil,Su=us.ReactCurrentDispatcher,Gm=us.ReactCurrentOwner,$r=us.ReactCurrentBatchConfig,Ze=0,Lt=null,kt=null,qt=0,br=0,Ro=ca(0),Ot=0,Cl=null,qa=0,vd=0,Zm=0,sl=null,fr=null,Ym=0,ui=1/0,Hn=null,_u=!1,zh=null,Zs=null,yc=!1,Us=null,Eu=0,al=0,Vh=null,Vc=-1,qc=0;function rr(){return Ze&6?_t():Vc!==-1?Vc:Vc=_t()}function Ys(t){return t.mode&1?Ze&2&&qt!==0?qt&-qt:fk.transition!==null?(qc===0&&(qc=Vx()),qc):(t=Xe,t!==0||(t=window.event,t=t===void 0?16:Gx(t.type)),t):1}function nn(t,e,r,s){if(50<al)throw al=0,Vh=null,Error(Q(185));Ml(t,r,s),(!(Ze&2)||t!==Lt)&&(t===Lt&&(!(Ze&2)&&(vd|=r),Ot===4&&Ns(t,qt)),gr(t,s),r===1&&Ze===0&&!(e.mode&1)&&(ui=_t()+500,fd&&ua()))}function gr(t,e){var r=t.callbackNode;fP(t,e);var s=iu(t,t===Lt?qt:0);if(s===0)r!==null&&jg(r),t.callbackNode=null,t.callbackPriority=0;else if(e=s&-s,t.callbackPriority!==e){if(r!=null&&jg(r),e===1)t.tag===0?dk(by.bind(null,t)):pw(by.bind(null,t)),ik(function(){!(Ze&6)&&ua()}),r=null;else{switch(qx(s)){case 1:r=_m;break;case 4:r=Ux;break;case 16:r=ou;break;case 536870912:r=zx;break;default:r=ou}r=fb(r,ab.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function ab(t,e){if(Vc=-1,qc=0,Ze&6)throw Error(Q(327));var r=t.callbackNode;if(Lo()&&t.callbackNode!==r)return null;var s=iu(t,t===Lt?qt:0);if(s===0)return null;if(s&30||s&t.expiredLanes||e)e=Cu(t,s);else{e=s;var n=Ze;Ze|=2;var a=ib();(Lt!==t||qt!==e)&&(Hn=null,ui=_t()+500,$a(t,e));do try{Ak();break}catch(i){ob(t,i)}while(!0);Mm(),Su.current=a,Ze=n,kt!==null?e=0:(Lt=null,qt=0,e=Ot)}if(e!==0){if(e===2&&(n=mh(t),n!==0&&(s=n,e=qh(t,n))),e===1)throw r=Cl,$a(t,0),Ns(t,s),gr(t,_t()),r;if(e===6)Ns(t,s);else{if(n=t.current.alternate,!(s&30)&&!Rk(n)&&(e=Cu(t,s),e===2&&(a=mh(t),a!==0&&(s=a,e=qh(t,a))),e===1))throw r=Cl,$a(t,0),Ns(t,s),gr(t,_t()),r;switch(t.finishedWork=n,t.finishedLanes=s,e){case 0:case 1:throw Error(Q(345));case 2:Sa(t,fr,Hn);break;case 3:if(Ns(t,s),(s&130023424)===s&&(e=Ym+500-_t(),10<e)){if(iu(t,0)!==0)break;if(n=t.suspendedLanes,(n&s)!==s){rr(),t.pingedLanes|=t.suspendedLanes&n;break}t.timeoutHandle=_h(Sa.bind(null,t,fr,Hn),e);break}Sa(t,fr,Hn);break;case 4:if(Ns(t,s),(s&4194240)===s)break;for(e=t.eventTimes,n=-1;0<s;){var o=31-rn(s);a=1<<o,o=e[o],o>n&&(n=o),s&=~a}if(s=n,s=_t()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*jk(s/1960))-s,10<s){t.timeoutHandle=_h(Sa.bind(null,t,fr,Hn),s);break}Sa(t,fr,Hn);break;case 5:Sa(t,fr,Hn);break;default:throw Error(Q(329))}}}return gr(t,_t()),t.callbackNode===r?ab.bind(null,t):null}function qh(t,e){var r=sl;return t.current.memoizedState.isDehydrated&&($a(t,e).flags|=256),t=Cu(t,e),t!==2&&(e=fr,fr=r,e!==null&&Hh(e)),t}function Hh(t){fr===null?fr=t:fr.push.apply(fr,t)}function Rk(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var s=0;s<r.length;s++){var n=r[s],a=n.getSnapshot;n=n.value;try{if(!sn(a(),n))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Ns(t,e){for(e&=~Zm,e&=~vd,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-rn(e),s=1<<r;t[r]=-1,e&=~s}}function by(t){if(Ze&6)throw Error(Q(327));Lo();var e=iu(t,0);if(!(e&1))return gr(t,_t()),null;var r=Cu(t,e);if(t.tag!==0&&r===2){var s=mh(t);s!==0&&(e=s,r=qh(t,s))}if(r===1)throw r=Cl,$a(t,0),Ns(t,e),gr(t,_t()),r;if(r===6)throw Error(Q(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Sa(t,fr,Hn),gr(t,_t()),null}function Jm(t,e){var r=Ze;Ze|=1;try{return t(e)}finally{Ze=r,Ze===0&&(ui=_t()+500,fd&&ua())}}function Ha(t){Us!==null&&Us.tag===0&&!(Ze&6)&&Lo();var e=Ze;Ze|=1;var r=$r.transition,s=Xe;try{if($r.transition=null,Xe=1,t)return t()}finally{Xe=s,$r.transition=r,Ze=e,!(Ze&6)&&ua()}}function Xm(){br=Ro.current,ct(Ro)}function $a(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,ok(r)),kt!==null)for(r=kt.return;r!==null;){var s=r;switch(Om(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&fu();break;case 3:li(),ct(mr),ct(Zt),Vm();break;case 5:zm(s);break;case 4:li();break;case 13:ct(mt);break;case 19:ct(mt);break;case 10:$m(s.type._context);break;case 22:case 23:Xm()}r=r.return}if(Lt=t,kt=t=Js(t.current,null),qt=br=e,Ot=0,Cl=null,Zm=vd=qa=0,fr=sl=null,ka!==null){for(e=0;e<ka.length;e++)if(r=ka[e],s=r.interleaved,s!==null){r.interleaved=null;var n=s.next,a=r.pending;if(a!==null){var o=a.next;a.next=n,s.next=o}r.pending=s}ka=null}return t}function ob(t,e){do{var r=kt;try{if(Mm(),Lc.current=bu,wu){for(var s=vt.memoizedState;s!==null;){var n=s.queue;n!==null&&(n.pending=null),s=s.next}wu=!1}if(Va=0,$t=Rt=vt=null,rl=!1,Sl=0,Gm.current=null,r===null||r.return===null){Ot=1,Cl=e,kt=null;break}e:{var a=t,o=r.return,i=r,c=e;if(e=qt,i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=i,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var m=d.alternate;m?(d.updateQueue=m.updateQueue,d.memoizedState=m.memoizedState,d.lanes=m.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=ly(o);if(f!==null){f.flags&=-257,cy(f,o,i,a,e),f.mode&1&&iy(a,u,e),e=f,c=u;var w=e.updateQueue;if(w===null){var p=new Set;p.add(c),e.updateQueue=p}else w.add(c);break e}else{if(!(e&1)){iy(a,u,e),ev();break e}c=Error(Q(426))}}else if(ht&&i.mode&1){var v=ly(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),cy(v,o,i,a,e),Im(ci(c,i));break e}}a=c=ci(c,i),Ot!==4&&(Ot=2),sl===null?sl=[a]:sl.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,e&=-e,a.lanes|=e;var y=qw(a,c,e);ty(a,y);break e;case 1:i=c;var g=a.type,b=a.stateNode;if(!(a.flags&128)&&(typeof g.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Zs===null||!Zs.has(b)))){a.flags|=65536,e&=-e,a.lanes|=e;var S=Hw(a,i,e);ty(a,S);break e}}a=a.return}while(a!==null)}cb(r)}catch(E){e=E,kt===r&&r!==null&&(kt=r=r.return);continue}break}while(!0)}function ib(){var t=Su.current;return Su.current=bu,t===null?bu:t}function ev(){(Ot===0||Ot===3||Ot===2)&&(Ot=4),Lt===null||!(qa&268435455)&&!(vd&268435455)||Ns(Lt,qt)}function Cu(t,e){var r=Ze;Ze|=2;var s=ib();(Lt!==t||qt!==e)&&(Hn=null,$a(t,e));do try{Tk();break}catch(n){ob(t,n)}while(!0);if(Mm(),Ze=r,Su.current=s,kt!==null)throw Error(Q(261));return Lt=null,qt=0,Ot}function Tk(){for(;kt!==null;)lb(kt)}function Ak(){for(;kt!==null&&!nP();)lb(kt)}function lb(t){var e=db(t.alternate,t,br);t.memoizedProps=t.pendingProps,e===null?cb(t):kt=e,Gm.current=null}function cb(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=Ck(r,e),r!==null){r.flags&=32767,kt=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ot=6,kt=null;return}}else if(r=Ek(r,e,br),r!==null){kt=r;return}if(e=e.sibling,e!==null){kt=e;return}kt=e=t}while(e!==null);Ot===0&&(Ot=5)}function Sa(t,e,r){var s=Xe,n=$r.transition;try{$r.transition=null,Xe=1,Ok(t,e,r,s)}finally{$r.transition=n,Xe=s}return null}function Ok(t,e,r,s){do Lo();while(Us!==null);if(Ze&6)throw Error(Q(327));r=t.finishedWork;var n=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(Q(177));t.callbackNode=null,t.callbackPriority=0;var a=r.lanes|r.childLanes;if(hP(t,a),t===Lt&&(kt=Lt=null,qt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||yc||(yc=!0,fb(ou,function(){return Lo(),null})),a=(r.flags&15990)!==0,r.subtreeFlags&15990||a){a=$r.transition,$r.transition=null;var o=Xe;Xe=1;var i=Ze;Ze|=4,Gm.current=null,kk(t,r),nb(r,t),XP(bh),lu=!!wh,bh=wh=null,t.current=r,Nk(r),sP(),Ze=i,Xe=o,$r.transition=a}else t.current=r;if(yc&&(yc=!1,Us=t,Eu=n),a=t.pendingLanes,a===0&&(Zs=null),iP(r.stateNode),gr(t,_t()),e!==null)for(s=t.onRecoverableError,r=0;r<e.length;r++)n=e[r],s(n.value,{componentStack:n.stack,digest:n.digest});if(_u)throw _u=!1,t=zh,zh=null,t;return Eu&1&&t.tag!==0&&Lo(),a=t.pendingLanes,a&1?t===Vh?al++:(al=0,Vh=t):al=0,ua(),null}function Lo(){if(Us!==null){var t=qx(Eu),e=$r.transition,r=Xe;try{if($r.transition=null,Xe=16>t?16:t,Us===null)var s=!1;else{if(t=Us,Us=null,Eu=0,Ze&6)throw Error(Q(331));var n=Ze;for(Ze|=4,ue=t.current;ue!==null;){var a=ue,o=a.child;if(ue.flags&16){var i=a.deletions;if(i!==null){for(var c=0;c<i.length;c++){var u=i[c];for(ue=u;ue!==null;){var d=ue;switch(d.tag){case 0:case 11:case 15:nl(8,d,a)}var h=d.child;if(h!==null)h.return=d,ue=h;else for(;ue!==null;){d=ue;var m=d.sibling,f=d.return;if(eb(d),d===u){ue=null;break}if(m!==null){m.return=f,ue=m;break}ue=f}}}var w=a.alternate;if(w!==null){var p=w.child;if(p!==null){w.child=null;do{var v=p.sibling;p.sibling=null,p=v}while(p!==null)}}ue=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,ue=o;else e:for(;ue!==null;){if(a=ue,a.flags&2048)switch(a.tag){case 0:case 11:case 15:nl(9,a,a.return)}var y=a.sibling;if(y!==null){y.return=a.return,ue=y;break e}ue=a.return}}var g=t.current;for(ue=g;ue!==null;){o=ue;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,ue=b;else e:for(o=g;ue!==null;){if(i=ue,i.flags&2048)try{switch(i.tag){case 0:case 11:case 15:md(9,i)}}catch(E){xt(i,i.return,E)}if(i===o){ue=null;break e}var S=i.sibling;if(S!==null){S.return=i.return,ue=S;break e}ue=i.return}}if(Ze=n,ua(),kn&&typeof kn.onPostCommitFiberRoot=="function")try{kn.onPostCommitFiberRoot(id,t)}catch{}s=!0}return s}finally{Xe=r,$r.transition=e}}return!1}function Sy(t,e,r){e=ci(r,e),e=qw(t,e,1),t=Gs(t,e,1),e=rr(),t!==null&&(Ml(t,1,e),gr(t,e))}function xt(t,e,r){if(t.tag===3)Sy(t,t,r);else for(;e!==null;){if(e.tag===3){Sy(e,t,r);break}else if(e.tag===1){var s=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Zs===null||!Zs.has(s))){t=ci(r,t),t=Hw(e,t,1),e=Gs(e,t,1),t=rr(),e!==null&&(Ml(e,1,t),gr(e,t));break}}e=e.return}}function Ik(t,e,r){var s=t.pingCache;s!==null&&s.delete(e),e=rr(),t.pingedLanes|=t.suspendedLanes&r,Lt===t&&(qt&r)===r&&(Ot===4||Ot===3&&(qt&130023424)===qt&&500>_t()-Ym?$a(t,0):Zm|=r),gr(t,e)}function ub(t,e){e===0&&(t.mode&1?(e=lc,lc<<=1,!(lc&130023424)&&(lc=4194304)):e=1);var r=rr();t=ss(t,e),t!==null&&(Ml(t,e,r),gr(t,r))}function Dk(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),ub(t,r)}function Mk(t,e){var r=0;switch(t.tag){case 13:var s=t.stateNode,n=t.memoizedState;n!==null&&(r=n.retryLane);break;case 19:s=t.stateNode;break;default:throw Error(Q(314))}s!==null&&s.delete(e),ub(t,r)}var db;db=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||mr.current)pr=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return pr=!1,_k(t,e,r);pr=!!(t.flags&131072)}else pr=!1,ht&&e.flags&1048576&&mw(e,mu,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;zc(t,e),t=e.pendingProps;var n=ai(e,Zt.current);Fo(e,r),n=Hm(null,e,s,t,n,r);var a=Bm();return e.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,vr(s)?(a=!0,hu(e)):a=!1,e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,Lm(e),n.updater=pd,e.stateNode=n,n._reactInternals=e,Rh(e,s,t,r),e=Oh(null,e,s,!0,a,r)):(e.tag=0,ht&&a&&Am(e),er(null,e,n,r),e=e.child),e;case 16:s=e.elementType;e:{switch(zc(t,e),t=e.pendingProps,n=s._init,s=n(s._payload),e.type=s,n=e.tag=Fk(s),t=Zr(s,t),n){case 0:e=Ah(null,e,s,t,r);break e;case 1:e=fy(null,e,s,t,r);break e;case 11:e=uy(null,e,s,t,r);break e;case 14:e=dy(null,e,s,Zr(s.type,t),r);break e}throw Error(Q(306,s,""))}return e;case 0:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),Ah(t,e,s,n,r);case 1:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),fy(t,e,s,n,r);case 3:e:{if(Qw(e),t===null)throw Error(Q(387));s=e.pendingProps,a=e.memoizedState,n=a.element,bw(t,e),yu(e,s,null,r);var o=e.memoizedState;if(s=o.element,a.isDehydrated)if(a={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=a,e.memoizedState=a,e.flags&256){n=ci(Error(Q(423)),e),e=hy(t,e,s,r,n);break e}else if(s!==n){n=ci(Error(Q(424)),e),e=hy(t,e,s,r,n);break e}else for(_r=Qs(e.stateNode.containerInfo.firstChild),Er=e,ht=!0,tn=null,r=xw(e,null,s,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(oi(),s===n){e=as(t,e,r);break e}er(t,e,s,r)}e=e.child}return e;case 5:return Sw(e),t===null&&kh(e),s=e.type,n=e.pendingProps,a=t!==null?t.memoizedProps:null,o=n.children,Sh(s,n)?o=null:a!==null&&Sh(s,a)&&(e.flags|=32),Ww(t,e),er(t,e,o,r),e.child;case 6:return t===null&&kh(e),null;case 13:return Gw(t,e,r);case 4:return Um(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=ii(e,null,s,r):er(t,e,s,r),e.child;case 11:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),uy(t,e,s,n,r);case 7:return er(t,e,e.pendingProps,r),e.child;case 8:return er(t,e,e.pendingProps.children,r),e.child;case 12:return er(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(s=e.type._context,n=e.pendingProps,a=e.memoizedProps,o=n.value,st(vu,s._currentValue),s._currentValue=o,a!==null)if(sn(a.value,o)){if(a.children===n.children&&!mr.current){e=as(t,e,r);break e}}else for(a=e.child,a!==null&&(a.return=e);a!==null;){var i=a.dependencies;if(i!==null){o=a.child;for(var c=i.firstContext;c!==null;){if(c.context===s){if(a.tag===1){c=Xn(-1,r&-r),c.tag=2;var u=a.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}}a.lanes|=r,c=a.alternate,c!==null&&(c.lanes|=r),Nh(a.return,r,e),i.lanes|=r;break}c=c.next}}else if(a.tag===10)o=a.type===e.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(Q(341));o.lanes|=r,i=o.alternate,i!==null&&(i.lanes|=r),Nh(o,r,e),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===e){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}er(t,e,n.children,r),e=e.child}return e;case 9:return n=e.type,s=e.pendingProps.children,Fo(e,r),n=Fr(n),s=s(n),e.flags|=1,er(t,e,s,r),e.child;case 14:return s=e.type,n=Zr(s,e.pendingProps),n=Zr(s.type,n),dy(t,e,s,n,r);case 15:return Bw(t,e,e.type,e.pendingProps,r);case 17:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),zc(t,e),e.tag=1,vr(s)?(t=!0,hu(e)):t=!1,Fo(e,r),Vw(e,s,n),Rh(e,s,n,r),Oh(null,e,s,!0,t,r);case 19:return Zw(t,e,r);case 22:return Kw(t,e,r)}throw Error(Q(156,e.tag))};function fb(t,e){return Lx(t,e)}function $k(t,e,r,s){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mr(t,e,r,s){return new $k(t,e,r,s)}function tv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Fk(t){if(typeof t=="function")return tv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===wm)return 11;if(t===bm)return 14}return 2}function Js(t,e){var r=t.alternate;return r===null?(r=Mr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Hc(t,e,r,s,n,a){var o=2;if(s=t,typeof t=="function")tv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case wo:return Fa(r.children,n,a,e);case xm:o=8,n|=8;break;case eh:return t=Mr(12,r,e,n|2),t.elementType=eh,t.lanes=a,t;case th:return t=Mr(13,r,e,n),t.elementType=th,t.lanes=a,t;case rh:return t=Mr(19,r,e,n),t.elementType=rh,t.lanes=a,t;case Sx:return gd(r,n,a,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case wx:o=10;break e;case bx:o=9;break e;case wm:o=11;break e;case bm:o=14;break e;case Ss:o=16,s=null;break e}throw Error(Q(130,t==null?t:typeof t,""))}return e=Mr(o,r,e,n),e.elementType=t,e.type=s,e.lanes=a,e}function Fa(t,e,r,s){return t=Mr(7,t,s,e),t.lanes=r,t}function gd(t,e,r,s){return t=Mr(22,t,s,e),t.elementType=Sx,t.lanes=r,t.stateNode={isHidden:!1},t}function Cf(t,e,r){return t=Mr(6,t,null,e),t.lanes=r,t}function Pf(t,e,r){return e=Mr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Lk(t,e,r,s,n){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=af(0),this.expirationTimes=af(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=af(0),this.identifierPrefix=s,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function rv(t,e,r,s,n,a,o,i,c){return t=new Lk(t,e,r,i,c),e===1?(e=1,a===!0&&(e|=8)):e=0,a=Mr(3,null,null,e),t.current=a,a.stateNode=t,a.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lm(a),t}function Uk(t,e,r){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:xo,key:s==null?null:""+s,children:t,containerInfo:e,implementation:r}}function hb(t){if(!t)return sa;t=t._reactInternals;e:{if(no(t)!==t||t.tag!==1)throw Error(Q(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(vr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Q(171))}if(t.tag===1){var r=t.type;if(vr(r))return hw(t,r,e)}return e}function pb(t,e,r,s,n,a,o,i,c){return t=rv(r,s,!0,t,n,a,o,i,c),t.context=hb(null),r=t.current,s=rr(),n=Ys(r),a=Xn(s,n),a.callback=e??null,Gs(r,a,n),t.current.lanes=n,Ml(t,n,s),gr(t,s),t}function yd(t,e,r,s){var n=e.current,a=rr(),o=Ys(n);return r=hb(r),e.context===null?e.context=r:e.pendingContext=r,e=Xn(a,o),e.payload={element:t},s=s===void 0?null:s,s!==null&&(e.callback=s),t=Gs(n,e,o),t!==null&&(nn(t,n,o,a),Fc(t,n,o)),o}function Pu(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function _y(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function nv(t,e){_y(t,e),(t=t.alternate)&&_y(t,e)}function zk(){return null}var mb=typeof reportError=="function"?reportError:function(t){console.error(t)};function sv(t){this._internalRoot=t}xd.prototype.render=sv.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Q(409));yd(t,e,null,null)};xd.prototype.unmount=sv.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Ha(function(){yd(null,t,null,null)}),e[ns]=null}};function xd(t){this._internalRoot=t}xd.prototype.unstable_scheduleHydration=function(t){if(t){var e=Kx();t={blockedOn:null,target:t,priority:e};for(var r=0;r<ks.length&&e!==0&&e<ks[r].priority;r++);ks.splice(r,0,t),r===0&&Qx(t)}};function av(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function wd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Ey(){}function Vk(t,e,r,s,n){if(n){if(typeof s=="function"){var a=s;s=function(){var u=Pu(o);a.call(u)}}var o=pb(e,s,t,0,null,!1,!1,"",Ey);return t._reactRootContainer=o,t[ns]=o.current,gl(t.nodeType===8?t.parentNode:t),Ha(),o}for(;n=t.lastChild;)t.removeChild(n);if(typeof s=="function"){var i=s;s=function(){var u=Pu(c);i.call(u)}}var c=rv(t,0,!1,null,null,!1,!1,"",Ey);return t._reactRootContainer=c,t[ns]=c.current,gl(t.nodeType===8?t.parentNode:t),Ha(function(){yd(e,c,r,s)}),c}function bd(t,e,r,s,n){var a=r._reactRootContainer;if(a){var o=a;if(typeof n=="function"){var i=n;n=function(){var c=Pu(o);i.call(c)}}yd(e,o,t,n)}else o=Vk(r,e,t,n,s);return Pu(o)}Hx=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=qi(e.pendingLanes);r!==0&&(Em(e,r|1),gr(e,_t()),!(Ze&6)&&(ui=_t()+500,ua()))}break;case 13:Ha(function(){var s=ss(t,1);if(s!==null){var n=rr();nn(s,t,1,n)}}),nv(t,1)}};Cm=function(t){if(t.tag===13){var e=ss(t,134217728);if(e!==null){var r=rr();nn(e,t,134217728,r)}nv(t,134217728)}};Bx=function(t){if(t.tag===13){var e=Ys(t),r=ss(t,e);if(r!==null){var s=rr();nn(r,t,e,s)}nv(t,e)}};Kx=function(){return Xe};Wx=function(t,e){var r=Xe;try{return Xe=t,e()}finally{Xe=r}};fh=function(t,e,r){switch(e){case"input":if(ah(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var s=r[e];if(s!==t&&s.form===t.form){var n=dd(s);if(!n)throw Error(Q(90));Ex(s),ah(s,n)}}}break;case"textarea":Px(t,r);break;case"select":e=r.value,e!=null&&Io(t,!!r.multiple,e,!1)}};Ox=Jm;Ix=Ha;var qk={usingClientEntryPoint:!1,Events:[Fl,Eo,dd,Tx,Ax,Jm]},$i={findFiberByHostInstance:Pa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Hk={bundleType:$i.bundleType,version:$i.version,rendererPackageName:$i.rendererPackageName,rendererConfig:$i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:us.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=$x(t),t===null?null:t.stateNode},findFiberByHostInstance:$i.findFiberByHostInstance||zk,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 xc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xc.isDisabled&&xc.supportsFiber)try{id=xc.inject(Hk),kn=xc}catch{}}kr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qk;kr.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!av(e))throw Error(Q(200));return Uk(t,e,null,r)};kr.createRoot=function(t,e){if(!av(t))throw Error(Q(299));var r=!1,s="",n=mb;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onRecoverableError!==void 0&&(n=e.onRecoverableError)),e=rv(t,1,!1,null,null,r,!1,s,n),t[ns]=e.current,gl(t.nodeType===8?t.parentNode:t),new sv(e)};kr.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Q(188)):(t=Object.keys(t).join(","),Error(Q(268,t)));return t=$x(e),t=t===null?null:t.stateNode,t};kr.flushSync=function(t){return Ha(t)};kr.hydrate=function(t,e,r){if(!wd(e))throw Error(Q(200));return bd(null,t,e,!0,r)};kr.hydrateRoot=function(t,e,r){if(!av(t))throw Error(Q(405));var s=r!=null&&r.hydratedSources||null,n=!1,a="",o=mb;if(r!=null&&(r.unstable_strictMode===!0&&(n=!0),r.identifierPrefix!==void 0&&(a=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),e=pb(e,null,t,1,r??null,n,!1,a,o),t[ns]=e.current,gl(t),s)for(t=0;t<s.length;t++)r=s[t],n=r._getVersion,n=n(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,n]:e.mutableSourceEagerHydrationData.push(r,n);return new xd(e)};kr.render=function(t,e,r){if(!wd(e))throw Error(Q(200));return bd(null,t,e,!1,r)};kr.unmountComponentAtNode=function(t){if(!wd(t))throw Error(Q(40));return t._reactRootContainer?(Ha(function(){bd(null,null,t,!1,function(){t._reactRootContainer=null,t[ns]=null})}),!0):!1};kr.unstable_batchedUpdates=Jm;kr.unstable_renderSubtreeIntoContainer=function(t,e,r,s){if(!wd(r))throw Error(Q(200));if(t==null||t._reactInternals===void 0)throw Error(Q(38));return bd(t,e,r,!1,s)};kr.version="18.3.1-next-f1338f8080-20240426";function vb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vb)}catch(t){console.error(t)}}vb(),vx.exports=kr;var so=vx.exports;const Bk=um(so);var gb,Cy=so;gb=Cy.createRoot,Cy.hydrateRoot;function Kk(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var r,s,n,a,o=[],i="",c=t.split("/");for(c[0]||c.shift();n=c.shift();)r=n[0],r==="*"?(o.push(r),i+=n[1]==="?"?"(?:/(.*))?":"/(.*)"):r===":"?(s=n.indexOf("?",1),a=n.indexOf(".",1),o.push(n.substring(1,~s?s:~a?a:n.length)),i+=~s&&!~a?"(?:/([^/]+?))?":"/([^/]+?)",~a&&(i+=(~s?"?":"")+"\\"+n.substring(a))):i+="/"+n;return{keys:o,pattern:new RegExp("^"+i+(e?"(?=$|/)":"/?$"),"i")}}var yb={exports:{}},xb={};/**
|
|
40
|
+
`+a.stack}return{value:t,source:e,stack:n,digest:null}}function Ef(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Oh(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var Ck=typeof WeakMap=="function"?WeakMap:Map;function Ww(t,e,r){r=es(-1,r),r.tag=3,r.payload={element:null};var s=e.value;return r.callback=function(){Eu||(Eu=!0,qh=s),Oh(t,e)},r}function Qw(t,e,r){r=es(-1,r),r.tag=3;var s=t.type.getDerivedStateFromError;if(typeof s=="function"){var n=e.value;r.payload=function(){return s(n)},r.callback=function(){Oh(t,e)}}var a=t.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(r.callback=function(){Oh(t,e),typeof s!="function"&&(Zs===null?Zs=new Set([this]):Zs.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function cy(t,e,r){var s=t.pingCache;if(s===null){s=t.pingCache=new Ck;var n=new Set;s.set(e,n)}else n=s.get(e),n===void 0&&(n=new Set,s.set(e,n));n.has(r)||(n.add(r),t=Lk.bind(null,t,e,r),e.then(t,t))}function uy(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function dy(t,e,r,s,n){return t.mode&1?(t.flags|=65536,t.lanes=n,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=es(-1,1),e.tag=2,Gs(r,e,1))),r.lanes|=1),t)}var Pk=ds.ReactCurrentOwner,pr=!1;function er(t,e,r,s){e.child=t===null?_w(e,null,r,s):ii(e,t.child,r,s)}function fy(t,e,r,s,n){r=r.render;var a=e.ref;return Fo(e,n),s=Km(t,e,r,s,a,n),r=Wm(),t!==null&&!pr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n,os(t,e,n)):(ht&&r&&Im(e),e.flags|=1,er(t,e,s,n),e.child)}function hy(t,e,r,s,n){if(t===null){var a=r.type;return typeof a=="function"&&!nv(a)&&a.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=a,Gw(t,e,a,s,n)):(t=Bc(r.type,null,s,e,e.mode,n),t.ref=e.ref,t.return=e,e.child=t)}if(a=t.child,!(t.lanes&n)){var o=a.memoizedProps;if(r=r.compare,r=r!==null?r:gl,r(o,s)&&t.ref===e.ref)return os(t,e,n)}return e.flags|=1,t=Js(a,s),t.ref=e.ref,t.return=e,e.child=t}function Gw(t,e,r,s,n){if(t!==null){var a=t.memoizedProps;if(gl(a,s)&&t.ref===e.ref)if(pr=!1,e.pendingProps=s=a,(t.lanes&n)!==0)t.flags&131072&&(pr=!0);else return e.lanes=t.lanes,os(t,e,n)}return Ih(t,e,r,s,n)}function Zw(t,e,r){var s=e.pendingProps,n=s.children,a=t!==null?t.memoizedState:null;if(s.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},st(Ro,br),br|=r;else{if(!(r&1073741824))return t=a!==null?a.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,st(Ro,br),br|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=a!==null?a.baseLanes:r,st(Ro,br),br|=s}else a!==null?(s=a.baseLanes|r,e.memoizedState=null):s=r,st(Ro,br),br|=s;return er(t,e,n,r),e.child}function Yw(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function Ih(t,e,r,s,n){var a=vr(r)?Ua:Zt.current;return a=ai(e,a),Fo(e,n),r=Km(t,e,r,s,a,n),s=Wm(),t!==null&&!pr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n,os(t,e,n)):(ht&&s&&Im(e),e.flags|=1,er(t,e,r,n),e.child)}function py(t,e,r,s,n){if(vr(r)){var a=!0;pu(e)}else a=!1;if(Fo(e,n),e.stateNode===null)Vc(t,e),Kw(e,r,s),Ah(e,r,s,n),s=!0;else if(t===null){var o=e.stateNode,i=e.memoizedProps;o.props=i;var c=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=Fr(u):(u=vr(r)?Ua:Zt.current,u=ai(e,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==s||c!==u)&&ly(e,o,s,u),Es=!1;var m=e.memoizedState;o.state=m,xu(e,s,o,n),c=e.memoizedState,i!==s||m!==c||mr.current||Es?(typeof d=="function"&&(Th(e,r,d,s),c=e.memoizedState),(i=Es||iy(e,r,i,s,m,c,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=s,e.memoizedState=c),o.props=s,o.state=c,o.context=u,s=i):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),s=!1)}else{o=e.stateNode,Cw(t,e),i=e.memoizedProps,u=e.type===e.elementType?i:Zr(e.type,i),o.props=u,h=e.pendingProps,m=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=Fr(c):(c=vr(r)?Ua:Zt.current,c=ai(e,c));var f=r.getDerivedStateFromProps;(d=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==h||m!==c)&&ly(e,o,s,c),Es=!1,m=e.memoizedState,o.state=m,xu(e,s,o,n);var w=e.memoizedState;i!==h||m!==w||mr.current||Es?(typeof f=="function"&&(Th(e,r,f,s),w=e.memoizedState),(u=Es||iy(e,r,u,s,m,w,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,w,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,w,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||i===t.memoizedProps&&m===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===t.memoizedProps&&m===t.memoizedState||(e.flags|=1024),e.memoizedProps=s,e.memoizedState=w),o.props=s,o.state=w,o.context=c,s=u):(typeof o.componentDidUpdate!="function"||i===t.memoizedProps&&m===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===t.memoizedProps&&m===t.memoizedState||(e.flags|=1024),s=!1)}return Dh(t,e,r,s,a,n)}function Dh(t,e,r,s,n,a){Yw(t,e);var o=(e.flags&128)!==0;if(!s&&!o)return n&&Xg(e,r,!1),os(t,e,a);s=e.stateNode,Pk.current=e;var i=o&&typeof r.getDerivedStateFromError!="function"?null:s.render();return e.flags|=1,t!==null&&o?(e.child=ii(e,t.child,null,a),e.child=ii(e,null,i,a)):er(t,e,i,a),e.memoizedState=s.state,n&&Xg(e,r,!0),e.child}function Jw(t){var e=t.stateNode;e.pendingContext?Jg(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Jg(t,e.context,!1),Vm(t,e.containerInfo)}function my(t,e,r,s,n){return oi(),Mm(n),e.flags|=256,er(t,e,r,s),e.child}var Mh={dehydrated:null,treeContext:null,retryLane:0};function $h(t){return{baseLanes:t,cachePool:null,transitions:null}}function Xw(t,e,r){var s=e.pendingProps,n=mt.current,a=!1,o=(e.flags&128)!==0,i;if((i=o)||(i=t!==null&&t.memoizedState===null?!1:(n&2)!==0),i?(a=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(n|=1),st(mt,n&1),t===null)return jh(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=s.children,t=s.fallback,a?(s=e.mode,a=e.child,o={mode:"hidden",children:o},!(s&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=yd(o,s,0,null),t=Fa(t,s,r,null),a.return=e,t.return=e,a.sibling=t,e.child=a,e.child.memoizedState=$h(r),e.memoizedState=Mh,t):Zm(e,o));if(n=t.memoizedState,n!==null&&(i=n.dehydrated,i!==null))return kk(t,e,o,s,i,n,r);if(a){a=s.fallback,o=e.mode,n=t.child,i=n.sibling;var c={mode:"hidden",children:s.children};return!(o&1)&&e.child!==n?(s=e.child,s.childLanes=0,s.pendingProps=c,e.deletions=null):(s=Js(n,c),s.subtreeFlags=n.subtreeFlags&14680064),i!==null?a=Js(i,a):(a=Fa(a,o,r,null),a.flags|=2),a.return=e,s.return=e,s.sibling=a,e.child=s,s=a,a=e.child,o=t.child.memoizedState,o=o===null?$h(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=t.childLanes&~r,e.memoizedState=Mh,s}return a=t.child,t=a.sibling,s=Js(a,{mode:"visible",children:s.children}),!(e.mode&1)&&(s.lanes=r),s.return=e,s.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=s,e.memoizedState=null,s}function Zm(t,e){return e=yd({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function gc(t,e,r,s){return s!==null&&Mm(s),ii(e,t.child,null,r),t=Zm(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function kk(t,e,r,s,n,a,o){if(r)return e.flags&256?(e.flags&=-257,s=Ef(Error(Q(422))),gc(t,e,o,s)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(a=s.fallback,n=e.mode,s=yd({mode:"visible",children:s.children},n,0,null),a=Fa(a,n,o,null),a.flags|=2,s.return=e,a.return=e,s.sibling=a,e.child=s,e.mode&1&&ii(e,t.child,null,o),e.child.memoizedState=$h(o),e.memoizedState=Mh,a);if(!(e.mode&1))return gc(t,e,o,null);if(n.data==="$!"){if(s=n.nextSibling&&n.nextSibling.dataset,s)var i=s.dgst;return s=i,a=Error(Q(419)),s=Ef(a,s,void 0),gc(t,e,o,s)}if(i=(o&t.childLanes)!==0,pr||i){if(s=Lt,s!==null){switch(o&-o){case 4:n=2;break;case 16:n=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:n=32;break;case 536870912:n=268435456;break;default:n=0}n=n&(s.suspendedLanes|o)?0:n,n!==0&&n!==a.retryLane&&(a.retryLane=n,as(t,n),nn(s,t,n,-1))}return rv(),s=Ef(Error(Q(421))),gc(t,e,o,s)}return n.data==="$?"?(e.flags|=128,e.child=t.child,e=Uk.bind(null,t),n._reactRetry=e,null):(t=a.treeContext,_r=Qs(n.nextSibling),Er=e,ht=!0,tn=null,t!==null&&(Or[Ir++]=Zn,Or[Ir++]=Yn,Or[Ir++]=za,Zn=t.id,Yn=t.overflow,za=e),e=Zm(e,s.children),e.flags|=4096,e)}function vy(t,e,r){t.lanes|=e;var s=t.alternate;s!==null&&(s.lanes|=e),Rh(t.return,e,r)}function Cf(t,e,r,s,n){var a=t.memoizedState;a===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:n}:(a.isBackwards=e,a.rendering=null,a.renderingStartTime=0,a.last=s,a.tail=r,a.tailMode=n)}function eb(t,e,r){var s=e.pendingProps,n=s.revealOrder,a=s.tail;if(er(t,e,s.children,r),s=mt.current,s&2)s=s&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vy(t,r,e);else if(t.tag===19)vy(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}s&=1}if(st(mt,s),!(e.mode&1))e.memoizedState=null;else switch(n){case"forwards":for(r=e.child,n=null;r!==null;)t=r.alternate,t!==null&&wu(t)===null&&(n=r),r=r.sibling;r=n,r===null?(n=e.child,e.child=null):(n=r.sibling,r.sibling=null),Cf(e,!1,n,r,a);break;case"backwards":for(r=null,n=e.child,e.child=null;n!==null;){if(t=n.alternate,t!==null&&wu(t)===null){e.child=n;break}t=n.sibling,n.sibling=r,r=n,n=t}Cf(e,!0,r,null,a);break;case"together":Cf(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Vc(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function os(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),qa|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Q(153));if(e.child!==null){for(t=e.child,r=Js(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=Js(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function Nk(t,e,r){switch(e.tag){case 3:Jw(e),oi();break;case 5:Pw(e);break;case 1:vr(e.type)&&pu(e);break;case 4:Vm(e,e.stateNode.containerInfo);break;case 10:var s=e.type._context,n=e.memoizedProps.value;st(gu,s._currentValue),s._currentValue=n;break;case 13:if(s=e.memoizedState,s!==null)return s.dehydrated!==null?(st(mt,mt.current&1),e.flags|=128,null):r&e.child.childLanes?Xw(t,e,r):(st(mt,mt.current&1),t=os(t,e,r),t!==null?t.sibling:null);st(mt,mt.current&1);break;case 19:if(s=(r&e.childLanes)!==0,t.flags&128){if(s)return eb(t,e,r);e.flags|=128}if(n=e.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),st(mt,mt.current),s)break;return null;case 22:case 23:return e.lanes=0,Zw(t,e,r)}return os(t,e,r)}var tb,Fh,rb,nb;tb=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Fh=function(){};rb=function(t,e,r,s){var n=t.memoizedProps;if(n!==s){t=e.stateNode,Na(Nn.current);var a=null;switch(r){case"input":n=oh(t,n),s=oh(t,s),a=[];break;case"select":n=gt({},n,{value:void 0}),s=gt({},s,{value:void 0}),a=[];break;case"textarea":n=ch(t,n),s=ch(t,s),a=[];break;default:typeof n.onClick!="function"&&typeof s.onClick=="function"&&(t.onclick=fu)}dh(r,s);var o;r=null;for(u in n)if(!s.hasOwnProperty(u)&&n.hasOwnProperty(u)&&n[u]!=null)if(u==="style"){var i=n[u];for(o in i)i.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(ul.hasOwnProperty(u)?a||(a=[]):(a=a||[]).push(u,null));for(u in s){var c=s[u];if(i=n!=null?n[u]:void 0,s.hasOwnProperty(u)&&c!==i&&(c!=null||i!=null))if(u==="style")if(i){for(o in i)!i.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&i[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(a||(a=[]),a.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,i=i?i.__html:void 0,c!=null&&i!==c&&(a=a||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(ul.hasOwnProperty(u)?(c!=null&&u==="onScroll"&<("scroll",t),a||i===c||(a=[])):(a=a||[]).push(u,c))}r&&(a=a||[]).push("style",r);var u=a;(e.updateQueue=u)&&(e.flags|=4)}};nb=function(t,e,r,s){r!==s&&(e.flags|=4)};function Mi(t,e){if(!ht)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:s.sibling=null}}function Qt(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,s=0;if(e)for(var n=t.child;n!==null;)r|=n.lanes|n.childLanes,s|=n.subtreeFlags&14680064,s|=n.flags&14680064,n.return=t,n=n.sibling;else for(n=t.child;n!==null;)r|=n.lanes|n.childLanes,s|=n.subtreeFlags,s|=n.flags,n.return=t,n=n.sibling;return t.subtreeFlags|=s,t.childLanes=r,e}function jk(t,e,r){var s=e.pendingProps;switch(Dm(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(e),null;case 1:return vr(e.type)&&hu(),Qt(e),null;case 3:return s=e.stateNode,li(),ct(mr),ct(Zt),Hm(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(mc(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,tn!==null&&(Kh(tn),tn=null))),Fh(t,e),Qt(e),null;case 5:qm(e);var n=Na(Sl.current);if(r=e.type,t!==null&&e.stateNode!=null)rb(t,e,r,s,n),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!s){if(e.stateNode===null)throw Error(Q(166));return Qt(e),null}if(t=Na(Nn.current),mc(e)){s=e.stateNode,r=e.type;var a=e.memoizedProps;switch(s[xn]=e,s[wl]=a,t=(e.mode&1)!==0,r){case"dialog":lt("cancel",s),lt("close",s);break;case"iframe":case"object":case"embed":lt("load",s);break;case"video":case"audio":for(n=0;n<Hi.length;n++)lt(Hi[n],s);break;case"source":lt("error",s);break;case"img":case"image":case"link":lt("error",s),lt("load",s);break;case"details":lt("toggle",s);break;case"input":Cg(s,a),lt("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!a.multiple},lt("invalid",s);break;case"textarea":kg(s,a),lt("invalid",s)}dh(r,a),n=null;for(var o in a)if(a.hasOwnProperty(o)){var i=a[o];o==="children"?typeof i=="string"?s.textContent!==i&&(a.suppressHydrationWarning!==!0&&pc(s.textContent,i,t),n=["children",i]):typeof i=="number"&&s.textContent!==""+i&&(a.suppressHydrationWarning!==!0&&pc(s.textContent,i,t),n=["children",""+i]):ul.hasOwnProperty(o)&&i!=null&&o==="onScroll"&<("scroll",s)}switch(r){case"input":oc(s),Pg(s,a,!0);break;case"textarea":oc(s),Ng(s);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(s.onclick=fu)}s=n,e.updateQueue=s,s!==null&&(e.flags|=4)}else{o=n.nodeType===9?n:n.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Tx(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof s.is=="string"?t=o.createElement(r,{is:s.is}):(t=o.createElement(r),r==="select"&&(o=t,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):t=o.createElementNS(t,r),t[xn]=e,t[wl]=s,tb(t,e,!1,!1),e.stateNode=t;e:{switch(o=fh(r,s),r){case"dialog":lt("cancel",t),lt("close",t),n=s;break;case"iframe":case"object":case"embed":lt("load",t),n=s;break;case"video":case"audio":for(n=0;n<Hi.length;n++)lt(Hi[n],t);n=s;break;case"source":lt("error",t),n=s;break;case"img":case"image":case"link":lt("error",t),lt("load",t),n=s;break;case"details":lt("toggle",t),n=s;break;case"input":Cg(t,s),n=oh(t,s),lt("invalid",t);break;case"option":n=s;break;case"select":t._wrapperState={wasMultiple:!!s.multiple},n=gt({},s,{value:void 0}),lt("invalid",t);break;case"textarea":kg(t,s),n=ch(t,s),lt("invalid",t);break;default:n=s}dh(r,n),i=n;for(a in i)if(i.hasOwnProperty(a)){var c=i[a];a==="style"?Ix(t,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Ax(t,c)):a==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&dl(t,c):typeof c=="number"&&dl(t,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(ul.hasOwnProperty(a)?c!=null&&a==="onScroll"&<("scroll",t):c!=null&&wm(t,a,c,o))}switch(r){case"input":oc(t),Pg(t,s,!1);break;case"textarea":oc(t),Ng(t);break;case"option":s.value!=null&&t.setAttribute("value",""+na(s.value));break;case"select":t.multiple=!!s.multiple,a=s.value,a!=null?Io(t,!!s.multiple,a,!1):s.defaultValue!=null&&Io(t,!!s.multiple,s.defaultValue,!0);break;default:typeof n.onClick=="function"&&(t.onclick=fu)}switch(r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Qt(e),null;case 6:if(t&&e.stateNode!=null)nb(t,e,t.memoizedProps,s);else{if(typeof s!="string"&&e.stateNode===null)throw Error(Q(166));if(r=Na(Sl.current),Na(Nn.current),mc(e)){if(s=e.stateNode,r=e.memoizedProps,s[xn]=e,(a=s.nodeValue!==r)&&(t=Er,t!==null))switch(t.tag){case 3:pc(s.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&pc(s.nodeValue,r,(t.mode&1)!==0)}a&&(e.flags|=4)}else s=(r.nodeType===9?r:r.ownerDocument).createTextNode(s),s[xn]=e,e.stateNode=s}return Qt(e),null;case 13:if(ct(mt),s=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ht&&_r!==null&&e.mode&1&&!(e.flags&128))bw(),oi(),e.flags|=98560,a=!1;else if(a=mc(e),s!==null&&s.dehydrated!==null){if(t===null){if(!a)throw Error(Q(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(Q(317));a[xn]=e}else oi(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Qt(e),a=!1}else tn!==null&&(Kh(tn),tn=null),a=!0;if(!a)return e.flags&65536?e:null}return e.flags&128?(e.lanes=r,e):(s=s!==null,s!==(t!==null&&t.memoizedState!==null)&&s&&(e.child.flags|=8192,e.mode&1&&(t===null||mt.current&1?Ot===0&&(Ot=3):rv())),e.updateQueue!==null&&(e.flags|=4),Qt(e),null);case 4:return li(),Fh(t,e),t===null&&yl(e.stateNode.containerInfo),Qt(e),null;case 10:return Lm(e.type._context),Qt(e),null;case 17:return vr(e.type)&&hu(),Qt(e),null;case 19:if(ct(mt),a=e.memoizedState,a===null)return Qt(e),null;if(s=(e.flags&128)!==0,o=a.rendering,o===null)if(s)Mi(a,!1);else{if(Ot!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=wu(t),o!==null){for(e.flags|=128,Mi(a,!1),s=o.updateQueue,s!==null&&(e.updateQueue=s,e.flags|=4),e.subtreeFlags=0,s=r,r=e.child;r!==null;)a=r,t=s,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=t,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,t=o.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return st(mt,mt.current&1|2),e.child}t=t.sibling}a.tail!==null&&_t()>ui&&(e.flags|=128,s=!0,Mi(a,!1),e.lanes=4194304)}else{if(!s)if(t=wu(o),t!==null){if(e.flags|=128,s=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Mi(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!ht)return Qt(e),null}else 2*_t()-a.renderingStartTime>ui&&r!==1073741824&&(e.flags|=128,s=!0,Mi(a,!1),e.lanes=4194304);a.isBackwards?(o.sibling=e.child,e.child=o):(r=a.last,r!==null?r.sibling=o:e.child=o,a.last=o)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=_t(),e.sibling=null,r=mt.current,st(mt,s?r&1|2:r&1),e):(Qt(e),null);case 22:case 23:return tv(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?br&1073741824&&(Qt(e),e.subtreeFlags&6&&(e.flags|=8192)):Qt(e),null;case 24:return null;case 25:return null}throw Error(Q(156,e.tag))}function Rk(t,e){switch(Dm(e),e.tag){case 1:return vr(e.type)&&hu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return li(),ct(mr),ct(Zt),Hm(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return qm(e),null;case 13:if(ct(mt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Q(340));oi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ct(mt),null;case 4:return li(),null;case 10:return Lm(e.type._context),null;case 22:case 23:return tv(),null;case 24:return null;default:return null}}var yc=!1,Gt=!1,Tk=typeof WeakSet=="function"?WeakSet:Set,ue=null;function jo(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){xt(t,e,s)}else r.current=null}function Lh(t,e,r){try{r()}catch(s){xt(t,e,s)}}var gy=!1;function Ak(t,e){if(Sh=cu,t=lw(),Om(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var n=s.anchorOffset,a=s.focusNode;s=s.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var o=0,i=-1,c=-1,u=0,d=0,h=t,m=null;t:for(;;){for(var f;h!==r||n!==0&&h.nodeType!==3||(i=o+n),h!==a||s!==0&&h.nodeType!==3||(c=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)m=h,h=f;for(;;){if(h===t)break t;if(m===r&&++u===n&&(i=o),m===a&&++d===s&&(c=o),(f=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=f}r=i===-1||c===-1?null:{start:i,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(_h={focusedElem:t,selectionRange:r},cu=!1,ue=e;ue!==null;)if(e=ue,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ue=t;else for(;ue!==null;){e=ue;try{var w=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var p=w.memoizedProps,y=w.memoizedState,g=e.stateNode,v=g.getSnapshotBeforeUpdate(e.elementType===e.type?p:Zr(e.type,p),y);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(S){xt(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,ue=t;break}ue=e.return}return w=gy,gy=!1,w}function nl(t,e,r){var s=e.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var n=s=s.next;do{if((n.tag&t)===t){var a=n.destroy;n.destroy=void 0,a!==void 0&&Lh(e,r,a)}n=n.next}while(n!==s)}}function vd(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var s=r.create;r.destroy=s()}r=r.next}while(r!==e)}}function Uh(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function sb(t){var e=t.alternate;e!==null&&(t.alternate=null,sb(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[xn],delete e[wl],delete e[Ph],delete e[pk],delete e[mk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function ab(t){return t.tag===5||t.tag===3||t.tag===4}function yy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ab(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function zh(t,e,r){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=fu));else if(s!==4&&(t=t.child,t!==null))for(zh(t,e,r),t=t.sibling;t!==null;)zh(t,e,r),t=t.sibling}function Vh(t,e,r){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(s!==4&&(t=t.child,t!==null))for(Vh(t,e,r),t=t.sibling;t!==null;)Vh(t,e,r),t=t.sibling}var Vt=null,en=!1;function ys(t,e,r){for(r=r.child;r!==null;)ob(t,e,r),r=r.sibling}function ob(t,e,r){if(kn&&typeof kn.onCommitFiberUnmount=="function")try{kn.onCommitFiberUnmount(ld,r)}catch{}switch(r.tag){case 5:Gt||jo(r,e);case 6:var s=Vt,n=en;Vt=null,ys(t,e,r),Vt=s,en=n,Vt!==null&&(en?(t=Vt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Vt.removeChild(r.stateNode));break;case 18:Vt!==null&&(en?(t=Vt,r=r.stateNode,t.nodeType===8?yf(t.parentNode,r):t.nodeType===1&&yf(t,r),ml(t)):yf(Vt,r.stateNode));break;case 4:s=Vt,n=en,Vt=r.stateNode.containerInfo,en=!0,ys(t,e,r),Vt=s,en=n;break;case 0:case 11:case 14:case 15:if(!Gt&&(s=r.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){n=s=s.next;do{var a=n,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Lh(r,e,o),n=n.next}while(n!==s)}ys(t,e,r);break;case 1:if(!Gt&&(jo(r,e),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(i){xt(r,e,i)}ys(t,e,r);break;case 21:ys(t,e,r);break;case 22:r.mode&1?(Gt=(s=Gt)||r.memoizedState!==null,ys(t,e,r),Gt=s):ys(t,e,r);break;default:ys(t,e,r)}}function xy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new Tk),e.forEach(function(s){var n=zk.bind(null,t,s);r.has(s)||(r.add(s),s.then(n,n))})}}function Kr(t,e){var r=e.deletions;if(r!==null)for(var s=0;s<r.length;s++){var n=r[s];try{var a=t,o=e,i=o;e:for(;i!==null;){switch(i.tag){case 5:Vt=i.stateNode,en=!1;break e;case 3:Vt=i.stateNode.containerInfo,en=!0;break e;case 4:Vt=i.stateNode.containerInfo,en=!0;break e}i=i.return}if(Vt===null)throw Error(Q(160));ob(a,o,n),Vt=null,en=!1;var c=n.alternate;c!==null&&(c.return=null),n.return=null}catch(u){xt(n,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)ib(e,t),e=e.sibling}function ib(t,e){var r=t.alternate,s=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Kr(e,t),fn(t),s&4){try{nl(3,t,t.return),vd(3,t)}catch(p){xt(t,t.return,p)}try{nl(5,t,t.return)}catch(p){xt(t,t.return,p)}}break;case 1:Kr(e,t),fn(t),s&512&&r!==null&&jo(r,r.return);break;case 5:if(Kr(e,t),fn(t),s&512&&r!==null&&jo(r,r.return),t.flags&32){var n=t.stateNode;try{dl(n,"")}catch(p){xt(t,t.return,p)}}if(s&4&&(n=t.stateNode,n!=null)){var a=t.memoizedProps,o=r!==null?r.memoizedProps:a,i=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{i==="input"&&a.type==="radio"&&a.name!=null&&jx(n,a),fh(i,o);var u=fh(i,a);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?Ix(n,h):d==="dangerouslySetInnerHTML"?Ax(n,h):d==="children"?dl(n,h):wm(n,d,h,u)}switch(i){case"input":ih(n,a);break;case"textarea":Rx(n,a);break;case"select":var m=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!a.multiple;var f=a.value;f!=null?Io(n,!!a.multiple,f,!1):m!==!!a.multiple&&(a.defaultValue!=null?Io(n,!!a.multiple,a.defaultValue,!0):Io(n,!!a.multiple,a.multiple?[]:"",!1))}n[wl]=a}catch(p){xt(t,t.return,p)}}break;case 6:if(Kr(e,t),fn(t),s&4){if(t.stateNode===null)throw Error(Q(162));n=t.stateNode,a=t.memoizedProps;try{n.nodeValue=a}catch(p){xt(t,t.return,p)}}break;case 3:if(Kr(e,t),fn(t),s&4&&r!==null&&r.memoizedState.isDehydrated)try{ml(e.containerInfo)}catch(p){xt(t,t.return,p)}break;case 4:Kr(e,t),fn(t);break;case 13:Kr(e,t),fn(t),n=t.child,n.flags&8192&&(a=n.memoizedState!==null,n.stateNode.isHidden=a,!a||n.alternate!==null&&n.alternate.memoizedState!==null||(Xm=_t())),s&4&&xy(t);break;case 22:if(d=r!==null&&r.memoizedState!==null,t.mode&1?(Gt=(u=Gt)||d,Kr(e,t),Gt=u):Kr(e,t),fn(t),s&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(ue=t,d=t.child;d!==null;){for(h=ue=d;ue!==null;){switch(m=ue,f=m.child,m.tag){case 0:case 11:case 14:case 15:nl(4,m,m.return);break;case 1:jo(m,m.return);var w=m.stateNode;if(typeof w.componentWillUnmount=="function"){s=m,r=m.return;try{e=s,w.props=e.memoizedProps,w.state=e.memoizedState,w.componentWillUnmount()}catch(p){xt(s,r,p)}}break;case 5:jo(m,m.return);break;case 22:if(m.memoizedState!==null){by(h);continue}}f!==null?(f.return=m,ue=f):by(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{n=h.stateNode,u?(a=n.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(i=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,i.style.display=Ox("display",o))}catch(p){xt(t,t.return,p)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(p){xt(t,t.return,p)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Kr(e,t),fn(t),s&4&&xy(t);break;case 21:break;default:Kr(e,t),fn(t)}}function fn(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(ab(r)){var s=r;break e}r=r.return}throw Error(Q(160))}switch(s.tag){case 5:var n=s.stateNode;s.flags&32&&(dl(n,""),s.flags&=-33);var a=yy(t);Vh(t,a,n);break;case 3:case 4:var o=s.stateNode.containerInfo,i=yy(t);zh(t,i,o);break;default:throw Error(Q(161))}}catch(c){xt(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Ok(t,e,r){ue=t,lb(t)}function lb(t,e,r){for(var s=(t.mode&1)!==0;ue!==null;){var n=ue,a=n.child;if(n.tag===22&&s){var o=n.memoizedState!==null||yc;if(!o){var i=n.alternate,c=i!==null&&i.memoizedState!==null||Gt;i=yc;var u=Gt;if(yc=o,(Gt=c)&&!u)for(ue=n;ue!==null;)o=ue,c=o.child,o.tag===22&&o.memoizedState!==null?Sy(n):c!==null?(c.return=o,ue=c):Sy(n);for(;a!==null;)ue=a,lb(a),a=a.sibling;ue=n,yc=i,Gt=u}wy(t)}else n.subtreeFlags&8772&&a!==null?(a.return=n,ue=a):wy(t)}}function wy(t){for(;ue!==null;){var e=ue;if(e.flags&8772){var r=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Gt||vd(5,e);break;case 1:var s=e.stateNode;if(e.flags&4&&!Gt)if(r===null)s.componentDidMount();else{var n=e.elementType===e.type?r.memoizedProps:Zr(e.type,r.memoizedProps);s.componentDidUpdate(n,r.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var a=e.updateQueue;a!==null&&sy(e,a,s);break;case 3:var o=e.updateQueue;if(o!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}sy(e,o,r)}break;case 5:var i=e.stateNode;if(r===null&&e.flags&4){r=i;var c=e.memoizedProps;switch(e.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(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&ml(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}Gt||e.flags&512&&Uh(e)}catch(m){xt(e,e.return,m)}}if(e===t){ue=null;break}if(r=e.sibling,r!==null){r.return=e.return,ue=r;break}ue=e.return}}function by(t){for(;ue!==null;){var e=ue;if(e===t){ue=null;break}var r=e.sibling;if(r!==null){r.return=e.return,ue=r;break}ue=e.return}}function Sy(t){for(;ue!==null;){var e=ue;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{vd(4,e)}catch(c){xt(e,r,c)}break;case 1:var s=e.stateNode;if(typeof s.componentDidMount=="function"){var n=e.return;try{s.componentDidMount()}catch(c){xt(e,n,c)}}var a=e.return;try{Uh(e)}catch(c){xt(e,a,c)}break;case 5:var o=e.return;try{Uh(e)}catch(c){xt(e,o,c)}}}catch(c){xt(e,e.return,c)}if(e===t){ue=null;break}var i=e.sibling;if(i!==null){i.return=e.return,ue=i;break}ue=e.return}}var Ik=Math.ceil,_u=ds.ReactCurrentDispatcher,Ym=ds.ReactCurrentOwner,$r=ds.ReactCurrentBatchConfig,Ze=0,Lt=null,kt=null,qt=0,br=0,Ro=ca(0),Ot=0,Pl=null,qa=0,gd=0,Jm=0,sl=null,fr=null,Xm=0,ui=1/0,Hn=null,Eu=!1,qh=null,Zs=null,xc=!1,zs=null,Cu=0,al=0,Hh=null,qc=-1,Hc=0;function rr(){return Ze&6?_t():qc!==-1?qc:qc=_t()}function Ys(t){return t.mode&1?Ze&2&&qt!==0?qt&-qt:gk.transition!==null?(Hc===0&&(Hc=Kx()),Hc):(t=Xe,t!==0||(t=window.event,t=t===void 0?16:Xx(t.type)),t):1}function nn(t,e,r,s){if(50<al)throw al=0,Hh=null,Error(Q(185));$l(t,r,s),(!(Ze&2)||t!==Lt)&&(t===Lt&&(!(Ze&2)&&(gd|=r),Ot===4&&js(t,qt)),gr(t,s),r===1&&Ze===0&&!(e.mode&1)&&(ui=_t()+500,hd&&ua()))}function gr(t,e){var r=t.callbackNode;gP(t,e);var s=lu(t,t===Lt?qt:0);if(s===0)r!==null&&Tg(r),t.callbackNode=null,t.callbackPriority=0;else if(e=s&-s,t.callbackPriority!==e){if(r!=null&&Tg(r),e===1)t.tag===0?vk(_y.bind(null,t)):yw(_y.bind(null,t)),fk(function(){!(Ze&6)&&ua()}),r=null;else{switch(Wx(s)){case 1:r=Cm;break;case 4:r=Hx;break;case 16:r=iu;break;case 536870912:r=Bx;break;default:r=iu}r=vb(r,cb.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function cb(t,e){if(qc=-1,Hc=0,Ze&6)throw Error(Q(327));var r=t.callbackNode;if(Lo()&&t.callbackNode!==r)return null;var s=lu(t,t===Lt?qt:0);if(s===0)return null;if(s&30||s&t.expiredLanes||e)e=Pu(t,s);else{e=s;var n=Ze;Ze|=2;var a=db();(Lt!==t||qt!==e)&&(Hn=null,ui=_t()+500,$a(t,e));do try{$k();break}catch(i){ub(t,i)}while(!0);Fm(),_u.current=a,Ze=n,kt!==null?e=0:(Lt=null,qt=0,e=Ot)}if(e!==0){if(e===2&&(n=gh(t),n!==0&&(s=n,e=Bh(t,n))),e===1)throw r=Pl,$a(t,0),js(t,s),gr(t,_t()),r;if(e===6)js(t,s);else{if(n=t.current.alternate,!(s&30)&&!Dk(n)&&(e=Pu(t,s),e===2&&(a=gh(t),a!==0&&(s=a,e=Bh(t,a))),e===1))throw r=Pl,$a(t,0),js(t,s),gr(t,_t()),r;switch(t.finishedWork=n,t.finishedLanes=s,e){case 0:case 1:throw Error(Q(345));case 2:Sa(t,fr,Hn);break;case 3:if(js(t,s),(s&130023424)===s&&(e=Xm+500-_t(),10<e)){if(lu(t,0)!==0)break;if(n=t.suspendedLanes,(n&s)!==s){rr(),t.pingedLanes|=t.suspendedLanes&n;break}t.timeoutHandle=Ch(Sa.bind(null,t,fr,Hn),e);break}Sa(t,fr,Hn);break;case 4:if(js(t,s),(s&4194240)===s)break;for(e=t.eventTimes,n=-1;0<s;){var o=31-rn(s);a=1<<o,o=e[o],o>n&&(n=o),s&=~a}if(s=n,s=_t()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Ik(s/1960))-s,10<s){t.timeoutHandle=Ch(Sa.bind(null,t,fr,Hn),s);break}Sa(t,fr,Hn);break;case 5:Sa(t,fr,Hn);break;default:throw Error(Q(329))}}}return gr(t,_t()),t.callbackNode===r?cb.bind(null,t):null}function Bh(t,e){var r=sl;return t.current.memoizedState.isDehydrated&&($a(t,e).flags|=256),t=Pu(t,e),t!==2&&(e=fr,fr=r,e!==null&&Kh(e)),t}function Kh(t){fr===null?fr=t:fr.push.apply(fr,t)}function Dk(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var s=0;s<r.length;s++){var n=r[s],a=n.getSnapshot;n=n.value;try{if(!sn(a(),n))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function js(t,e){for(e&=~Jm,e&=~gd,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-rn(e),s=1<<r;t[r]=-1,e&=~s}}function _y(t){if(Ze&6)throw Error(Q(327));Lo();var e=lu(t,0);if(!(e&1))return gr(t,_t()),null;var r=Pu(t,e);if(t.tag!==0&&r===2){var s=gh(t);s!==0&&(e=s,r=Bh(t,s))}if(r===1)throw r=Pl,$a(t,0),js(t,e),gr(t,_t()),r;if(r===6)throw Error(Q(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Sa(t,fr,Hn),gr(t,_t()),null}function ev(t,e){var r=Ze;Ze|=1;try{return t(e)}finally{Ze=r,Ze===0&&(ui=_t()+500,hd&&ua())}}function Ha(t){zs!==null&&zs.tag===0&&!(Ze&6)&&Lo();var e=Ze;Ze|=1;var r=$r.transition,s=Xe;try{if($r.transition=null,Xe=1,t)return t()}finally{Xe=s,$r.transition=r,Ze=e,!(Ze&6)&&ua()}}function tv(){br=Ro.current,ct(Ro)}function $a(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,dk(r)),kt!==null)for(r=kt.return;r!==null;){var s=r;switch(Dm(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&hu();break;case 3:li(),ct(mr),ct(Zt),Hm();break;case 5:qm(s);break;case 4:li();break;case 13:ct(mt);break;case 19:ct(mt);break;case 10:Lm(s.type._context);break;case 22:case 23:tv()}r=r.return}if(Lt=t,kt=t=Js(t.current,null),qt=br=e,Ot=0,Pl=null,Jm=gd=qa=0,fr=sl=null,ka!==null){for(e=0;e<ka.length;e++)if(r=ka[e],s=r.interleaved,s!==null){r.interleaved=null;var n=s.next,a=r.pending;if(a!==null){var o=a.next;a.next=n,s.next=o}r.pending=s}ka=null}return t}function ub(t,e){do{var r=kt;try{if(Fm(),Uc.current=Su,bu){for(var s=vt.memoizedState;s!==null;){var n=s.queue;n!==null&&(n.pending=null),s=s.next}bu=!1}if(Va=0,$t=Rt=vt=null,rl=!1,_l=0,Ym.current=null,r===null||r.return===null){Ot=1,Pl=e,kt=null;break}e:{var a=t,o=r.return,i=r,c=e;if(e=qt,i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=i,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var m=d.alternate;m?(d.updateQueue=m.updateQueue,d.memoizedState=m.memoizedState,d.lanes=m.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=uy(o);if(f!==null){f.flags&=-257,dy(f,o,i,a,e),f.mode&1&&cy(a,u,e),e=f,c=u;var w=e.updateQueue;if(w===null){var p=new Set;p.add(c),e.updateQueue=p}else w.add(c);break e}else{if(!(e&1)){cy(a,u,e),rv();break e}c=Error(Q(426))}}else if(ht&&i.mode&1){var y=uy(o);if(y!==null){!(y.flags&65536)&&(y.flags|=256),dy(y,o,i,a,e),Mm(ci(c,i));break e}}a=c=ci(c,i),Ot!==4&&(Ot=2),sl===null?sl=[a]:sl.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,e&=-e,a.lanes|=e;var g=Ww(a,c,e);ny(a,g);break e;case 1:i=c;var v=a.type,b=a.stateNode;if(!(a.flags&128)&&(typeof v.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Zs===null||!Zs.has(b)))){a.flags|=65536,e&=-e,a.lanes|=e;var S=Qw(a,i,e);ny(a,S);break e}}a=a.return}while(a!==null)}hb(r)}catch(E){e=E,kt===r&&r!==null&&(kt=r=r.return);continue}break}while(!0)}function db(){var t=_u.current;return _u.current=Su,t===null?Su:t}function rv(){(Ot===0||Ot===3||Ot===2)&&(Ot=4),Lt===null||!(qa&268435455)&&!(gd&268435455)||js(Lt,qt)}function Pu(t,e){var r=Ze;Ze|=2;var s=db();(Lt!==t||qt!==e)&&(Hn=null,$a(t,e));do try{Mk();break}catch(n){ub(t,n)}while(!0);if(Fm(),Ze=r,_u.current=s,kt!==null)throw Error(Q(261));return Lt=null,qt=0,Ot}function Mk(){for(;kt!==null;)fb(kt)}function $k(){for(;kt!==null&&!lP();)fb(kt)}function fb(t){var e=mb(t.alternate,t,br);t.memoizedProps=t.pendingProps,e===null?hb(t):kt=e,Ym.current=null}function hb(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=Rk(r,e),r!==null){r.flags&=32767,kt=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ot=6,kt=null;return}}else if(r=jk(r,e,br),r!==null){kt=r;return}if(e=e.sibling,e!==null){kt=e;return}kt=e=t}while(e!==null);Ot===0&&(Ot=5)}function Sa(t,e,r){var s=Xe,n=$r.transition;try{$r.transition=null,Xe=1,Fk(t,e,r,s)}finally{$r.transition=n,Xe=s}return null}function Fk(t,e,r,s){do Lo();while(zs!==null);if(Ze&6)throw Error(Q(327));r=t.finishedWork;var n=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(Q(177));t.callbackNode=null,t.callbackPriority=0;var a=r.lanes|r.childLanes;if(yP(t,a),t===Lt&&(kt=Lt=null,qt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||xc||(xc=!0,vb(iu,function(){return Lo(),null})),a=(r.flags&15990)!==0,r.subtreeFlags&15990||a){a=$r.transition,$r.transition=null;var o=Xe;Xe=1;var i=Ze;Ze|=4,Ym.current=null,Ak(t,r),ib(r,t),sk(_h),cu=!!Sh,_h=Sh=null,t.current=r,Ok(r),cP(),Ze=i,Xe=o,$r.transition=a}else t.current=r;if(xc&&(xc=!1,zs=t,Cu=n),a=t.pendingLanes,a===0&&(Zs=null),fP(r.stateNode),gr(t,_t()),e!==null)for(s=t.onRecoverableError,r=0;r<e.length;r++)n=e[r],s(n.value,{componentStack:n.stack,digest:n.digest});if(Eu)throw Eu=!1,t=qh,qh=null,t;return Cu&1&&t.tag!==0&&Lo(),a=t.pendingLanes,a&1?t===Hh?al++:(al=0,Hh=t):al=0,ua(),null}function Lo(){if(zs!==null){var t=Wx(Cu),e=$r.transition,r=Xe;try{if($r.transition=null,Xe=16>t?16:t,zs===null)var s=!1;else{if(t=zs,zs=null,Cu=0,Ze&6)throw Error(Q(331));var n=Ze;for(Ze|=4,ue=t.current;ue!==null;){var a=ue,o=a.child;if(ue.flags&16){var i=a.deletions;if(i!==null){for(var c=0;c<i.length;c++){var u=i[c];for(ue=u;ue!==null;){var d=ue;switch(d.tag){case 0:case 11:case 15:nl(8,d,a)}var h=d.child;if(h!==null)h.return=d,ue=h;else for(;ue!==null;){d=ue;var m=d.sibling,f=d.return;if(sb(d),d===u){ue=null;break}if(m!==null){m.return=f,ue=m;break}ue=f}}}var w=a.alternate;if(w!==null){var p=w.child;if(p!==null){w.child=null;do{var y=p.sibling;p.sibling=null,p=y}while(p!==null)}}ue=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,ue=o;else e:for(;ue!==null;){if(a=ue,a.flags&2048)switch(a.tag){case 0:case 11:case 15:nl(9,a,a.return)}var g=a.sibling;if(g!==null){g.return=a.return,ue=g;break e}ue=a.return}}var v=t.current;for(ue=v;ue!==null;){o=ue;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,ue=b;else e:for(o=v;ue!==null;){if(i=ue,i.flags&2048)try{switch(i.tag){case 0:case 11:case 15:vd(9,i)}}catch(E){xt(i,i.return,E)}if(i===o){ue=null;break e}var S=i.sibling;if(S!==null){S.return=i.return,ue=S;break e}ue=i.return}}if(Ze=n,ua(),kn&&typeof kn.onPostCommitFiberRoot=="function")try{kn.onPostCommitFiberRoot(ld,t)}catch{}s=!0}return s}finally{Xe=r,$r.transition=e}}return!1}function Ey(t,e,r){e=ci(r,e),e=Ww(t,e,1),t=Gs(t,e,1),e=rr(),t!==null&&($l(t,1,e),gr(t,e))}function xt(t,e,r){if(t.tag===3)Ey(t,t,r);else for(;e!==null;){if(e.tag===3){Ey(e,t,r);break}else if(e.tag===1){var s=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Zs===null||!Zs.has(s))){t=ci(r,t),t=Qw(e,t,1),e=Gs(e,t,1),t=rr(),e!==null&&($l(e,1,t),gr(e,t));break}}e=e.return}}function Lk(t,e,r){var s=t.pingCache;s!==null&&s.delete(e),e=rr(),t.pingedLanes|=t.suspendedLanes&r,Lt===t&&(qt&r)===r&&(Ot===4||Ot===3&&(qt&130023424)===qt&&500>_t()-Xm?$a(t,0):Jm|=r),gr(t,e)}function pb(t,e){e===0&&(t.mode&1?(e=cc,cc<<=1,!(cc&130023424)&&(cc=4194304)):e=1);var r=rr();t=as(t,e),t!==null&&($l(t,e,r),gr(t,r))}function Uk(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),pb(t,r)}function zk(t,e){var r=0;switch(t.tag){case 13:var s=t.stateNode,n=t.memoizedState;n!==null&&(r=n.retryLane);break;case 19:s=t.stateNode;break;default:throw Error(Q(314))}s!==null&&s.delete(e),pb(t,r)}var mb;mb=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||mr.current)pr=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return pr=!1,Nk(t,e,r);pr=!!(t.flags&131072)}else pr=!1,ht&&e.flags&1048576&&xw(e,vu,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;Vc(t,e),t=e.pendingProps;var n=ai(e,Zt.current);Fo(e,r),n=Km(null,e,s,t,n,r);var a=Wm();return e.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,vr(s)?(a=!0,pu(e)):a=!1,e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,zm(e),n.updater=md,e.stateNode=n,n._reactInternals=e,Ah(e,s,t,r),e=Dh(null,e,s,!0,a,r)):(e.tag=0,ht&&a&&Im(e),er(null,e,n,r),e=e.child),e;case 16:s=e.elementType;e:{switch(Vc(t,e),t=e.pendingProps,n=s._init,s=n(s._payload),e.type=s,n=e.tag=qk(s),t=Zr(s,t),n){case 0:e=Ih(null,e,s,t,r);break e;case 1:e=py(null,e,s,t,r);break e;case 11:e=fy(null,e,s,t,r);break e;case 14:e=hy(null,e,s,Zr(s.type,t),r);break e}throw Error(Q(306,s,""))}return e;case 0:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),Ih(t,e,s,n,r);case 1:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),py(t,e,s,n,r);case 3:e:{if(Jw(e),t===null)throw Error(Q(387));s=e.pendingProps,a=e.memoizedState,n=a.element,Cw(t,e),xu(e,s,null,r);var o=e.memoizedState;if(s=o.element,a.isDehydrated)if(a={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=a,e.memoizedState=a,e.flags&256){n=ci(Error(Q(423)),e),e=my(t,e,s,r,n);break e}else if(s!==n){n=ci(Error(Q(424)),e),e=my(t,e,s,r,n);break e}else for(_r=Qs(e.stateNode.containerInfo.firstChild),Er=e,ht=!0,tn=null,r=_w(e,null,s,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(oi(),s===n){e=os(t,e,r);break e}er(t,e,s,r)}e=e.child}return e;case 5:return Pw(e),t===null&&jh(e),s=e.type,n=e.pendingProps,a=t!==null?t.memoizedProps:null,o=n.children,Eh(s,n)?o=null:a!==null&&Eh(s,a)&&(e.flags|=32),Yw(t,e),er(t,e,o,r),e.child;case 6:return t===null&&jh(e),null;case 13:return Xw(t,e,r);case 4:return Vm(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=ii(e,null,s,r):er(t,e,s,r),e.child;case 11:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),fy(t,e,s,n,r);case 7:return er(t,e,e.pendingProps,r),e.child;case 8:return er(t,e,e.pendingProps.children,r),e.child;case 12:return er(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(s=e.type._context,n=e.pendingProps,a=e.memoizedProps,o=n.value,st(gu,s._currentValue),s._currentValue=o,a!==null)if(sn(a.value,o)){if(a.children===n.children&&!mr.current){e=os(t,e,r);break e}}else for(a=e.child,a!==null&&(a.return=e);a!==null;){var i=a.dependencies;if(i!==null){o=a.child;for(var c=i.firstContext;c!==null;){if(c.context===s){if(a.tag===1){c=es(-1,r&-r),c.tag=2;var u=a.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}}a.lanes|=r,c=a.alternate,c!==null&&(c.lanes|=r),Rh(a.return,r,e),i.lanes|=r;break}c=c.next}}else if(a.tag===10)o=a.type===e.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(Q(341));o.lanes|=r,i=o.alternate,i!==null&&(i.lanes|=r),Rh(o,r,e),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===e){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}er(t,e,n.children,r),e=e.child}return e;case 9:return n=e.type,s=e.pendingProps.children,Fo(e,r),n=Fr(n),s=s(n),e.flags|=1,er(t,e,s,r),e.child;case 14:return s=e.type,n=Zr(s,e.pendingProps),n=Zr(s.type,n),hy(t,e,s,n,r);case 15:return Gw(t,e,e.type,e.pendingProps,r);case 17:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),Vc(t,e),e.tag=1,vr(s)?(t=!0,pu(e)):t=!1,Fo(e,r),Kw(e,s,n),Ah(e,s,n,r),Dh(null,e,s,!0,t,r);case 19:return eb(t,e,r);case 22:return Zw(t,e,r)}throw Error(Q(156,e.tag))};function vb(t,e){return qx(t,e)}function Vk(t,e,r,s){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mr(t,e,r,s){return new Vk(t,e,r,s)}function nv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function qk(t){if(typeof t=="function")return nv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Sm)return 11;if(t===_m)return 14}return 2}function Js(t,e){var r=t.alternate;return r===null?(r=Mr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Bc(t,e,r,s,n,a){var o=2;if(s=t,typeof t=="function")nv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case wo:return Fa(r.children,n,a,e);case bm:o=8,n|=8;break;case rh:return t=Mr(12,r,e,n|2),t.elementType=rh,t.lanes=a,t;case nh:return t=Mr(13,r,e,n),t.elementType=nh,t.lanes=a,t;case sh:return t=Mr(19,r,e,n),t.elementType=sh,t.lanes=a,t;case Px:return yd(r,n,a,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ex:o=10;break e;case Cx:o=9;break e;case Sm:o=11;break e;case _m:o=14;break e;case _s:o=16,s=null;break e}throw Error(Q(130,t==null?t:typeof t,""))}return e=Mr(o,r,e,n),e.elementType=t,e.type=s,e.lanes=a,e}function Fa(t,e,r,s){return t=Mr(7,t,s,e),t.lanes=r,t}function yd(t,e,r,s){return t=Mr(22,t,s,e),t.elementType=Px,t.lanes=r,t.stateNode={isHidden:!1},t}function Pf(t,e,r){return t=Mr(6,t,null,e),t.lanes=r,t}function kf(t,e,r){return e=Mr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Hk(t,e,r,s,n){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=of(0),this.expirationTimes=of(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=of(0),this.identifierPrefix=s,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function sv(t,e,r,s,n,a,o,i,c){return t=new Hk(t,e,r,i,c),e===1?(e=1,a===!0&&(e|=8)):e=0,a=Mr(3,null,null,e),t.current=a,a.stateNode=t,a.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},zm(a),t}function Bk(t,e,r){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:xo,key:s==null?null:""+s,children:t,containerInfo:e,implementation:r}}function gb(t){if(!t)return sa;t=t._reactInternals;e:{if(no(t)!==t||t.tag!==1)throw Error(Q(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(vr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Q(171))}if(t.tag===1){var r=t.type;if(vr(r))return gw(t,r,e)}return e}function yb(t,e,r,s,n,a,o,i,c){return t=sv(r,s,!0,t,n,a,o,i,c),t.context=gb(null),r=t.current,s=rr(),n=Ys(r),a=es(s,n),a.callback=e??null,Gs(r,a,n),t.current.lanes=n,$l(t,n,s),gr(t,s),t}function xd(t,e,r,s){var n=e.current,a=rr(),o=Ys(n);return r=gb(r),e.context===null?e.context=r:e.pendingContext=r,e=es(a,o),e.payload={element:t},s=s===void 0?null:s,s!==null&&(e.callback=s),t=Gs(n,e,o),t!==null&&(nn(t,n,o,a),Lc(t,n,o)),o}function ku(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Cy(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function av(t,e){Cy(t,e),(t=t.alternate)&&Cy(t,e)}function Kk(){return null}var xb=typeof reportError=="function"?reportError:function(t){console.error(t)};function ov(t){this._internalRoot=t}wd.prototype.render=ov.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Q(409));xd(t,e,null,null)};wd.prototype.unmount=ov.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Ha(function(){xd(null,t,null,null)}),e[ss]=null}};function wd(t){this._internalRoot=t}wd.prototype.unstable_scheduleHydration=function(t){if(t){var e=Zx();t={blockedOn:null,target:t,priority:e};for(var r=0;r<Ns.length&&e!==0&&e<Ns[r].priority;r++);Ns.splice(r,0,t),r===0&&Jx(t)}};function iv(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function bd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Py(){}function Wk(t,e,r,s,n){if(n){if(typeof s=="function"){var a=s;s=function(){var u=ku(o);a.call(u)}}var o=yb(e,s,t,0,null,!1,!1,"",Py);return t._reactRootContainer=o,t[ss]=o.current,yl(t.nodeType===8?t.parentNode:t),Ha(),o}for(;n=t.lastChild;)t.removeChild(n);if(typeof s=="function"){var i=s;s=function(){var u=ku(c);i.call(u)}}var c=sv(t,0,!1,null,null,!1,!1,"",Py);return t._reactRootContainer=c,t[ss]=c.current,yl(t.nodeType===8?t.parentNode:t),Ha(function(){xd(e,c,r,s)}),c}function Sd(t,e,r,s,n){var a=r._reactRootContainer;if(a){var o=a;if(typeof n=="function"){var i=n;n=function(){var c=ku(o);i.call(c)}}xd(e,o,t,n)}else o=Wk(r,e,t,n,s);return ku(o)}Qx=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=qi(e.pendingLanes);r!==0&&(Pm(e,r|1),gr(e,_t()),!(Ze&6)&&(ui=_t()+500,ua()))}break;case 13:Ha(function(){var s=as(t,1);if(s!==null){var n=rr();nn(s,t,1,n)}}),av(t,1)}};km=function(t){if(t.tag===13){var e=as(t,134217728);if(e!==null){var r=rr();nn(e,t,134217728,r)}av(t,134217728)}};Gx=function(t){if(t.tag===13){var e=Ys(t),r=as(t,e);if(r!==null){var s=rr();nn(r,t,e,s)}av(t,e)}};Zx=function(){return Xe};Yx=function(t,e){var r=Xe;try{return Xe=t,e()}finally{Xe=r}};ph=function(t,e,r){switch(e){case"input":if(ih(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var s=r[e];if(s!==t&&s.form===t.form){var n=fd(s);if(!n)throw Error(Q(90));Nx(s),ih(s,n)}}}break;case"textarea":Rx(t,r);break;case"select":e=r.value,e!=null&&Io(t,!!r.multiple,e,!1)}};$x=ev;Fx=Ha;var Qk={usingClientEntryPoint:!1,Events:[Ll,Eo,fd,Dx,Mx,ev]},$i={findFiberByHostInstance:Pa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Gk={bundleType:$i.bundleType,version:$i.version,rendererPackageName:$i.rendererPackageName,rendererConfig:$i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ds.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=zx(t),t===null?null:t.stateNode},findFiberByHostInstance:$i.findFiberByHostInstance||Kk,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 wc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wc.isDisabled&&wc.supportsFiber)try{ld=wc.inject(Gk),kn=wc}catch{}}kr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Qk;kr.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!iv(e))throw Error(Q(200));return Bk(t,e,null,r)};kr.createRoot=function(t,e){if(!iv(t))throw Error(Q(299));var r=!1,s="",n=xb;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onRecoverableError!==void 0&&(n=e.onRecoverableError)),e=sv(t,1,!1,null,null,r,!1,s,n),t[ss]=e.current,yl(t.nodeType===8?t.parentNode:t),new ov(e)};kr.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Q(188)):(t=Object.keys(t).join(","),Error(Q(268,t)));return t=zx(e),t=t===null?null:t.stateNode,t};kr.flushSync=function(t){return Ha(t)};kr.hydrate=function(t,e,r){if(!bd(e))throw Error(Q(200));return Sd(null,t,e,!0,r)};kr.hydrateRoot=function(t,e,r){if(!iv(t))throw Error(Q(405));var s=r!=null&&r.hydratedSources||null,n=!1,a="",o=xb;if(r!=null&&(r.unstable_strictMode===!0&&(n=!0),r.identifierPrefix!==void 0&&(a=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),e=yb(e,null,t,1,r??null,n,!1,a,o),t[ss]=e.current,yl(t),s)for(t=0;t<s.length;t++)r=s[t],n=r._getVersion,n=n(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,n]:e.mutableSourceEagerHydrationData.push(r,n);return new wd(e)};kr.render=function(t,e,r){if(!bd(e))throw Error(Q(200));return Sd(null,t,e,!1,r)};kr.unmountComponentAtNode=function(t){if(!bd(t))throw Error(Q(40));return t._reactRootContainer?(Ha(function(){Sd(null,null,t,!1,function(){t._reactRootContainer=null,t[ss]=null})}),!0):!1};kr.unstable_batchedUpdates=ev;kr.unstable_renderSubtreeIntoContainer=function(t,e,r,s){if(!bd(r))throw Error(Q(200));if(t==null||t._reactInternals===void 0)throw Error(Q(38));return Sd(t,e,r,!1,s)};kr.version="18.3.1-next-f1338f8080-20240426";function wb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(wb)}catch(t){console.error(t)}}wb(),wx.exports=kr;var so=wx.exports;const Zk=fm(so);var bb,ky=so;bb=ky.createRoot,ky.hydrateRoot;function Yk(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var r,s,n,a,o=[],i="",c=t.split("/");for(c[0]||c.shift();n=c.shift();)r=n[0],r==="*"?(o.push(r),i+=n[1]==="?"?"(?:/(.*))?":"/(.*)"):r===":"?(s=n.indexOf("?",1),a=n.indexOf(".",1),o.push(n.substring(1,~s?s:~a?a:n.length)),i+=~s&&!~a?"(?:/([^/]+?))?":"/([^/]+?)",~a&&(i+=(~s?"?":"")+"\\"+n.substring(a))):i+="/"+n;return{keys:o,pattern:new RegExp("^"+i+(e?"(?=$|/)":"/?$"),"i")}}var Sb={exports:{}},_b={};/**
|
|
41
41
|
* @license React
|
|
42
42
|
* use-sync-external-store-shim.production.js
|
|
43
43
|
*
|
|
@@ -45,137 +45,137 @@ Error generating stack: `+a.message+`
|
|
|
45
45
|
*
|
|
46
46
|
* This source code is licensed under the MIT license found in the
|
|
47
47
|
* LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/var di=x;function Wk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Qk=typeof Object.is=="function"?Object.is:Wk,Gk=di.useState,Zk=di.useEffect,Yk=di.useLayoutEffect,Jk=di.useDebugValue;function Xk(t,e){var r=e(),s=Gk({inst:{value:r,getSnapshot:e}}),n=s[0].inst,a=s[1];return Yk(function(){n.value=r,n.getSnapshot=e,kf(n)&&a({inst:n})},[t,r,e]),Zk(function(){return kf(n)&&a({inst:n}),t(function(){kf(n)&&a({inst:n})})},[t]),Jk(r),r}function kf(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Qk(t,r)}catch{return!0}}function eN(t,e){return e()}var tN=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?eN:Xk;xb.useSyncExternalStore=di.useSyncExternalStore!==void 0?di.useSyncExternalStore:tN;yb.exports=xb;var rN=yb.exports;const nN=mm.useInsertionEffect,sN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",aN=sN?x.useLayoutEffect:x.useEffect,oN=nN||aN,wb=t=>{const e=x.useRef([t,(...r)=>e[0](...r)]).current;return oN(()=>{e[0]=t}),e[1]},iN="popstate",ov="pushState",iv="replaceState",lN="hashchange",Py=[iN,ov,iv,lN],cN=t=>{for(const e of Py)addEventListener(e,t);return()=>{for(const e of Py)removeEventListener(e,t)}},bb=(t,e)=>rN.useSyncExternalStore(cN,t,e),uN=()=>location.search,dN=({ssrSearch:t=""}={})=>bb(uN,()=>t),ky=()=>location.pathname,fN=({ssrPath:t}={})=>bb(ky,t?()=>t:ky),hN=(t,{replace:e=!1,state:r=null}={})=>history[e?iv:ov](r,"",t),pN=(t={})=>[fN(t),hN],Ny=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Ny]>"u"){for(const t of[ov,iv]){const e=history[t];history[t]=function(){const r=e.apply(this,arguments),s=new Event(t);return s.arguments=arguments,dispatchEvent(s),r}}Object.defineProperty(window,Ny,{value:!0})}const mN=(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())?"~"+e:e.slice(t.length)||"/",Sb=(t="")=>t==="/"?"":t,vN=(t,e)=>t[0]==="~"?t.slice(1):Sb(e)+t,gN=(t="",e)=>mN(jy(Sb(t)),jy(e)),jy=t=>{try{return decodeURI(t)}catch{return t}},_b={hook:pN,searchHook:dN,parser:Kk,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:t=>t},Eb=x.createContext(_b),Ul=()=>x.useContext(Eb),Cb={},Pb=x.createContext(Cb),yN=()=>x.useContext(Pb),Sd=t=>{const[e,r]=t.hook(t);return[gN(t.base,e),wb((s,n)=>r(vN(s,t.base),n))]},xN=()=>Sd(Ul()),kb=(t,e,r,s)=>{const{pattern:n,keys:a}=e instanceof RegExp?{keys:!1,pattern:e}:t(e||"*",s),o=n.exec(r)||[],[i,...c]=o;return i!==void 0?[!0,(()=>{const u=a!==!1?Object.fromEntries(a.map((h,m)=>[h,c[m]])):o.groups;let d={...c};return u&&Object.assign(d,u),d})(),...s?[i]:[]]:[!1,null]},wN=({children:t,...e})=>{var d,h;const r=Ul(),s=e.hook?_b:r;let n=s;const[a,o]=((d=e.ssrPath)==null?void 0:d.split("?"))??[];o&&(e.ssrSearch=o,e.ssrPath=a),e.hrefs=e.hrefs??((h=e.hook)==null?void 0:h.hrefs);let i=x.useRef({}),c=i.current,u=c;for(let m in s){const f=m==="base"?s[m]+(e[m]||""):e[m]||s[m];c===u&&f!==u[m]&&(i.current=u={...u}),u[m]=f,(f!==s[m]||f!==n[m])&&(n=u)}return x.createElement(Eb.Provider,{value:n,children:t})},Ry=({children:t,component:e},r)=>e?x.createElement(e,{params:r}):typeof t=="function"?t(r):t,bN=t=>{let e=x.useRef(Cb);const r=e.current;return e.current=Object.keys(t).length!==Object.keys(r).length||Object.entries(t).some(([s,n])=>n!==r[s])?t:r},wc=({path:t,nest:e,match:r,...s})=>{const n=Ul(),[a]=Sd(n),[o,i,c]=r??kb(n.parser,t,a,e),u=bN({...yN(),...i});if(!o)return null;const d=c?x.createElement(wN,{base:c},Ry(s,u)):Ry(s,u);return x.createElement(Pb.Provider,{value:u,children:d})};x.forwardRef((t,e)=>{const r=Ul(),[s,n]=Sd(r),{to:a="",href:o=a,onClick:i,asChild:c,children:u,className:d,replace:h,state:m,...f}=t,w=wb(v=>{v.ctrlKey||v.metaKey||v.altKey||v.shiftKey||v.button!==0||(i==null||i(v),v.defaultPrevented||(v.preventDefault(),n(o,t)))}),p=r.hrefs(o[0]==="~"?o.slice(1):r.base+o,r);return c&&x.isValidElement(u)?x.cloneElement(u,{onClick:w,href:p}):x.createElement("a",{...f,onClick:w,href:p,className:d!=null&&d.call?d(s===o):d,children:u,ref:e})});const Nb=t=>Array.isArray(t)?t.flatMap(e=>Nb(e&&e.type===x.Fragment?e.props.children:e)):[t],SN=({children:t,location:e})=>{const r=Ul(),[s]=Sd(r);for(const n of Nb(t)){let a=0;if(x.isValidElement(n)&&(a=kb(r.parser,n.props.path,e||s,n.props.nest))[0])return x.cloneElement(n,{match:a})}return null};var bi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ba=typeof window>"u"||"Deno"in globalThis;function tr(){}function _N(t,e){return typeof t=="function"?t(e):t}function Bh(t){return typeof t=="number"&&t>=0&&t!==1/0}function jb(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Xs(t,e){return typeof t=="function"?t(e):t}function Ar(t,e){return typeof t=="function"?t(e):t}function Ty(t,e){const{type:r="all",exact:s,fetchStatus:n,predicate:a,queryKey:o,stale:i}=t;if(o){if(s){if(e.queryHash!==lv(o,e.options))return!1}else if(!Pl(e.queryKey,o))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&e.isStale()!==i||n&&n!==e.state.fetchStatus||a&&!a(e))}function Ay(t,e){const{exact:r,status:s,predicate:n,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(r){if(Ka(e.options.mutationKey)!==Ka(a))return!1}else if(!Pl(e.options.mutationKey,a))return!1}return!(s&&e.state.status!==s||n&&!n(e))}function lv(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ka)(t)}function Ka(t){return JSON.stringify(t,(e,r)=>Kh(r)?Object.keys(r).sort().reduce((s,n)=>(s[n]=r[n],s),{}):r)}function Pl(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>Pl(t[r],e[r])):!1}function Rb(t,e){if(t===e)return t;const r=Oy(t)&&Oy(e);if(r||Kh(t)&&Kh(e)){const s=r?t:Object.keys(t),n=s.length,a=r?e:Object.keys(e),o=a.length,i=r?[]:{},c=new Set(s);let u=0;for(let d=0;d<o;d++){const h=r?d:a[d];(!r&&c.has(h)||r)&&t[h]===void 0&&e[h]===void 0?(i[h]=void 0,u++):(i[h]=Rb(t[h],e[h]),i[h]===t[h]&&t[h]!==void 0&&u++)}return n===o&&u===n?t:i}return e}function ku(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Oy(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Kh(t){if(!Iy(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Iy(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Iy(t){return Object.prototype.toString.call(t)==="[object Object]"}function EN(t){return new Promise(e=>{setTimeout(e,t)})}function Wh(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?Rb(t,e):e}function CN(t,e,r=0){const s=[...t,e];return r&&s.length>r?s.slice(1):s}function PN(t,e,r=0){const s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var cv=Symbol();function Tb(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===cv?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Ab(t,e){return typeof t=="function"?t(...e):!!t}var ja,Rs,Bo,G0,kN=(G0=class extends bi{constructor(){super();be(this,ja);be(this,Rs);be(this,Bo);ie(this,Bo,e=>{if(!Ba&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Rs)||this.setEventListener(O(this,Bo))}onUnsubscribe(){var e;this.hasListeners()||((e=O(this,Rs))==null||e.call(this),ie(this,Rs,void 0))}setEventListener(e){var r;ie(this,Bo,e),(r=O(this,Rs))==null||r.call(this),ie(this,Rs,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){O(this,ja)!==e&&(ie(this,ja,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof O(this,ja)=="boolean"?O(this,ja):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ja=new WeakMap,Rs=new WeakMap,Bo=new WeakMap,G0),uv=new kN,Ko,Ts,Wo,Z0,NN=(Z0=class extends bi{constructor(){super();be(this,Ko,!0);be(this,Ts);be(this,Wo);ie(this,Wo,e=>{if(!Ba&&window.addEventListener){const r=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",s)}}})}onSubscribe(){O(this,Ts)||this.setEventListener(O(this,Wo))}onUnsubscribe(){var e;this.hasListeners()||((e=O(this,Ts))==null||e.call(this),ie(this,Ts,void 0))}setEventListener(e){var r;ie(this,Wo,e),(r=O(this,Ts))==null||r.call(this),ie(this,Ts,e(this.setOnline.bind(this)))}setOnline(e){O(this,Ko)!==e&&(ie(this,Ko,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return O(this,Ko)}},Ko=new WeakMap,Ts=new WeakMap,Wo=new WeakMap,Z0),Nu=new NN;function Qh(){let t,e;const r=new Promise((n,a)=>{t=n,e=a});r.status="pending",r.catch(()=>{});function s(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{s({status:"fulfilled",value:n}),t(n)},r.reject=n=>{s({status:"rejected",reason:n}),e(n)},r}function jN(t){return Math.min(1e3*2**t,3e4)}function Ob(t){return(t??"online")==="online"?Nu.isOnline():!0}var Ib=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Db(t){let e=!1,r=0,s;const n=Qh(),a=()=>n.status!=="pending",o=p=>{var v;a()||(m(new Ib(p)),(v=t.abort)==null||v.call(t))},i=()=>{e=!0},c=()=>{e=!1},u=()=>uv.isFocused()&&(t.networkMode==="always"||Nu.isOnline())&&t.canRun(),d=()=>Ob(t.networkMode)&&t.canRun(),h=p=>{a()||(s==null||s(),n.resolve(p))},m=p=>{a()||(s==null||s(),n.reject(p))},f=()=>new Promise(p=>{var v;s=y=>{(a()||u())&&p(y)},(v=t.onPause)==null||v.call(t)}).then(()=>{var p;s=void 0,a()||(p=t.onContinue)==null||p.call(t)}),w=()=>{if(a())return;let p;const v=r===0?t.initialPromise:void 0;try{p=v??t.fn()}catch(y){p=Promise.reject(y)}Promise.resolve(p).then(h).catch(y=>{var N;if(a())return;const g=t.retry??(Ba?0:3),b=t.retryDelay??jN,S=typeof b=="function"?b(r,y):b,E=g===!0||typeof g=="number"&&r<g||typeof g=="function"&&g(r,y);if(e||!E){m(y);return}r++,(N=t.onFail)==null||N.call(t,r,y),EN(S).then(()=>u()?void 0:f()).then(()=>{e?m(y):w()})})};return{promise:n,status:()=>n.status,cancel:o,continue:()=>(s==null||s(),n),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?w():f().then(w),n)}}var RN=t=>setTimeout(t,0);function TN(){let t=[],e=0,r=i=>{i()},s=i=>{i()},n=RN;const a=i=>{e?t.push(i):n(()=>{r(i)})},o=()=>{const i=t;t=[],i.length&&n(()=>{s(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;e++;try{c=i()}finally{e--,e||o()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{n=i}}}var Tt=TN(),Ra,Y0,Mb=(Y0=class{constructor(){be(this,Ra)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Bh(this.gcTime)&&ie(this,Ra,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ba?1/0:5*60*1e3))}clearGcTimeout(){O(this,Ra)&&(clearTimeout(O(this,Ra)),ie(this,Ra,void 0))}},Ra=new WeakMap,Y0),Qo,Go,Tr,Ta,Mt,Tl,Aa,Jr,zn,J0,AN=(J0=class extends Mb{constructor(e){super();be(this,Jr);be(this,Qo);be(this,Go);be(this,Tr);be(this,Ta);be(this,Mt);be(this,Tl);be(this,Aa);ie(this,Aa,!1),ie(this,Tl,e.defaultOptions),this.setOptions(e.options),this.observers=[],ie(this,Ta,e.client),ie(this,Tr,O(this,Ta).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ie(this,Qo,ON(this.options)),this.state=e.state??O(this,Qo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=O(this,Mt))==null?void 0:e.promise}setOptions(e){this.options={...O(this,Tl),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Tr).remove(this)}setData(e,r){const s=Wh(this.state.data,e,this.options);return Le(this,Jr,zn).call(this,{data:s,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),s}setState(e,r){Le(this,Jr,zn).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var s,n;const r=(s=O(this,Mt))==null?void 0:s.promise;return(n=O(this,Mt))==null||n.cancel(e),r?r.then(tr).catch(tr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Qo))}isActive(){return this.observers.some(e=>Ar(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cv||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Xs(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!jb(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=O(this,Mt))==null||r.continue()}onOnline(){var r;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=O(this,Mt))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),O(this,Tr).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(O(this,Mt)&&(O(this,Aa)?O(this,Mt).cancel({revert:!0}):O(this,Mt).cancelRetry()),this.scheduleGc()),O(this,Tr).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,Jr,zn).call(this,{type:"invalidate"})}async fetch(e,r){var c,u,d,h,m,f,w,p,v,y,g,b;if(this.state.fetchStatus!=="idle"&&((c=O(this,Mt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,Mt))return O(this,Mt).continueRetry(),O(this,Mt).promise}if(e&&this.setOptions(e),!this.options.queryFn){const S=this.observers.find(E=>E.options.queryFn);S&&this.setOptions(S.options)}const s=new AbortController,n=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(ie(this,Aa,!0),s.signal)})},a=()=>{const S=Tb(this.options,r),N=(()=>{const j={client:O(this,Ta),queryKey:this.queryKey,meta:this.meta};return n(j),j})();return ie(this,Aa,!1),this.options.persister?this.options.persister(S,N,this):S(N)},i=(()=>{const S={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,Ta),state:this.state,fetchFn:a};return n(S),S})();(u=this.options.behavior)==null||u.onFetch(i,this),ie(this,Go,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=i.fetchOptions)==null?void 0:d.meta))&&Le(this,Jr,zn).call(this,{type:"fetch",meta:(h=i.fetchOptions)==null?void 0:h.meta}),ie(this,Mt,Db({initialPromise:r==null?void 0:r.initialPromise,fn:i.fetchFn,abort:s.abort.bind(s),onFail:(S,E)=>{Le(this,Jr,zn).call(this,{type:"failed",failureCount:S,error:E})},onPause:()=>{Le(this,Jr,zn).call(this,{type:"pause"})},onContinue:()=>{Le(this,Jr,zn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const S=await O(this,Mt).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(f=(m=O(this,Tr).config).onSuccess)==null||f.call(m,S,this),(p=(w=O(this,Tr).config).onSettled)==null||p.call(w,S,this.state.error,this),S}catch(S){if(S instanceof Ib){if(S.silent)return O(this,Mt).promise;if(S.revert){if(this.setState({...O(this,Go),fetchStatus:"idle"}),this.state.data===void 0)throw S;return this.state.data}}throw Le(this,Jr,zn).call(this,{type:"error",error:S}),(y=(v=O(this,Tr).config).onError)==null||y.call(v,S,this),(b=(g=O(this,Tr).config).onSettled)==null||b.call(g,this.state.data,S,this),S}finally{this.scheduleGc()}}},Qo=new WeakMap,Go=new WeakMap,Tr=new WeakMap,Ta=new WeakMap,Mt=new WeakMap,Tl=new WeakMap,Aa=new WeakMap,Jr=new WeakSet,zn=function(e){const r=s=>{switch(e.type){case"failed":return{...s,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...$b(s.data,this.options),fetchMeta:e.meta??null};case"success":const n={...s,data:e.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ie(this,Go,e.manual?n:void 0),n;case"error":const a=e.error;return{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...e.state}}};this.state=r(this.state),Tt.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),O(this,Tr).notify({query:this,type:"updated",action:e})})},J0);function $b(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ob(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function ON(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,s=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var vn,X0,IN=(X0=class extends bi{constructor(e={}){super();be(this,vn);this.config=e,ie(this,vn,new Map)}build(e,r,s){const n=r.queryKey,a=r.queryHash??lv(n,r);let o=this.get(a);return o||(o=new AN({client:e,queryKey:n,queryHash:a,options:e.defaultQueryOptions(r),state:s,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){O(this,vn).has(e.queryHash)||(O(this,vn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=O(this,vn).get(e.queryHash);r&&(e.destroy(),r===e&&O(this,vn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Tt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return O(this,vn).get(e)}getAll(){return[...O(this,vn).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(s=>Ty(r,s))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(s=>Ty(e,s)):r}notify(e){Tt.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){Tt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Tt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vn=new WeakMap,X0),gn,Jt,Oa,yn,ws,ex,DN=(ex=class extends Mb{constructor(e){super();be(this,yn);be(this,gn);be(this,Jt);be(this,Oa);this.mutationId=e.mutationId,ie(this,Jt,e.mutationCache),ie(this,gn,[]),this.state=e.state||Fb(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){O(this,gn).includes(e)||(O(this,gn).push(e),this.clearGcTimeout(),O(this,Jt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ie(this,gn,O(this,gn).filter(r=>r!==e)),this.scheduleGc(),O(this,Jt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){O(this,gn).length||(this.state.status==="pending"?this.scheduleGc():O(this,Jt).remove(this))}continue(){var e;return((e=O(this,Oa))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,i,c,u,d,h,m,f,w,p,v,y,g,b,S,E,N,j,R;const r=()=>{Le(this,yn,ws).call(this,{type:"continue"})};ie(this,Oa,Db({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(A,F)=>{Le(this,yn,ws).call(this,{type:"failed",failureCount:A,error:F})},onPause:()=>{Le(this,yn,ws).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,Jt).canRun(this)}));const s=this.state.status==="pending",n=!O(this,Oa).canStart();try{if(s)r();else{Le(this,yn,ws).call(this,{type:"pending",variables:e,isPaused:n}),await((o=(a=O(this,Jt).config).onMutate)==null?void 0:o.call(a,e,this));const F=await((c=(i=this.options).onMutate)==null?void 0:c.call(i,e));F!==this.state.context&&Le(this,yn,ws).call(this,{type:"pending",context:F,variables:e,isPaused:n})}const A=await O(this,Oa).start();return await((d=(u=O(this,Jt).config).onSuccess)==null?void 0:d.call(u,A,e,this.state.context,this)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,A,e,this.state.context)),await((w=(f=O(this,Jt).config).onSettled)==null?void 0:w.call(f,A,null,this.state.variables,this.state.context,this)),await((v=(p=this.options).onSettled)==null?void 0:v.call(p,A,null,e,this.state.context)),Le(this,yn,ws).call(this,{type:"success",data:A}),A}catch(A){try{throw await((g=(y=O(this,Jt).config).onError)==null?void 0:g.call(y,A,e,this.state.context,this)),await((S=(b=this.options).onError)==null?void 0:S.call(b,A,e,this.state.context)),await((N=(E=O(this,Jt).config).onSettled)==null?void 0:N.call(E,void 0,A,this.state.variables,this.state.context,this)),await((R=(j=this.options).onSettled)==null?void 0:R.call(j,void 0,A,e,this.state.context)),A}finally{Le(this,yn,ws).call(this,{type:"error",error:A})}}finally{O(this,Jt).runNext(this)}}},gn=new WeakMap,Jt=new WeakMap,Oa=new WeakMap,yn=new WeakSet,ws=function(e){const r=s=>{switch(e.type){case"failed":return{...s,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...s,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:e.error,failureCount:s.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Tt.batch(()=>{O(this,gn).forEach(s=>{s.onMutationUpdate(e)}),O(this,Jt).notify({mutation:this,type:"updated",action:e})})},ex);function Fb(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Kn,Xr,Al,tx,MN=(tx=class extends bi{constructor(e={}){super();be(this,Kn);be(this,Xr);be(this,Al);this.config=e,ie(this,Kn,new Set),ie(this,Xr,new Map),ie(this,Al,0)}build(e,r,s){const n=new DN({mutationCache:this,mutationId:++rc(this,Al)._,options:e.defaultMutationOptions(r),state:s});return this.add(n),n}add(e){O(this,Kn).add(e);const r=bc(e);if(typeof r=="string"){const s=O(this,Xr).get(r);s?s.push(e):O(this,Xr).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(O(this,Kn).delete(e)){const r=bc(e);if(typeof r=="string"){const s=O(this,Xr).get(r);if(s)if(s.length>1){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}else s[0]===e&&O(this,Xr).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=bc(e);if(typeof r=="string"){const s=O(this,Xr).get(r),n=s==null?void 0:s.find(a=>a.state.status==="pending");return!n||n===e}else return!0}runNext(e){var s;const r=bc(e);if(typeof r=="string"){const n=(s=O(this,Xr).get(r))==null?void 0:s.find(a=>a!==e&&a.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Tt.batch(()=>{O(this,Kn).forEach(e=>{this.notify({type:"removed",mutation:e})}),O(this,Kn).clear(),O(this,Xr).clear()})}getAll(){return Array.from(O(this,Kn))}find(e){const r={exact:!0,...e};return this.getAll().find(s=>Ay(r,s))}findAll(e={}){return this.getAll().filter(r=>Ay(e,r))}notify(e){Tt.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return Tt.batch(()=>Promise.all(e.map(r=>r.continue().catch(tr))))}},Kn=new WeakMap,Xr=new WeakMap,Al=new WeakMap,tx);function bc(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Dy(t){return{onFetch:(e,r)=>{var d,h,m,f,w;const s=e.options,n=(m=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,a=((f=e.state.data)==null?void 0:f.pages)||[],o=((w=e.state.data)==null?void 0:w.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const v=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?p=!0:e.signal.addEventListener("abort",()=>{p=!0}),e.signal)})},y=Tb(e.options,e.fetchOptions),g=async(b,S,E)=>{if(p)return Promise.reject();if(S==null&&b.pages.length)return Promise.resolve(b);const j=(()=>{const T={client:e.client,queryKey:e.queryKey,pageParam:S,direction:E?"backward":"forward",meta:e.options.meta};return v(T),T})(),R=await y(j),{maxPages:A}=e.options,F=E?PN:CN;return{pages:F(b.pages,R,A),pageParams:F(b.pageParams,S,A)}};if(n&&a.length){const b=n==="backward",S=b?$N:My,E={pages:a,pageParams:o},N=S(s,E);i=await g(E,N,b)}else{const b=t??a.length;do{const S=c===0?o[0]??s.initialPageParam:My(s,i);if(c>0&&S==null)break;i=await g(i,S),c++}while(c<b)}return i};e.options.persister?e.fetchFn=()=>{var p,v;return(v=(p=e.options).persister)==null?void 0:v.call(p,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=u}}}function My(t,{pages:e,pageParams:r}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,r[s],r):void 0}function $N(t,{pages:e,pageParams:r}){var s;return e.length>0?(s=t.getPreviousPageParam)==null?void 0:s.call(t,e[0],e,r[0],r):void 0}var yt,As,Os,Zo,Yo,Is,Jo,Xo,rx,FN=(rx=class{constructor(t={}){be(this,yt);be(this,As);be(this,Os);be(this,Zo);be(this,Yo);be(this,Is);be(this,Jo);be(this,Xo);ie(this,yt,t.queryCache||new IN),ie(this,As,t.mutationCache||new MN),ie(this,Os,t.defaultOptions||{}),ie(this,Zo,new Map),ie(this,Yo,new Map),ie(this,Is,0)}mount(){rc(this,Is)._++,O(this,Is)===1&&(ie(this,Jo,uv.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,yt).onFocus())})),ie(this,Xo,Nu.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,yt).onOnline())})))}unmount(){var t,e;rc(this,Is)._--,O(this,Is)===0&&((t=O(this,Jo))==null||t.call(this),ie(this,Jo,void 0),(e=O(this,Xo))==null||e.call(this),ie(this,Xo,void 0))}isFetching(t){return O(this,yt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return O(this,As).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=O(this,yt).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=O(this,yt).build(this,e),s=r.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Xs(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return O(this,yt).findAll(t).map(({queryKey:e,state:r})=>{const s=r.data;return[e,s]})}setQueryData(t,e,r){const s=this.defaultQueryOptions({queryKey:t}),n=O(this,yt).get(s.queryHash),a=n==null?void 0:n.state.data,o=_N(e,a);if(o!==void 0)return O(this,yt).build(this,s).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return Tt.batch(()=>O(this,yt).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=O(this,yt).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=O(this,yt);Tt.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=O(this,yt);return Tt.batch(()=>(r.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},s=Tt.batch(()=>O(this,yt).findAll(t).map(n=>n.cancel(r)));return Promise.all(s).then(tr).catch(tr)}invalidateQueries(t,e={}){return Tt.batch(()=>(O(this,yt).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},s=Tt.batch(()=>O(this,yt).findAll(t).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(tr)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(tr)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=O(this,yt).build(this,e);return r.isStaleByTime(Xs(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(tr).catch(tr)}fetchInfiniteQuery(t){return t.behavior=Dy(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(tr).catch(tr)}ensureInfiniteQueryData(t){return t.behavior=Dy(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Nu.isOnline()?O(this,As).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,yt)}getMutationCache(){return O(this,As)}getDefaultOptions(){return O(this,Os)}setDefaultOptions(t){ie(this,Os,t)}setQueryDefaults(t,e){O(this,Zo).set(Ka(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...O(this,Zo).values()],r={};return e.forEach(s=>{Pl(t,s.queryKey)&&Object.assign(r,s.defaultOptions)}),r}setMutationDefaults(t,e){O(this,Yo).set(Ka(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...O(this,Yo).values()],r={};return e.forEach(s=>{Pl(t,s.mutationKey)&&Object.assign(r,s.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...O(this,Os).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=lv(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===cv&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...O(this,Os).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){O(this,yt).clear(),O(this,As).clear()}},yt=new WeakMap,As=new WeakMap,Os=new WeakMap,Zo=new WeakMap,Yo=new WeakMap,Is=new WeakMap,Jo=new WeakMap,Xo=new WeakMap,rx),lr,Ke,Ol,Xt,Ia,ei,Wn,Ds,Il,ti,ri,Da,Ma,Ms,ni,Je,Bi,Gh,Zh,Yh,Jh,Xh,ep,tp,Lb,nx,LN=(nx=class extends bi{constructor(e,r){super();be(this,Je);be(this,lr);be(this,Ke);be(this,Ol);be(this,Xt);be(this,Ia);be(this,ei);be(this,Wn);be(this,Ds);be(this,Il);be(this,ti);be(this,ri);be(this,Da);be(this,Ma);be(this,Ms);be(this,ni,new Set);this.options=r,ie(this,lr,e),ie(this,Ds,null),ie(this,Wn,Qh()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Ke).addObserver(this),$y(O(this,Ke),this.options)?Le(this,Je,Bi).call(this):this.updateResult(),Le(this,Je,Jh).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rp(O(this,Ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rp(O(this,Ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,Je,Xh).call(this),Le(this,Je,ep).call(this),O(this,Ke).removeObserver(this)}setOptions(e){const r=this.options,s=O(this,Ke);if(this.options=O(this,lr).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ar(this.options.enabled,O(this,Ke))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,Je,tp).call(this),O(this,Ke).setOptions(this.options),r._defaulted&&!ku(this.options,r)&&O(this,lr).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Ke),observer:this});const n=this.hasListeners();n&&Fy(O(this,Ke),s,this.options,r)&&Le(this,Je,Bi).call(this),this.updateResult(),n&&(O(this,Ke)!==s||Ar(this.options.enabled,O(this,Ke))!==Ar(r.enabled,O(this,Ke))||Xs(this.options.staleTime,O(this,Ke))!==Xs(r.staleTime,O(this,Ke)))&&Le(this,Je,Gh).call(this);const a=Le(this,Je,Zh).call(this);n&&(O(this,Ke)!==s||Ar(this.options.enabled,O(this,Ke))!==Ar(r.enabled,O(this,Ke))||a!==O(this,Ms))&&Le(this,Je,Yh).call(this,a)}getOptimisticResult(e){const r=O(this,lr).getQueryCache().build(O(this,lr),e),s=this.createResult(r,e);return zN(this,s)&&(ie(this,Xt,s),ie(this,ei,this.options),ie(this,Ia,O(this,Ke).state)),s}getCurrentResult(){return O(this,Xt)}trackResult(e,r){return new Proxy(e,{get:(s,n)=>(this.trackProp(n),r==null||r(n),n==="promise"&&!this.options.experimental_prefetchInRender&&O(this,Wn).status==="pending"&&O(this,Wn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,n))})}trackProp(e){O(this,ni).add(e)}getCurrentQuery(){return O(this,Ke)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=O(this,lr).defaultQueryOptions(e),s=O(this,lr).getQueryCache().build(O(this,lr),r);return s.fetch().then(()=>this.createResult(s,r))}fetch(e){return Le(this,Je,Bi).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,Xt)))}createResult(e,r){var A;const s=O(this,Ke),n=this.options,a=O(this,Xt),o=O(this,Ia),i=O(this,ei),u=e!==s?e.state:O(this,Ol),{state:d}=e;let h={...d},m=!1,f;if(r._optimisticResults){const F=this.hasListeners(),T=!F&&$y(e,r),_=F&&Fy(e,s,r,n);(T||_)&&(h={...h,...$b(d.data,e.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:w,errorUpdatedAt:p,status:v}=h;f=h.data;let y=!1;if(r.placeholderData!==void 0&&f===void 0&&v==="pending"){let F;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(F=a.data,y=!0):F=typeof r.placeholderData=="function"?r.placeholderData((A=O(this,ri))==null?void 0:A.state.data,O(this,ri)):r.placeholderData,F!==void 0&&(v="success",f=Wh(a==null?void 0:a.data,F,r),m=!0)}if(r.select&&f!==void 0&&!y)if(a&&f===(o==null?void 0:o.data)&&r.select===O(this,Il))f=O(this,ti);else try{ie(this,Il,r.select),f=r.select(f),f=Wh(a==null?void 0:a.data,f,r),ie(this,ti,f),ie(this,Ds,null)}catch(F){ie(this,Ds,F)}O(this,Ds)&&(w=O(this,Ds),f=O(this,ti),p=Date.now(),v="error");const g=h.fetchStatus==="fetching",b=v==="pending",S=v==="error",E=b&&g,N=f!==void 0,R={status:v,fetchStatus:h.fetchStatus,isPending:b,isSuccess:v==="success",isError:S,isInitialLoading:E,isLoading:E,data:f,dataUpdatedAt:h.dataUpdatedAt,error:w,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:g,isRefetching:g&&!b,isLoadingError:S&&!N,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:S&&N,isStale:dv(e,r),refetch:this.refetch,promise:O(this,Wn),isEnabled:Ar(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const F=I=>{R.status==="error"?I.reject(R.error):R.data!==void 0&&I.resolve(R.data)},T=()=>{const I=ie(this,Wn,R.promise=Qh());F(I)},_=O(this,Wn);switch(_.status){case"pending":e.queryHash===s.queryHash&&F(_);break;case"fulfilled":(R.status==="error"||R.data!==_.value)&&T();break;case"rejected":(R.status!=="error"||R.error!==_.reason)&&T();break}}return R}updateResult(){const e=O(this,Xt),r=this.createResult(O(this,Ke),this.options);if(ie(this,Ia,O(this,Ke).state),ie(this,ei,this.options),O(this,Ia).data!==void 0&&ie(this,ri,O(this,Ke)),ku(r,e))return;ie(this,Xt,r);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!O(this,ni).size)return!0;const o=new Set(a??O(this,ni));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,Xt)).some(i=>{const c=i;return O(this,Xt)[c]!==e[c]&&o.has(c)})};Le(this,Je,Lb).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,Je,Jh).call(this)}},lr=new WeakMap,Ke=new WeakMap,Ol=new WeakMap,Xt=new WeakMap,Ia=new WeakMap,ei=new WeakMap,Wn=new WeakMap,Ds=new WeakMap,Il=new WeakMap,ti=new WeakMap,ri=new WeakMap,Da=new WeakMap,Ma=new WeakMap,Ms=new WeakMap,ni=new WeakMap,Je=new WeakSet,Bi=function(e){Le(this,Je,tp).call(this);let r=O(this,Ke).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(tr)),r},Gh=function(){Le(this,Je,Xh).call(this);const e=Xs(this.options.staleTime,O(this,Ke));if(Ba||O(this,Xt).isStale||!Bh(e))return;const s=jb(O(this,Xt).dataUpdatedAt,e)+1;ie(this,Da,setTimeout(()=>{O(this,Xt).isStale||this.updateResult()},s))},Zh=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Ke)):this.options.refetchInterval)??!1},Yh=function(e){Le(this,Je,ep).call(this),ie(this,Ms,e),!(Ba||Ar(this.options.enabled,O(this,Ke))===!1||!Bh(O(this,Ms))||O(this,Ms)===0)&&ie(this,Ma,setInterval(()=>{(this.options.refetchIntervalInBackground||uv.isFocused())&&Le(this,Je,Bi).call(this)},O(this,Ms)))},Jh=function(){Le(this,Je,Gh).call(this),Le(this,Je,Yh).call(this,Le(this,Je,Zh).call(this))},Xh=function(){O(this,Da)&&(clearTimeout(O(this,Da)),ie(this,Da,void 0))},ep=function(){O(this,Ma)&&(clearInterval(O(this,Ma)),ie(this,Ma,void 0))},tp=function(){const e=O(this,lr).getQueryCache().build(O(this,lr),this.options);if(e===O(this,Ke))return;const r=O(this,Ke);ie(this,Ke,e),ie(this,Ol,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},Lb=function(e){Tt.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(O(this,Xt))}),O(this,lr).getQueryCache().notify({query:O(this,Ke),type:"observerResultsUpdated"})})},nx);function UN(t,e){return Ar(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function $y(t,e){return UN(t,e)||t.state.data!==void 0&&rp(t,e,e.refetchOnMount)}function rp(t,e,r){if(Ar(e.enabled,t)!==!1&&Xs(e.staleTime,t)!=="static"){const s=typeof r=="function"?r(t):r;return s==="always"||s!==!1&&dv(t,e)}return!1}function Fy(t,e,r,s){return(t!==e||Ar(s.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&dv(t,r)}function dv(t,e){return Ar(e.enabled,t)!==!1&&t.isStaleByTime(Xs(e.staleTime,t))}function zN(t,e){return!ku(t.getCurrentResult(),e)}var $s,Fs,cr,Qn,ts,Bc,np,sx,VN=(sx=class extends bi{constructor(r,s){super();be(this,ts);be(this,$s);be(this,Fs);be(this,cr);be(this,Qn);ie(this,$s,r),this.setOptions(s),this.bindMethods(),Le(this,ts,Bc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var n;const s=this.options;this.options=O(this,$s).defaultMutationOptions(r),ku(this.options,s)||O(this,$s).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,cr),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Ka(s.mutationKey)!==Ka(this.options.mutationKey)?this.reset():((n=O(this,cr))==null?void 0:n.state.status)==="pending"&&O(this,cr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=O(this,cr))==null||r.removeObserver(this)}onMutationUpdate(r){Le(this,ts,Bc).call(this),Le(this,ts,np).call(this,r)}getCurrentResult(){return O(this,Fs)}reset(){var r;(r=O(this,cr))==null||r.removeObserver(this),ie(this,cr,void 0),Le(this,ts,Bc).call(this),Le(this,ts,np).call(this)}mutate(r,s){var n;return ie(this,Qn,s),(n=O(this,cr))==null||n.removeObserver(this),ie(this,cr,O(this,$s).getMutationCache().build(O(this,$s),this.options)),O(this,cr).addObserver(this),O(this,cr).execute(r)}},$s=new WeakMap,Fs=new WeakMap,cr=new WeakMap,Qn=new WeakMap,ts=new WeakSet,Bc=function(){var s;const r=((s=O(this,cr))==null?void 0:s.state)??Fb();ie(this,Fs,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},np=function(r){Tt.batch(()=>{var s,n,a,o,i,c,u,d;if(O(this,Qn)&&this.hasListeners()){const h=O(this,Fs).variables,m=O(this,Fs).context;(r==null?void 0:r.type)==="success"?((n=(s=O(this,Qn)).onSuccess)==null||n.call(s,r.data,h,m),(o=(a=O(this,Qn)).onSettled)==null||o.call(a,r.data,null,h,m)):(r==null?void 0:r.type)==="error"&&((c=(i=O(this,Qn)).onError)==null||c.call(i,r.error,h,m),(d=(u=O(this,Qn)).onSettled)==null||d.call(u,void 0,r.error,h,m))}this.listeners.forEach(h=>{h(O(this,Fs))})})},sx),Ub=x.createContext(void 0),yr=t=>{const e=x.useContext(Ub);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},qN=({client:t,children:e})=>(x.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),l.jsx(Ub.Provider,{value:t,children:e})),zb=x.createContext(!1),HN=()=>x.useContext(zb);zb.Provider;function BN(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var KN=x.createContext(BN()),WN=()=>x.useContext(KN),QN=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},GN=t=>{x.useEffect(()=>{t.clearReset()},[t])},ZN=({result:t,errorResetBoundary:e,throwOnError:r,query:s,suspense:n})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(n&&t.data===void 0||Ab(r,[t.error,s])),YN=t=>{if(t.suspense){const e=s=>s==="static"?s:Math.max(s??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...s)=>e(r(...s)):e(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},JN=(t,e)=>t.isLoading&&t.isFetching&&!e,XN=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Ly=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function ej(t,e,r){var h,m,f,w,p;const s=HN(),n=WN(),a=yr(),o=a.defaultQueryOptions(t);(m=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||m.call(h,o),o._optimisticResults=s?"isRestoring":"optimistic",YN(o),QN(o,n),GN(n);const i=!a.getQueryCache().get(o.queryHash),[c]=x.useState(()=>new e(a,o)),u=c.getOptimisticResult(o),d=!s&&t.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(v=>{const y=d?c.subscribe(Tt.batchCalls(v)):tr;return c.updateResult(),y},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),x.useEffect(()=>{c.setOptions(o)},[o,c]),XN(o,u))throw Ly(o,c,n);if(ZN({result:u,errorResetBoundary:n,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((w=(f=a.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||w.call(f,o,u),o.experimental_prefetchInRender&&!Ba&&JN(u,s)){const v=i?Ly(o,c,n):(p=a.getQueryCache().get(o.queryHash))==null?void 0:p.promise;v==null||v.catch(tr).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function hr(t,e){return ej(t,LN)}function At(t,e){const r=yr(),[s]=x.useState(()=>new VN(r,t));x.useEffect(()=>{s.setOptions(t)},[s,t]);const n=x.useSyncExternalStore(x.useCallback(o=>s.subscribe(Tt.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=x.useCallback((o,i)=>{s.mutate(o,i).catch(tr)},[s]);if(n.error&&Ab(s.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}const tj="x-agent-deck-client",rj="dashboard",Vb={[tj]:rj};async function qb(t){if(t.ok)return;let e=t.statusText;try{const r=await t.text();try{const s=JSON.parse(r);e=s.error||s.message||e}catch{r.trim()&&(e=`${t.status}: ${r}`)}}catch(r){console.warn("Response body parsing failed:",r)}throw new Error(e)}async function Oe(t,e,r){const s=await fetch(e,{method:t,headers:{...Vb,...r?{"Content-Type":"application/json"}:{}},body:r?JSON.stringify(r):void 0});return await qb(s),s}const nj=({on401:t})=>async({queryKey:e})=>{const r=e.join("/"),s=await fetch(r,{headers:Vb});return await qb(s),await s.json()},sj=new FN({defaultOptions:{queries:{queryFn:nj({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),aj=1,oj=1e6;let Nf=0;function ij(){return Nf=(Nf+1)%Number.MAX_SAFE_INTEGER,Nf.toString()}const jf=new Map,Uy=t=>{if(jf.has(t))return;const e=setTimeout(()=>{jf.delete(t),ol({type:"REMOVE_TOAST",toastId:t})},oj);jf.set(t,e)},lj=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,aj)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;return r?Uy(r):t.toasts.forEach(s=>{Uy(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},Kc=[];let Wc={toasts:[]};function ol(t){Wc=lj(Wc,t),Kc.forEach(e=>{e(Wc)})}function cj({...t}){const e=ij(),r=n=>ol({type:"UPDATE_TOAST",toast:{...n,id:e}}),s=()=>ol({type:"DISMISS_TOAST",toastId:e});return ol({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:n=>{n||s()}}}),{id:e,dismiss:s,update:r}}function or(){const[t,e]=x.useState(Wc);return x.useEffect(()=>(Kc.push(e),()=>{const r=Kc.indexOf(e);r>-1&&Kc.splice(r,1)}),[t]),{...t,toast:cj,dismiss:r=>ol({type:"DISMISS_TOAST",toastId:r})}}function Se(t,e,{checkForDefaultPrevented:r=!0}={}){return function(n){if(t==null||t(n),r===!1||!n.defaultPrevented)return e==null?void 0:e(n)}}function zy(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Hb(...t){return e=>{let r=!1;const s=t.map(n=>{const a=zy(n,e);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let n=0;n<s.length;n++){const a=s[n];typeof a=="function"?a():zy(t[n],null)}}}}function et(...t){return x.useCallback(Hb(...t),t)}function uj(t,e){const r=x.createContext(e),s=a=>{const{children:o,...i}=a,c=x.useMemo(()=>i,Object.values(i));return l.jsx(r.Provider,{value:c,children:o})};s.displayName=t+"Provider";function n(a){const o=x.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[s,n]}function ds(t,e=[]){let r=[];function s(a,o){const i=x.createContext(o),c=r.length;r=[...r,o];const u=h=>{var y;const{scope:m,children:f,...w}=h,p=((y=m==null?void 0:m[t])==null?void 0:y[c])||i,v=x.useMemo(()=>w,Object.values(w));return l.jsx(p.Provider,{value:v,children:f})};u.displayName=a+"Provider";function d(h,m){var p;const f=((p=m==null?void 0:m[t])==null?void 0:p[c])||i,w=x.useContext(f);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[u,d]}const n=()=>{const a=r.map(o=>x.createContext(o));return function(i){const c=(i==null?void 0:i[t])||a;return x.useMemo(()=>({[`__scope${t}`]:{...i,[t]:c}}),[i,c])}};return n.scopeName=t,[s,dj(n,...e)]}function dj(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const s=t.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const o=s.reduce((i,{useScope:c,scopeName:u})=>{const h=c(a)[`__scope${u}`];return{...i,...h}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function fi(t){const e=hj(t),r=x.forwardRef((s,n)=>{const{children:a,...o}=s,i=x.Children.toArray(a),c=i.find(mj);if(c){const u=c.props.children,d=i.map(h=>h===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:h);return l.jsx(e,{...o,ref:n,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return l.jsx(e,{...o,ref:n,children:a})});return r.displayName=`${t}.Slot`,r}var fj=fi("Slot");function hj(t){const e=x.forwardRef((r,s)=>{const{children:n,...a}=r;if(x.isValidElement(n)){const o=gj(n),i=vj(a,n.props);return n.type!==x.Fragment&&(i.ref=s?Hb(s,o):o),x.cloneElement(n,i)}return x.Children.count(n)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Bb=Symbol("radix.slottable");function pj(t){const e=({children:r})=>l.jsx(l.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Bb,e}function mj(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Bb}function vj(t,e){const r={...e};for(const s in e){const n=t[s],a=e[s];/^on[A-Z]/.test(s)?n&&a?r[s]=(...i)=>{const c=a(...i);return n(...i),c}:n&&(r[s]=n):s==="style"?r[s]={...n,...a}:s==="className"&&(r[s]=[n,a].filter(Boolean).join(" "))}return{...t,...r}}function gj(t){var s,n;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(n=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function fv(t){const e=t+"CollectionProvider",[r,s]=ds(e),[n,a]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:v,children:y}=p,g=mn.useRef(null),b=mn.useRef(new Map).current;return l.jsx(n,{scope:v,itemMap:b,collectionRef:g,children:y})};o.displayName=e;const i=t+"CollectionSlot",c=fi(i),u=mn.forwardRef((p,v)=>{const{scope:y,children:g}=p,b=a(i,y),S=et(v,b.collectionRef);return l.jsx(c,{ref:S,children:g})});u.displayName=i;const d=t+"CollectionItemSlot",h="data-radix-collection-item",m=fi(d),f=mn.forwardRef((p,v)=>{const{scope:y,children:g,...b}=p,S=mn.useRef(null),E=et(v,S),N=a(d,y);return mn.useEffect(()=>(N.itemMap.set(S,{ref:S,...b}),()=>void N.itemMap.delete(S))),l.jsx(m,{[h]:"",ref:E,children:g})});f.displayName=d;function w(p){const v=a(t+"CollectionConsumer",p);return mn.useCallback(()=>{const g=v.collectionRef.current;if(!g)return[];const b=Array.from(g.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((N,j)=>b.indexOf(N.ref.current)-b.indexOf(j.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:u,ItemSlot:f},w,s]}var yj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ae=yj.reduce((t,e)=>{const r=fi(`Primitive.${e}`),s=x.forwardRef((n,a)=>{const{asChild:o,...i}=n,c=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...i,ref:a})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Kb(t,e){t&&so.flushSync(()=>t.dispatchEvent(e))}function Ur(t){const e=x.useRef(t);return x.useEffect(()=>{e.current=t}),x.useMemo(()=>(...r)=>{var s;return(s=e.current)==null?void 0:s.call(e,...r)},[])}function xj(t,e=globalThis==null?void 0:globalThis.document){const r=Ur(t);x.useEffect(()=>{const s=n=>{n.key==="Escape"&&r(n)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[r,e])}var wj="DismissableLayer",sp="dismissableLayer.update",bj="dismissableLayer.pointerDownOutside",Sj="dismissableLayer.focusOutside",Vy,Wb=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zl=x.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:n,onFocusOutside:a,onInteractOutside:o,onDismiss:i,...c}=t,u=x.useContext(Wb),[d,h]=x.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=x.useState({}),w=et(e,j=>h(j)),p=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=p.indexOf(v),g=d?p.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,S=g>=y,E=Ej(j=>{const R=j.target,A=[...u.branches].some(F=>F.contains(R));!S||A||(n==null||n(j),o==null||o(j),j.defaultPrevented||i==null||i())},m),N=Cj(j=>{const R=j.target;[...u.branches].some(F=>F.contains(R))||(a==null||a(j),o==null||o(j),j.defaultPrevented||i==null||i())},m);return xj(j=>{g===u.layers.size-1&&(s==null||s(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},m),x.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Vy=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),qy(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Vy)}},[d,m,r,u]),x.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),qy())},[d,u]),x.useEffect(()=>{const j=()=>f({});return document.addEventListener(sp,j),()=>document.removeEventListener(sp,j)},[]),l.jsx(Ae.div,{...c,ref:w,style:{pointerEvents:b?S?"auto":"none":void 0,...t.style},onFocusCapture:Se(t.onFocusCapture,N.onFocusCapture),onBlurCapture:Se(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Se(t.onPointerDownCapture,E.onPointerDownCapture)})});zl.displayName=wj;var _j="DismissableLayerBranch",Qb=x.forwardRef((t,e)=>{const r=x.useContext(Wb),s=x.useRef(null),n=et(e,s);return x.useEffect(()=>{const a=s.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),l.jsx(Ae.div,{...t,ref:n})});Qb.displayName=_j;function Ej(t,e=globalThis==null?void 0:globalThis.document){const r=Ur(t),s=x.useRef(!1),n=x.useRef(()=>{});return x.useEffect(()=>{const a=i=>{if(i.target&&!s.current){let c=function(){Gb(bj,r,u,{discrete:!0})};const u={originalEvent:i};i.pointerType==="touch"?(e.removeEventListener("click",n.current),n.current=c,e.addEventListener("click",n.current,{once:!0})):c()}else e.removeEventListener("click",n.current);s.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",n.current)}},[e,r]),{onPointerDownCapture:()=>s.current=!0}}function Cj(t,e=globalThis==null?void 0:globalThis.document){const r=Ur(t),s=x.useRef(!1);return x.useEffect(()=>{const n=a=>{a.target&&!s.current&&Gb(Sj,r,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",n),()=>e.removeEventListener("focusin",n)},[e,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function qy(){const t=new CustomEvent(sp);document.dispatchEvent(t)}function Gb(t,e,r,{discrete:s}){const n=r.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),s?Kb(n,a):n.dispatchEvent(a)}var Pj=zl,kj=Qb,Bt=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},Nj="Portal",_d=x.forwardRef((t,e)=>{var i;const{container:r,...s}=t,[n,a]=x.useState(!1);Bt(()=>a(!0),[]);const o=r||n&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return o?Bk.createPortal(l.jsx(Ae.div,{...s,ref:e}),o):null});_d.displayName=Nj;function jj(t,e){return x.useReducer((r,s)=>e[r][s]??r,t)}var da=t=>{const{present:e,children:r}=t,s=Rj(e),n=typeof r=="function"?r({present:s.isPresent}):x.Children.only(r),a=et(s.ref,Tj(n));return typeof r=="function"||s.isPresent?x.cloneElement(n,{ref:a}):null};da.displayName="Presence";function Rj(t){const[e,r]=x.useState(),s=x.useRef(null),n=x.useRef(t),a=x.useRef("none"),o=t?"mounted":"unmounted",[i,c]=jj(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=Sc(s.current);a.current=i==="mounted"?u:"none"},[i]),Bt(()=>{const u=s.current,d=n.current;if(d!==t){const m=a.current,f=Sc(u);t?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,c]),Bt(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,h=f=>{const p=Sc(s.current).includes(CSS.escape(f.animationName));if(f.target===e&&p&&(c("ANIMATION_END"),!n.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},m=f=>{f.target===e&&(a.current=Sc(s.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:x.useCallback(u=>{s.current=u?getComputedStyle(u):null,r(u)},[])}}function Sc(t){return(t==null?void 0:t.animationName)||"none"}function Tj(t){var s,n;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(n=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Aj=mm[" useInsertionEffect ".trim().toString()]||Bt;function Wa({prop:t,defaultProp:e,onChange:r=()=>{},caller:s}){const[n,a,o]=Oj({defaultProp:e,onChange:r}),i=t!==void 0,c=i?t:n;{const d=x.useRef(t!==void 0);x.useEffect(()=>{const h=d.current;h!==i&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${i?"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=i},[i,s])}const u=x.useCallback(d=>{var h;if(i){const m=Ij(d)?d(t):d;m!==t&&((h=o.current)==null||h.call(o,m))}else a(d)},[i,t,a,o]);return[c,u]}function Oj({defaultProp:t,onChange:e}){const[r,s]=x.useState(t),n=x.useRef(r),a=x.useRef(e);return Aj(()=>{a.current=e},[e]),x.useEffect(()=>{var o;n.current!==r&&((o=a.current)==null||o.call(a,r),n.current=r)},[r,n]),[r,s,a]}function Ij(t){return typeof t=="function"}var Zb=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"}),Dj="VisuallyHidden",Ed=x.forwardRef((t,e)=>l.jsx(Ae.span,{...t,ref:e,style:{...Zb,...t.style}}));Ed.displayName=Dj;var Mj=Ed,hv="ToastProvider",[pv,$j,Fj]=fv("Toast"),[Yb,dF]=ds("Toast",[Fj]),[Lj,Cd]=Yb(hv),Jb=t=>{const{__scopeToast:e,label:r="Notification",duration:s=5e3,swipeDirection:n="right",swipeThreshold:a=50,children:o}=t,[i,c]=x.useState(null),[u,d]=x.useState(0),h=x.useRef(!1),m=x.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${hv}\`. Expected non-empty \`string\`.`),l.jsx(pv.Provider,{scope:e,children:l.jsx(Lj,{scope:e,label:r,duration:s,swipeDirection:n,swipeThreshold:a,toastCount:u,viewport:i,onViewportChange:c,onToastAdd:x.useCallback(()=>d(f=>f+1),[]),onToastRemove:x.useCallback(()=>d(f=>f-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:m,children:o})})};Jb.displayName=hv;var Xb="ToastViewport",Uj=["F8"],ap="toast.viewportPause",op="toast.viewportResume",e1=x.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:s=Uj,label:n="Notifications ({hotkey})",...a}=t,o=Cd(Xb,r),i=$j(r),c=x.useRef(null),u=x.useRef(null),d=x.useRef(null),h=x.useRef(null),m=et(e,h,o.onViewportChange),f=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),w=o.toastCount>0;x.useEffect(()=>{const v=y=>{var b;s.length!==0&&s.every(S=>y[S]||y.code===S)&&((b=h.current)==null||b.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s]),x.useEffect(()=>{const v=c.current,y=h.current;if(w&&v&&y){const g=()=>{if(!o.isClosePausedRef.current){const N=new CustomEvent(ap);y.dispatchEvent(N),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const N=new CustomEvent(op);y.dispatchEvent(N),o.isClosePausedRef.current=!1}},S=N=>{!v.contains(N.relatedTarget)&&b()},E=()=>{v.contains(document.activeElement)||b()};return v.addEventListener("focusin",g),v.addEventListener("focusout",S),v.addEventListener("pointermove",g),v.addEventListener("pointerleave",E),window.addEventListener("blur",g),window.addEventListener("focus",b),()=>{v.removeEventListener("focusin",g),v.removeEventListener("focusout",S),v.removeEventListener("pointermove",g),v.removeEventListener("pointerleave",E),window.removeEventListener("blur",g),window.removeEventListener("focus",b)}}},[w,o.isClosePausedRef]);const p=x.useCallback(({tabbingDirection:v})=>{const g=i().map(b=>{const S=b.ref.current,E=[S,...Xj(S)];return v==="forwards"?E:E.reverse()});return(v==="forwards"?g.reverse():g).flat()},[i]);return x.useEffect(()=>{const v=h.current;if(v){const y=g=>{var E,N,j;const b=g.altKey||g.ctrlKey||g.metaKey;if(g.key==="Tab"&&!b){const R=document.activeElement,A=g.shiftKey;if(g.target===v&&A){(E=u.current)==null||E.focus();return}const _=p({tabbingDirection:A?"backwards":"forwards"}),I=_.findIndex(C=>C===R);Rf(_.slice(I+1))?g.preventDefault():A?(N=u.current)==null||N.focus():(j=d.current)==null||j.focus()}};return v.addEventListener("keydown",y),()=>v.removeEventListener("keydown",y)}},[i,p]),l.jsxs(kj,{ref:c,role:"region","aria-label":n.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:w?void 0:"none"},children:[w&&l.jsx(ip,{ref:u,onFocusFromOutsideViewport:()=>{const v=p({tabbingDirection:"forwards"});Rf(v)}}),l.jsx(pv.Slot,{scope:r,children:l.jsx(Ae.ol,{tabIndex:-1,...a,ref:m})}),w&&l.jsx(ip,{ref:d,onFocusFromOutsideViewport:()=>{const v=p({tabbingDirection:"backwards"});Rf(v)}})]})});e1.displayName=Xb;var t1="ToastFocusProxy",ip=x.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:s,...n}=t,a=Cd(t1,r);return l.jsx(Ed,{tabIndex:0,...n,ref:e,style:{position:"fixed"},onFocus:o=>{var u;const i=o.relatedTarget;!((u=a.viewport)!=null&&u.contains(i))&&s()}})});ip.displayName=t1;var Vl="Toast",zj="toast.swipeStart",Vj="toast.swipeMove",qj="toast.swipeCancel",Hj="toast.swipeEnd",r1=x.forwardRef((t,e)=>{const{forceMount:r,open:s,defaultOpen:n,onOpenChange:a,...o}=t,[i,c]=Wa({prop:s,defaultProp:n??!0,onChange:a,caller:Vl});return l.jsx(da,{present:r||i,children:l.jsx(Wj,{open:i,...o,ref:e,onClose:()=>c(!1),onPause:Ur(t.onPause),onResume:Ur(t.onResume),onSwipeStart:Se(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Se(t.onSwipeMove,u=>{const{x:d,y:h}=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",`${h}px`)}),onSwipeCancel:Se(t.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:Se(t.onSwipeEnd,u=>{const{x:d,y:h}=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",`${h}px`),c(!1)})})})});r1.displayName=Vl;var[Bj,Kj]=Yb(Vl,{onClose(){}}),Wj=x.forwardRef((t,e)=>{const{__scopeToast:r,type:s="foreground",duration:n,open:a,onClose:o,onEscapeKeyDown:i,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:m,onSwipeEnd:f,...w}=t,p=Cd(Vl,r),[v,y]=x.useState(null),g=et(e,C=>y(C)),b=x.useRef(null),S=x.useRef(null),E=n||p.duration,N=x.useRef(0),j=x.useRef(E),R=x.useRef(0),{onToastAdd:A,onToastRemove:F}=p,T=Ur(()=>{var z;(v==null?void 0:v.contains(document.activeElement))&&((z=p.viewport)==null||z.focus()),o()}),_=x.useCallback(C=>{!C||C===1/0||(window.clearTimeout(R.current),N.current=new Date().getTime(),R.current=window.setTimeout(T,C))},[T]);x.useEffect(()=>{const C=p.viewport;if(C){const z=()=>{_(j.current),u==null||u()},U=()=>{const K=new Date().getTime()-N.current;j.current=j.current-K,window.clearTimeout(R.current),c==null||c()};return C.addEventListener(ap,U),C.addEventListener(op,z),()=>{C.removeEventListener(ap,U),C.removeEventListener(op,z)}}},[p.viewport,E,c,u,_]),x.useEffect(()=>{a&&!p.isClosePausedRef.current&&_(E)},[a,E,p.isClosePausedRef,_]),x.useEffect(()=>(A(),()=>F()),[A,F]);const I=x.useMemo(()=>v?c1(v):null,[v]);return p.viewport?l.jsxs(l.Fragment,{children:[I&&l.jsx(Qj,{__scopeToast:r,role:"status","aria-live":s==="foreground"?"assertive":"polite",children:I}),l.jsx(Bj,{scope:r,onClose:T,children:so.createPortal(l.jsx(pv.ItemSlot,{scope:r,children:l.jsx(Pj,{asChild:!0,onEscapeKeyDown:Se(i,()=>{p.isFocusedToastEscapeKeyDownRef.current||T(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Ae.li,{tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":p.swipeDirection,...w,ref:g,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Se(t.onKeyDown,C=>{C.key==="Escape"&&(i==null||i(C.nativeEvent),C.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,T()))}),onPointerDown:Se(t.onPointerDown,C=>{C.button===0&&(b.current={x:C.clientX,y:C.clientY})}),onPointerMove:Se(t.onPointerMove,C=>{if(!b.current)return;const z=C.clientX-b.current.x,U=C.clientY-b.current.y,K=!!S.current,P=["left","right"].includes(p.swipeDirection),D=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,L=P?D(0,z):0,J=P?0:D(0,U),Z=C.pointerType==="touch"?10:2,B={x:L,y:J},oe={originalEvent:C,delta:B};K?(S.current=B,_c(Vj,h,oe,{discrete:!1})):Hy(B,p.swipeDirection,Z)?(S.current=B,_c(zj,d,oe,{discrete:!1}),C.target.setPointerCapture(C.pointerId)):(Math.abs(z)>Z||Math.abs(U)>Z)&&(b.current=null)}),onPointerUp:Se(t.onPointerUp,C=>{const z=S.current,U=C.target;if(U.hasPointerCapture(C.pointerId)&&U.releasePointerCapture(C.pointerId),S.current=null,b.current=null,z){const K=C.currentTarget,P={originalEvent:C,delta:z};Hy(z,p.swipeDirection,p.swipeThreshold)?_c(Hj,f,P,{discrete:!0}):_c(qj,m,P,{discrete:!0}),K.addEventListener("click",D=>D.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),Qj=t=>{const{__scopeToast:e,children:r,...s}=t,n=Cd(Vl,e),[a,o]=x.useState(!1),[i,c]=x.useState(!1);return Yj(()=>o(!0)),x.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),i?null:l.jsx(_d,{asChild:!0,children:l.jsx(Ed,{...s,children:a&&l.jsxs(l.Fragment,{children:[n.label," ",r]})})})},Gj="ToastTitle",n1=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return l.jsx(Ae.div,{...s,ref:e})});n1.displayName=Gj;var Zj="ToastDescription",s1=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return l.jsx(Ae.div,{...s,ref:e})});s1.displayName=Zj;var a1="ToastAction",o1=x.forwardRef((t,e)=>{const{altText:r,...s}=t;return r.trim()?l.jsx(l1,{altText:r,asChild:!0,children:l.jsx(mv,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${a1}\`. Expected non-empty \`string\`.`),null)});o1.displayName=a1;var i1="ToastClose",mv=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t,n=Kj(i1,r);return l.jsx(l1,{asChild:!0,children:l.jsx(Ae.button,{type:"button",...s,ref:e,onClick:Se(t.onClick,n.onClose)})})});mv.displayName=i1;var l1=x.forwardRef((t,e)=>{const{__scopeToast:r,altText:s,...n}=t;return l.jsx(Ae.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...n,ref:e})});function c1(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),Jj(s)){const n=s.ariaHidden||s.hidden||s.style.display==="none",a=s.dataset.radixToastAnnounceExclude==="";if(!n)if(a){const o=s.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...c1(s))}}),e}function _c(t,e,r,{discrete:s}){const n=r.originalEvent.currentTarget,a=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),s?Kb(n,a):n.dispatchEvent(a)}var Hy=(t,e,r=0)=>{const s=Math.abs(t.x),n=Math.abs(t.y),a=s>n;return e==="left"||e==="right"?a&&s>r:!a&&n>r};function Yj(t=()=>{}){const e=Ur(t);Bt(()=>{let r=0,s=0;return r=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(s)}},[e])}function Jj(t){return t.nodeType===t.ELEMENT_NODE}function Xj(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||n?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function Rf(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var e2=Jb,u1=e1,d1=r1,f1=n1,h1=s1,p1=o1,m1=mv;function v1(t){var e,r,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(r=v1(t[e]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function g1(){for(var t,e,r=0,s="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=v1(t))&&(s&&(s+=" "),s+=e);return s}const By=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Ky=g1,Pd=(t,e)=>r=>{var s;if((e==null?void 0:e.variants)==null)return Ky(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:a}=e,o=Object.keys(n).map(u=>{const d=r==null?void 0:r[u],h=a==null?void 0:a[u];if(d===null)return null;const m=By(d)||By(h);return n[u][m]}),i=r&&Object.entries(r).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:h,className:m,...f}=d;return Object.entries(f).every(w=>{let[p,v]=w;return Array.isArray(v)?v.includes({...a,...i}[p]):{...a,...i}[p]===v})?[...u,h,m]:u},[]);return Ky(t,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
|
|
48
|
+
*/var di=x;function Jk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Xk=typeof Object.is=="function"?Object.is:Jk,eN=di.useState,tN=di.useEffect,rN=di.useLayoutEffect,nN=di.useDebugValue;function sN(t,e){var r=e(),s=eN({inst:{value:r,getSnapshot:e}}),n=s[0].inst,a=s[1];return rN(function(){n.value=r,n.getSnapshot=e,Nf(n)&&a({inst:n})},[t,r,e]),tN(function(){return Nf(n)&&a({inst:n}),t(function(){Nf(n)&&a({inst:n})})},[t]),nN(r),r}function Nf(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Xk(t,r)}catch{return!0}}function aN(t,e){return e()}var oN=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?aN:sN;_b.useSyncExternalStore=di.useSyncExternalStore!==void 0?di.useSyncExternalStore:oN;Sb.exports=_b;var iN=Sb.exports;const lN=gm.useInsertionEffect,cN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",uN=cN?x.useLayoutEffect:x.useEffect,dN=lN||uN,Eb=t=>{const e=x.useRef([t,(...r)=>e[0](...r)]).current;return dN(()=>{e[0]=t}),e[1]},fN="popstate",lv="pushState",cv="replaceState",hN="hashchange",Ny=[fN,lv,cv,hN],pN=t=>{for(const e of Ny)addEventListener(e,t);return()=>{for(const e of Ny)removeEventListener(e,t)}},Cb=(t,e)=>iN.useSyncExternalStore(pN,t,e),mN=()=>location.search,vN=({ssrSearch:t=""}={})=>Cb(mN,()=>t),jy=()=>location.pathname,gN=({ssrPath:t}={})=>Cb(jy,t?()=>t:jy),yN=(t,{replace:e=!1,state:r=null}={})=>history[e?cv:lv](r,"",t),xN=(t={})=>[gN(t),yN],Ry=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Ry]>"u"){for(const t of[lv,cv]){const e=history[t];history[t]=function(){const r=e.apply(this,arguments),s=new Event(t);return s.arguments=arguments,dispatchEvent(s),r}}Object.defineProperty(window,Ry,{value:!0})}const wN=(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())?"~"+e:e.slice(t.length)||"/",Pb=(t="")=>t==="/"?"":t,bN=(t,e)=>t[0]==="~"?t.slice(1):Pb(e)+t,SN=(t="",e)=>wN(Ty(Pb(t)),Ty(e)),Ty=t=>{try{return decodeURI(t)}catch{return t}},kb={hook:xN,searchHook:vN,parser:Yk,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:t=>t},Nb=x.createContext(kb),zl=()=>x.useContext(Nb),jb={},Rb=x.createContext(jb),_N=()=>x.useContext(Rb),_d=t=>{const[e,r]=t.hook(t);return[SN(t.base,e),Eb((s,n)=>r(bN(s,t.base),n))]},EN=()=>_d(zl()),Tb=(t,e,r,s)=>{const{pattern:n,keys:a}=e instanceof RegExp?{keys:!1,pattern:e}:t(e||"*",s),o=n.exec(r)||[],[i,...c]=o;return i!==void 0?[!0,(()=>{const u=a!==!1?Object.fromEntries(a.map((h,m)=>[h,c[m]])):o.groups;let d={...c};return u&&Object.assign(d,u),d})(),...s?[i]:[]]:[!1,null]},CN=({children:t,...e})=>{var d,h;const r=zl(),s=e.hook?kb:r;let n=s;const[a,o]=((d=e.ssrPath)==null?void 0:d.split("?"))??[];o&&(e.ssrSearch=o,e.ssrPath=a),e.hrefs=e.hrefs??((h=e.hook)==null?void 0:h.hrefs);let i=x.useRef({}),c=i.current,u=c;for(let m in s){const f=m==="base"?s[m]+(e[m]||""):e[m]||s[m];c===u&&f!==u[m]&&(i.current=u={...u}),u[m]=f,(f!==s[m]||f!==n[m])&&(n=u)}return x.createElement(Nb.Provider,{value:n,children:t})},Ay=({children:t,component:e},r)=>e?x.createElement(e,{params:r}):typeof t=="function"?t(r):t,PN=t=>{let e=x.useRef(jb);const r=e.current;return e.current=Object.keys(t).length!==Object.keys(r).length||Object.entries(t).some(([s,n])=>n!==r[s])?t:r},bc=({path:t,nest:e,match:r,...s})=>{const n=zl(),[a]=_d(n),[o,i,c]=r??Tb(n.parser,t,a,e),u=PN({..._N(),...i});if(!o)return null;const d=c?x.createElement(CN,{base:c},Ay(s,u)):Ay(s,u);return x.createElement(Rb.Provider,{value:u,children:d})};x.forwardRef((t,e)=>{const r=zl(),[s,n]=_d(r),{to:a="",href:o=a,onClick:i,asChild:c,children:u,className:d,replace:h,state:m,...f}=t,w=Eb(y=>{y.ctrlKey||y.metaKey||y.altKey||y.shiftKey||y.button!==0||(i==null||i(y),y.defaultPrevented||(y.preventDefault(),n(o,t)))}),p=r.hrefs(o[0]==="~"?o.slice(1):r.base+o,r);return c&&x.isValidElement(u)?x.cloneElement(u,{onClick:w,href:p}):x.createElement("a",{...f,onClick:w,href:p,className:d!=null&&d.call?d(s===o):d,children:u,ref:e})});const Ab=t=>Array.isArray(t)?t.flatMap(e=>Ab(e&&e.type===x.Fragment?e.props.children:e)):[t],kN=({children:t,location:e})=>{const r=zl(),[s]=_d(r);for(const n of Ab(t)){let a=0;if(x.isValidElement(n)&&(a=Tb(r.parser,n.props.path,e||s,n.props.nest))[0])return x.cloneElement(n,{match:a})}return null};var bi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ba=typeof window>"u"||"Deno"in globalThis;function tr(){}function NN(t,e){return typeof t=="function"?t(e):t}function Wh(t){return typeof t=="number"&&t>=0&&t!==1/0}function Ob(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Xs(t,e){return typeof t=="function"?t(e):t}function Ar(t,e){return typeof t=="function"?t(e):t}function Oy(t,e){const{type:r="all",exact:s,fetchStatus:n,predicate:a,queryKey:o,stale:i}=t;if(o){if(s){if(e.queryHash!==uv(o,e.options))return!1}else if(!kl(e.queryKey,o))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&e.isStale()!==i||n&&n!==e.state.fetchStatus||a&&!a(e))}function Iy(t,e){const{exact:r,status:s,predicate:n,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(r){if(Ka(e.options.mutationKey)!==Ka(a))return!1}else if(!kl(e.options.mutationKey,a))return!1}return!(s&&e.state.status!==s||n&&!n(e))}function uv(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ka)(t)}function Ka(t){return JSON.stringify(t,(e,r)=>Qh(r)?Object.keys(r).sort().reduce((s,n)=>(s[n]=r[n],s),{}):r)}function kl(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>kl(t[r],e[r])):!1}function Ib(t,e){if(t===e)return t;const r=Dy(t)&&Dy(e);if(r||Qh(t)&&Qh(e)){const s=r?t:Object.keys(t),n=s.length,a=r?e:Object.keys(e),o=a.length,i=r?[]:{},c=new Set(s);let u=0;for(let d=0;d<o;d++){const h=r?d:a[d];(!r&&c.has(h)||r)&&t[h]===void 0&&e[h]===void 0?(i[h]=void 0,u++):(i[h]=Ib(t[h],e[h]),i[h]===t[h]&&t[h]!==void 0&&u++)}return n===o&&u===n?t:i}return e}function Nu(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Dy(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Qh(t){if(!My(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!My(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function My(t){return Object.prototype.toString.call(t)==="[object Object]"}function jN(t){return new Promise(e=>{setTimeout(e,t)})}function Gh(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?Ib(t,e):e}function RN(t,e,r=0){const s=[...t,e];return r&&s.length>r?s.slice(1):s}function TN(t,e,r=0){const s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var dv=Symbol();function Db(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===dv?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Mb(t,e){return typeof t=="function"?t(...e):!!t}var ja,Ts,Bo,X0,AN=(X0=class extends bi{constructor(){super();be(this,ja);be(this,Ts);be(this,Bo);ie(this,Bo,e=>{if(!Ba&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Ts)||this.setEventListener(O(this,Bo))}onUnsubscribe(){var e;this.hasListeners()||((e=O(this,Ts))==null||e.call(this),ie(this,Ts,void 0))}setEventListener(e){var r;ie(this,Bo,e),(r=O(this,Ts))==null||r.call(this),ie(this,Ts,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){O(this,ja)!==e&&(ie(this,ja,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof O(this,ja)=="boolean"?O(this,ja):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ja=new WeakMap,Ts=new WeakMap,Bo=new WeakMap,X0),fv=new AN,Ko,As,Wo,ex,ON=(ex=class extends bi{constructor(){super();be(this,Ko,!0);be(this,As);be(this,Wo);ie(this,Wo,e=>{if(!Ba&&window.addEventListener){const r=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",s)}}})}onSubscribe(){O(this,As)||this.setEventListener(O(this,Wo))}onUnsubscribe(){var e;this.hasListeners()||((e=O(this,As))==null||e.call(this),ie(this,As,void 0))}setEventListener(e){var r;ie(this,Wo,e),(r=O(this,As))==null||r.call(this),ie(this,As,e(this.setOnline.bind(this)))}setOnline(e){O(this,Ko)!==e&&(ie(this,Ko,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return O(this,Ko)}},Ko=new WeakMap,As=new WeakMap,Wo=new WeakMap,ex),ju=new ON;function Zh(){let t,e;const r=new Promise((n,a)=>{t=n,e=a});r.status="pending",r.catch(()=>{});function s(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{s({status:"fulfilled",value:n}),t(n)},r.reject=n=>{s({status:"rejected",reason:n}),e(n)},r}function IN(t){return Math.min(1e3*2**t,3e4)}function $b(t){return(t??"online")==="online"?ju.isOnline():!0}var Fb=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Lb(t){let e=!1,r=0,s;const n=Zh(),a=()=>n.status!=="pending",o=p=>{var y;a()||(m(new Fb(p)),(y=t.abort)==null||y.call(t))},i=()=>{e=!0},c=()=>{e=!1},u=()=>fv.isFocused()&&(t.networkMode==="always"||ju.isOnline())&&t.canRun(),d=()=>$b(t.networkMode)&&t.canRun(),h=p=>{a()||(s==null||s(),n.resolve(p))},m=p=>{a()||(s==null||s(),n.reject(p))},f=()=>new Promise(p=>{var y;s=g=>{(a()||u())&&p(g)},(y=t.onPause)==null||y.call(t)}).then(()=>{var p;s=void 0,a()||(p=t.onContinue)==null||p.call(t)}),w=()=>{if(a())return;let p;const y=r===0?t.initialPromise:void 0;try{p=y??t.fn()}catch(g){p=Promise.reject(g)}Promise.resolve(p).then(h).catch(g=>{var N;if(a())return;const v=t.retry??(Ba?0:3),b=t.retryDelay??IN,S=typeof b=="function"?b(r,g):b,E=v===!0||typeof v=="number"&&r<v||typeof v=="function"&&v(r,g);if(e||!E){m(g);return}r++,(N=t.onFail)==null||N.call(t,r,g),jN(S).then(()=>u()?void 0:f()).then(()=>{e?m(g):w()})})};return{promise:n,status:()=>n.status,cancel:o,continue:()=>(s==null||s(),n),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?w():f().then(w),n)}}var DN=t=>setTimeout(t,0);function MN(){let t=[],e=0,r=i=>{i()},s=i=>{i()},n=DN;const a=i=>{e?t.push(i):n(()=>{r(i)})},o=()=>{const i=t;t=[],i.length&&n(()=>{s(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;e++;try{c=i()}finally{e--,e||o()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{n=i}}}var Tt=MN(),Ra,tx,Ub=(tx=class{constructor(){be(this,Ra)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wh(this.gcTime)&&ie(this,Ra,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ba?1/0:5*60*1e3))}clearGcTimeout(){O(this,Ra)&&(clearTimeout(O(this,Ra)),ie(this,Ra,void 0))}},Ra=new WeakMap,tx),Qo,Go,Tr,Ta,Mt,Al,Aa,Jr,zn,rx,$N=(rx=class extends Ub{constructor(e){super();be(this,Jr);be(this,Qo);be(this,Go);be(this,Tr);be(this,Ta);be(this,Mt);be(this,Al);be(this,Aa);ie(this,Aa,!1),ie(this,Al,e.defaultOptions),this.setOptions(e.options),this.observers=[],ie(this,Ta,e.client),ie(this,Tr,O(this,Ta).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ie(this,Qo,FN(this.options)),this.state=e.state??O(this,Qo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=O(this,Mt))==null?void 0:e.promise}setOptions(e){this.options={...O(this,Al),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Tr).remove(this)}setData(e,r){const s=Gh(this.state.data,e,this.options);return Le(this,Jr,zn).call(this,{data:s,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),s}setState(e,r){Le(this,Jr,zn).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var s,n;const r=(s=O(this,Mt))==null?void 0:s.promise;return(n=O(this,Mt))==null||n.cancel(e),r?r.then(tr).catch(tr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Qo))}isActive(){return this.observers.some(e=>Ar(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===dv||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Xs(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Ob(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=O(this,Mt))==null||r.continue()}onOnline(){var r;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=O(this,Mt))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),O(this,Tr).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(O(this,Mt)&&(O(this,Aa)?O(this,Mt).cancel({revert:!0}):O(this,Mt).cancelRetry()),this.scheduleGc()),O(this,Tr).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,Jr,zn).call(this,{type:"invalidate"})}async fetch(e,r){var c,u,d,h,m,f,w,p,y,g,v,b;if(this.state.fetchStatus!=="idle"&&((c=O(this,Mt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,Mt))return O(this,Mt).continueRetry(),O(this,Mt).promise}if(e&&this.setOptions(e),!this.options.queryFn){const S=this.observers.find(E=>E.options.queryFn);S&&this.setOptions(S.options)}const s=new AbortController,n=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(ie(this,Aa,!0),s.signal)})},a=()=>{const S=Db(this.options,r),N=(()=>{const j={client:O(this,Ta),queryKey:this.queryKey,meta:this.meta};return n(j),j})();return ie(this,Aa,!1),this.options.persister?this.options.persister(S,N,this):S(N)},i=(()=>{const S={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,Ta),state:this.state,fetchFn:a};return n(S),S})();(u=this.options.behavior)==null||u.onFetch(i,this),ie(this,Go,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=i.fetchOptions)==null?void 0:d.meta))&&Le(this,Jr,zn).call(this,{type:"fetch",meta:(h=i.fetchOptions)==null?void 0:h.meta}),ie(this,Mt,Lb({initialPromise:r==null?void 0:r.initialPromise,fn:i.fetchFn,abort:s.abort.bind(s),onFail:(S,E)=>{Le(this,Jr,zn).call(this,{type:"failed",failureCount:S,error:E})},onPause:()=>{Le(this,Jr,zn).call(this,{type:"pause"})},onContinue:()=>{Le(this,Jr,zn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const S=await O(this,Mt).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(f=(m=O(this,Tr).config).onSuccess)==null||f.call(m,S,this),(p=(w=O(this,Tr).config).onSettled)==null||p.call(w,S,this.state.error,this),S}catch(S){if(S instanceof Fb){if(S.silent)return O(this,Mt).promise;if(S.revert){if(this.setState({...O(this,Go),fetchStatus:"idle"}),this.state.data===void 0)throw S;return this.state.data}}throw Le(this,Jr,zn).call(this,{type:"error",error:S}),(g=(y=O(this,Tr).config).onError)==null||g.call(y,S,this),(b=(v=O(this,Tr).config).onSettled)==null||b.call(v,this.state.data,S,this),S}finally{this.scheduleGc()}}},Qo=new WeakMap,Go=new WeakMap,Tr=new WeakMap,Ta=new WeakMap,Mt=new WeakMap,Al=new WeakMap,Aa=new WeakMap,Jr=new WeakSet,zn=function(e){const r=s=>{switch(e.type){case"failed":return{...s,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...zb(s.data,this.options),fetchMeta:e.meta??null};case"success":const n={...s,data:e.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ie(this,Go,e.manual?n:void 0),n;case"error":const a=e.error;return{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...e.state}}};this.state=r(this.state),Tt.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),O(this,Tr).notify({query:this,type:"updated",action:e})})},rx);function zb(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$b(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function FN(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,s=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var vn,nx,LN=(nx=class extends bi{constructor(e={}){super();be(this,vn);this.config=e,ie(this,vn,new Map)}build(e,r,s){const n=r.queryKey,a=r.queryHash??uv(n,r);let o=this.get(a);return o||(o=new $N({client:e,queryKey:n,queryHash:a,options:e.defaultQueryOptions(r),state:s,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){O(this,vn).has(e.queryHash)||(O(this,vn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=O(this,vn).get(e.queryHash);r&&(e.destroy(),r===e&&O(this,vn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Tt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return O(this,vn).get(e)}getAll(){return[...O(this,vn).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(s=>Oy(r,s))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(s=>Oy(e,s)):r}notify(e){Tt.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){Tt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Tt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vn=new WeakMap,nx),gn,Jt,Oa,yn,bs,sx,UN=(sx=class extends Ub{constructor(e){super();be(this,yn);be(this,gn);be(this,Jt);be(this,Oa);this.mutationId=e.mutationId,ie(this,Jt,e.mutationCache),ie(this,gn,[]),this.state=e.state||Vb(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){O(this,gn).includes(e)||(O(this,gn).push(e),this.clearGcTimeout(),O(this,Jt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ie(this,gn,O(this,gn).filter(r=>r!==e)),this.scheduleGc(),O(this,Jt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){O(this,gn).length||(this.state.status==="pending"?this.scheduleGc():O(this,Jt).remove(this))}continue(){var e;return((e=O(this,Oa))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,i,c,u,d,h,m,f,w,p,y,g,v,b,S,E,N,j,R;const r=()=>{Le(this,yn,bs).call(this,{type:"continue"})};ie(this,Oa,Lb({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(A,F)=>{Le(this,yn,bs).call(this,{type:"failed",failureCount:A,error:F})},onPause:()=>{Le(this,yn,bs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,Jt).canRun(this)}));const s=this.state.status==="pending",n=!O(this,Oa).canStart();try{if(s)r();else{Le(this,yn,bs).call(this,{type:"pending",variables:e,isPaused:n}),await((o=(a=O(this,Jt).config).onMutate)==null?void 0:o.call(a,e,this));const F=await((c=(i=this.options).onMutate)==null?void 0:c.call(i,e));F!==this.state.context&&Le(this,yn,bs).call(this,{type:"pending",context:F,variables:e,isPaused:n})}const A=await O(this,Oa).start();return await((d=(u=O(this,Jt).config).onSuccess)==null?void 0:d.call(u,A,e,this.state.context,this)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,A,e,this.state.context)),await((w=(f=O(this,Jt).config).onSettled)==null?void 0:w.call(f,A,null,this.state.variables,this.state.context,this)),await((y=(p=this.options).onSettled)==null?void 0:y.call(p,A,null,e,this.state.context)),Le(this,yn,bs).call(this,{type:"success",data:A}),A}catch(A){try{throw await((v=(g=O(this,Jt).config).onError)==null?void 0:v.call(g,A,e,this.state.context,this)),await((S=(b=this.options).onError)==null?void 0:S.call(b,A,e,this.state.context)),await((N=(E=O(this,Jt).config).onSettled)==null?void 0:N.call(E,void 0,A,this.state.variables,this.state.context,this)),await((R=(j=this.options).onSettled)==null?void 0:R.call(j,void 0,A,e,this.state.context)),A}finally{Le(this,yn,bs).call(this,{type:"error",error:A})}}finally{O(this,Jt).runNext(this)}}},gn=new WeakMap,Jt=new WeakMap,Oa=new WeakMap,yn=new WeakSet,bs=function(e){const r=s=>{switch(e.type){case"failed":return{...s,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...s,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:e.error,failureCount:s.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Tt.batch(()=>{O(this,gn).forEach(s=>{s.onMutationUpdate(e)}),O(this,Jt).notify({mutation:this,type:"updated",action:e})})},sx);function Vb(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Kn,Xr,Ol,ax,zN=(ax=class extends bi{constructor(e={}){super();be(this,Kn);be(this,Xr);be(this,Ol);this.config=e,ie(this,Kn,new Set),ie(this,Xr,new Map),ie(this,Ol,0)}build(e,r,s){const n=new UN({mutationCache:this,mutationId:++nc(this,Ol)._,options:e.defaultMutationOptions(r),state:s});return this.add(n),n}add(e){O(this,Kn).add(e);const r=Sc(e);if(typeof r=="string"){const s=O(this,Xr).get(r);s?s.push(e):O(this,Xr).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(O(this,Kn).delete(e)){const r=Sc(e);if(typeof r=="string"){const s=O(this,Xr).get(r);if(s)if(s.length>1){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}else s[0]===e&&O(this,Xr).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Sc(e);if(typeof r=="string"){const s=O(this,Xr).get(r),n=s==null?void 0:s.find(a=>a.state.status==="pending");return!n||n===e}else return!0}runNext(e){var s;const r=Sc(e);if(typeof r=="string"){const n=(s=O(this,Xr).get(r))==null?void 0:s.find(a=>a!==e&&a.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Tt.batch(()=>{O(this,Kn).forEach(e=>{this.notify({type:"removed",mutation:e})}),O(this,Kn).clear(),O(this,Xr).clear()})}getAll(){return Array.from(O(this,Kn))}find(e){const r={exact:!0,...e};return this.getAll().find(s=>Iy(r,s))}findAll(e={}){return this.getAll().filter(r=>Iy(e,r))}notify(e){Tt.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return Tt.batch(()=>Promise.all(e.map(r=>r.continue().catch(tr))))}},Kn=new WeakMap,Xr=new WeakMap,Ol=new WeakMap,ax);function Sc(t){var e;return(e=t.options.scope)==null?void 0:e.id}function $y(t){return{onFetch:(e,r)=>{var d,h,m,f,w;const s=e.options,n=(m=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,a=((f=e.state.data)==null?void 0:f.pages)||[],o=((w=e.state.data)==null?void 0:w.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const y=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?p=!0:e.signal.addEventListener("abort",()=>{p=!0}),e.signal)})},g=Db(e.options,e.fetchOptions),v=async(b,S,E)=>{if(p)return Promise.reject();if(S==null&&b.pages.length)return Promise.resolve(b);const j=(()=>{const T={client:e.client,queryKey:e.queryKey,pageParam:S,direction:E?"backward":"forward",meta:e.options.meta};return y(T),T})(),R=await g(j),{maxPages:A}=e.options,F=E?TN:RN;return{pages:F(b.pages,R,A),pageParams:F(b.pageParams,S,A)}};if(n&&a.length){const b=n==="backward",S=b?VN:Fy,E={pages:a,pageParams:o},N=S(s,E);i=await v(E,N,b)}else{const b=t??a.length;do{const S=c===0?o[0]??s.initialPageParam:Fy(s,i);if(c>0&&S==null)break;i=await v(i,S),c++}while(c<b)}return i};e.options.persister?e.fetchFn=()=>{var p,y;return(y=(p=e.options).persister)==null?void 0:y.call(p,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=u}}}function Fy(t,{pages:e,pageParams:r}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,r[s],r):void 0}function VN(t,{pages:e,pageParams:r}){var s;return e.length>0?(s=t.getPreviousPageParam)==null?void 0:s.call(t,e[0],e,r[0],r):void 0}var yt,Os,Is,Zo,Yo,Ds,Jo,Xo,ox,qN=(ox=class{constructor(t={}){be(this,yt);be(this,Os);be(this,Is);be(this,Zo);be(this,Yo);be(this,Ds);be(this,Jo);be(this,Xo);ie(this,yt,t.queryCache||new LN),ie(this,Os,t.mutationCache||new zN),ie(this,Is,t.defaultOptions||{}),ie(this,Zo,new Map),ie(this,Yo,new Map),ie(this,Ds,0)}mount(){nc(this,Ds)._++,O(this,Ds)===1&&(ie(this,Jo,fv.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,yt).onFocus())})),ie(this,Xo,ju.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,yt).onOnline())})))}unmount(){var t,e;nc(this,Ds)._--,O(this,Ds)===0&&((t=O(this,Jo))==null||t.call(this),ie(this,Jo,void 0),(e=O(this,Xo))==null||e.call(this),ie(this,Xo,void 0))}isFetching(t){return O(this,yt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return O(this,Os).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=O(this,yt).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=O(this,yt).build(this,e),s=r.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Xs(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return O(this,yt).findAll(t).map(({queryKey:e,state:r})=>{const s=r.data;return[e,s]})}setQueryData(t,e,r){const s=this.defaultQueryOptions({queryKey:t}),n=O(this,yt).get(s.queryHash),a=n==null?void 0:n.state.data,o=NN(e,a);if(o!==void 0)return O(this,yt).build(this,s).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return Tt.batch(()=>O(this,yt).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=O(this,yt).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=O(this,yt);Tt.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=O(this,yt);return Tt.batch(()=>(r.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},s=Tt.batch(()=>O(this,yt).findAll(t).map(n=>n.cancel(r)));return Promise.all(s).then(tr).catch(tr)}invalidateQueries(t,e={}){return Tt.batch(()=>(O(this,yt).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},s=Tt.batch(()=>O(this,yt).findAll(t).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(tr)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(tr)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=O(this,yt).build(this,e);return r.isStaleByTime(Xs(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(tr).catch(tr)}fetchInfiniteQuery(t){return t.behavior=$y(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(tr).catch(tr)}ensureInfiniteQueryData(t){return t.behavior=$y(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return ju.isOnline()?O(this,Os).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,yt)}getMutationCache(){return O(this,Os)}getDefaultOptions(){return O(this,Is)}setDefaultOptions(t){ie(this,Is,t)}setQueryDefaults(t,e){O(this,Zo).set(Ka(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...O(this,Zo).values()],r={};return e.forEach(s=>{kl(t,s.queryKey)&&Object.assign(r,s.defaultOptions)}),r}setMutationDefaults(t,e){O(this,Yo).set(Ka(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...O(this,Yo).values()],r={};return e.forEach(s=>{kl(t,s.mutationKey)&&Object.assign(r,s.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...O(this,Is).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=uv(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===dv&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...O(this,Is).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){O(this,yt).clear(),O(this,Os).clear()}},yt=new WeakMap,Os=new WeakMap,Is=new WeakMap,Zo=new WeakMap,Yo=new WeakMap,Ds=new WeakMap,Jo=new WeakMap,Xo=new WeakMap,ox),lr,Ke,Il,Xt,Ia,ei,Wn,Ms,Dl,ti,ri,Da,Ma,$s,ni,Je,Bi,Yh,Jh,Xh,ep,tp,rp,np,qb,ix,HN=(ix=class extends bi{constructor(e,r){super();be(this,Je);be(this,lr);be(this,Ke);be(this,Il);be(this,Xt);be(this,Ia);be(this,ei);be(this,Wn);be(this,Ms);be(this,Dl);be(this,ti);be(this,ri);be(this,Da);be(this,Ma);be(this,$s);be(this,ni,new Set);this.options=r,ie(this,lr,e),ie(this,Ms,null),ie(this,Wn,Zh()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Ke).addObserver(this),Ly(O(this,Ke),this.options)?Le(this,Je,Bi).call(this):this.updateResult(),Le(this,Je,ep).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return sp(O(this,Ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return sp(O(this,Ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,Je,tp).call(this),Le(this,Je,rp).call(this),O(this,Ke).removeObserver(this)}setOptions(e){const r=this.options,s=O(this,Ke);if(this.options=O(this,lr).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ar(this.options.enabled,O(this,Ke))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,Je,np).call(this),O(this,Ke).setOptions(this.options),r._defaulted&&!Nu(this.options,r)&&O(this,lr).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Ke),observer:this});const n=this.hasListeners();n&&Uy(O(this,Ke),s,this.options,r)&&Le(this,Je,Bi).call(this),this.updateResult(),n&&(O(this,Ke)!==s||Ar(this.options.enabled,O(this,Ke))!==Ar(r.enabled,O(this,Ke))||Xs(this.options.staleTime,O(this,Ke))!==Xs(r.staleTime,O(this,Ke)))&&Le(this,Je,Yh).call(this);const a=Le(this,Je,Jh).call(this);n&&(O(this,Ke)!==s||Ar(this.options.enabled,O(this,Ke))!==Ar(r.enabled,O(this,Ke))||a!==O(this,$s))&&Le(this,Je,Xh).call(this,a)}getOptimisticResult(e){const r=O(this,lr).getQueryCache().build(O(this,lr),e),s=this.createResult(r,e);return KN(this,s)&&(ie(this,Xt,s),ie(this,ei,this.options),ie(this,Ia,O(this,Ke).state)),s}getCurrentResult(){return O(this,Xt)}trackResult(e,r){return new Proxy(e,{get:(s,n)=>(this.trackProp(n),r==null||r(n),n==="promise"&&!this.options.experimental_prefetchInRender&&O(this,Wn).status==="pending"&&O(this,Wn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,n))})}trackProp(e){O(this,ni).add(e)}getCurrentQuery(){return O(this,Ke)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=O(this,lr).defaultQueryOptions(e),s=O(this,lr).getQueryCache().build(O(this,lr),r);return s.fetch().then(()=>this.createResult(s,r))}fetch(e){return Le(this,Je,Bi).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,Xt)))}createResult(e,r){var A;const s=O(this,Ke),n=this.options,a=O(this,Xt),o=O(this,Ia),i=O(this,ei),u=e!==s?e.state:O(this,Il),{state:d}=e;let h={...d},m=!1,f;if(r._optimisticResults){const F=this.hasListeners(),T=!F&&Ly(e,r),_=F&&Uy(e,s,r,n);(T||_)&&(h={...h,...zb(d.data,e.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:w,errorUpdatedAt:p,status:y}=h;f=h.data;let g=!1;if(r.placeholderData!==void 0&&f===void 0&&y==="pending"){let F;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(F=a.data,g=!0):F=typeof r.placeholderData=="function"?r.placeholderData((A=O(this,ri))==null?void 0:A.state.data,O(this,ri)):r.placeholderData,F!==void 0&&(y="success",f=Gh(a==null?void 0:a.data,F,r),m=!0)}if(r.select&&f!==void 0&&!g)if(a&&f===(o==null?void 0:o.data)&&r.select===O(this,Dl))f=O(this,ti);else try{ie(this,Dl,r.select),f=r.select(f),f=Gh(a==null?void 0:a.data,f,r),ie(this,ti,f),ie(this,Ms,null)}catch(F){ie(this,Ms,F)}O(this,Ms)&&(w=O(this,Ms),f=O(this,ti),p=Date.now(),y="error");const v=h.fetchStatus==="fetching",b=y==="pending",S=y==="error",E=b&&v,N=f!==void 0,R={status:y,fetchStatus:h.fetchStatus,isPending:b,isSuccess:y==="success",isError:S,isInitialLoading:E,isLoading:E,data:f,dataUpdatedAt:h.dataUpdatedAt,error:w,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!b,isLoadingError:S&&!N,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:S&&N,isStale:hv(e,r),refetch:this.refetch,promise:O(this,Wn),isEnabled:Ar(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const F=I=>{R.status==="error"?I.reject(R.error):R.data!==void 0&&I.resolve(R.data)},T=()=>{const I=ie(this,Wn,R.promise=Zh());F(I)},_=O(this,Wn);switch(_.status){case"pending":e.queryHash===s.queryHash&&F(_);break;case"fulfilled":(R.status==="error"||R.data!==_.value)&&T();break;case"rejected":(R.status!=="error"||R.error!==_.reason)&&T();break}}return R}updateResult(){const e=O(this,Xt),r=this.createResult(O(this,Ke),this.options);if(ie(this,Ia,O(this,Ke).state),ie(this,ei,this.options),O(this,Ia).data!==void 0&&ie(this,ri,O(this,Ke)),Nu(r,e))return;ie(this,Xt,r);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!O(this,ni).size)return!0;const o=new Set(a??O(this,ni));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,Xt)).some(i=>{const c=i;return O(this,Xt)[c]!==e[c]&&o.has(c)})};Le(this,Je,qb).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,Je,ep).call(this)}},lr=new WeakMap,Ke=new WeakMap,Il=new WeakMap,Xt=new WeakMap,Ia=new WeakMap,ei=new WeakMap,Wn=new WeakMap,Ms=new WeakMap,Dl=new WeakMap,ti=new WeakMap,ri=new WeakMap,Da=new WeakMap,Ma=new WeakMap,$s=new WeakMap,ni=new WeakMap,Je=new WeakSet,Bi=function(e){Le(this,Je,np).call(this);let r=O(this,Ke).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(tr)),r},Yh=function(){Le(this,Je,tp).call(this);const e=Xs(this.options.staleTime,O(this,Ke));if(Ba||O(this,Xt).isStale||!Wh(e))return;const s=Ob(O(this,Xt).dataUpdatedAt,e)+1;ie(this,Da,setTimeout(()=>{O(this,Xt).isStale||this.updateResult()},s))},Jh=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Ke)):this.options.refetchInterval)??!1},Xh=function(e){Le(this,Je,rp).call(this),ie(this,$s,e),!(Ba||Ar(this.options.enabled,O(this,Ke))===!1||!Wh(O(this,$s))||O(this,$s)===0)&&ie(this,Ma,setInterval(()=>{(this.options.refetchIntervalInBackground||fv.isFocused())&&Le(this,Je,Bi).call(this)},O(this,$s)))},ep=function(){Le(this,Je,Yh).call(this),Le(this,Je,Xh).call(this,Le(this,Je,Jh).call(this))},tp=function(){O(this,Da)&&(clearTimeout(O(this,Da)),ie(this,Da,void 0))},rp=function(){O(this,Ma)&&(clearInterval(O(this,Ma)),ie(this,Ma,void 0))},np=function(){const e=O(this,lr).getQueryCache().build(O(this,lr),this.options);if(e===O(this,Ke))return;const r=O(this,Ke);ie(this,Ke,e),ie(this,Il,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},qb=function(e){Tt.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(O(this,Xt))}),O(this,lr).getQueryCache().notify({query:O(this,Ke),type:"observerResultsUpdated"})})},ix);function BN(t,e){return Ar(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Ly(t,e){return BN(t,e)||t.state.data!==void 0&&sp(t,e,e.refetchOnMount)}function sp(t,e,r){if(Ar(e.enabled,t)!==!1&&Xs(e.staleTime,t)!=="static"){const s=typeof r=="function"?r(t):r;return s==="always"||s!==!1&&hv(t,e)}return!1}function Uy(t,e,r,s){return(t!==e||Ar(s.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&hv(t,r)}function hv(t,e){return Ar(e.enabled,t)!==!1&&t.isStaleByTime(Xs(e.staleTime,t))}function KN(t,e){return!Nu(t.getCurrentResult(),e)}var Fs,Ls,cr,Qn,rs,Kc,ap,lx,WN=(lx=class extends bi{constructor(r,s){super();be(this,rs);be(this,Fs);be(this,Ls);be(this,cr);be(this,Qn);ie(this,Fs,r),this.setOptions(s),this.bindMethods(),Le(this,rs,Kc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var n;const s=this.options;this.options=O(this,Fs).defaultMutationOptions(r),Nu(this.options,s)||O(this,Fs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,cr),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Ka(s.mutationKey)!==Ka(this.options.mutationKey)?this.reset():((n=O(this,cr))==null?void 0:n.state.status)==="pending"&&O(this,cr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=O(this,cr))==null||r.removeObserver(this)}onMutationUpdate(r){Le(this,rs,Kc).call(this),Le(this,rs,ap).call(this,r)}getCurrentResult(){return O(this,Ls)}reset(){var r;(r=O(this,cr))==null||r.removeObserver(this),ie(this,cr,void 0),Le(this,rs,Kc).call(this),Le(this,rs,ap).call(this)}mutate(r,s){var n;return ie(this,Qn,s),(n=O(this,cr))==null||n.removeObserver(this),ie(this,cr,O(this,Fs).getMutationCache().build(O(this,Fs),this.options)),O(this,cr).addObserver(this),O(this,cr).execute(r)}},Fs=new WeakMap,Ls=new WeakMap,cr=new WeakMap,Qn=new WeakMap,rs=new WeakSet,Kc=function(){var s;const r=((s=O(this,cr))==null?void 0:s.state)??Vb();ie(this,Ls,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},ap=function(r){Tt.batch(()=>{var s,n,a,o,i,c,u,d;if(O(this,Qn)&&this.hasListeners()){const h=O(this,Ls).variables,m=O(this,Ls).context;(r==null?void 0:r.type)==="success"?((n=(s=O(this,Qn)).onSuccess)==null||n.call(s,r.data,h,m),(o=(a=O(this,Qn)).onSettled)==null||o.call(a,r.data,null,h,m)):(r==null?void 0:r.type)==="error"&&((c=(i=O(this,Qn)).onError)==null||c.call(i,r.error,h,m),(d=(u=O(this,Qn)).onSettled)==null||d.call(u,void 0,r.error,h,m))}this.listeners.forEach(h=>{h(O(this,Ls))})})},lx),Hb=x.createContext(void 0),yr=t=>{const e=x.useContext(Hb);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},QN=({client:t,children:e})=>(x.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),l.jsx(Hb.Provider,{value:t,children:e})),Bb=x.createContext(!1),GN=()=>x.useContext(Bb);Bb.Provider;function ZN(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var YN=x.createContext(ZN()),JN=()=>x.useContext(YN),XN=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},ej=t=>{x.useEffect(()=>{t.clearReset()},[t])},tj=({result:t,errorResetBoundary:e,throwOnError:r,query:s,suspense:n})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(n&&t.data===void 0||Mb(r,[t.error,s])),rj=t=>{if(t.suspense){const e=s=>s==="static"?s:Math.max(s??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...s)=>e(r(...s)):e(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},nj=(t,e)=>t.isLoading&&t.isFetching&&!e,sj=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,zy=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function aj(t,e,r){var h,m,f,w,p;const s=GN(),n=JN(),a=yr(),o=a.defaultQueryOptions(t);(m=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||m.call(h,o),o._optimisticResults=s?"isRestoring":"optimistic",rj(o),XN(o,n),ej(n);const i=!a.getQueryCache().get(o.queryHash),[c]=x.useState(()=>new e(a,o)),u=c.getOptimisticResult(o),d=!s&&t.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(y=>{const g=d?c.subscribe(Tt.batchCalls(y)):tr;return c.updateResult(),g},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),x.useEffect(()=>{c.setOptions(o)},[o,c]),sj(o,u))throw zy(o,c,n);if(tj({result:u,errorResetBoundary:n,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((w=(f=a.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||w.call(f,o,u),o.experimental_prefetchInRender&&!Ba&&nj(u,s)){const y=i?zy(o,c,n):(p=a.getQueryCache().get(o.queryHash))==null?void 0:p.promise;y==null||y.catch(tr).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function hr(t,e){return aj(t,HN)}function At(t,e){const r=yr(),[s]=x.useState(()=>new WN(r,t));x.useEffect(()=>{s.setOptions(t)},[s,t]);const n=x.useSyncExternalStore(x.useCallback(o=>s.subscribe(Tt.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=x.useCallback((o,i)=>{s.mutate(o,i).catch(tr)},[s]);if(n.error&&Mb(s.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}const oj="x-agent-deck-client",ij="dashboard",Kb={[oj]:ij};async function Wb(t){if(t.ok)return;let e=t.statusText;try{const r=await t.text();try{const s=JSON.parse(r);e=s.error||s.message||e}catch{r.trim()&&(e=`${t.status}: ${r}`)}}catch(r){console.warn("Response body parsing failed:",r)}throw new Error(e)}async function Oe(t,e,r){const s=await fetch(e,{method:t,headers:{...Kb,...r?{"Content-Type":"application/json"}:{}},body:r?JSON.stringify(r):void 0});return await Wb(s),s}const lj=({on401:t})=>async({queryKey:e})=>{const r=e.join("/"),s=await fetch(r,{headers:Kb});return await Wb(s),await s.json()},cj=new qN({defaultOptions:{queries:{queryFn:lj({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),uj=1,dj=1e6;let jf=0;function fj(){return jf=(jf+1)%Number.MAX_SAFE_INTEGER,jf.toString()}const Rf=new Map,Vy=t=>{if(Rf.has(t))return;const e=setTimeout(()=>{Rf.delete(t),ol({type:"REMOVE_TOAST",toastId:t})},dj);Rf.set(t,e)},hj=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,uj)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;return r?Vy(r):t.toasts.forEach(s=>{Vy(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},Wc=[];let Qc={toasts:[]};function ol(t){Qc=hj(Qc,t),Wc.forEach(e=>{e(Qc)})}function pj({...t}){const e=fj(),r=n=>ol({type:"UPDATE_TOAST",toast:{...n,id:e}}),s=()=>ol({type:"DISMISS_TOAST",toastId:e});return ol({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:n=>{n||s()}}}),{id:e,dismiss:s,update:r}}function or(){const[t,e]=x.useState(Qc);return x.useEffect(()=>(Wc.push(e),()=>{const r=Wc.indexOf(e);r>-1&&Wc.splice(r,1)}),[t]),{...t,toast:pj,dismiss:r=>ol({type:"DISMISS_TOAST",toastId:r})}}function Se(t,e,{checkForDefaultPrevented:r=!0}={}){return function(n){if(t==null||t(n),r===!1||!n.defaultPrevented)return e==null?void 0:e(n)}}function qy(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Qb(...t){return e=>{let r=!1;const s=t.map(n=>{const a=qy(n,e);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let n=0;n<s.length;n++){const a=s[n];typeof a=="function"?a():qy(t[n],null)}}}}function et(...t){return x.useCallback(Qb(...t),t)}function mj(t,e){const r=x.createContext(e),s=a=>{const{children:o,...i}=a,c=x.useMemo(()=>i,Object.values(i));return l.jsx(r.Provider,{value:c,children:o})};s.displayName=t+"Provider";function n(a){const o=x.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[s,n]}function fs(t,e=[]){let r=[];function s(a,o){const i=x.createContext(o),c=r.length;r=[...r,o];const u=h=>{var g;const{scope:m,children:f,...w}=h,p=((g=m==null?void 0:m[t])==null?void 0:g[c])||i,y=x.useMemo(()=>w,Object.values(w));return l.jsx(p.Provider,{value:y,children:f})};u.displayName=a+"Provider";function d(h,m){var p;const f=((p=m==null?void 0:m[t])==null?void 0:p[c])||i,w=x.useContext(f);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[u,d]}const n=()=>{const a=r.map(o=>x.createContext(o));return function(i){const c=(i==null?void 0:i[t])||a;return x.useMemo(()=>({[`__scope${t}`]:{...i,[t]:c}}),[i,c])}};return n.scopeName=t,[s,vj(n,...e)]}function vj(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const s=t.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const o=s.reduce((i,{useScope:c,scopeName:u})=>{const h=c(a)[`__scope${u}`];return{...i,...h}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function fi(t){const e=yj(t),r=x.forwardRef((s,n)=>{const{children:a,...o}=s,i=x.Children.toArray(a),c=i.find(wj);if(c){const u=c.props.children,d=i.map(h=>h===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:h);return l.jsx(e,{...o,ref:n,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return l.jsx(e,{...o,ref:n,children:a})});return r.displayName=`${t}.Slot`,r}var gj=fi("Slot");function yj(t){const e=x.forwardRef((r,s)=>{const{children:n,...a}=r;if(x.isValidElement(n)){const o=Sj(n),i=bj(a,n.props);return n.type!==x.Fragment&&(i.ref=s?Qb(s,o):o),x.cloneElement(n,i)}return x.Children.count(n)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Gb=Symbol("radix.slottable");function xj(t){const e=({children:r})=>l.jsx(l.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Gb,e}function wj(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Gb}function bj(t,e){const r={...e};for(const s in e){const n=t[s],a=e[s];/^on[A-Z]/.test(s)?n&&a?r[s]=(...i)=>{const c=a(...i);return n(...i),c}:n&&(r[s]=n):s==="style"?r[s]={...n,...a}:s==="className"&&(r[s]=[n,a].filter(Boolean).join(" "))}return{...t,...r}}function Sj(t){var s,n;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(n=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function pv(t){const e=t+"CollectionProvider",[r,s]=fs(e),[n,a]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:y,children:g}=p,v=mn.useRef(null),b=mn.useRef(new Map).current;return l.jsx(n,{scope:y,itemMap:b,collectionRef:v,children:g})};o.displayName=e;const i=t+"CollectionSlot",c=fi(i),u=mn.forwardRef((p,y)=>{const{scope:g,children:v}=p,b=a(i,g),S=et(y,b.collectionRef);return l.jsx(c,{ref:S,children:v})});u.displayName=i;const d=t+"CollectionItemSlot",h="data-radix-collection-item",m=fi(d),f=mn.forwardRef((p,y)=>{const{scope:g,children:v,...b}=p,S=mn.useRef(null),E=et(y,S),N=a(d,g);return mn.useEffect(()=>(N.itemMap.set(S,{ref:S,...b}),()=>void N.itemMap.delete(S))),l.jsx(m,{[h]:"",ref:E,children:v})});f.displayName=d;function w(p){const y=a(t+"CollectionConsumer",p);return mn.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const b=Array.from(v.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((N,j)=>b.indexOf(N.ref.current)-b.indexOf(j.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:u,ItemSlot:f},w,s]}var _j=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ae=_j.reduce((t,e)=>{const r=fi(`Primitive.${e}`),s=x.forwardRef((n,a)=>{const{asChild:o,...i}=n,c=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...i,ref:a})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Zb(t,e){t&&so.flushSync(()=>t.dispatchEvent(e))}function Ur(t){const e=x.useRef(t);return x.useEffect(()=>{e.current=t}),x.useMemo(()=>(...r)=>{var s;return(s=e.current)==null?void 0:s.call(e,...r)},[])}function Ej(t,e=globalThis==null?void 0:globalThis.document){const r=Ur(t);x.useEffect(()=>{const s=n=>{n.key==="Escape"&&r(n)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[r,e])}var Cj="DismissableLayer",op="dismissableLayer.update",Pj="dismissableLayer.pointerDownOutside",kj="dismissableLayer.focusOutside",Hy,Yb=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Vl=x.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:n,onFocusOutside:a,onInteractOutside:o,onDismiss:i,...c}=t,u=x.useContext(Yb),[d,h]=x.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=x.useState({}),w=et(e,j=>h(j)),p=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=p.indexOf(y),v=d?p.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=g,E=jj(j=>{const R=j.target,A=[...u.branches].some(F=>F.contains(R));!S||A||(n==null||n(j),o==null||o(j),j.defaultPrevented||i==null||i())},m),N=Rj(j=>{const R=j.target;[...u.branches].some(F=>F.contains(R))||(a==null||a(j),o==null||o(j),j.defaultPrevented||i==null||i())},m);return Ej(j=>{v===u.layers.size-1&&(s==null||s(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},m),x.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Hy=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),By(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Hy)}},[d,m,r,u]),x.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),By())},[d,u]),x.useEffect(()=>{const j=()=>f({});return document.addEventListener(op,j),()=>document.removeEventListener(op,j)},[]),l.jsx(Ae.div,{...c,ref:w,style:{pointerEvents:b?S?"auto":"none":void 0,...t.style},onFocusCapture:Se(t.onFocusCapture,N.onFocusCapture),onBlurCapture:Se(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Se(t.onPointerDownCapture,E.onPointerDownCapture)})});Vl.displayName=Cj;var Nj="DismissableLayerBranch",Jb=x.forwardRef((t,e)=>{const r=x.useContext(Yb),s=x.useRef(null),n=et(e,s);return x.useEffect(()=>{const a=s.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),l.jsx(Ae.div,{...t,ref:n})});Jb.displayName=Nj;function jj(t,e=globalThis==null?void 0:globalThis.document){const r=Ur(t),s=x.useRef(!1),n=x.useRef(()=>{});return x.useEffect(()=>{const a=i=>{if(i.target&&!s.current){let c=function(){Xb(Pj,r,u,{discrete:!0})};const u={originalEvent:i};i.pointerType==="touch"?(e.removeEventListener("click",n.current),n.current=c,e.addEventListener("click",n.current,{once:!0})):c()}else e.removeEventListener("click",n.current);s.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",n.current)}},[e,r]),{onPointerDownCapture:()=>s.current=!0}}function Rj(t,e=globalThis==null?void 0:globalThis.document){const r=Ur(t),s=x.useRef(!1);return x.useEffect(()=>{const n=a=>{a.target&&!s.current&&Xb(kj,r,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",n),()=>e.removeEventListener("focusin",n)},[e,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function By(){const t=new CustomEvent(op);document.dispatchEvent(t)}function Xb(t,e,r,{discrete:s}){const n=r.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),s?Zb(n,a):n.dispatchEvent(a)}var Tj=Vl,Aj=Jb,Bt=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},Oj="Portal",Ed=x.forwardRef((t,e)=>{var i;const{container:r,...s}=t,[n,a]=x.useState(!1);Bt(()=>a(!0),[]);const o=r||n&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return o?Zk.createPortal(l.jsx(Ae.div,{...s,ref:e}),o):null});Ed.displayName=Oj;function Ij(t,e){return x.useReducer((r,s)=>e[r][s]??r,t)}var da=t=>{const{present:e,children:r}=t,s=Dj(e),n=typeof r=="function"?r({present:s.isPresent}):x.Children.only(r),a=et(s.ref,Mj(n));return typeof r=="function"||s.isPresent?x.cloneElement(n,{ref:a}):null};da.displayName="Presence";function Dj(t){const[e,r]=x.useState(),s=x.useRef(null),n=x.useRef(t),a=x.useRef("none"),o=t?"mounted":"unmounted",[i,c]=Ij(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=_c(s.current);a.current=i==="mounted"?u:"none"},[i]),Bt(()=>{const u=s.current,d=n.current;if(d!==t){const m=a.current,f=_c(u);t?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,c]),Bt(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,h=f=>{const p=_c(s.current).includes(CSS.escape(f.animationName));if(f.target===e&&p&&(c("ANIMATION_END"),!n.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},m=f=>{f.target===e&&(a.current=_c(s.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:x.useCallback(u=>{s.current=u?getComputedStyle(u):null,r(u)},[])}}function _c(t){return(t==null?void 0:t.animationName)||"none"}function Mj(t){var s,n;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(n=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var $j=gm[" useInsertionEffect ".trim().toString()]||Bt;function Wa({prop:t,defaultProp:e,onChange:r=()=>{},caller:s}){const[n,a,o]=Fj({defaultProp:e,onChange:r}),i=t!==void 0,c=i?t:n;{const d=x.useRef(t!==void 0);x.useEffect(()=>{const h=d.current;h!==i&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${i?"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=i},[i,s])}const u=x.useCallback(d=>{var h;if(i){const m=Lj(d)?d(t):d;m!==t&&((h=o.current)==null||h.call(o,m))}else a(d)},[i,t,a,o]);return[c,u]}function Fj({defaultProp:t,onChange:e}){const[r,s]=x.useState(t),n=x.useRef(r),a=x.useRef(e);return $j(()=>{a.current=e},[e]),x.useEffect(()=>{var o;n.current!==r&&((o=a.current)==null||o.call(a,r),n.current=r)},[r,n]),[r,s,a]}function Lj(t){return typeof t=="function"}var e1=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"}),Uj="VisuallyHidden",Cd=x.forwardRef((t,e)=>l.jsx(Ae.span,{...t,ref:e,style:{...e1,...t.style}}));Cd.displayName=Uj;var zj=Cd,mv="ToastProvider",[vv,Vj,qj]=pv("Toast"),[t1,xF]=fs("Toast",[qj]),[Hj,Pd]=t1(mv),r1=t=>{const{__scopeToast:e,label:r="Notification",duration:s=5e3,swipeDirection:n="right",swipeThreshold:a=50,children:o}=t,[i,c]=x.useState(null),[u,d]=x.useState(0),h=x.useRef(!1),m=x.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${mv}\`. Expected non-empty \`string\`.`),l.jsx(vv.Provider,{scope:e,children:l.jsx(Hj,{scope:e,label:r,duration:s,swipeDirection:n,swipeThreshold:a,toastCount:u,viewport:i,onViewportChange:c,onToastAdd:x.useCallback(()=>d(f=>f+1),[]),onToastRemove:x.useCallback(()=>d(f=>f-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:m,children:o})})};r1.displayName=mv;var n1="ToastViewport",Bj=["F8"],ip="toast.viewportPause",lp="toast.viewportResume",s1=x.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:s=Bj,label:n="Notifications ({hotkey})",...a}=t,o=Pd(n1,r),i=Vj(r),c=x.useRef(null),u=x.useRef(null),d=x.useRef(null),h=x.useRef(null),m=et(e,h,o.onViewportChange),f=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),w=o.toastCount>0;x.useEffect(()=>{const y=g=>{var b;s.length!==0&&s.every(S=>g[S]||g.code===S)&&((b=h.current)==null||b.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]),x.useEffect(()=>{const y=c.current,g=h.current;if(w&&y&&g){const v=()=>{if(!o.isClosePausedRef.current){const N=new CustomEvent(ip);g.dispatchEvent(N),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const N=new CustomEvent(lp);g.dispatchEvent(N),o.isClosePausedRef.current=!1}},S=N=>{!y.contains(N.relatedTarget)&&b()},E=()=>{y.contains(document.activeElement)||b()};return y.addEventListener("focusin",v),y.addEventListener("focusout",S),y.addEventListener("pointermove",v),y.addEventListener("pointerleave",E),window.addEventListener("blur",v),window.addEventListener("focus",b),()=>{y.removeEventListener("focusin",v),y.removeEventListener("focusout",S),y.removeEventListener("pointermove",v),y.removeEventListener("pointerleave",E),window.removeEventListener("blur",v),window.removeEventListener("focus",b)}}},[w,o.isClosePausedRef]);const p=x.useCallback(({tabbingDirection:y})=>{const v=i().map(b=>{const S=b.ref.current,E=[S,...s2(S)];return y==="forwards"?E:E.reverse()});return(y==="forwards"?v.reverse():v).flat()},[i]);return x.useEffect(()=>{const y=h.current;if(y){const g=v=>{var E,N,j;const b=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!b){const R=document.activeElement,A=v.shiftKey;if(v.target===y&&A){(E=u.current)==null||E.focus();return}const _=p({tabbingDirection:A?"backwards":"forwards"}),I=_.findIndex(C=>C===R);Tf(_.slice(I+1))?v.preventDefault():A?(N=u.current)==null||N.focus():(j=d.current)==null||j.focus()}};return y.addEventListener("keydown",g),()=>y.removeEventListener("keydown",g)}},[i,p]),l.jsxs(Aj,{ref:c,role:"region","aria-label":n.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:w?void 0:"none"},children:[w&&l.jsx(cp,{ref:u,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"forwards"});Tf(y)}}),l.jsx(vv.Slot,{scope:r,children:l.jsx(Ae.ol,{tabIndex:-1,...a,ref:m})}),w&&l.jsx(cp,{ref:d,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"backwards"});Tf(y)}})]})});s1.displayName=n1;var a1="ToastFocusProxy",cp=x.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:s,...n}=t,a=Pd(a1,r);return l.jsx(Cd,{tabIndex:0,...n,ref:e,style:{position:"fixed"},onFocus:o=>{var u;const i=o.relatedTarget;!((u=a.viewport)!=null&&u.contains(i))&&s()}})});cp.displayName=a1;var ql="Toast",Kj="toast.swipeStart",Wj="toast.swipeMove",Qj="toast.swipeCancel",Gj="toast.swipeEnd",o1=x.forwardRef((t,e)=>{const{forceMount:r,open:s,defaultOpen:n,onOpenChange:a,...o}=t,[i,c]=Wa({prop:s,defaultProp:n??!0,onChange:a,caller:ql});return l.jsx(da,{present:r||i,children:l.jsx(Jj,{open:i,...o,ref:e,onClose:()=>c(!1),onPause:Ur(t.onPause),onResume:Ur(t.onResume),onSwipeStart:Se(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Se(t.onSwipeMove,u=>{const{x:d,y:h}=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",`${h}px`)}),onSwipeCancel:Se(t.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:Se(t.onSwipeEnd,u=>{const{x:d,y:h}=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",`${h}px`),c(!1)})})})});o1.displayName=ql;var[Zj,Yj]=t1(ql,{onClose(){}}),Jj=x.forwardRef((t,e)=>{const{__scopeToast:r,type:s="foreground",duration:n,open:a,onClose:o,onEscapeKeyDown:i,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:m,onSwipeEnd:f,...w}=t,p=Pd(ql,r),[y,g]=x.useState(null),v=et(e,C=>g(C)),b=x.useRef(null),S=x.useRef(null),E=n||p.duration,N=x.useRef(0),j=x.useRef(E),R=x.useRef(0),{onToastAdd:A,onToastRemove:F}=p,T=Ur(()=>{var z;(y==null?void 0:y.contains(document.activeElement))&&((z=p.viewport)==null||z.focus()),o()}),_=x.useCallback(C=>{!C||C===1/0||(window.clearTimeout(R.current),N.current=new Date().getTime(),R.current=window.setTimeout(T,C))},[T]);x.useEffect(()=>{const C=p.viewport;if(C){const z=()=>{_(j.current),u==null||u()},U=()=>{const K=new Date().getTime()-N.current;j.current=j.current-K,window.clearTimeout(R.current),c==null||c()};return C.addEventListener(ip,U),C.addEventListener(lp,z),()=>{C.removeEventListener(ip,U),C.removeEventListener(lp,z)}}},[p.viewport,E,c,u,_]),x.useEffect(()=>{a&&!p.isClosePausedRef.current&&_(E)},[a,E,p.isClosePausedRef,_]),x.useEffect(()=>(A(),()=>F()),[A,F]);const I=x.useMemo(()=>y?h1(y):null,[y]);return p.viewport?l.jsxs(l.Fragment,{children:[I&&l.jsx(Xj,{__scopeToast:r,role:"status","aria-live":s==="foreground"?"assertive":"polite",children:I}),l.jsx(Zj,{scope:r,onClose:T,children:so.createPortal(l.jsx(vv.ItemSlot,{scope:r,children:l.jsx(Tj,{asChild:!0,onEscapeKeyDown:Se(i,()=>{p.isFocusedToastEscapeKeyDownRef.current||T(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Ae.li,{tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":p.swipeDirection,...w,ref:v,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Se(t.onKeyDown,C=>{C.key==="Escape"&&(i==null||i(C.nativeEvent),C.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,T()))}),onPointerDown:Se(t.onPointerDown,C=>{C.button===0&&(b.current={x:C.clientX,y:C.clientY})}),onPointerMove:Se(t.onPointerMove,C=>{if(!b.current)return;const z=C.clientX-b.current.x,U=C.clientY-b.current.y,K=!!S.current,P=["left","right"].includes(p.swipeDirection),D=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,L=P?D(0,z):0,X=P?0:D(0,U),G=C.pointerType==="touch"?10:2,B={x:L,y:X},oe={originalEvent:C,delta:B};K?(S.current=B,Ec(Wj,h,oe,{discrete:!1})):Ky(B,p.swipeDirection,G)?(S.current=B,Ec(Kj,d,oe,{discrete:!1}),C.target.setPointerCapture(C.pointerId)):(Math.abs(z)>G||Math.abs(U)>G)&&(b.current=null)}),onPointerUp:Se(t.onPointerUp,C=>{const z=S.current,U=C.target;if(U.hasPointerCapture(C.pointerId)&&U.releasePointerCapture(C.pointerId),S.current=null,b.current=null,z){const K=C.currentTarget,P={originalEvent:C,delta:z};Ky(z,p.swipeDirection,p.swipeThreshold)?Ec(Gj,f,P,{discrete:!0}):Ec(Qj,m,P,{discrete:!0}),K.addEventListener("click",D=>D.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),Xj=t=>{const{__scopeToast:e,children:r,...s}=t,n=Pd(ql,e),[a,o]=x.useState(!1),[i,c]=x.useState(!1);return r2(()=>o(!0)),x.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),i?null:l.jsx(Ed,{asChild:!0,children:l.jsx(Cd,{...s,children:a&&l.jsxs(l.Fragment,{children:[n.label," ",r]})})})},e2="ToastTitle",i1=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return l.jsx(Ae.div,{...s,ref:e})});i1.displayName=e2;var t2="ToastDescription",l1=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return l.jsx(Ae.div,{...s,ref:e})});l1.displayName=t2;var c1="ToastAction",u1=x.forwardRef((t,e)=>{const{altText:r,...s}=t;return r.trim()?l.jsx(f1,{altText:r,asChild:!0,children:l.jsx(gv,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${c1}\`. Expected non-empty \`string\`.`),null)});u1.displayName=c1;var d1="ToastClose",gv=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t,n=Yj(d1,r);return l.jsx(f1,{asChild:!0,children:l.jsx(Ae.button,{type:"button",...s,ref:e,onClick:Se(t.onClick,n.onClose)})})});gv.displayName=d1;var f1=x.forwardRef((t,e)=>{const{__scopeToast:r,altText:s,...n}=t;return l.jsx(Ae.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...n,ref:e})});function h1(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),n2(s)){const n=s.ariaHidden||s.hidden||s.style.display==="none",a=s.dataset.radixToastAnnounceExclude==="";if(!n)if(a){const o=s.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...h1(s))}}),e}function Ec(t,e,r,{discrete:s}){const n=r.originalEvent.currentTarget,a=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),s?Zb(n,a):n.dispatchEvent(a)}var Ky=(t,e,r=0)=>{const s=Math.abs(t.x),n=Math.abs(t.y),a=s>n;return e==="left"||e==="right"?a&&s>r:!a&&n>r};function r2(t=()=>{}){const e=Ur(t);Bt(()=>{let r=0,s=0;return r=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(s)}},[e])}function n2(t){return t.nodeType===t.ELEMENT_NODE}function s2(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||n?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function Tf(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var a2=r1,p1=s1,m1=o1,v1=i1,g1=l1,y1=u1,x1=gv;function w1(t){var e,r,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(r=w1(t[e]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function b1(){for(var t,e,r=0,s="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=w1(t))&&(s&&(s+=" "),s+=e);return s}const Wy=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Qy=b1,kd=(t,e)=>r=>{var s;if((e==null?void 0:e.variants)==null)return Qy(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:a}=e,o=Object.keys(n).map(u=>{const d=r==null?void 0:r[u],h=a==null?void 0:a[u];if(d===null)return null;const m=Wy(d)||Wy(h);return n[u][m]}),i=r&&Object.entries(r).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:h,className:m,...f}=d;return Object.entries(f).every(w=>{let[p,y]=w;return Array.isArray(y)?y.includes({...a,...i}[p]):{...a,...i}[p]===y})?[...u,h,m]:u},[]);return Qy(t,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
|
|
49
49
|
* @license lucide-react v0.453.0 - ISC
|
|
50
50
|
*
|
|
51
51
|
* This source code is licensed under the ISC license.
|
|
52
52
|
* See the LICENSE file in the root directory of this source tree.
|
|
53
|
-
*/const
|
|
53
|
+
*/const o2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),S1=(...t)=>t.filter((e,r,s)=>!!e&&s.indexOf(e)===r).join(" ");/**
|
|
54
54
|
* @license lucide-react v0.453.0 - ISC
|
|
55
55
|
*
|
|
56
56
|
* This source code is licensed under the ISC license.
|
|
57
57
|
* See the LICENSE file in the root directory of this source tree.
|
|
58
|
-
*/var
|
|
58
|
+
*/var i2={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
59
|
* @license lucide-react v0.453.0 - ISC
|
|
60
60
|
*
|
|
61
61
|
* This source code is licensed under the ISC license.
|
|
62
62
|
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
-
*/const
|
|
63
|
+
*/const l2=x.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:n="",children:a,iconNode:o,...i},c)=>x.createElement("svg",{ref:c,...i2,width:e,height:e,stroke:t,strokeWidth:s?Number(r)*24/Number(e):r,className:S1("lucide",n),...i},[...o.map(([u,d])=>x.createElement(u,d)),...Array.isArray(a)?a:[a]]));/**
|
|
64
64
|
* @license lucide-react v0.453.0 - ISC
|
|
65
65
|
*
|
|
66
66
|
* This source code is licensed under the ISC license.
|
|
67
67
|
* See the LICENSE file in the root directory of this source tree.
|
|
68
|
-
*/const Ye=(t,e)=>{const r=x.forwardRef(({className:s,...n},a)=>x.createElement(
|
|
68
|
+
*/const Ye=(t,e)=>{const r=x.forwardRef(({className:s,...n},a)=>x.createElement(l2,{ref:a,iconNode:e,className:S1(`lucide-${o2(t)}`,s),...n}));return r.displayName=`${t}`,r};/**
|
|
69
69
|
* @license lucide-react v0.453.0 - ISC
|
|
70
70
|
*
|
|
71
71
|
* This source code is licensed under the ISC license.
|
|
72
72
|
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/const
|
|
73
|
+
*/const c2=Ye("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
74
|
* @license lucide-react v0.453.0 - ISC
|
|
75
75
|
*
|
|
76
76
|
* This source code is licensed under the ISC license.
|
|
77
77
|
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
-
*/const
|
|
78
|
+
*/const _1=Ye("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
79
|
* @license lucide-react v0.453.0 - ISC
|
|
80
80
|
*
|
|
81
81
|
* This source code is licensed under the ISC license.
|
|
82
82
|
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/const
|
|
83
|
+
*/const yv=Ye("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
84
|
* @license lucide-react v0.453.0 - ISC
|
|
85
85
|
*
|
|
86
86
|
* This source code is licensed under the ISC license.
|
|
87
87
|
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
-
*/const
|
|
88
|
+
*/const u2=Ye("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
89
|
* @license lucide-react v0.453.0 - ISC
|
|
90
90
|
*
|
|
91
91
|
* This source code is licensed under the ISC license.
|
|
92
92
|
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
-
*/const
|
|
93
|
+
*/const Af=Ye("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
94
|
* @license lucide-react v0.453.0 - ISC
|
|
95
95
|
*
|
|
96
96
|
* This source code is licensed under the ISC license.
|
|
97
97
|
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/const
|
|
98
|
+
*/const E1=Ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
99
99
|
* @license lucide-react v0.453.0 - ISC
|
|
100
100
|
*
|
|
101
101
|
* This source code is licensed under the ISC license.
|
|
102
102
|
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
-
*/const
|
|
103
|
+
*/const xv=Ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
104
104
|
* @license lucide-react v0.453.0 - ISC
|
|
105
105
|
*
|
|
106
106
|
* This source code is licensed under the ISC license.
|
|
107
107
|
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
-
*/const
|
|
108
|
+
*/const d2=Ye("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
109
109
|
* @license lucide-react v0.453.0 - ISC
|
|
110
110
|
*
|
|
111
111
|
* This source code is licensed under the ISC license.
|
|
112
112
|
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
-
*/const
|
|
113
|
+
*/const C1=Ye("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"}]]);/**
|
|
114
114
|
* @license lucide-react v0.453.0 - ISC
|
|
115
115
|
*
|
|
116
116
|
* This source code is licensed under the ISC license.
|
|
117
117
|
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
-
*/const
|
|
118
|
+
*/const up=Ye("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
119
119
|
* @license lucide-react v0.453.0 - ISC
|
|
120
120
|
*
|
|
121
121
|
* This source code is licensed under the ISC license.
|
|
122
122
|
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
-
*/const
|
|
123
|
+
*/const Gy=Ye("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"}]]);/**
|
|
124
124
|
* @license lucide-react v0.453.0 - ISC
|
|
125
125
|
*
|
|
126
126
|
* This source code is licensed under the ISC license.
|
|
127
127
|
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
-
*/const
|
|
128
|
+
*/const f2=Ye("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"}]]);/**
|
|
129
129
|
* @license lucide-react v0.453.0 - ISC
|
|
130
130
|
*
|
|
131
131
|
* This source code is licensed under the ISC license.
|
|
132
132
|
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
-
*/const
|
|
133
|
+
*/const P1=Ye("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"}]]);/**
|
|
134
134
|
* @license lucide-react v0.453.0 - ISC
|
|
135
135
|
*
|
|
136
136
|
* This source code is licensed under the ISC license.
|
|
137
137
|
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
-
*/const
|
|
138
|
+
*/const Zy=Ye("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"}]]);/**
|
|
139
139
|
* @license lucide-react v0.453.0 - ISC
|
|
140
140
|
*
|
|
141
141
|
* This source code is licensed under the ISC license.
|
|
142
142
|
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
-
*/const
|
|
143
|
+
*/const Jn=Ye("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"}]]);/**
|
|
144
144
|
* @license lucide-react v0.453.0 - ISC
|
|
145
145
|
*
|
|
146
146
|
* This source code is licensed under the ISC license.
|
|
147
147
|
* See the LICENSE file in the root directory of this source tree.
|
|
148
|
-
*/const
|
|
148
|
+
*/const h2=Ye("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
149
149
|
* @license lucide-react v0.453.0 - ISC
|
|
150
150
|
*
|
|
151
151
|
* This source code is licensed under the ISC license.
|
|
152
152
|
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
-
*/const
|
|
153
|
+
*/const dp=Ye("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"}]]);/**
|
|
154
154
|
* @license lucide-react v0.453.0 - ISC
|
|
155
155
|
*
|
|
156
156
|
* This source code is licensed under the ISC license.
|
|
157
157
|
* See the LICENSE file in the root directory of this source tree.
|
|
158
|
-
*/const
|
|
158
|
+
*/const Cc=Ye("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"}]]);/**
|
|
159
159
|
* @license lucide-react v0.453.0 - ISC
|
|
160
160
|
*
|
|
161
161
|
* This source code is licensed under the ISC license.
|
|
162
162
|
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
-
*/const
|
|
163
|
+
*/const fp=Ye("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"}]]);/**
|
|
164
164
|
* @license lucide-react v0.453.0 - ISC
|
|
165
165
|
*
|
|
166
166
|
* This source code is licensed under the ISC license.
|
|
167
167
|
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
-
*/const
|
|
168
|
+
*/const p2=Ye("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"}]]);/**
|
|
169
169
|
* @license lucide-react v0.453.0 - ISC
|
|
170
170
|
*
|
|
171
171
|
* This source code is licensed under the ISC license.
|
|
172
172
|
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
-
*/const
|
|
173
|
+
*/const Yy=Ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
174
174
|
* @license lucide-react v0.453.0 - ISC
|
|
175
175
|
*
|
|
176
176
|
* This source code is licensed under the ISC license.
|
|
177
177
|
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
-
*/const
|
|
178
|
+
*/const m2=Ye("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
179
179
|
* @license lucide-react v0.453.0 - ISC
|
|
180
180
|
*
|
|
181
181
|
* This source code is licensed under the ISC license.
|
|
@@ -185,22 +185,22 @@ Error generating stack: `+a.message+`
|
|
|
185
185
|
*
|
|
186
186
|
* This source code is licensed under the ISC license.
|
|
187
187
|
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
-
*/const
|
|
188
|
+
*/const k1=Ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
189
189
|
* @license lucide-react v0.453.0 - ISC
|
|
190
190
|
*
|
|
191
191
|
* This source code is licensed under the ISC license.
|
|
192
192
|
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
-
*/const
|
|
193
|
+
*/const Ru=Ye("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"}]]);/**
|
|
194
194
|
* @license lucide-react v0.453.0 - ISC
|
|
195
195
|
*
|
|
196
196
|
* This source code is licensed under the ISC license.
|
|
197
197
|
* See the LICENSE file in the root directory of this source tree.
|
|
198
|
-
*/const
|
|
198
|
+
*/const v2=Ye("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
199
199
|
* @license lucide-react v0.453.0 - ISC
|
|
200
200
|
*
|
|
201
201
|
* This source code is licensed under the ISC license.
|
|
202
202
|
* See the LICENSE file in the root directory of this source tree.
|
|
203
|
-
*/const
|
|
203
|
+
*/const Nd=Ye("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"}]]);/**
|
|
204
204
|
* @license lucide-react v0.453.0 - ISC
|
|
205
205
|
*
|
|
206
206
|
* This source code is licensed under the ISC license.
|
|
@@ -210,39 +210,39 @@ Error generating stack: `+a.message+`
|
|
|
210
210
|
*
|
|
211
211
|
* This source code is licensed under the ISC license.
|
|
212
212
|
* See the LICENSE file in the root directory of this source tree.
|
|
213
|
-
*/const
|
|
213
|
+
*/const g2=Ye("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"}]]);/**
|
|
214
214
|
* @license lucide-react v0.453.0 - ISC
|
|
215
215
|
*
|
|
216
216
|
* This source code is licensed under the ISC license.
|
|
217
217
|
* See the LICENSE file in the root directory of this source tree.
|
|
218
|
-
*/const
|
|
218
|
+
*/const Tu=Ye("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"}]]);/**
|
|
219
219
|
* @license lucide-react v0.453.0 - ISC
|
|
220
220
|
*
|
|
221
221
|
* This source code is licensed under the ISC license.
|
|
222
222
|
* See the LICENSE file in the root directory of this source tree.
|
|
223
|
-
*/const Tu=Ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),yv="-",h2=t=>{const e=m2(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:o=>{const i=o.split(yv);return i[0]===""&&i.length!==1&&i.shift(),E1(i,e)||p2(o)},getConflictingClassGroupIds:(o,i)=>{const c=r[o]||[];return i&&s[o]?[...c,...s[o]]:c}}},E1=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],s=e.nextPart.get(r),n=s?E1(t.slice(1),s):void 0;if(n)return n;if(e.validators.length===0)return;const a=t.join(yv);return(o=e.validators.find(({validator:i})=>i(a)))==null?void 0:o.classGroupId},Zy=/^\[(.+)\]$/,p2=t=>{if(Zy.test(t)){const e=Zy.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},m2=t=>{const{theme:e,prefix:r}=t,s={nextPart:new Map,validators:[]};return g2(Object.entries(t.classGroups),r).forEach(([a,o])=>{dp(o,s,a,e)}),s},dp=(t,e,r,s)=>{t.forEach(n=>{if(typeof n=="string"){const a=n===""?e:Yy(e,n);a.classGroupId=r;return}if(typeof n=="function"){if(v2(n)){dp(n(s),e,r,s);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([a,o])=>{dp(o,Yy(e,a),r,s)})})},Yy=(t,e)=>{let r=t;return e.split(yv).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},v2=t=>t.isThemeGetter,g2=(t,e)=>e?t.map(([r,s])=>{const n=s.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,i])=>[e+o,i])):a);return[r,n]}):t,y2=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,s=new Map;const n=(a,o)=>{r.set(a,o),e++,e>t&&(e=0,s=r,r=new Map)};return{get(a){let o=r.get(a);if(o!==void 0)return o;if((o=s.get(a))!==void 0)return n(a,o),o},set(a,o){r.has(a)?r.set(a,o):n(a,o)}}},C1="!",x2=t=>{const{separator:e,experimentalParseClassName:r}=t,s=e.length===1,n=e[0],a=e.length,o=i=>{const c=[];let u=0,d=0,h;for(let v=0;v<i.length;v++){let y=i[v];if(u===0){if(y===n&&(s||i.slice(v,v+a)===e)){c.push(i.slice(d,v)),d=v+a;continue}if(y==="/"){h=v;continue}}y==="["?u++:y==="]"&&u--}const m=c.length===0?i:i.substring(d),f=m.startsWith(C1),w=f?m.substring(1):m,p=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:f,baseClassName:w,maybePostfixModifierPosition:p}};return r?i=>r({className:i,parseClassName:o}):o},w2=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(s=>{s[0]==="["?(e.push(...r.sort(),s),r=[]):r.push(s)}),e.push(...r.sort()),e},b2=t=>({cache:y2(t.cacheSize),parseClassName:x2(t),...h2(t)}),S2=/\s+/,_2=(t,e)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n}=e,a=[],o=t.trim().split(S2);let i="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:f}=r(u);let w=!!f,p=s(w?m.substring(0,f):m);if(!p){if(!w){i=u+(i.length>0?" "+i:i);continue}if(p=s(m),!p){i=u+(i.length>0?" "+i:i);continue}w=!1}const v=w2(d).join(":"),y=h?v+C1:v,g=y+p;if(a.includes(g))continue;a.push(g);const b=n(p,w);for(let S=0;S<b.length;++S){const E=b[S];a.push(y+E)}i=u+(i.length>0?" "+i:i)}return i};function E2(){let t=0,e,r,s="";for(;t<arguments.length;)(e=arguments[t++])&&(r=P1(e))&&(s&&(s+=" "),s+=r);return s}const P1=t=>{if(typeof t=="string")return t;let e,r="";for(let s=0;s<t.length;s++)t[s]&&(e=P1(t[s]))&&(r&&(r+=" "),r+=e);return r};function C2(t,...e){let r,s,n,a=o;function o(c){const u=e.reduce((d,h)=>h(d),t());return r=b2(u),s=r.cache.get,n=r.cache.set,a=i,i(c)}function i(c){const u=s(c);if(u)return u;const d=_2(c,r);return n(c,d),d}return function(){return a(E2.apply(null,arguments))}}const it=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},k1=/^\[(?:([a-z-]+):)?(.+)\]$/i,P2=/^\d+\/\d+$/,k2=new Set(["px","full","screen"]),N2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,j2=/\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$/,R2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,T2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=t=>Uo(t)||k2.has(t)||P2.test(t),ys=t=>Si(t,"length",U2),Uo=t=>!!t&&!Number.isNaN(Number(t)),Af=t=>Si(t,"number",Uo),Fi=t=>!!t&&Number.isInteger(Number(t)),O2=t=>t.endsWith("%")&&Uo(t.slice(0,-1)),$e=t=>k1.test(t),xs=t=>N2.test(t),I2=new Set(["length","size","percentage"]),D2=t=>Si(t,I2,N1),M2=t=>Si(t,"position",N1),$2=new Set(["image","url"]),F2=t=>Si(t,$2,V2),L2=t=>Si(t,"",z2),Li=()=>!0,Si=(t,e,r)=>{const s=k1.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):r(s[2]):!1},U2=t=>j2.test(t)&&!R2.test(t),N1=()=>!1,z2=t=>T2.test(t),V2=t=>A2.test(t),q2=()=>{const t=it("colors"),e=it("spacing"),r=it("blur"),s=it("brightness"),n=it("borderColor"),a=it("borderRadius"),o=it("borderSpacing"),i=it("borderWidth"),c=it("contrast"),u=it("grayscale"),d=it("hueRotate"),h=it("invert"),m=it("gap"),f=it("gradientColorStops"),w=it("gradientColorStopPositions"),p=it("inset"),v=it("margin"),y=it("opacity"),g=it("padding"),b=it("saturate"),S=it("scale"),E=it("sepia"),N=it("skew"),j=it("space"),R=it("translate"),A=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",$e,e],_=()=>[$e,e],I=()=>["",Un,ys],C=()=>["auto",Uo,$e],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",$e],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],J=()=>[Uo,$e];return{cacheSize:500,separator:":",theme:{colors:[Li],spacing:[Un,ys],blur:["none","",xs,$e],brightness:J(),borderColor:[t],borderRadius:["none","","full",xs,$e],borderSpacing:_(),borderWidth:I(),contrast:J(),grayscale:D(),hueRotate:J(),invert:D(),gap:_(),gradientColorStops:[t],gradientColorStopPositions:[O2,ys],inset:T(),margin:T(),opacity:J(),padding:_(),saturate:J(),scale:J(),sepia:D(),skew:J(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",$e]}],container:["container"],columns:[{columns:[xs]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"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:[...z(),$e]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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",Fi,$e]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",$e]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",Fi,$e]}],"grid-cols":[{"grid-cols":[Li]}],"col-start-end":[{col:["auto",{span:["full",Fi,$e]},$e]}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":[Li]}],"row-start-end":[{row:["auto",{span:[Fi,$e]},$e]}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",$e]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",$e]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...P()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...P(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...P(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",$e,e]}],"min-w":[{"min-w":[$e,e,"min","max","fit"]}],"max-w":[{"max-w":[$e,e,"none","full","min","max","fit","prose",{screen:[xs]},xs]}],h:[{h:[$e,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[$e,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[$e,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[$e,e,"auto","min","max","fit"]}],"font-size":[{text:["base",xs,ys]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Af]}],"font-family":[{font:[Li]}],"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",$e]}],"line-clamp":[{"line-clamp":["none",Uo,Af]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Un,$e]}],"list-image":[{"list-image":["none",$e]}],"list-style-type":[{list:["none","disc","decimal",$e]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Un,ys]}],"underline-offset":[{"underline-offset":["auto",Un,$e]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e]}],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",$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),M2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",D2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},F2]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:U()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[Un,$e]}],"outline-w":[{outline:[Un,ys]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Un,ys]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",xs,L2]}],"shadow-color":[{shadow:[Li]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[s]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",xs,$e]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[b]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",$e]}],duration:[{duration:J()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:J()}],animate:[{animate:["none","spin","ping","pulse","bounce",$e]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Fi,$e]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",$e]}],accent:[{accent:["auto",t]}],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",$e]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"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",$e]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Un,ys,Af]}],stroke:[{stroke:[t,"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"]}}},H2=C2(q2);function Te(...t){return H2(g1(t))}const B2=e2,j1=x.forwardRef(({className:t,...e},r)=>l.jsx(u1,{ref:r,className:Te("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]",t),...e}));j1.displayName=u1.displayName;const K2=Pd("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"}}),R1=x.forwardRef(({className:t,variant:e,...r},s)=>l.jsx(d1,{ref:s,className:Te(K2({variant:e}),t),...r}));R1.displayName=d1.displayName;const W2=x.forwardRef(({className:t,...e},r)=>l.jsx(p1,{ref:r,className:Te("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",t),...e}));W2.displayName=p1.displayName;const T1=x.forwardRef(({className:t,...e},r)=>l.jsx(m1,{ref:r,className:Te("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",t),"toast-close":"",...e,children:l.jsx(Tu,{className:"h-4 w-4"})}));T1.displayName=m1.displayName;const A1=x.forwardRef(({className:t,...e},r)=>l.jsx(f1,{ref:r,className:Te("text-sm font-semibold",t),...e}));A1.displayName=f1.displayName;const O1=x.forwardRef(({className:t,...e},r)=>l.jsx(h1,{ref:r,className:Te("text-sm opacity-90",t),...e}));O1.displayName=h1.displayName;function Q2(){const{toasts:t}=or();return l.jsxs(B2,{children:[t.map(function({id:e,title:r,description:s,action:n,...a}){return l.jsxs(R1,{...a,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(A1,{children:r}),s&&l.jsx(O1,{children:s})]}),n,l.jsx(T1,{})]},e)}),l.jsx(j1,{})]})}var G2=mm[" useId ".trim().toString()]||(()=>{}),Z2=0;function ea(t){const[e,r]=x.useState(G2());return Bt(()=>{r(s=>s??String(Z2++))},[t]),e?`radix-${e}`:""}const Y2=["top","right","bottom","left"],aa=Math.min,Sr=Math.max,Au=Math.round,Cc=Math.floor,jn=t=>({x:t,y:t}),J2={left:"right",right:"left",bottom:"top",top:"bottom"},X2={start:"end",end:"start"};function fp(t,e,r){return Sr(t,aa(e,r))}function os(t,e){return typeof t=="function"?t(e):t}function is(t){return t.split("-")[0]}function _i(t){return t.split("-")[1]}function xv(t){return t==="x"?"y":"x"}function wv(t){return t==="y"?"height":"width"}const eR=new Set(["top","bottom"]);function Cn(t){return eR.has(is(t))?"y":"x"}function bv(t){return xv(Cn(t))}function tR(t,e,r){r===void 0&&(r=!1);const s=_i(t),n=bv(t),a=wv(n);let o=n==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=Ou(o)),[o,Ou(o)]}function rR(t){const e=Ou(t);return[hp(t),e,hp(e)]}function hp(t){return t.replace(/start|end/g,e=>X2[e])}const Jy=["left","right"],Xy=["right","left"],nR=["top","bottom"],sR=["bottom","top"];function aR(t,e,r){switch(t){case"top":case"bottom":return r?e?Xy:Jy:e?Jy:Xy;case"left":case"right":return e?nR:sR;default:return[]}}function oR(t,e,r,s){const n=_i(t);let a=aR(is(t),r==="start",s);return n&&(a=a.map(o=>o+"-"+n),e&&(a=a.concat(a.map(hp)))),a}function Ou(t){return t.replace(/left|right|bottom|top/g,e=>J2[e])}function iR(t){return{top:0,right:0,bottom:0,left:0,...t}}function I1(t){return typeof t!="number"?iR(t):{top:t,right:t,bottom:t,left:t}}function Iu(t){const{x:e,y:r,width:s,height:n}=t;return{width:s,height:n,top:r,left:e,right:e+s,bottom:r+n,x:e,y:r}}function e0(t,e,r){let{reference:s,floating:n}=t;const a=Cn(e),o=bv(e),i=wv(o),c=is(e),u=a==="y",d=s.x+s.width/2-n.width/2,h=s.y+s.height/2-n.height/2,m=s[i]/2-n[i]/2;let f;switch(c){case"top":f={x:d,y:s.y-n.height};break;case"bottom":f={x:d,y:s.y+s.height};break;case"right":f={x:s.x+s.width,y:h};break;case"left":f={x:s.x-n.width,y:h};break;default:f={x:s.x,y:s.y}}switch(_i(e)){case"start":f[o]-=m*(r&&u?-1:1);break;case"end":f[o]+=m*(r&&u?-1:1);break}return f}const lR=async(t,e,r)=>{const{placement:s="bottom",strategy:n="absolute",middleware:a=[],platform:o}=r,i=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:n}),{x:d,y:h}=e0(u,s,c),m=s,f={},w=0;for(let p=0;p<i.length;p++){const{name:v,fn:y}=i[p],{x:g,y:b,data:S,reset:E}=await y({x:d,y:h,initialPlacement:s,placement:m,strategy:n,middlewareData:f,rects:u,platform:o,elements:{reference:t,floating:e}});d=g??d,h=b??h,f={...f,[v]:{...f[v],...S}},E&&w<=50&&(w++,typeof E=="object"&&(E.placement&&(m=E.placement),E.rects&&(u=E.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:n}):E.rects),{x:d,y:h}=e0(u,m,c)),p=-1)}return{x:d,y:h,placement:m,strategy:n,middlewareData:f}};async function kl(t,e){var r;e===void 0&&(e={});const{x:s,y:n,platform:a,rects:o,elements:i,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=os(e,t),w=I1(f),v=i[m?h==="floating"?"reference":"floating":h],y=Iu(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(v)))==null||r?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:u,rootBoundary:d,strategy:c})),g=h==="floating"?{x:s,y:n,width:o.floating.width,height:o.floating.height}:o.reference,b=await(a.getOffsetParent==null?void 0:a.getOffsetParent(i.floating)),S=await(a.isElement==null?void 0:a.isElement(b))?await(a.getScale==null?void 0:a.getScale(b))||{x:1,y:1}:{x:1,y:1},E=Iu(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:g,offsetParent:b,strategy:c}):g);return{top:(y.top-E.top+w.top)/S.y,bottom:(E.bottom-y.bottom+w.bottom)/S.y,left:(y.left-E.left+w.left)/S.x,right:(E.right-y.right+w.right)/S.x}}const cR=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:s,placement:n,rects:a,platform:o,elements:i,middlewareData:c}=e,{element:u,padding:d=0}=os(t,e)||{};if(u==null)return{};const h=I1(d),m={x:r,y:s},f=bv(n),w=wv(f),p=await o.getDimensions(u),v=f==="y",y=v?"top":"left",g=v?"bottom":"right",b=v?"clientHeight":"clientWidth",S=a.reference[w]+a.reference[f]-m[f]-a.floating[w],E=m[f]-a.reference[f],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let j=N?N[b]:0;(!j||!await(o.isElement==null?void 0:o.isElement(N)))&&(j=i.floating[b]||a.floating[w]);const R=S/2-E/2,A=j/2-p[w]/2-1,F=aa(h[y],A),T=aa(h[g],A),_=F,I=j-p[w]-T,C=j/2-p[w]/2+R,z=fp(_,C,I),U=!c.arrow&&_i(n)!=null&&C!==z&&a.reference[w]/2-(C<_?F:T)-p[w]/2<0,K=U?C<_?C-_:C-I:0;return{[f]:m[f]+K,data:{[f]:z,centerOffset:C-z-K,...U&&{alignmentOffset:K}},reset:U}}}),uR=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,s;const{placement:n,middlewareData:a,rects:o,initialPlacement:i,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:p=!0,...v}=os(t,e);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const y=is(n),g=Cn(i),b=is(i)===i,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),E=m||(b||!p?[Ou(i)]:rR(i)),N=w!=="none";!m&&N&&E.push(...oR(i,p,w,S));const j=[i,...E],R=await kl(e,v),A=[];let F=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&A.push(R[y]),h){const C=tR(n,o,S);A.push(R[C[0]],R[C[1]])}if(F=[...F,{placement:n,overflows:A}],!A.every(C=>C<=0)){var T,_;const C=(((T=a.flip)==null?void 0:T.index)||0)+1,z=j[C];if(z&&(!(h==="alignment"?g!==Cn(z):!1)||F.every(P=>Cn(P.placement)===g?P.overflows[0]>0:!0)))return{data:{index:C,overflows:F},reset:{placement:z}};let U=(_=F.filter(K=>K.overflows[0]<=0).sort((K,P)=>K.overflows[1]-P.overflows[1])[0])==null?void 0:_.placement;if(!U)switch(f){case"bestFit":{var I;const K=(I=F.filter(P=>{if(N){const D=Cn(P.placement);return D===g||D==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(D=>D>0).reduce((D,L)=>D+L,0)]).sort((P,D)=>P[1]-D[1])[0])==null?void 0:I[0];K&&(U=K);break}case"initialPlacement":U=i;break}if(n!==U)return{reset:{placement:U}}}return{}}}};function t0(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function r0(t){return Y2.some(e=>t[e]>=0)}const dR=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:s="referenceHidden",...n}=os(t,e);switch(s){case"referenceHidden":{const a=await kl(e,{...n,elementContext:"reference"}),o=t0(a,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:r0(o)}}}case"escaped":{const a=await kl(e,{...n,altBoundary:!0}),o=t0(a,r.floating);return{data:{escapedOffsets:o,escaped:r0(o)}}}default:return{}}}}},D1=new Set(["left","top"]);async function fR(t,e){const{placement:r,platform:s,elements:n}=t,a=await(s.isRTL==null?void 0:s.isRTL(n.floating)),o=is(r),i=_i(r),c=Cn(r)==="y",u=D1.has(o)?-1:1,d=a&&c?-1:1,h=os(e,t);let{mainAxis:m,crossAxis:f,alignmentAxis:w}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return i&&typeof w=="number"&&(f=i==="end"?w*-1:w),c?{x:f*d,y:m*u}:{x:m*u,y:f*d}}const hR=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,s;const{x:n,y:a,placement:o,middlewareData:i}=e,c=await fR(e,t);return o===((r=i.offset)==null?void 0:r.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:n+c.x,y:a+c.y,data:{...c,placement:o}}}}},pR=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:s,placement:n}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:i={fn:v=>{let{x:y,y:g}=v;return{x:y,y:g}}},...c}=os(t,e),u={x:r,y:s},d=await kl(e,c),h=Cn(is(n)),m=xv(h);let f=u[m],w=u[h];if(a){const v=m==="y"?"top":"left",y=m==="y"?"bottom":"right",g=f+d[v],b=f-d[y];f=fp(g,f,b)}if(o){const v=h==="y"?"top":"left",y=h==="y"?"bottom":"right",g=w+d[v],b=w-d[y];w=fp(g,w,b)}const p=i.fn({...e,[m]:f,[h]:w});return{...p,data:{x:p.x-r,y:p.y-s,enabled:{[m]:a,[h]:o}}}}}},mR=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:s,placement:n,rects:a,middlewareData:o}=e,{offset:i=0,mainAxis:c=!0,crossAxis:u=!0}=os(t,e),d={x:r,y:s},h=Cn(n),m=xv(h);let f=d[m],w=d[h];const p=os(i,e),v=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const b=m==="y"?"height":"width",S=a.reference[m]-a.floating[b]+v.mainAxis,E=a.reference[m]+a.reference[b]-v.mainAxis;f<S?f=S:f>E&&(f=E)}if(u){var y,g;const b=m==="y"?"width":"height",S=D1.has(is(n)),E=a.reference[h]-a.floating[b]+(S&&((y=o.offset)==null?void 0:y[h])||0)+(S?0:v.crossAxis),N=a.reference[h]+a.reference[b]+(S?0:((g=o.offset)==null?void 0:g[h])||0)-(S?v.crossAxis:0);w<E?w=E:w>N&&(w=N)}return{[m]:f,[h]:w}}}},vR=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,s;const{placement:n,rects:a,platform:o,elements:i}=e,{apply:c=()=>{},...u}=os(t,e),d=await kl(e,u),h=is(n),m=_i(n),f=Cn(n)==="y",{width:w,height:p}=a.floating;let v,y;h==="top"||h==="bottom"?(v=h,y=m===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(y=h,v=m==="end"?"top":"bottom");const g=p-d.top-d.bottom,b=w-d.left-d.right,S=aa(p-d[v],g),E=aa(w-d[y],b),N=!e.middlewareData.shift;let j=S,R=E;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(R=b),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(j=g),N&&!m){const F=Sr(d.left,0),T=Sr(d.right,0),_=Sr(d.top,0),I=Sr(d.bottom,0);f?R=w-2*(F!==0||T!==0?F+T:Sr(d.left,d.right)):j=p-2*(_!==0||I!==0?_+I:Sr(d.top,d.bottom))}await c({...e,availableWidth:R,availableHeight:j});const A=await o.getDimensions(i.floating);return w!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function Nd(){return typeof window<"u"}function Ei(t){return M1(t)?(t.nodeName||"").toLowerCase():"#document"}function Cr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function On(t){var e;return(e=(M1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function M1(t){return Nd()?t instanceof Node||t instanceof Cr(t).Node:!1}function an(t){return Nd()?t instanceof Element||t instanceof Cr(t).Element:!1}function Tn(t){return Nd()?t instanceof HTMLElement||t instanceof Cr(t).HTMLElement:!1}function n0(t){return!Nd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Cr(t).ShadowRoot}const gR=new Set(["inline","contents"]);function ql(t){const{overflow:e,overflowX:r,overflowY:s,display:n}=on(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+r)&&!gR.has(n)}const yR=new Set(["table","td","th"]);function xR(t){return yR.has(Ei(t))}const wR=[":popover-open",":modal"];function jd(t){return wR.some(e=>{try{return t.matches(e)}catch{return!1}})}const bR=["transform","translate","scale","rotate","perspective"],SR=["transform","translate","scale","rotate","perspective","filter"],_R=["paint","layout","strict","content"];function Sv(t){const e=_v(),r=an(t)?on(t):t;return bR.some(s=>r[s]?r[s]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||SR.some(s=>(r.willChange||"").includes(s))||_R.some(s=>(r.contain||"").includes(s))}function ER(t){let e=oa(t);for(;Tn(e)&&!hi(e);){if(Sv(e))return e;if(jd(e))return null;e=oa(e)}return null}function _v(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const CR=new Set(["html","body","#document"]);function hi(t){return CR.has(Ei(t))}function on(t){return Cr(t).getComputedStyle(t)}function Rd(t){return an(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function oa(t){if(Ei(t)==="html")return t;const e=t.assignedSlot||t.parentNode||n0(t)&&t.host||On(t);return n0(e)?e.host:e}function $1(t){const e=oa(t);return hi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Tn(e)&&ql(e)?e:$1(e)}function Nl(t,e,r){var s;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=$1(t),a=n===((s=t.ownerDocument)==null?void 0:s.body),o=Cr(n);if(a){const i=pp(o);return e.concat(o,o.visualViewport||[],ql(n)?n:[],i&&r?Nl(i):[])}return e.concat(n,Nl(n,[],r))}function pp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function F1(t){const e=on(t);let r=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const n=Tn(t),a=n?t.offsetWidth:r,o=n?t.offsetHeight:s,i=Au(r)!==a||Au(s)!==o;return i&&(r=a,s=o),{width:r,height:s,$:i}}function Ev(t){return an(t)?t:t.contextElement}function zo(t){const e=Ev(t);if(!Tn(e))return jn(1);const r=e.getBoundingClientRect(),{width:s,height:n,$:a}=F1(e);let o=(a?Au(r.width):r.width)/s,i=(a?Au(r.height):r.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!i||!Number.isFinite(i))&&(i=1),{x:o,y:i}}const PR=jn(0);function L1(t){const e=Cr(t);return!_v()||!e.visualViewport?PR:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function kR(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Cr(t)?!1:e}function Qa(t,e,r,s){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),a=Ev(t);let o=jn(1);e&&(s?an(s)&&(o=zo(s)):o=zo(t));const i=kR(a,r,s)?L1(a):jn(0);let c=(n.left+i.x)/o.x,u=(n.top+i.y)/o.y,d=n.width/o.x,h=n.height/o.y;if(a){const m=Cr(a),f=s&&an(s)?Cr(s):s;let w=m,p=pp(w);for(;p&&s&&f!==w;){const v=zo(p),y=p.getBoundingClientRect(),g=on(p),b=y.left+(p.clientLeft+parseFloat(g.paddingLeft))*v.x,S=y.top+(p.clientTop+parseFloat(g.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,h*=v.y,c+=b,u+=S,w=Cr(p),p=pp(w)}}return Iu({width:d,height:h,x:c,y:u})}function Td(t,e){const r=Rd(t).scrollLeft;return e?e.left+r:Qa(On(t)).left+r}function U1(t,e){const r=t.getBoundingClientRect(),s=r.left+e.scrollLeft-Td(t,r),n=r.top+e.scrollTop;return{x:s,y:n}}function NR(t){let{elements:e,rect:r,offsetParent:s,strategy:n}=t;const a=n==="fixed",o=On(s),i=e?jd(e.floating):!1;if(s===o||i&&a)return r;let c={scrollLeft:0,scrollTop:0},u=jn(1);const d=jn(0),h=Tn(s);if((h||!h&&!a)&&((Ei(s)!=="body"||ql(o))&&(c=Rd(s)),Tn(s))){const f=Qa(s);u=zo(s),d.x=f.x+s.clientLeft,d.y=f.y+s.clientTop}const m=o&&!h&&!a?U1(o,c):jn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:r.y*u.y-c.scrollTop*u.y+d.y+m.y}}function jR(t){return Array.from(t.getClientRects())}function RR(t){const e=On(t),r=Rd(t),s=t.ownerDocument.body,n=Sr(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),a=Sr(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let o=-r.scrollLeft+Td(t);const i=-r.scrollTop;return on(s).direction==="rtl"&&(o+=Sr(e.clientWidth,s.clientWidth)-n),{width:n,height:a,x:o,y:i}}const s0=25;function TR(t,e){const r=Cr(t),s=On(t),n=r.visualViewport;let a=s.clientWidth,o=s.clientHeight,i=0,c=0;if(n){a=n.width,o=n.height;const d=_v();(!d||d&&e==="fixed")&&(i=n.offsetLeft,c=n.offsetTop)}const u=Td(s);if(u<=0){const d=s.ownerDocument,h=d.body,m=getComputedStyle(h),f=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,w=Math.abs(s.clientWidth-h.clientWidth-f);w<=s0&&(a-=w)}else u<=s0&&(a+=u);return{width:a,height:o,x:i,y:c}}const AR=new Set(["absolute","fixed"]);function OR(t,e){const r=Qa(t,!0,e==="fixed"),s=r.top+t.clientTop,n=r.left+t.clientLeft,a=Tn(t)?zo(t):jn(1),o=t.clientWidth*a.x,i=t.clientHeight*a.y,c=n*a.x,u=s*a.y;return{width:o,height:i,x:c,y:u}}function a0(t,e,r){let s;if(e==="viewport")s=TR(t,r);else if(e==="document")s=RR(On(t));else if(an(e))s=OR(e,r);else{const n=L1(t);s={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return Iu(s)}function z1(t,e){const r=oa(t);return r===e||!an(r)||hi(r)?!1:on(r).position==="fixed"||z1(r,e)}function IR(t,e){const r=e.get(t);if(r)return r;let s=Nl(t,[],!1).filter(i=>an(i)&&Ei(i)!=="body"),n=null;const a=on(t).position==="fixed";let o=a?oa(t):t;for(;an(o)&&!hi(o);){const i=on(o),c=Sv(o);!c&&i.position==="fixed"&&(n=null),(a?!c&&!n:!c&&i.position==="static"&&!!n&&AR.has(n.position)||ql(o)&&!c&&z1(t,o))?s=s.filter(d=>d!==o):n=i,o=oa(o)}return e.set(t,s),s}function DR(t){let{element:e,boundary:r,rootBoundary:s,strategy:n}=t;const o=[...r==="clippingAncestors"?jd(e)?[]:IR(e,this._c):[].concat(r),s],i=o[0],c=o.reduce((u,d)=>{const h=a0(e,d,n);return u.top=Sr(h.top,u.top),u.right=aa(h.right,u.right),u.bottom=aa(h.bottom,u.bottom),u.left=Sr(h.left,u.left),u},a0(e,i,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function MR(t){const{width:e,height:r}=F1(t);return{width:e,height:r}}function $R(t,e,r){const s=Tn(e),n=On(e),a=r==="fixed",o=Qa(t,!0,a,e);let i={scrollLeft:0,scrollTop:0};const c=jn(0);function u(){c.x=Td(n)}if(s||!s&&!a)if((Ei(e)!=="body"||ql(n))&&(i=Rd(e)),s){const f=Qa(e,!0,a,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else n&&u();a&&!s&&n&&u();const d=n&&!s&&!a?U1(n,i):jn(0),h=o.left+i.scrollLeft-c.x-d.x,m=o.top+i.scrollTop-c.y-d.y;return{x:h,y:m,width:o.width,height:o.height}}function Of(t){return on(t).position==="static"}function o0(t,e){if(!Tn(t)||on(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return On(t)===r&&(r=r.ownerDocument.body),r}function V1(t,e){const r=Cr(t);if(jd(t))return r;if(!Tn(t)){let n=oa(t);for(;n&&!hi(n);){if(an(n)&&!Of(n))return n;n=oa(n)}return r}let s=o0(t,e);for(;s&&xR(s)&&Of(s);)s=o0(s,e);return s&&hi(s)&&Of(s)&&!Sv(s)?r:s||ER(t)||r}const FR=async function(t){const e=this.getOffsetParent||V1,r=this.getDimensions,s=await r(t.floating);return{reference:$R(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function LR(t){return on(t).direction==="rtl"}const UR={convertOffsetParentRelativeRectToViewportRelativeRect:NR,getDocumentElement:On,getClippingRect:DR,getOffsetParent:V1,getElementRects:FR,getClientRects:jR,getDimensions:MR,getScale:zo,isElement:an,isRTL:LR};function q1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function zR(t,e){let r=null,s;const n=On(t);function a(){var i;clearTimeout(s),(i=r)==null||i.disconnect(),r=null}function o(i,c){i===void 0&&(i=!1),c===void 0&&(c=1),a();const u=t.getBoundingClientRect(),{left:d,top:h,width:m,height:f}=u;if(i||e(),!m||!f)return;const w=Cc(h),p=Cc(n.clientWidth-(d+m)),v=Cc(n.clientHeight-(h+f)),y=Cc(d),b={rootMargin:-w+"px "+-p+"px "+-v+"px "+-y+"px",threshold:Sr(0,aa(1,c))||1};let S=!0;function E(N){const j=N[0].intersectionRatio;if(j!==c){if(!S)return o();j?o(!1,j):s=setTimeout(()=>{o(!1,1e-7)},1e3)}j===1&&!q1(u,t.getBoundingClientRect())&&o(),S=!1}try{r=new IntersectionObserver(E,{...b,root:n.ownerDocument})}catch{r=new IntersectionObserver(E,b)}r.observe(t)}return o(!0),a}function VR(t,e,r,s){s===void 0&&(s={});const{ancestorScroll:n=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=Ev(t),d=n||a?[...u?Nl(u):[],...Nl(e)]:[];d.forEach(y=>{n&&y.addEventListener("scroll",r,{passive:!0}),a&&y.addEventListener("resize",r)});const h=u&&i?zR(u,r):null;let m=-1,f=null;o&&(f=new ResizeObserver(y=>{let[g]=y;g&&g.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=f)==null||b.observe(e)})),r()}),u&&!c&&f.observe(u),f.observe(e));let w,p=c?Qa(t):null;c&&v();function v(){const y=Qa(t);p&&!q1(p,y)&&r(),p=y,w=requestAnimationFrame(v)}return r(),()=>{var y;d.forEach(g=>{n&&g.removeEventListener("scroll",r),a&&g.removeEventListener("resize",r)}),h==null||h(),(y=f)==null||y.disconnect(),f=null,c&&cancelAnimationFrame(w)}}const qR=hR,HR=pR,BR=uR,KR=vR,WR=dR,i0=cR,QR=mR,GR=(t,e,r)=>{const s=new Map,n={platform:UR,...r},a={...n.platform,_c:s};return lR(t,e,{...n,platform:a})};var ZR=typeof document<"u",YR=function(){},Qc=ZR?x.useLayoutEffect:YR;function Du(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,s,n;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(s=r;s--!==0;)if(!Du(t[s],e[s]))return!1;return!0}if(n=Object.keys(t),r=n.length,r!==Object.keys(e).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(e,n[s]))return!1;for(s=r;s--!==0;){const a=n[s];if(!(a==="_owner"&&t.$$typeof)&&!Du(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function H1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function l0(t,e){const r=H1(t);return Math.round(e*r)/r}function If(t){const e=x.useRef(t);return Qc(()=>{e.current=t}),e}function JR(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:s=[],platform:n,elements:{reference:a,floating:o}={},transform:i=!0,whileElementsMounted:c,open:u}=t,[d,h]=x.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[m,f]=x.useState(s);Du(m,s)||f(s);const[w,p]=x.useState(null),[v,y]=x.useState(null),g=x.useCallback(P=>{P!==N.current&&(N.current=P,p(P))},[]),b=x.useCallback(P=>{P!==j.current&&(j.current=P,y(P))},[]),S=a||w,E=o||v,N=x.useRef(null),j=x.useRef(null),R=x.useRef(d),A=c!=null,F=If(c),T=If(n),_=If(u),I=x.useCallback(()=>{if(!N.current||!j.current)return;const P={placement:e,strategy:r,middleware:m};T.current&&(P.platform=T.current),GR(N.current,j.current,P).then(D=>{const L={...D,isPositioned:_.current!==!1};C.current&&!Du(R.current,L)&&(R.current=L,so.flushSync(()=>{h(L)}))})},[m,e,r,T,_]);Qc(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,h(P=>({...P,isPositioned:!1})))},[u]);const C=x.useRef(!1);Qc(()=>(C.current=!0,()=>{C.current=!1}),[]),Qc(()=>{if(S&&(N.current=S),E&&(j.current=E),S&&E){if(F.current)return F.current(S,E,I);I()}},[S,E,I,F,A]);const z=x.useMemo(()=>({reference:N,floating:j,setReference:g,setFloating:b}),[g,b]),U=x.useMemo(()=>({reference:S,floating:E}),[S,E]),K=x.useMemo(()=>{const P={position:r,left:0,top:0};if(!U.floating)return P;const D=l0(U.floating,d.x),L=l0(U.floating,d.y);return i?{...P,transform:"translate("+D+"px, "+L+"px)",...H1(U.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:D,top:L}},[r,i,U.floating,d.x,d.y]);return x.useMemo(()=>({...d,update:I,refs:z,elements:U,floatingStyles:K}),[d,I,z,U,K])}const XR=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:s,padding:n}=typeof t=="function"?t(r):t;return s&&e(s)?s.current!=null?i0({element:s.current,padding:n}).fn(r):{}:s?i0({element:s,padding:n}).fn(r):{}}}},eT=(t,e)=>({...qR(t),options:[t,e]}),tT=(t,e)=>({...HR(t),options:[t,e]}),rT=(t,e)=>({...QR(t),options:[t,e]}),nT=(t,e)=>({...BR(t),options:[t,e]}),sT=(t,e)=>({...KR(t),options:[t,e]}),aT=(t,e)=>({...WR(t),options:[t,e]}),oT=(t,e)=>({...XR(t),options:[t,e]});var iT="Arrow",B1=x.forwardRef((t,e)=>{const{children:r,width:s=10,height:n=5,...a}=t;return l.jsx(Ae.svg,{...a,ref:e,width:s,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});B1.displayName=iT;var lT=B1;function K1(t){const[e,r]=x.useState(void 0);return Bt(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const a=n[0];let o,i;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,i=u.blockSize}else o=t.offsetWidth,i=t.offsetHeight;r({width:o,height:i})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else r(void 0)},[t]),e}var Cv="Popper",[W1,Ad]=ds(Cv),[cT,Q1]=W1(Cv),G1=t=>{const{__scopePopper:e,children:r}=t,[s,n]=x.useState(null);return l.jsx(cT,{scope:e,anchor:s,onAnchorChange:n,children:r})};G1.displayName=Cv;var Z1="PopperAnchor",Y1=x.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:s,...n}=t,a=Q1(Z1,r),o=x.useRef(null),i=et(e,o),c=x.useRef(null);return x.useEffect(()=>{const u=c.current;c.current=(s==null?void 0:s.current)||o.current,u!==c.current&&a.onAnchorChange(c.current)}),s?null:l.jsx(Ae.div,{...n,ref:i})});Y1.displayName=Z1;var Pv="PopperContent",[uT,dT]=W1(Pv),J1=x.forwardRef((t,e)=>{var re,ye,ke,me,ee,_e;const{__scopePopper:r,side:s="bottom",sideOffset:n=0,align:a="center",alignOffset:o=0,arrowPadding:i=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:f="optimized",onPlaced:w,...p}=t,v=Q1(Pv,r),[y,g]=x.useState(null),b=et(e,Pe=>g(Pe)),[S,E]=x.useState(null),N=K1(S),j=(N==null?void 0:N.width)??0,R=(N==null?void 0:N.height)??0,A=s+(a!=="center"?"-"+a:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],_=T.length>0,I={padding:F,boundary:T.filter(hT),altBoundary:_},{refs:C,floatingStyles:z,placement:U,isPositioned:K,middlewareData:P}=JR({strategy:"fixed",placement:A,whileElementsMounted:(...Pe)=>VR(...Pe,{animationFrame:f==="always"}),elements:{reference:v.anchor},middleware:[eT({mainAxis:n+R,alignmentAxis:o}),c&&tT({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?rT():void 0,...I}),c&&nT({...I}),sT({...I,apply:({elements:Pe,rects:De,availableWidth:X,availableHeight:ce})=>{const{width:Y,height:ze}=De.reference,te=Pe.floating.style;te.setProperty("--radix-popper-available-width",`${X}px`),te.setProperty("--radix-popper-available-height",`${ce}px`),te.setProperty("--radix-popper-anchor-width",`${Y}px`),te.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),S&&oT({element:S,padding:i}),pT({arrowWidth:j,arrowHeight:R}),m&&aT({strategy:"referenceHidden",...I})]}),[D,L]=tS(U),J=Ur(w);Bt(()=>{K&&(J==null||J())},[K,J]);const Z=(re=P.arrow)==null?void 0:re.x,B=(ye=P.arrow)==null?void 0:ye.y,oe=((ke=P.arrow)==null?void 0:ke.centerOffset)!==0,[ve,ge]=x.useState();return Bt(()=>{y&&ge(window.getComputedStyle(y).zIndex)},[y]),l.jsx("div",{ref:C.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:K?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[(me=P.transformOrigin)==null?void 0:me.x,(ee=P.transformOrigin)==null?void 0:ee.y].join(" "),...((_e=P.hide)==null?void 0:_e.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:l.jsx(uT,{scope:r,placedSide:D,onArrowChange:E,arrowX:Z,arrowY:B,shouldHideArrow:oe,children:l.jsx(Ae.div,{"data-side":D,"data-align":L,...p,ref:b,style:{...p.style,animation:K?void 0:"none"}})})})});J1.displayName=Pv;var X1="PopperArrow",fT={top:"bottom",right:"left",bottom:"top",left:"right"},eS=x.forwardRef(function(e,r){const{__scopePopper:s,...n}=e,a=dT(X1,s),o=fT[a.placedSide];return l.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:l.jsx(lT,{...n,ref:r,style:{...n.style,display:"block"}})})});eS.displayName=X1;function hT(t){return t!==null}var pT=t=>({name:"transformOrigin",options:t,fn(e){var v,y,g;const{placement:r,rects:s,middlewareData:n}=e,o=((v=n.arrow)==null?void 0:v.centerOffset)!==0,i=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[u,d]=tS(r),h={start:"0%",center:"50%",end:"100%"}[d],m=(((y=n.arrow)==null?void 0:y.x)??0)+i/2,f=(((g=n.arrow)==null?void 0:g.y)??0)+c/2;let w="",p="";return u==="bottom"?(w=o?h:`${m}px`,p=`${-c}px`):u==="top"?(w=o?h:`${m}px`,p=`${s.floating.height+c}px`):u==="right"?(w=`${-c}px`,p=o?h:`${f}px`):u==="left"&&(w=`${s.floating.width+c}px`,p=o?h:`${f}px`),{data:{x:w,y:p}}}});function tS(t){const[e,r="center"]=t.split("-");return[e,r]}var mT=G1,rS=Y1,nS=J1,sS=eS,[Od,fF]=ds("Tooltip",[Ad]),kv=Ad(),aS="TooltipProvider",vT=700,c0="tooltip.open",[gT,oS]=Od(aS),iS=t=>{const{__scopeTooltip:e,delayDuration:r=vT,skipDelayDuration:s=300,disableHoverableContent:n=!1,children:a}=t,o=x.useRef(!0),i=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(gT,{scope:e,isOpenDelayedRef:o,delayDuration:r,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:x.useCallback(u=>{i.current=u},[]),disableHoverableContent:n,children:a})};iS.displayName=aS;var lS="Tooltip",[hF,Id]=Od(lS),mp="TooltipTrigger",yT=x.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,n=Id(mp,r),a=oS(mp,r),o=kv(r),i=x.useRef(null),c=et(e,i,n.onTriggerChange),u=x.useRef(!1),d=x.useRef(!1),h=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx(rS,{asChild:!0,...o,children:l.jsx(Ae.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...s,ref:c,onPointerMove:Se(t.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!a.isPointerInTransitRef.current&&(n.onTriggerEnter(),d.current=!0)}),onPointerLeave:Se(t.onPointerLeave,()=>{n.onTriggerLeave(),d.current=!1}),onPointerDown:Se(t.onPointerDown,()=>{n.open&&n.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Se(t.onFocus,()=>{u.current||n.onOpen()}),onBlur:Se(t.onBlur,n.onClose),onClick:Se(t.onClick,n.onClose)})})});yT.displayName=mp;var xT="TooltipPortal",[pF,wT]=Od(xT,{forceMount:void 0}),pi="TooltipContent",cS=x.forwardRef((t,e)=>{const r=wT(pi,t.__scopeTooltip),{forceMount:s=r.forceMount,side:n="top",...a}=t,o=Id(pi,t.__scopeTooltip);return l.jsx(da,{present:s||o.open,children:o.disableHoverableContent?l.jsx(uS,{side:n,...a,ref:e}):l.jsx(bT,{side:n,...a,ref:e})})}),bT=x.forwardRef((t,e)=>{const r=Id(pi,t.__scopeTooltip),s=oS(pi,t.__scopeTooltip),n=x.useRef(null),a=et(e,n),[o,i]=x.useState(null),{trigger:c,onClose:u}=r,d=n.current,{onPointerInTransitChange:h}=s,m=x.useCallback(()=>{i(null),h(!1)},[h]),f=x.useCallback((w,p)=>{const v=w.currentTarget,y={x:w.clientX,y:w.clientY},g=PT(y,v.getBoundingClientRect()),b=kT(y,g),S=NT(p.getBoundingClientRect()),E=RT([...b,...S]);i(E),h(!0)},[h]);return x.useEffect(()=>()=>m(),[m]),x.useEffect(()=>{if(c&&d){const w=v=>f(v,d),p=v=>f(v,c);return c.addEventListener("pointerleave",w),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",w),d.removeEventListener("pointerleave",p)}}},[c,d,f,m]),x.useEffect(()=>{if(o){const w=p=>{const v=p.target,y={x:p.clientX,y:p.clientY},g=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),b=!jT(y,o);g?m():b&&(m(),u())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[c,d,o,u,m]),l.jsx(uS,{...t,ref:a})}),[ST,_T]=Od(lS,{isInside:!1}),ET=pj("TooltipContent"),uS=x.forwardRef((t,e)=>{const{__scopeTooltip:r,children:s,"aria-label":n,onEscapeKeyDown:a,onPointerDownOutside:o,...i}=t,c=Id(pi,r),u=kv(r),{onClose:d}=c;return x.useEffect(()=>(document.addEventListener(c0,d),()=>document.removeEventListener(c0,d)),[d]),x.useEffect(()=>{if(c.trigger){const h=m=>{const f=m.target;f!=null&&f.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),l.jsx(zl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(nS,{"data-state":c.stateAttribute,...u,...i,ref:e,style:{...i.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(ET,{children:s}),l.jsx(ST,{scope:r,isInside:!0,children:l.jsx(Mj,{id:c.contentId,role:"tooltip",children:n||s})})]})})});cS.displayName=pi;var dS="TooltipArrow",CT=x.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,n=kv(r);return _T(dS,r).isInside?null:l.jsx(sS,{...n,...s,ref:e})});CT.displayName=dS;function PT(t,e){const r=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),n=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(r,s,n,a)){case a:return"left";case n:return"right";case r:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function kT(t,e,r=5){const s=[];switch(e){case"top":s.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":s.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":s.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":s.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return s}function NT(t){const{top:e,right:r,bottom:s,left:n}=t;return[{x:n,y:e},{x:r,y:e},{x:r,y:s},{x:n,y:s}]}function jT(t,e){const{x:r,y:s}=t;let n=!1;for(let a=0,o=e.length-1;a<e.length;o=a++){const i=e[a],c=e[o],u=i.x,d=i.y,h=c.x,m=c.y;d>s!=m>s&&r<(h-u)*(s-d)/(m-d)+u&&(n=!n)}return n}function RT(t){const e=t.slice();return e.sort((r,s)=>r.x<s.x?-1:r.x>s.x?1:r.y<s.y?-1:r.y>s.y?1:0),TT(e)}function TT(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s<t.length;s++){const n=t[s];for(;e.length>=2;){const a=e[e.length-1],o=e[e.length-2];if((a.x-o.x)*(n.y-o.y)>=(a.y-o.y)*(n.x-o.x))e.pop();else break}e.push(n)}e.pop();const r=[];for(let s=t.length-1;s>=0;s--){const n=t[s];for(;r.length>=2;){const a=r[r.length-1],o=r[r.length-2];if((a.x-o.x)*(n.y-o.y)>=(a.y-o.y)*(n.x-o.x))r.pop();else break}r.push(n)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var AT=iS,fS=cS;const OT=AT,IT=x.forwardRef(({className:t,sideOffset:e=4,...r},s)=>l.jsx(fS,{ref:s,sideOffset:e,className:Te("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]",t),...r}));IT.displayName=fS.displayName;const DT={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 MT(t){return t?{total:t.total,byKind:t.byKind,serviceWarnings:new Map(Object.entries(t.services)),credentialWarnings:new Map(Object.entries(t.credentials)),playbookWarnings:new Map(Object.entries(t.playbooks))}:DT}const wr="#92E4DD",ur="#F9386D",Yr="#FFFFFF",bn="bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900";function Wr(t){return t.type==="mcp"||t.type==="local-mcp"?wr:t.cardColor??wr}function Sn(t){return{borderColor:t,color:t,boxShadow:`0 0 20px ${t}20`}}const $T=Pd("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"}}),fe=x.forwardRef(({className:t,variant:e,size:r,asChild:s=!1,...n},a)=>{const o=s?fj:"button";return l.jsx(o,{className:Te($T({variant:e,size:r,className:t})),ref:a,...n})});fe.displayName="Button";const Mu="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 hS(t){return t.iconUrl?t.iconUrl:null}function Vo({warnings:t}){if(!(t!=null&&t.length))return null;const e=t.find(s=>s.severity==="error")??t[0],r=e.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:t.map(s=>s.message).join(" · "),"data-testid":"card-warning-badge",children:[l.jsx(wn,{className:"h-2.5 w-2.5 shrink-0"}),l.jsx("span",{className:"max-w-[72px] truncate",children:e.message})]})}const FT=t=>{const e=Wr(t),r=hS(t);return r?l.jsx("img",{src:r,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1}):l.jsx("div",{style:{width:28,height:28,backgroundColor:e,WebkitMask:`url(${Mu}) no-repeat center / contain`,mask:`url(${Mu}) no-repeat center / contain`}})};function LT({service:t,onDragStart:e,onDragEnd:r,isInActiveDeck:s,onCardClick:n,isInCollection:a=!1,onMouseEnter:o,onMouseLeave:i,activeDeck:c,warnings:u}){const d=yr(),{toast:h}=or(),m=Wr(t),f=At({mutationFn:async()=>{if(!c)throw new Error("No active deck found");return Oe("POST",`/api/decks/${c.id}/services`,{serviceId:t.id,position:0})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),h({title:"Service added to deck",description:`${t.name} has been added to your active deck.`})},onError:y=>{h({title:"Failed to add service",description:y.message,variant:"destructive"})}}),w=At({mutationFn:async()=>Oe("DELETE",`/api/services/${t.id}`,{}),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),d.invalidateQueries({queryKey:["/api/decks"]}),h({title:"Service deleted",description:`${t.name} has been deleted successfully.`})},onError:y=>{h({title:"Failed to delete service",description:y.message,variant:"destructive"})}}),p=y=>{y.stopPropagation(),f.mutate()},v=y=>{y.stopPropagation(),window.confirm(`Are you sure you want to delete ${t.name}? This action cannot be undone.`)&&w.mutate()};return l.jsx("div",{className:"relative group cursor-pointer",draggable:!s,onDragStart:y=>e(y,t),onDragEnd:r,onClick:()=>n==null?void 0:n(t),"data-testid":`card-${t.id}`,onMouseEnter:o,onMouseLeave:i,children:l.jsxs("div",{className:`
|
|
223
|
+
*/const Au=Ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wv="-",y2=t=>{const e=w2(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:o=>{const i=o.split(wv);return i[0]===""&&i.length!==1&&i.shift(),N1(i,e)||x2(o)},getConflictingClassGroupIds:(o,i)=>{const c=r[o]||[];return i&&s[o]?[...c,...s[o]]:c}}},N1=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],s=e.nextPart.get(r),n=s?N1(t.slice(1),s):void 0;if(n)return n;if(e.validators.length===0)return;const a=t.join(wv);return(o=e.validators.find(({validator:i})=>i(a)))==null?void 0:o.classGroupId},Jy=/^\[(.+)\]$/,x2=t=>{if(Jy.test(t)){const e=Jy.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},w2=t=>{const{theme:e,prefix:r}=t,s={nextPart:new Map,validators:[]};return S2(Object.entries(t.classGroups),r).forEach(([a,o])=>{hp(o,s,a,e)}),s},hp=(t,e,r,s)=>{t.forEach(n=>{if(typeof n=="string"){const a=n===""?e:Xy(e,n);a.classGroupId=r;return}if(typeof n=="function"){if(b2(n)){hp(n(s),e,r,s);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([a,o])=>{hp(o,Xy(e,a),r,s)})})},Xy=(t,e)=>{let r=t;return e.split(wv).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},b2=t=>t.isThemeGetter,S2=(t,e)=>e?t.map(([r,s])=>{const n=s.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,i])=>[e+o,i])):a);return[r,n]}):t,_2=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,s=new Map;const n=(a,o)=>{r.set(a,o),e++,e>t&&(e=0,s=r,r=new Map)};return{get(a){let o=r.get(a);if(o!==void 0)return o;if((o=s.get(a))!==void 0)return n(a,o),o},set(a,o){r.has(a)?r.set(a,o):n(a,o)}}},j1="!",E2=t=>{const{separator:e,experimentalParseClassName:r}=t,s=e.length===1,n=e[0],a=e.length,o=i=>{const c=[];let u=0,d=0,h;for(let y=0;y<i.length;y++){let g=i[y];if(u===0){if(g===n&&(s||i.slice(y,y+a)===e)){c.push(i.slice(d,y)),d=y+a;continue}if(g==="/"){h=y;continue}}g==="["?u++:g==="]"&&u--}const m=c.length===0?i:i.substring(d),f=m.startsWith(j1),w=f?m.substring(1):m,p=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:f,baseClassName:w,maybePostfixModifierPosition:p}};return r?i=>r({className:i,parseClassName:o}):o},C2=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(s=>{s[0]==="["?(e.push(...r.sort(),s),r=[]):r.push(s)}),e.push(...r.sort()),e},P2=t=>({cache:_2(t.cacheSize),parseClassName:E2(t),...y2(t)}),k2=/\s+/,N2=(t,e)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n}=e,a=[],o=t.trim().split(k2);let i="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:f}=r(u);let w=!!f,p=s(w?m.substring(0,f):m);if(!p){if(!w){i=u+(i.length>0?" "+i:i);continue}if(p=s(m),!p){i=u+(i.length>0?" "+i:i);continue}w=!1}const y=C2(d).join(":"),g=h?y+j1:y,v=g+p;if(a.includes(v))continue;a.push(v);const b=n(p,w);for(let S=0;S<b.length;++S){const E=b[S];a.push(g+E)}i=u+(i.length>0?" "+i:i)}return i};function j2(){let t=0,e,r,s="";for(;t<arguments.length;)(e=arguments[t++])&&(r=R1(e))&&(s&&(s+=" "),s+=r);return s}const R1=t=>{if(typeof t=="string")return t;let e,r="";for(let s=0;s<t.length;s++)t[s]&&(e=R1(t[s]))&&(r&&(r+=" "),r+=e);return r};function R2(t,...e){let r,s,n,a=o;function o(c){const u=e.reduce((d,h)=>h(d),t());return r=P2(u),s=r.cache.get,n=r.cache.set,a=i,i(c)}function i(c){const u=s(c);if(u)return u;const d=N2(c,r);return n(c,d),d}return function(){return a(j2.apply(null,arguments))}}const it=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},T1=/^\[(?:([a-z-]+):)?(.+)\]$/i,T2=/^\d+\/\d+$/,A2=new Set(["px","full","screen"]),O2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I2=/\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$/,D2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,M2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=t=>Uo(t)||A2.has(t)||T2.test(t),xs=t=>Si(t,"length",B2),Uo=t=>!!t&&!Number.isNaN(Number(t)),Of=t=>Si(t,"number",Uo),Fi=t=>!!t&&Number.isInteger(Number(t)),F2=t=>t.endsWith("%")&&Uo(t.slice(0,-1)),$e=t=>T1.test(t),ws=t=>O2.test(t),L2=new Set(["length","size","percentage"]),U2=t=>Si(t,L2,A1),z2=t=>Si(t,"position",A1),V2=new Set(["image","url"]),q2=t=>Si(t,V2,W2),H2=t=>Si(t,"",K2),Li=()=>!0,Si=(t,e,r)=>{const s=T1.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):r(s[2]):!1},B2=t=>I2.test(t)&&!D2.test(t),A1=()=>!1,K2=t=>M2.test(t),W2=t=>$2.test(t),Q2=()=>{const t=it("colors"),e=it("spacing"),r=it("blur"),s=it("brightness"),n=it("borderColor"),a=it("borderRadius"),o=it("borderSpacing"),i=it("borderWidth"),c=it("contrast"),u=it("grayscale"),d=it("hueRotate"),h=it("invert"),m=it("gap"),f=it("gradientColorStops"),w=it("gradientColorStopPositions"),p=it("inset"),y=it("margin"),g=it("opacity"),v=it("padding"),b=it("saturate"),S=it("scale"),E=it("sepia"),N=it("skew"),j=it("space"),R=it("translate"),A=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",$e,e],_=()=>[$e,e],I=()=>["",Un,xs],C=()=>["auto",Uo,$e],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",$e],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],X=()=>[Uo,$e];return{cacheSize:500,separator:":",theme:{colors:[Li],spacing:[Un,xs],blur:["none","",ws,$e],brightness:X(),borderColor:[t],borderRadius:["none","","full",ws,$e],borderSpacing:_(),borderWidth:I(),contrast:X(),grayscale:D(),hueRotate:X(),invert:D(),gap:_(),gradientColorStops:[t],gradientColorStopPositions:[F2,xs],inset:T(),margin:T(),opacity:X(),padding:_(),saturate:X(),scale:X(),sepia:D(),skew:X(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",$e]}],container:["container"],columns:[{columns:[ws]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"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:[...z(),$e]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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",Fi,$e]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",$e]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",Fi,$e]}],"grid-cols":[{"grid-cols":[Li]}],"col-start-end":[{col:["auto",{span:["full",Fi,$e]},$e]}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":[Li]}],"row-start-end":[{row:["auto",{span:[Fi,$e]},$e]}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",$e]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",$e]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...P()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...P(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...P(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[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":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",$e,e]}],"min-w":[{"min-w":[$e,e,"min","max","fit"]}],"max-w":[{"max-w":[$e,e,"none","full","min","max","fit","prose",{screen:[ws]},ws]}],h:[{h:[$e,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[$e,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[$e,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[$e,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ws,xs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Of]}],"font-family":[{font:[Li]}],"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",$e]}],"line-clamp":[{"line-clamp":["none",Uo,Of]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Un,$e]}],"list-image":[{"list-image":["none",$e]}],"list-style-type":[{list:["none","disc","decimal",$e]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Un,xs]}],"underline-offset":[{"underline-offset":["auto",Un,$e]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e]}],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",$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),z2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",U2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},q2]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:U()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[Un,$e]}],"outline-w":[{outline:[Un,xs]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[Un,xs]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ws,H2]}],"shadow-color":[{shadow:[Li]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[s]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ws,$e]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[b]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",$e]}],duration:[{duration:X()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:X()}],animate:[{animate:["none","spin","ping","pulse","bounce",$e]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Fi,$e]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",$e]}],accent:[{accent:["auto",t]}],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",$e]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"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",$e]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Un,xs,Of]}],stroke:[{stroke:[t,"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"]}}},G2=R2(Q2);function Te(...t){return G2(b1(t))}const Z2=a2,O1=x.forwardRef(({className:t,...e},r)=>l.jsx(p1,{ref:r,className:Te("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]",t),...e}));O1.displayName=p1.displayName;const Y2=kd("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"}}),I1=x.forwardRef(({className:t,variant:e,...r},s)=>l.jsx(m1,{ref:s,className:Te(Y2({variant:e}),t),...r}));I1.displayName=m1.displayName;const J2=x.forwardRef(({className:t,...e},r)=>l.jsx(y1,{ref:r,className:Te("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",t),...e}));J2.displayName=y1.displayName;const D1=x.forwardRef(({className:t,...e},r)=>l.jsx(x1,{ref:r,className:Te("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",t),"toast-close":"",...e,children:l.jsx(Au,{className:"h-4 w-4"})}));D1.displayName=x1.displayName;const M1=x.forwardRef(({className:t,...e},r)=>l.jsx(v1,{ref:r,className:Te("text-sm font-semibold",t),...e}));M1.displayName=v1.displayName;const $1=x.forwardRef(({className:t,...e},r)=>l.jsx(g1,{ref:r,className:Te("text-sm opacity-90",t),...e}));$1.displayName=g1.displayName;function X2(){const{toasts:t}=or();return l.jsxs(Z2,{children:[t.map(function({id:e,title:r,description:s,action:n,...a}){return l.jsxs(I1,{...a,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(M1,{children:r}),s&&l.jsx($1,{children:s})]}),n,l.jsx(D1,{})]},e)}),l.jsx(O1,{})]})}var eR=gm[" useId ".trim().toString()]||(()=>{}),tR=0;function ea(t){const[e,r]=x.useState(eR());return Bt(()=>{r(s=>s??String(tR++))},[t]),e?`radix-${e}`:""}const rR=["top","right","bottom","left"],aa=Math.min,Sr=Math.max,Ou=Math.round,Pc=Math.floor,jn=t=>({x:t,y:t}),nR={left:"right",right:"left",bottom:"top",top:"bottom"},sR={start:"end",end:"start"};function pp(t,e,r){return Sr(t,aa(e,r))}function is(t,e){return typeof t=="function"?t(e):t}function ls(t){return t.split("-")[0]}function _i(t){return t.split("-")[1]}function bv(t){return t==="x"?"y":"x"}function Sv(t){return t==="y"?"height":"width"}const aR=new Set(["top","bottom"]);function Cn(t){return aR.has(ls(t))?"y":"x"}function _v(t){return bv(Cn(t))}function oR(t,e,r){r===void 0&&(r=!1);const s=_i(t),n=_v(t),a=Sv(n);let o=n==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=Iu(o)),[o,Iu(o)]}function iR(t){const e=Iu(t);return[mp(t),e,mp(e)]}function mp(t){return t.replace(/start|end/g,e=>sR[e])}const e0=["left","right"],t0=["right","left"],lR=["top","bottom"],cR=["bottom","top"];function uR(t,e,r){switch(t){case"top":case"bottom":return r?e?t0:e0:e?e0:t0;case"left":case"right":return e?lR:cR;default:return[]}}function dR(t,e,r,s){const n=_i(t);let a=uR(ls(t),r==="start",s);return n&&(a=a.map(o=>o+"-"+n),e&&(a=a.concat(a.map(mp)))),a}function Iu(t){return t.replace(/left|right|bottom|top/g,e=>nR[e])}function fR(t){return{top:0,right:0,bottom:0,left:0,...t}}function F1(t){return typeof t!="number"?fR(t):{top:t,right:t,bottom:t,left:t}}function Du(t){const{x:e,y:r,width:s,height:n}=t;return{width:s,height:n,top:r,left:e,right:e+s,bottom:r+n,x:e,y:r}}function r0(t,e,r){let{reference:s,floating:n}=t;const a=Cn(e),o=_v(e),i=Sv(o),c=ls(e),u=a==="y",d=s.x+s.width/2-n.width/2,h=s.y+s.height/2-n.height/2,m=s[i]/2-n[i]/2;let f;switch(c){case"top":f={x:d,y:s.y-n.height};break;case"bottom":f={x:d,y:s.y+s.height};break;case"right":f={x:s.x+s.width,y:h};break;case"left":f={x:s.x-n.width,y:h};break;default:f={x:s.x,y:s.y}}switch(_i(e)){case"start":f[o]-=m*(r&&u?-1:1);break;case"end":f[o]+=m*(r&&u?-1:1);break}return f}const hR=async(t,e,r)=>{const{placement:s="bottom",strategy:n="absolute",middleware:a=[],platform:o}=r,i=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:n}),{x:d,y:h}=r0(u,s,c),m=s,f={},w=0;for(let p=0;p<i.length;p++){const{name:y,fn:g}=i[p],{x:v,y:b,data:S,reset:E}=await g({x:d,y:h,initialPlacement:s,placement:m,strategy:n,middlewareData:f,rects:u,platform:o,elements:{reference:t,floating:e}});d=v??d,h=b??h,f={...f,[y]:{...f[y],...S}},E&&w<=50&&(w++,typeof E=="object"&&(E.placement&&(m=E.placement),E.rects&&(u=E.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:n}):E.rects),{x:d,y:h}=r0(u,m,c)),p=-1)}return{x:d,y:h,placement:m,strategy:n,middlewareData:f}};async function Nl(t,e){var r;e===void 0&&(e={});const{x:s,y:n,platform:a,rects:o,elements:i,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=is(e,t),w=F1(f),y=i[m?h==="floating"?"reference":"floating":h],g=Du(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(y)))==null||r?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:u,rootBoundary:d,strategy:c})),v=h==="floating"?{x:s,y:n,width:o.floating.width,height:o.floating.height}:o.reference,b=await(a.getOffsetParent==null?void 0:a.getOffsetParent(i.floating)),S=await(a.isElement==null?void 0:a.isElement(b))?await(a.getScale==null?void 0:a.getScale(b))||{x:1,y:1}:{x:1,y:1},E=Du(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:b,strategy:c}):v);return{top:(g.top-E.top+w.top)/S.y,bottom:(E.bottom-g.bottom+w.bottom)/S.y,left:(g.left-E.left+w.left)/S.x,right:(E.right-g.right+w.right)/S.x}}const pR=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:s,placement:n,rects:a,platform:o,elements:i,middlewareData:c}=e,{element:u,padding:d=0}=is(t,e)||{};if(u==null)return{};const h=F1(d),m={x:r,y:s},f=_v(n),w=Sv(f),p=await o.getDimensions(u),y=f==="y",g=y?"top":"left",v=y?"bottom":"right",b=y?"clientHeight":"clientWidth",S=a.reference[w]+a.reference[f]-m[f]-a.floating[w],E=m[f]-a.reference[f],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let j=N?N[b]:0;(!j||!await(o.isElement==null?void 0:o.isElement(N)))&&(j=i.floating[b]||a.floating[w]);const R=S/2-E/2,A=j/2-p[w]/2-1,F=aa(h[g],A),T=aa(h[v],A),_=F,I=j-p[w]-T,C=j/2-p[w]/2+R,z=pp(_,C,I),U=!c.arrow&&_i(n)!=null&&C!==z&&a.reference[w]/2-(C<_?F:T)-p[w]/2<0,K=U?C<_?C-_:C-I:0;return{[f]:m[f]+K,data:{[f]:z,centerOffset:C-z-K,...U&&{alignmentOffset:K}},reset:U}}}),mR=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,s;const{placement:n,middlewareData:a,rects:o,initialPlacement:i,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:p=!0,...y}=is(t,e);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const g=ls(n),v=Cn(i),b=ls(i)===i,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),E=m||(b||!p?[Iu(i)]:iR(i)),N=w!=="none";!m&&N&&E.push(...dR(i,p,w,S));const j=[i,...E],R=await Nl(e,y),A=[];let F=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&A.push(R[g]),h){const C=oR(n,o,S);A.push(R[C[0]],R[C[1]])}if(F=[...F,{placement:n,overflows:A}],!A.every(C=>C<=0)){var T,_;const C=(((T=a.flip)==null?void 0:T.index)||0)+1,z=j[C];if(z&&(!(h==="alignment"?v!==Cn(z):!1)||F.every(P=>Cn(P.placement)===v?P.overflows[0]>0:!0)))return{data:{index:C,overflows:F},reset:{placement:z}};let U=(_=F.filter(K=>K.overflows[0]<=0).sort((K,P)=>K.overflows[1]-P.overflows[1])[0])==null?void 0:_.placement;if(!U)switch(f){case"bestFit":{var I;const K=(I=F.filter(P=>{if(N){const D=Cn(P.placement);return D===v||D==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(D=>D>0).reduce((D,L)=>D+L,0)]).sort((P,D)=>P[1]-D[1])[0])==null?void 0:I[0];K&&(U=K);break}case"initialPlacement":U=i;break}if(n!==U)return{reset:{placement:U}}}return{}}}};function n0(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function s0(t){return rR.some(e=>t[e]>=0)}const vR=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:s="referenceHidden",...n}=is(t,e);switch(s){case"referenceHidden":{const a=await Nl(e,{...n,elementContext:"reference"}),o=n0(a,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:s0(o)}}}case"escaped":{const a=await Nl(e,{...n,altBoundary:!0}),o=n0(a,r.floating);return{data:{escapedOffsets:o,escaped:s0(o)}}}default:return{}}}}},L1=new Set(["left","top"]);async function gR(t,e){const{placement:r,platform:s,elements:n}=t,a=await(s.isRTL==null?void 0:s.isRTL(n.floating)),o=ls(r),i=_i(r),c=Cn(r)==="y",u=L1.has(o)?-1:1,d=a&&c?-1:1,h=is(e,t);let{mainAxis:m,crossAxis:f,alignmentAxis:w}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return i&&typeof w=="number"&&(f=i==="end"?w*-1:w),c?{x:f*d,y:m*u}:{x:m*u,y:f*d}}const yR=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,s;const{x:n,y:a,placement:o,middlewareData:i}=e,c=await gR(e,t);return o===((r=i.offset)==null?void 0:r.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:n+c.x,y:a+c.y,data:{...c,placement:o}}}}},xR=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:s,placement:n}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:i={fn:y=>{let{x:g,y:v}=y;return{x:g,y:v}}},...c}=is(t,e),u={x:r,y:s},d=await Nl(e,c),h=Cn(ls(n)),m=bv(h);let f=u[m],w=u[h];if(a){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",v=f+d[y],b=f-d[g];f=pp(v,f,b)}if(o){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",v=w+d[y],b=w-d[g];w=pp(v,w,b)}const p=i.fn({...e,[m]:f,[h]:w});return{...p,data:{x:p.x-r,y:p.y-s,enabled:{[m]:a,[h]:o}}}}}},wR=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:s,placement:n,rects:a,middlewareData:o}=e,{offset:i=0,mainAxis:c=!0,crossAxis:u=!0}=is(t,e),d={x:r,y:s},h=Cn(n),m=bv(h);let f=d[m],w=d[h];const p=is(i,e),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const b=m==="y"?"height":"width",S=a.reference[m]-a.floating[b]+y.mainAxis,E=a.reference[m]+a.reference[b]-y.mainAxis;f<S?f=S:f>E&&(f=E)}if(u){var g,v;const b=m==="y"?"width":"height",S=L1.has(ls(n)),E=a.reference[h]-a.floating[b]+(S&&((g=o.offset)==null?void 0:g[h])||0)+(S?0:y.crossAxis),N=a.reference[h]+a.reference[b]+(S?0:((v=o.offset)==null?void 0:v[h])||0)-(S?y.crossAxis:0);w<E?w=E:w>N&&(w=N)}return{[m]:f,[h]:w}}}},bR=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,s;const{placement:n,rects:a,platform:o,elements:i}=e,{apply:c=()=>{},...u}=is(t,e),d=await Nl(e,u),h=ls(n),m=_i(n),f=Cn(n)==="y",{width:w,height:p}=a.floating;let y,g;h==="top"||h==="bottom"?(y=h,g=m===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(g=h,y=m==="end"?"top":"bottom");const v=p-d.top-d.bottom,b=w-d.left-d.right,S=aa(p-d[y],v),E=aa(w-d[g],b),N=!e.middlewareData.shift;let j=S,R=E;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(R=b),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(j=v),N&&!m){const F=Sr(d.left,0),T=Sr(d.right,0),_=Sr(d.top,0),I=Sr(d.bottom,0);f?R=w-2*(F!==0||T!==0?F+T:Sr(d.left,d.right)):j=p-2*(_!==0||I!==0?_+I:Sr(d.top,d.bottom))}await c({...e,availableWidth:R,availableHeight:j});const A=await o.getDimensions(i.floating);return w!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function jd(){return typeof window<"u"}function Ei(t){return U1(t)?(t.nodeName||"").toLowerCase():"#document"}function Cr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function On(t){var e;return(e=(U1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function U1(t){return jd()?t instanceof Node||t instanceof Cr(t).Node:!1}function an(t){return jd()?t instanceof Element||t instanceof Cr(t).Element:!1}function Tn(t){return jd()?t instanceof HTMLElement||t instanceof Cr(t).HTMLElement:!1}function a0(t){return!jd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Cr(t).ShadowRoot}const SR=new Set(["inline","contents"]);function Hl(t){const{overflow:e,overflowX:r,overflowY:s,display:n}=on(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+r)&&!SR.has(n)}const _R=new Set(["table","td","th"]);function ER(t){return _R.has(Ei(t))}const CR=[":popover-open",":modal"];function Rd(t){return CR.some(e=>{try{return t.matches(e)}catch{return!1}})}const PR=["transform","translate","scale","rotate","perspective"],kR=["transform","translate","scale","rotate","perspective","filter"],NR=["paint","layout","strict","content"];function Ev(t){const e=Cv(),r=an(t)?on(t):t;return PR.some(s=>r[s]?r[s]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||kR.some(s=>(r.willChange||"").includes(s))||NR.some(s=>(r.contain||"").includes(s))}function jR(t){let e=oa(t);for(;Tn(e)&&!hi(e);){if(Ev(e))return e;if(Rd(e))return null;e=oa(e)}return null}function Cv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const RR=new Set(["html","body","#document"]);function hi(t){return RR.has(Ei(t))}function on(t){return Cr(t).getComputedStyle(t)}function Td(t){return an(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function oa(t){if(Ei(t)==="html")return t;const e=t.assignedSlot||t.parentNode||a0(t)&&t.host||On(t);return a0(e)?e.host:e}function z1(t){const e=oa(t);return hi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Tn(e)&&Hl(e)?e:z1(e)}function jl(t,e,r){var s;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=z1(t),a=n===((s=t.ownerDocument)==null?void 0:s.body),o=Cr(n);if(a){const i=vp(o);return e.concat(o,o.visualViewport||[],Hl(n)?n:[],i&&r?jl(i):[])}return e.concat(n,jl(n,[],r))}function vp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function V1(t){const e=on(t);let r=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const n=Tn(t),a=n?t.offsetWidth:r,o=n?t.offsetHeight:s,i=Ou(r)!==a||Ou(s)!==o;return i&&(r=a,s=o),{width:r,height:s,$:i}}function Pv(t){return an(t)?t:t.contextElement}function zo(t){const e=Pv(t);if(!Tn(e))return jn(1);const r=e.getBoundingClientRect(),{width:s,height:n,$:a}=V1(e);let o=(a?Ou(r.width):r.width)/s,i=(a?Ou(r.height):r.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!i||!Number.isFinite(i))&&(i=1),{x:o,y:i}}const TR=jn(0);function q1(t){const e=Cr(t);return!Cv()||!e.visualViewport?TR:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function AR(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Cr(t)?!1:e}function Qa(t,e,r,s){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),a=Pv(t);let o=jn(1);e&&(s?an(s)&&(o=zo(s)):o=zo(t));const i=AR(a,r,s)?q1(a):jn(0);let c=(n.left+i.x)/o.x,u=(n.top+i.y)/o.y,d=n.width/o.x,h=n.height/o.y;if(a){const m=Cr(a),f=s&&an(s)?Cr(s):s;let w=m,p=vp(w);for(;p&&s&&f!==w;){const y=zo(p),g=p.getBoundingClientRect(),v=on(p),b=g.left+(p.clientLeft+parseFloat(v.paddingLeft))*y.x,S=g.top+(p.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,h*=y.y,c+=b,u+=S,w=Cr(p),p=vp(w)}}return Du({width:d,height:h,x:c,y:u})}function Ad(t,e){const r=Td(t).scrollLeft;return e?e.left+r:Qa(On(t)).left+r}function H1(t,e){const r=t.getBoundingClientRect(),s=r.left+e.scrollLeft-Ad(t,r),n=r.top+e.scrollTop;return{x:s,y:n}}function OR(t){let{elements:e,rect:r,offsetParent:s,strategy:n}=t;const a=n==="fixed",o=On(s),i=e?Rd(e.floating):!1;if(s===o||i&&a)return r;let c={scrollLeft:0,scrollTop:0},u=jn(1);const d=jn(0),h=Tn(s);if((h||!h&&!a)&&((Ei(s)!=="body"||Hl(o))&&(c=Td(s)),Tn(s))){const f=Qa(s);u=zo(s),d.x=f.x+s.clientLeft,d.y=f.y+s.clientTop}const m=o&&!h&&!a?H1(o,c):jn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:r.y*u.y-c.scrollTop*u.y+d.y+m.y}}function IR(t){return Array.from(t.getClientRects())}function DR(t){const e=On(t),r=Td(t),s=t.ownerDocument.body,n=Sr(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),a=Sr(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let o=-r.scrollLeft+Ad(t);const i=-r.scrollTop;return on(s).direction==="rtl"&&(o+=Sr(e.clientWidth,s.clientWidth)-n),{width:n,height:a,x:o,y:i}}const o0=25;function MR(t,e){const r=Cr(t),s=On(t),n=r.visualViewport;let a=s.clientWidth,o=s.clientHeight,i=0,c=0;if(n){a=n.width,o=n.height;const d=Cv();(!d||d&&e==="fixed")&&(i=n.offsetLeft,c=n.offsetTop)}const u=Ad(s);if(u<=0){const d=s.ownerDocument,h=d.body,m=getComputedStyle(h),f=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,w=Math.abs(s.clientWidth-h.clientWidth-f);w<=o0&&(a-=w)}else u<=o0&&(a+=u);return{width:a,height:o,x:i,y:c}}const $R=new Set(["absolute","fixed"]);function FR(t,e){const r=Qa(t,!0,e==="fixed"),s=r.top+t.clientTop,n=r.left+t.clientLeft,a=Tn(t)?zo(t):jn(1),o=t.clientWidth*a.x,i=t.clientHeight*a.y,c=n*a.x,u=s*a.y;return{width:o,height:i,x:c,y:u}}function i0(t,e,r){let s;if(e==="viewport")s=MR(t,r);else if(e==="document")s=DR(On(t));else if(an(e))s=FR(e,r);else{const n=q1(t);s={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return Du(s)}function B1(t,e){const r=oa(t);return r===e||!an(r)||hi(r)?!1:on(r).position==="fixed"||B1(r,e)}function LR(t,e){const r=e.get(t);if(r)return r;let s=jl(t,[],!1).filter(i=>an(i)&&Ei(i)!=="body"),n=null;const a=on(t).position==="fixed";let o=a?oa(t):t;for(;an(o)&&!hi(o);){const i=on(o),c=Ev(o);!c&&i.position==="fixed"&&(n=null),(a?!c&&!n:!c&&i.position==="static"&&!!n&&$R.has(n.position)||Hl(o)&&!c&&B1(t,o))?s=s.filter(d=>d!==o):n=i,o=oa(o)}return e.set(t,s),s}function UR(t){let{element:e,boundary:r,rootBoundary:s,strategy:n}=t;const o=[...r==="clippingAncestors"?Rd(e)?[]:LR(e,this._c):[].concat(r),s],i=o[0],c=o.reduce((u,d)=>{const h=i0(e,d,n);return u.top=Sr(h.top,u.top),u.right=aa(h.right,u.right),u.bottom=aa(h.bottom,u.bottom),u.left=Sr(h.left,u.left),u},i0(e,i,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function zR(t){const{width:e,height:r}=V1(t);return{width:e,height:r}}function VR(t,e,r){const s=Tn(e),n=On(e),a=r==="fixed",o=Qa(t,!0,a,e);let i={scrollLeft:0,scrollTop:0};const c=jn(0);function u(){c.x=Ad(n)}if(s||!s&&!a)if((Ei(e)!=="body"||Hl(n))&&(i=Td(e)),s){const f=Qa(e,!0,a,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else n&&u();a&&!s&&n&&u();const d=n&&!s&&!a?H1(n,i):jn(0),h=o.left+i.scrollLeft-c.x-d.x,m=o.top+i.scrollTop-c.y-d.y;return{x:h,y:m,width:o.width,height:o.height}}function If(t){return on(t).position==="static"}function l0(t,e){if(!Tn(t)||on(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return On(t)===r&&(r=r.ownerDocument.body),r}function K1(t,e){const r=Cr(t);if(Rd(t))return r;if(!Tn(t)){let n=oa(t);for(;n&&!hi(n);){if(an(n)&&!If(n))return n;n=oa(n)}return r}let s=l0(t,e);for(;s&&ER(s)&&If(s);)s=l0(s,e);return s&&hi(s)&&If(s)&&!Ev(s)?r:s||jR(t)||r}const qR=async function(t){const e=this.getOffsetParent||K1,r=this.getDimensions,s=await r(t.floating);return{reference:VR(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function HR(t){return on(t).direction==="rtl"}const BR={convertOffsetParentRelativeRectToViewportRelativeRect:OR,getDocumentElement:On,getClippingRect:UR,getOffsetParent:K1,getElementRects:qR,getClientRects:IR,getDimensions:zR,getScale:zo,isElement:an,isRTL:HR};function W1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function KR(t,e){let r=null,s;const n=On(t);function a(){var i;clearTimeout(s),(i=r)==null||i.disconnect(),r=null}function o(i,c){i===void 0&&(i=!1),c===void 0&&(c=1),a();const u=t.getBoundingClientRect(),{left:d,top:h,width:m,height:f}=u;if(i||e(),!m||!f)return;const w=Pc(h),p=Pc(n.clientWidth-(d+m)),y=Pc(n.clientHeight-(h+f)),g=Pc(d),b={rootMargin:-w+"px "+-p+"px "+-y+"px "+-g+"px",threshold:Sr(0,aa(1,c))||1};let S=!0;function E(N){const j=N[0].intersectionRatio;if(j!==c){if(!S)return o();j?o(!1,j):s=setTimeout(()=>{o(!1,1e-7)},1e3)}j===1&&!W1(u,t.getBoundingClientRect())&&o(),S=!1}try{r=new IntersectionObserver(E,{...b,root:n.ownerDocument})}catch{r=new IntersectionObserver(E,b)}r.observe(t)}return o(!0),a}function WR(t,e,r,s){s===void 0&&(s={});const{ancestorScroll:n=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=Pv(t),d=n||a?[...u?jl(u):[],...jl(e)]:[];d.forEach(g=>{n&&g.addEventListener("scroll",r,{passive:!0}),a&&g.addEventListener("resize",r)});const h=u&&i?KR(u,r):null;let m=-1,f=null;o&&(f=new ResizeObserver(g=>{let[v]=g;v&&v.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=f)==null||b.observe(e)})),r()}),u&&!c&&f.observe(u),f.observe(e));let w,p=c?Qa(t):null;c&&y();function y(){const g=Qa(t);p&&!W1(p,g)&&r(),p=g,w=requestAnimationFrame(y)}return r(),()=>{var g;d.forEach(v=>{n&&v.removeEventListener("scroll",r),a&&v.removeEventListener("resize",r)}),h==null||h(),(g=f)==null||g.disconnect(),f=null,c&&cancelAnimationFrame(w)}}const QR=yR,GR=xR,ZR=mR,YR=bR,JR=vR,c0=pR,XR=wR,eT=(t,e,r)=>{const s=new Map,n={platform:BR,...r},a={...n.platform,_c:s};return hR(t,e,{...n,platform:a})};var tT=typeof document<"u",rT=function(){},Gc=tT?x.useLayoutEffect:rT;function Mu(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,s,n;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(s=r;s--!==0;)if(!Mu(t[s],e[s]))return!1;return!0}if(n=Object.keys(t),r=n.length,r!==Object.keys(e).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(e,n[s]))return!1;for(s=r;s--!==0;){const a=n[s];if(!(a==="_owner"&&t.$$typeof)&&!Mu(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function Q1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function u0(t,e){const r=Q1(t);return Math.round(e*r)/r}function Df(t){const e=x.useRef(t);return Gc(()=>{e.current=t}),e}function nT(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:s=[],platform:n,elements:{reference:a,floating:o}={},transform:i=!0,whileElementsMounted:c,open:u}=t,[d,h]=x.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[m,f]=x.useState(s);Mu(m,s)||f(s);const[w,p]=x.useState(null),[y,g]=x.useState(null),v=x.useCallback(P=>{P!==N.current&&(N.current=P,p(P))},[]),b=x.useCallback(P=>{P!==j.current&&(j.current=P,g(P))},[]),S=a||w,E=o||y,N=x.useRef(null),j=x.useRef(null),R=x.useRef(d),A=c!=null,F=Df(c),T=Df(n),_=Df(u),I=x.useCallback(()=>{if(!N.current||!j.current)return;const P={placement:e,strategy:r,middleware:m};T.current&&(P.platform=T.current),eT(N.current,j.current,P).then(D=>{const L={...D,isPositioned:_.current!==!1};C.current&&!Mu(R.current,L)&&(R.current=L,so.flushSync(()=>{h(L)}))})},[m,e,r,T,_]);Gc(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,h(P=>({...P,isPositioned:!1})))},[u]);const C=x.useRef(!1);Gc(()=>(C.current=!0,()=>{C.current=!1}),[]),Gc(()=>{if(S&&(N.current=S),E&&(j.current=E),S&&E){if(F.current)return F.current(S,E,I);I()}},[S,E,I,F,A]);const z=x.useMemo(()=>({reference:N,floating:j,setReference:v,setFloating:b}),[v,b]),U=x.useMemo(()=>({reference:S,floating:E}),[S,E]),K=x.useMemo(()=>{const P={position:r,left:0,top:0};if(!U.floating)return P;const D=u0(U.floating,d.x),L=u0(U.floating,d.y);return i?{...P,transform:"translate("+D+"px, "+L+"px)",...Q1(U.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:D,top:L}},[r,i,U.floating,d.x,d.y]);return x.useMemo(()=>({...d,update:I,refs:z,elements:U,floatingStyles:K}),[d,I,z,U,K])}const sT=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:s,padding:n}=typeof t=="function"?t(r):t;return s&&e(s)?s.current!=null?c0({element:s.current,padding:n}).fn(r):{}:s?c0({element:s,padding:n}).fn(r):{}}}},aT=(t,e)=>({...QR(t),options:[t,e]}),oT=(t,e)=>({...GR(t),options:[t,e]}),iT=(t,e)=>({...XR(t),options:[t,e]}),lT=(t,e)=>({...ZR(t),options:[t,e]}),cT=(t,e)=>({...YR(t),options:[t,e]}),uT=(t,e)=>({...JR(t),options:[t,e]}),dT=(t,e)=>({...sT(t),options:[t,e]});var fT="Arrow",G1=x.forwardRef((t,e)=>{const{children:r,width:s=10,height:n=5,...a}=t;return l.jsx(Ae.svg,{...a,ref:e,width:s,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});G1.displayName=fT;var hT=G1;function Z1(t){const[e,r]=x.useState(void 0);return Bt(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const a=n[0];let o,i;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,i=u.blockSize}else o=t.offsetWidth,i=t.offsetHeight;r({width:o,height:i})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else r(void 0)},[t]),e}var kv="Popper",[Y1,Od]=fs(kv),[pT,J1]=Y1(kv),X1=t=>{const{__scopePopper:e,children:r}=t,[s,n]=x.useState(null);return l.jsx(pT,{scope:e,anchor:s,onAnchorChange:n,children:r})};X1.displayName=kv;var eS="PopperAnchor",tS=x.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:s,...n}=t,a=J1(eS,r),o=x.useRef(null),i=et(e,o),c=x.useRef(null);return x.useEffect(()=>{const u=c.current;c.current=(s==null?void 0:s.current)||o.current,u!==c.current&&a.onAnchorChange(c.current)}),s?null:l.jsx(Ae.div,{...n,ref:i})});tS.displayName=eS;var Nv="PopperContent",[mT,vT]=Y1(Nv),rS=x.forwardRef((t,e)=>{var re,ye,ke,me,ee,_e;const{__scopePopper:r,side:s="bottom",sideOffset:n=0,align:a="center",alignOffset:o=0,arrowPadding:i=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:f="optimized",onPlaced:w,...p}=t,y=J1(Nv,r),[g,v]=x.useState(null),b=et(e,Pe=>v(Pe)),[S,E]=x.useState(null),N=Z1(S),j=(N==null?void 0:N.width)??0,R=(N==null?void 0:N.height)??0,A=s+(a!=="center"?"-"+a:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],_=T.length>0,I={padding:F,boundary:T.filter(yT),altBoundary:_},{refs:C,floatingStyles:z,placement:U,isPositioned:K,middlewareData:P}=nT({strategy:"fixed",placement:A,whileElementsMounted:(...Pe)=>WR(...Pe,{animationFrame:f==="always"}),elements:{reference:y.anchor},middleware:[aT({mainAxis:n+R,alignmentAxis:o}),c&&oT({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?iT():void 0,...I}),c&&lT({...I}),cT({...I,apply:({elements:Pe,rects:De,availableWidth:J,availableHeight:ce})=>{const{width:Y,height:ze}=De.reference,te=Pe.floating.style;te.setProperty("--radix-popper-available-width",`${J}px`),te.setProperty("--radix-popper-available-height",`${ce}px`),te.setProperty("--radix-popper-anchor-width",`${Y}px`),te.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),S&&dT({element:S,padding:i}),xT({arrowWidth:j,arrowHeight:R}),m&&uT({strategy:"referenceHidden",...I})]}),[D,L]=aS(U),X=Ur(w);Bt(()=>{K&&(X==null||X())},[K,X]);const G=(re=P.arrow)==null?void 0:re.x,B=(ye=P.arrow)==null?void 0:ye.y,oe=((ke=P.arrow)==null?void 0:ke.centerOffset)!==0,[ve,ge]=x.useState();return Bt(()=>{g&&ge(window.getComputedStyle(g).zIndex)},[g]),l.jsx("div",{ref:C.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:K?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[(me=P.transformOrigin)==null?void 0:me.x,(ee=P.transformOrigin)==null?void 0:ee.y].join(" "),...((_e=P.hide)==null?void 0:_e.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:l.jsx(mT,{scope:r,placedSide:D,onArrowChange:E,arrowX:G,arrowY:B,shouldHideArrow:oe,children:l.jsx(Ae.div,{"data-side":D,"data-align":L,...p,ref:b,style:{...p.style,animation:K?void 0:"none"}})})})});rS.displayName=Nv;var nS="PopperArrow",gT={top:"bottom",right:"left",bottom:"top",left:"right"},sS=x.forwardRef(function(e,r){const{__scopePopper:s,...n}=e,a=vT(nS,s),o=gT[a.placedSide];return l.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:l.jsx(hT,{...n,ref:r,style:{...n.style,display:"block"}})})});sS.displayName=nS;function yT(t){return t!==null}var xT=t=>({name:"transformOrigin",options:t,fn(e){var y,g,v;const{placement:r,rects:s,middlewareData:n}=e,o=((y=n.arrow)==null?void 0:y.centerOffset)!==0,i=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[u,d]=aS(r),h={start:"0%",center:"50%",end:"100%"}[d],m=(((g=n.arrow)==null?void 0:g.x)??0)+i/2,f=(((v=n.arrow)==null?void 0:v.y)??0)+c/2;let w="",p="";return u==="bottom"?(w=o?h:`${m}px`,p=`${-c}px`):u==="top"?(w=o?h:`${m}px`,p=`${s.floating.height+c}px`):u==="right"?(w=`${-c}px`,p=o?h:`${f}px`):u==="left"&&(w=`${s.floating.width+c}px`,p=o?h:`${f}px`),{data:{x:w,y:p}}}});function aS(t){const[e,r="center"]=t.split("-");return[e,r]}var wT=X1,oS=tS,iS=rS,lS=sS,[Id,wF]=fs("Tooltip",[Od]),jv=Od(),cS="TooltipProvider",bT=700,d0="tooltip.open",[ST,uS]=Id(cS),dS=t=>{const{__scopeTooltip:e,delayDuration:r=bT,skipDelayDuration:s=300,disableHoverableContent:n=!1,children:a}=t,o=x.useRef(!0),i=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(ST,{scope:e,isOpenDelayedRef:o,delayDuration:r,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:x.useCallback(u=>{i.current=u},[]),disableHoverableContent:n,children:a})};dS.displayName=cS;var fS="Tooltip",[bF,Dd]=Id(fS),gp="TooltipTrigger",_T=x.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,n=Dd(gp,r),a=uS(gp,r),o=jv(r),i=x.useRef(null),c=et(e,i,n.onTriggerChange),u=x.useRef(!1),d=x.useRef(!1),h=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx(oS,{asChild:!0,...o,children:l.jsx(Ae.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...s,ref:c,onPointerMove:Se(t.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!a.isPointerInTransitRef.current&&(n.onTriggerEnter(),d.current=!0)}),onPointerLeave:Se(t.onPointerLeave,()=>{n.onTriggerLeave(),d.current=!1}),onPointerDown:Se(t.onPointerDown,()=>{n.open&&n.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Se(t.onFocus,()=>{u.current||n.onOpen()}),onBlur:Se(t.onBlur,n.onClose),onClick:Se(t.onClick,n.onClose)})})});_T.displayName=gp;var ET="TooltipPortal",[SF,CT]=Id(ET,{forceMount:void 0}),pi="TooltipContent",hS=x.forwardRef((t,e)=>{const r=CT(pi,t.__scopeTooltip),{forceMount:s=r.forceMount,side:n="top",...a}=t,o=Dd(pi,t.__scopeTooltip);return l.jsx(da,{present:s||o.open,children:o.disableHoverableContent?l.jsx(pS,{side:n,...a,ref:e}):l.jsx(PT,{side:n,...a,ref:e})})}),PT=x.forwardRef((t,e)=>{const r=Dd(pi,t.__scopeTooltip),s=uS(pi,t.__scopeTooltip),n=x.useRef(null),a=et(e,n),[o,i]=x.useState(null),{trigger:c,onClose:u}=r,d=n.current,{onPointerInTransitChange:h}=s,m=x.useCallback(()=>{i(null),h(!1)},[h]),f=x.useCallback((w,p)=>{const y=w.currentTarget,g={x:w.clientX,y:w.clientY},v=TT(g,y.getBoundingClientRect()),b=AT(g,v),S=OT(p.getBoundingClientRect()),E=DT([...b,...S]);i(E),h(!0)},[h]);return x.useEffect(()=>()=>m(),[m]),x.useEffect(()=>{if(c&&d){const w=y=>f(y,d),p=y=>f(y,c);return c.addEventListener("pointerleave",w),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",w),d.removeEventListener("pointerleave",p)}}},[c,d,f,m]),x.useEffect(()=>{if(o){const w=p=>{const y=p.target,g={x:p.clientX,y:p.clientY},v=(c==null?void 0:c.contains(y))||(d==null?void 0:d.contains(y)),b=!IT(g,o);v?m():b&&(m(),u())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[c,d,o,u,m]),l.jsx(pS,{...t,ref:a})}),[kT,NT]=Id(fS,{isInside:!1}),jT=xj("TooltipContent"),pS=x.forwardRef((t,e)=>{const{__scopeTooltip:r,children:s,"aria-label":n,onEscapeKeyDown:a,onPointerDownOutside:o,...i}=t,c=Dd(pi,r),u=jv(r),{onClose:d}=c;return x.useEffect(()=>(document.addEventListener(d0,d),()=>document.removeEventListener(d0,d)),[d]),x.useEffect(()=>{if(c.trigger){const h=m=>{const f=m.target;f!=null&&f.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),l.jsx(Vl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(iS,{"data-state":c.stateAttribute,...u,...i,ref:e,style:{...i.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(jT,{children:s}),l.jsx(kT,{scope:r,isInside:!0,children:l.jsx(zj,{id:c.contentId,role:"tooltip",children:n||s})})]})})});hS.displayName=pi;var mS="TooltipArrow",RT=x.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,n=jv(r);return NT(mS,r).isInside?null:l.jsx(lS,{...n,...s,ref:e})});RT.displayName=mS;function TT(t,e){const r=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),n=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(r,s,n,a)){case a:return"left";case n:return"right";case r:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function AT(t,e,r=5){const s=[];switch(e){case"top":s.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":s.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":s.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":s.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return s}function OT(t){const{top:e,right:r,bottom:s,left:n}=t;return[{x:n,y:e},{x:r,y:e},{x:r,y:s},{x:n,y:s}]}function IT(t,e){const{x:r,y:s}=t;let n=!1;for(let a=0,o=e.length-1;a<e.length;o=a++){const i=e[a],c=e[o],u=i.x,d=i.y,h=c.x,m=c.y;d>s!=m>s&&r<(h-u)*(s-d)/(m-d)+u&&(n=!n)}return n}function DT(t){const e=t.slice();return e.sort((r,s)=>r.x<s.x?-1:r.x>s.x?1:r.y<s.y?-1:r.y>s.y?1:0),MT(e)}function MT(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s<t.length;s++){const n=t[s];for(;e.length>=2;){const a=e[e.length-1],o=e[e.length-2];if((a.x-o.x)*(n.y-o.y)>=(a.y-o.y)*(n.x-o.x))e.pop();else break}e.push(n)}e.pop();const r=[];for(let s=t.length-1;s>=0;s--){const n=t[s];for(;r.length>=2;){const a=r[r.length-1],o=r[r.length-2];if((a.x-o.x)*(n.y-o.y)>=(a.y-o.y)*(n.x-o.x))r.pop();else break}r.push(n)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var $T=dS,vS=hS;const FT=$T,LT=x.forwardRef(({className:t,sideOffset:e=4,...r},s)=>l.jsx(vS,{ref:s,sideOffset:e,className:Te("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]",t),...r}));LT.displayName=vS.displayName;const UT={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 zT(t){return t?{total:t.total,byKind:t.byKind,serviceWarnings:new Map(Object.entries(t.services)),credentialWarnings:new Map(Object.entries(t.credentials)),playbookWarnings:new Map(Object.entries(t.playbooks))}:UT}const wr="#92E4DD",ur="#F9386D",Yr="#FFFFFF",bn="bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900";function Wr(t){return t.type==="mcp"||t.type==="local-mcp"?wr:t.cardColor??wr}function Sn(t){return{borderColor:t,color:t,boxShadow:`0 0 20px ${t}20`}}const VT=kd("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"}}),fe=x.forwardRef(({className:t,variant:e,size:r,asChild:s=!1,...n},a)=>{const o=s?gj:"button";return l.jsx(o,{className:Te(VT({variant:e,size:r,className:t})),ref:a,...n})});fe.displayName="Button";const $u="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 gS(t){return t.iconUrl?t.iconUrl:null}function Vo({warnings:t}){if(!(t!=null&&t.length))return null;const e=t.find(s=>s.severity==="error")??t[0],r=e.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:t.map(s=>s.message).join(" · "),"data-testid":"card-warning-badge",children:[l.jsx(wn,{className:"h-2.5 w-2.5 shrink-0"}),l.jsx("span",{className:"max-w-[72px] truncate",children:e.message})]})}const qT=t=>{const e=Wr(t),r=gS(t);return r?l.jsx("img",{src:r,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1}):l.jsx("div",{style:{width:28,height:28,backgroundColor:e,WebkitMask:`url(${$u}) no-repeat center / contain`,mask:`url(${$u}) no-repeat center / contain`}})};function HT({service:t,onDragStart:e,onDragEnd:r,isInActiveDeck:s,onCardClick:n,isInCollection:a=!1,onMouseEnter:o,onMouseLeave:i,activeDeck:c,warnings:u}){const d=yr(),{toast:h}=or(),m=Wr(t),f=At({mutationFn:async()=>{if(!c)throw new Error("No active deck found");return Oe("POST",`/api/decks/${c.id}/services`,{serviceId:t.id,position:0})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),h({title:"Service added to deck",description:`${t.name} has been added to your active deck.`})},onError:g=>{h({title:"Failed to add service",description:g.message,variant:"destructive"})}}),w=At({mutationFn:async()=>Oe("DELETE",`/api/services/${t.id}`,{}),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),d.invalidateQueries({queryKey:["/api/decks"]}),h({title:"Service deleted",description:`${t.name} has been deleted successfully.`})},onError:g=>{h({title:"Failed to delete service",description:g.message,variant:"destructive"})}}),p=g=>{g.stopPropagation(),f.mutate()},y=g=>{g.stopPropagation(),window.confirm(`Are you sure you want to delete ${t.name}? This action cannot be undone.`)&&w.mutate()};return l.jsx("div",{className:"relative group cursor-pointer",draggable:!s,onDragStart:g=>e(g,t),onDragEnd:r,onClick:()=>n==null?void 0:n(t),"data-testid":`card-${t.id}`,onMouseEnter:o,onMouseLeave:i,children:l.jsxs("div",{className:`
|
|
224
224
|
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
225
225
|
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
226
226
|
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
227
227
|
relative overflow-hidden
|
|
228
228
|
${s?"opacity-60":""}
|
|
229
229
|
${a?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
230
|
-
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(Vo,{warnings:u}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:m},children:t.type==="mcp"?"RM":t.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:m},children:t.type==="mcp"?"RM":t.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(fe,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:
|
|
230
|
+
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(Vo,{warnings:u}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:m},children:t.type==="mcp"?"RM":t.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:m},children:t.type==="mcp"?"RM":t.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(fe,{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 ${t.name}`,children:l.jsx(Nd,{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:m},children:qT(t)}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-service-name-${t.id}`,style:{color:m},children:t.name}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:m,borderColor:m},children:t.type==="mcp"?"Remote MCP":t.type==="local-mcp"?"Local MCP":"A2A"})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(fe,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:m,borderColor:m},onClick:p,disabled:s||f.isPending,"data-testid":`button-add-to-deck-${t.id}`,children:s?"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 BT=x.memo(HT);function KT(t){return t.iconUrl?t.iconUrl:null}function yS({credential:t,color:e}){const r=KT(t);return r?l.jsx("img",{src:r,alt:"",className:"h-7 w-7 object-contain rounded-sm",draggable:!1}):l.jsx(dp,{className:"h-7 w-7",strokeWidth:2.25,style:{color:e}})}function WT({credential:t,isInActiveDeck:e,activeDeck:r,isInCollection:s=!0,onDragStart:n,onDragEnd:a,onMouseEnter:o,onMouseLeave:i,onCardClick:c,warnings:u}){const d=yr(),{toast:h}=or(),m=ur,f=At({mutationFn:async()=>{if(!r)throw new Error("No active deck found");return Oe("POST",`/api/decks/${r.id}/credentials`,{credentialId:t.id})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/decks"]}),h({title:"Added to deck",description:`${t.label} is in your active deck.`})},onError:p=>{h({title:"Failed to add to deck",description:p.message,variant:"destructive"})}}),w=At({mutationFn:async()=>Oe("DELETE",`/api/credentials/${t.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/credentials/vault"]}),d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/decks"]}),h({title:"API key removed",description:`${t.label} was deleted from your vault.`})},onError:p=>{h({title:"Failed to remove API key",description:p.message,variant:"destructive"})}});return l.jsx("div",{className:"relative group cursor-pointer",draggable:!e&&!!n,onDragStart:n?p=>n(p,t):void 0,onDragEnd:a,onClick:()=>c==null?void 0:c(t),"data-testid":`card-${t.id}`,onMouseEnter:o,onMouseLeave:i,children:l.jsxs("div",{className:`
|
|
231
231
|
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
232
232
|
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
233
233
|
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
234
234
|
relative overflow-hidden
|
|
235
235
|
${e?"opacity-60":""}
|
|
236
236
|
${s?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
237
|
-
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(Vo,{warnings:u}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:m},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:m},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(fe,{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 ${t.label} from your vault?`)&&w.mutate()},title:`Remove ${t.label}`,children:l.jsx(
|
|
237
|
+
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(Vo,{warnings:u}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:m},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:m},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(fe,{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 ${t.label} from your vault?`)&&w.mutate()},title:`Remove ${t.label}`,children:l.jsx(Nd,{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:m},children:l.jsx(yS,{credential:t,color:m})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-credential-name-${t.id}`,style:{color:m},children:t.label}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:m,borderColor:m},children:t.hasSecret?"API Key":"Missing key"})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(fe,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:m,borderColor:m},onClick:p=>{p.stopPropagation(),f.mutate()},disabled:e||f.isPending||!r,"data-testid":`button-add-to-deck-${t.id}`,children:e?"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 QT=x.memo(WT);function GT({playbook:t,isInActiveDeck:e,activeDeck:r,isInCollection:s=!0,onDragStart:n,onDragEnd:a,onMouseEnter:o,onMouseLeave:i,onCardClick:c,warnings:u}){const d=yr(),{toast:h}=or(),m=Yr,f=t.dependsOnCredentialIds.length+t.dependsOnServiceIds.length,w=At({mutationFn:async()=>{if(!r)throw new Error("No deck selected");return Oe("POST",`/api/decks/${r.id}/playbooks`,{playbookId:t.id})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),h({title:"Playbook added to deck",description:`${t.title} is on this deck.`})},onError:y=>{h({title:"Failed to add playbook",description:y.message,variant:"destructive"})}}),p=At({mutationFn:async()=>Oe("DELETE",`/api/playbooks/${t.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/playbooks/vault"]}),d.invalidateQueries({queryKey:["/api/decks"]}),h({title:"Playbook deleted",description:`${t.title} was removed from your collection.`})},onError:y=>{h({title:"Failed to delete playbook",description:y.message,variant:"destructive"})}});return l.jsx("div",{className:"relative group cursor-pointer",draggable:!e&&!!n,onDragStart:n?y=>n(y,t):void 0,onDragEnd:a,onClick:()=>c==null?void 0:c(t),"data-testid":`card-${t.id}`,onMouseEnter:o,onMouseLeave:i,children:l.jsxs("div",{className:`
|
|
238
238
|
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
239
239
|
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
240
240
|
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
241
241
|
relative overflow-hidden
|
|
242
242
|
${e?"opacity-60":""}
|
|
243
243
|
${s?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
244
|
-
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(Vo,{warnings:u}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:m},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:m},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(fe,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:v=>{v.stopPropagation(),window.confirm(`Delete playbook "${t.title}"?`)&&p.mutate()},title:`Delete ${t.title}`,children:l.jsx(kd,{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:m},children:l.jsx(vv,{className:"h-7 w-7",strokeWidth:2.25})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:m},children:t.title}),l.jsxs("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:m,borderColor:m},children:["Playbook",f>0?` · ${f} deps`:""]})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(fe,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:m,borderColor:m},onClick:v=>{v.stopPropagation(),w.mutate()},disabled:e||w.isPending||!r,children:e?"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 BT=x.memo(HT);function KT({deck:t,services:e,credentials:r=[],playbooks:s=[],collectionWarnings:n,onDrop:a,onDragStart:o,onCredentialDragStart:i,onPlaybookDragStart:c,onDragEnd:u,onCardClick:d,onPlaybookClick:h,onCredentialClick:m}){const f=g=>{g.preventDefault(),a(g)},w=g=>{g.preventDefault()},p=g=>{const b=Wr(g),S=hS(g);return S?l.jsx("img",{src:S,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1}):l.jsx("div",{style:{width:28,height:28,backgroundColor:b,WebkitMask:`url(${Mu}) no-repeat center / contain`,mask:`url(${Mu}) no-repeat center / contain`}})},v=e.length+r.length+s.length,y=(g,b)=>l.jsx("div",{className:"relative transition-all duration-500 hover:z-20 hover:scale-110",style:{zIndex:v-b,transform:`rotate(${(b-v/2)*2}deg)`},children:l.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transform transition-all 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 hover:rotate-0",style:{borderColor:Yr,boxShadow:`0 0 20px ${Yr}20`},draggable:!0,onDragStart:S=>c(S,g,!0),onDragEnd:u,onClick:()=>h==null?void 0:h(g),"data-testid":`deck-card-${g.id}`,children:[l.jsx(Vo,{warnings:n==null?void 0:n.playbookWarnings.get(g.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:Yr},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:Yr},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:Yr},children:l.jsx(vv,{className:"h-7 w-7",strokeWidth:2.25})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Yr},children:g.title}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Yr,borderColor:Yr},children:"Playbook"})]})]})},g.id);return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"flex items-center justify-between mb-4",children:l.jsxs("h3",{className:"text-lg font-bold flex items-center",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",children:t.name}),l.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:["(",v," cards)"]})]})}),l.jsx("div",{className:"relative flex-1 p-4 rounded-xl border-2 border-dashed flex items-center justify-center overflow-hidden",onDrop:f,onDragOver:w,style:{minHeight:"200px",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 items-center justify-center",style:{width:"fit-content"},children:v===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(Vs,{className:"w-8 h-8 text-gray-500"})})}):l.jsxs("div",{className:"flex items-center justify-center space-x-[-60px] hover:space-x-4 transition-all duration-500 group",children:[r.map((g,b)=>l.jsx("div",{className:"relative transition-all duration-500 hover:z-20 hover:scale-110",style:{zIndex:v-b,transform:`rotate(${(b-v/2)*2}deg)`},children:l.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transform transition-all 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 hover:rotate-0",style:{borderColor:ur,boxShadow:`0 0 20px ${ur}20`},draggable:!0,onDragStart:S=>i(S,g,!0),onDragEnd:u,onClick:()=>m==null?void 0:m(g),"data-testid":`deck-card-${g.id}`,children:[l.jsx(Vo,{warnings:n==null?void 0:n.credentialWarnings.get(g.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(pS,{credential:g,color:ur})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:ur},children:g.label}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:ur,borderColor:ur},children:g.hasSecret?"API Key":"Missing key"})]})]})},g.id)),s.map((g,b)=>y(g,r.length+b)),e.map((g,b)=>{const S=r.length+s.length+b,E=p(g);return l.jsx("div",{className:"relative transition-all duration-500 hover:z-20 hover:scale-110",style:{zIndex:v-S,transform:`rotate(${(S-v/2)*2}deg)`},children:l.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transform transition-all 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 hover:rotate-0",style:{borderColor:Wr(g),boxShadow:`0 0 20px ${Wr(g)}20`},draggable:!0,onDragStart:N=>o(N,g,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(g),"data-testid":`deck-card-${g.id}`,children:[l.jsx(Vo,{warnings:n==null?void 0:n.serviceWarnings.get(g.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:Wr(g)},children:g.type==="mcp"?"RM":g.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:Wr(g)},children:g.type==="mcp"?"RM":g.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:Wr(g)},children:E}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Wr(g)},children:g.name}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Wr(g),borderColor:Wr(g)},children:g.type==="mcp"?"Remote MCP":g.type==="local-mcp"?"Local MCP":"A2A"})]})]})},g.id)})]})})})]})}var Df="focusScope.autoFocusOnMount",Mf="focusScope.autoFocusOnUnmount",u0={bubbles:!1,cancelable:!0},WT="FocusScope",Nv=x.forwardRef((t,e)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:n,onUnmountAutoFocus:a,...o}=t,[i,c]=x.useState(null),u=Ur(n),d=Ur(a),h=x.useRef(null),m=et(e,p=>c(p)),f=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(s){let p=function(b){if(f.paused||!i)return;const S=b.target;i.contains(S)?h.current=S:bs(h.current,{select:!0})},v=function(b){if(f.paused||!i)return;const S=b.relatedTarget;S!==null&&(i.contains(S)||bs(h.current,{select:!0}))},y=function(b){if(document.activeElement===document.body)for(const E of b)E.removedNodes.length>0&&bs(i)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const g=new MutationObserver(y);return i&&g.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),g.disconnect()}}},[s,i,f.paused]),x.useEffect(()=>{if(i){f0.add(f);const p=document.activeElement;if(!i.contains(p)){const y=new CustomEvent(Df,u0);i.addEventListener(Df,u),i.dispatchEvent(y),y.defaultPrevented||(QT(XT(mS(i)),{select:!0}),document.activeElement===p&&bs(i))}return()=>{i.removeEventListener(Df,u),setTimeout(()=>{const y=new CustomEvent(Mf,u0);i.addEventListener(Mf,d),i.dispatchEvent(y),y.defaultPrevented||bs(p??document.body,{select:!0}),i.removeEventListener(Mf,d),f0.remove(f)},0)}}},[i,u,d,f]);const w=x.useCallback(p=>{if(!r&&!s||f.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(v&&y){const g=p.currentTarget,[b,S]=GT(g);b&&S?!p.shiftKey&&y===S?(p.preventDefault(),r&&bs(b,{select:!0})):p.shiftKey&&y===b&&(p.preventDefault(),r&&bs(S,{select:!0})):y===g&&p.preventDefault()}},[r,s,f.paused]);return l.jsx(Ae.div,{tabIndex:-1,...o,ref:m,onKeyDown:w})});Nv.displayName=WT;function QT(t,{select:e=!1}={}){const r=document.activeElement;for(const s of t)if(bs(s,{select:e}),document.activeElement!==r)return}function GT(t){const e=mS(t),r=d0(e,t),s=d0(e.reverse(),t);return[r,s]}function mS(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||n?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function d0(t,e){for(const r of t)if(!ZT(r,{upTo:e}))return r}function ZT(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function YT(t){return t instanceof HTMLInputElement&&"select"in t}function bs(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&YT(t)&&e&&t.select()}}var f0=JT();function JT(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=h0(t,e),t.unshift(e)},remove(e){var r;t=h0(t,e),(r=t[0])==null||r.resume()}}}function h0(t,e){const r=[...t],s=r.indexOf(e);return s!==-1&&r.splice(s,1),r}function XT(t){return t.filter(e=>e.tagName!=="A")}var $f=0;function vS(){x.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??p0()),document.body.insertAdjacentElement("beforeend",t[1]??p0()),$f++,()=>{$f===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),$f--}},[])}function p0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var _n=function(){return _n=Object.assign||function(e){for(var r,s=1,n=arguments.length;s<n;s++){r=arguments[s];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},_n.apply(this,arguments)};function gS(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function eA(t,e,r){if(r||arguments.length===2)for(var s=0,n=e.length,a;s<n;s++)(a||!(s in e))&&(a||(a=Array.prototype.slice.call(e,0,s)),a[s]=e[s]);return t.concat(a||Array.prototype.slice.call(e))}var Gc="right-scroll-bar-position",Zc="width-before-scroll-bar",tA="with-scroll-bars-hidden",rA="--removed-body-scroll-bar-size";function Ff(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function nA(t,e){var r=x.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(s){var n=r.value;n!==s&&(r.value=s,r.callback(s,n))}}}})[0];return r.callback=e,r.facade}var sA=typeof window<"u"?x.useLayoutEffect:x.useEffect,m0=new WeakMap;function aA(t,e){var r=nA(null,function(s){return t.forEach(function(n){return Ff(n,s)})});return sA(function(){var s=m0.get(r);if(s){var n=new Set(s),a=new Set(t),o=r.current;n.forEach(function(i){a.has(i)||Ff(i,null)}),a.forEach(function(i){n.has(i)||Ff(i,o)})}m0.set(r,t)},[t]),r}function oA(t){return t}function iA(t,e){e===void 0&&(e=oA);var r=[],s=!1,n={read:function(){if(s)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]:t},useMedium:function(a){var o=e(a,s);return r.push(o),function(){r=r.filter(function(i){return i!==o})}},assignSyncMedium:function(a){for(s=!0;r.length;){var o=r;r=[],o.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){s=!0;var o=[];if(r.length){var i=r;r=[],i.forEach(a),o=r}var c=function(){var d=o;o=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return n}function lA(t){t===void 0&&(t={});var e=iA(null);return e.options=_n({async:!0,ssr:!1},t),e}var yS=function(t){var e=t.sideCar,r=gS(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=e.read();if(!s)throw new Error("Sidecar medium not found");return x.createElement(s,_n({},r))};yS.isSideCarExport=!0;function cA(t,e){return t.useMedium(e),yS}var xS=lA(),Lf=function(){},Dd=x.forwardRef(function(t,e){var r=x.useRef(null),s=x.useState({onScrollCapture:Lf,onWheelCapture:Lf,onTouchMoveCapture:Lf}),n=s[0],a=s[1],o=t.forwardProps,i=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,h=t.shards,m=t.sideCar,f=t.noRelative,w=t.noIsolation,p=t.inert,v=t.allowPinchZoom,y=t.as,g=y===void 0?"div":y,b=t.gapMode,S=gS(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,N=aA([r,e]),j=_n(_n({},S),n);return x.createElement(x.Fragment,null,d&&x.createElement(E,{sideCar:xS,removeScrollBar:u,shards:h,noRelative:f,noIsolation:w,inert:p,setCallbacks:a,allowPinchZoom:!!v,lockRef:r,gapMode:b}),o?x.cloneElement(x.Children.only(i),_n(_n({},j),{ref:N})):x.createElement(g,_n({},j,{className:c,ref:N}),i))});Dd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Dd.classNames={fullWidth:Zc,zeroRight:Gc};var uA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function dA(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=uA();return e&&t.setAttribute("nonce",e),t}function fA(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function hA(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var pA=function(){var t=0,e=null;return{add:function(r){t==0&&(e=dA())&&(fA(e,r),hA(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},mA=function(){var t=pA();return function(e,r){x.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},wS=function(){var t=mA(),e=function(r){var s=r.styles,n=r.dynamic;return t(s,n),null};return e},vA={left:0,top:0,right:0,gap:0},Uf=function(t){return parseInt(t||"",10)||0},gA=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],s=e[t==="padding"?"paddingTop":"marginTop"],n=e[t==="padding"?"paddingRight":"marginRight"];return[Uf(r),Uf(s),Uf(n)]},yA=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return vA;var e=gA(t),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,s-r+e[2]-e[0])}},xA=wS(),qo="data-scroll-locked",wA=function(t,e,r,s){var n=t.left,a=t.top,o=t.right,i=t.gap;return r===void 0&&(r="margin"),`
|
|
245
|
-
.`.concat(
|
|
244
|
+
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(Vo,{warnings:u}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:m},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:m},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(fe,{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 "${t.title}"?`)&&p.mutate()},title:`Delete ${t.title}`,children:l.jsx(Nd,{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:m},children:l.jsx(yv,{className:"h-7 w-7",strokeWidth:2.25})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:m},children:t.title}),l.jsxs("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:m,borderColor:m},children:["Playbook",f>0?` · ${f} deps`:""]})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(fe,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:m,borderColor:m},onClick:y=>{y.stopPropagation(),w.mutate()},disabled:e||w.isPending||!r,children:e?"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 ZT=x.memo(GT);function YT({deck:t,services:e,credentials:r=[],playbooks:s=[],collectionWarnings:n,onDrop:a,onDragStart:o,onCredentialDragStart:i,onPlaybookDragStart:c,onDragEnd:u,onCardClick:d,onPlaybookClick:h,onCredentialClick:m}){const f=v=>{v.preventDefault(),a(v)},w=v=>{v.preventDefault()},p=v=>{const b=Wr(v),S=gS(v);return S?l.jsx("img",{src:S,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1}):l.jsx("div",{style:{width:28,height:28,backgroundColor:b,WebkitMask:`url(${$u}) no-repeat center / contain`,mask:`url(${$u}) no-repeat center / contain`}})},y=e.length+r.length+s.length,g=(v,b)=>l.jsx("div",{className:"relative transition-all duration-500 hover:z-20 hover:scale-110",style:{zIndex:y-b,transform:`rotate(${(b-y/2)*2}deg)`},children:l.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transform transition-all 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 hover:rotate-0",style:{borderColor:Yr,boxShadow:`0 0 20px ${Yr}20`},draggable:!0,onDragStart:S=>c(S,v,!0),onDragEnd:u,onClick:()=>h==null?void 0:h(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(Vo,{warnings:n==null?void 0:n.playbookWarnings.get(v.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:Yr},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:Yr},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:Yr},children:l.jsx(yv,{className:"h-7 w-7",strokeWidth:2.25})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Yr},children:v.title}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Yr,borderColor:Yr},children:"Playbook"})]})]})},v.id);return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"flex items-center justify-between mb-4",children:l.jsxs("h3",{className:"text-lg font-bold flex items-center",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",children:t.name}),l.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:["(",y," cards)"]})]})}),l.jsx("div",{className:"relative flex-1 p-4 rounded-xl border-2 border-dashed flex items-center justify-center overflow-hidden",onDrop:f,onDragOver:w,style:{minHeight:"200px",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 items-center justify-center",style:{width:"fit-content"},children:y===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(Vs,{className:"w-8 h-8 text-gray-500"})})}):l.jsxs("div",{className:"flex items-center justify-center space-x-[-60px] hover:space-x-4 transition-all duration-500 group",children:[r.map((v,b)=>l.jsx("div",{className:"relative transition-all duration-500 hover:z-20 hover:scale-110",style:{zIndex:y-b,transform:`rotate(${(b-y/2)*2}deg)`},children:l.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transform transition-all 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 hover:rotate-0",style:{borderColor:ur,boxShadow:`0 0 20px ${ur}20`},draggable:!0,onDragStart:S=>i(S,v,!0),onDragEnd:u,onClick:()=>m==null?void 0:m(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(Vo,{warnings:n==null?void 0:n.credentialWarnings.get(v.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(yS,{credential:v,color:ur})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:ur},children:v.label}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:ur,borderColor:ur},children:v.hasSecret?"API Key":"Missing key"})]})]})},v.id)),s.map((v,b)=>g(v,r.length+b)),e.map((v,b)=>{const S=r.length+s.length+b,E=p(v);return l.jsx("div",{className:"relative transition-all duration-500 hover:z-20 hover:scale-110",style:{zIndex:y-S,transform:`rotate(${(S-y/2)*2}deg)`},children:l.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transform transition-all 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 hover:rotate-0",style:{borderColor:Wr(v),boxShadow:`0 0 20px ${Wr(v)}20`},draggable:!0,onDragStart:N=>o(N,v,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(Vo,{warnings:n==null?void 0:n.serviceWarnings.get(v.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:Wr(v)},children:v.type==="mcp"?"RM":v.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:Wr(v)},children:v.type==="mcp"?"RM":v.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:Wr(v)},children:E}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Wr(v)},children:v.name}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Wr(v),borderColor:Wr(v)},children:v.type==="mcp"?"Remote MCP":v.type==="local-mcp"?"Local MCP":"A2A"})]})]})},v.id)})]})})})]})}var Mf="focusScope.autoFocusOnMount",$f="focusScope.autoFocusOnUnmount",f0={bubbles:!1,cancelable:!0},JT="FocusScope",Rv=x.forwardRef((t,e)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:n,onUnmountAutoFocus:a,...o}=t,[i,c]=x.useState(null),u=Ur(n),d=Ur(a),h=x.useRef(null),m=et(e,p=>c(p)),f=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(s){let p=function(b){if(f.paused||!i)return;const S=b.target;i.contains(S)?h.current=S:Ss(h.current,{select:!0})},y=function(b){if(f.paused||!i)return;const S=b.relatedTarget;S!==null&&(i.contains(S)||Ss(h.current,{select:!0}))},g=function(b){if(document.activeElement===document.body)for(const E of b)E.removedNodes.length>0&&Ss(i)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const v=new MutationObserver(g);return i&&v.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),v.disconnect()}}},[s,i,f.paused]),x.useEffect(()=>{if(i){p0.add(f);const p=document.activeElement;if(!i.contains(p)){const g=new CustomEvent(Mf,f0);i.addEventListener(Mf,u),i.dispatchEvent(g),g.defaultPrevented||(XT(sA(xS(i)),{select:!0}),document.activeElement===p&&Ss(i))}return()=>{i.removeEventListener(Mf,u),setTimeout(()=>{const g=new CustomEvent($f,f0);i.addEventListener($f,d),i.dispatchEvent(g),g.defaultPrevented||Ss(p??document.body,{select:!0}),i.removeEventListener($f,d),p0.remove(f)},0)}}},[i,u,d,f]);const w=x.useCallback(p=>{if(!r&&!s||f.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,g=document.activeElement;if(y&&g){const v=p.currentTarget,[b,S]=eA(v);b&&S?!p.shiftKey&&g===S?(p.preventDefault(),r&&Ss(b,{select:!0})):p.shiftKey&&g===b&&(p.preventDefault(),r&&Ss(S,{select:!0})):g===v&&p.preventDefault()}},[r,s,f.paused]);return l.jsx(Ae.div,{tabIndex:-1,...o,ref:m,onKeyDown:w})});Rv.displayName=JT;function XT(t,{select:e=!1}={}){const r=document.activeElement;for(const s of t)if(Ss(s,{select:e}),document.activeElement!==r)return}function eA(t){const e=xS(t),r=h0(e,t),s=h0(e.reverse(),t);return[r,s]}function xS(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||n?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function h0(t,e){for(const r of t)if(!tA(r,{upTo:e}))return r}function tA(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function rA(t){return t instanceof HTMLInputElement&&"select"in t}function Ss(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&rA(t)&&e&&t.select()}}var p0=nA();function nA(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=m0(t,e),t.unshift(e)},remove(e){var r;t=m0(t,e),(r=t[0])==null||r.resume()}}}function m0(t,e){const r=[...t],s=r.indexOf(e);return s!==-1&&r.splice(s,1),r}function sA(t){return t.filter(e=>e.tagName!=="A")}var Ff=0;function wS(){x.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??v0()),document.body.insertAdjacentElement("beforeend",t[1]??v0()),Ff++,()=>{Ff===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Ff--}},[])}function v0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var _n=function(){return _n=Object.assign||function(e){for(var r,s=1,n=arguments.length;s<n;s++){r=arguments[s];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},_n.apply(this,arguments)};function bS(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function aA(t,e,r){if(r||arguments.length===2)for(var s=0,n=e.length,a;s<n;s++)(a||!(s in e))&&(a||(a=Array.prototype.slice.call(e,0,s)),a[s]=e[s]);return t.concat(a||Array.prototype.slice.call(e))}var Zc="right-scroll-bar-position",Yc="width-before-scroll-bar",oA="with-scroll-bars-hidden",iA="--removed-body-scroll-bar-size";function Lf(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function lA(t,e){var r=x.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(s){var n=r.value;n!==s&&(r.value=s,r.callback(s,n))}}}})[0];return r.callback=e,r.facade}var cA=typeof window<"u"?x.useLayoutEffect:x.useEffect,g0=new WeakMap;function uA(t,e){var r=lA(null,function(s){return t.forEach(function(n){return Lf(n,s)})});return cA(function(){var s=g0.get(r);if(s){var n=new Set(s),a=new Set(t),o=r.current;n.forEach(function(i){a.has(i)||Lf(i,null)}),a.forEach(function(i){n.has(i)||Lf(i,o)})}g0.set(r,t)},[t]),r}function dA(t){return t}function fA(t,e){e===void 0&&(e=dA);var r=[],s=!1,n={read:function(){if(s)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]:t},useMedium:function(a){var o=e(a,s);return r.push(o),function(){r=r.filter(function(i){return i!==o})}},assignSyncMedium:function(a){for(s=!0;r.length;){var o=r;r=[],o.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){s=!0;var o=[];if(r.length){var i=r;r=[],i.forEach(a),o=r}var c=function(){var d=o;o=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return n}function hA(t){t===void 0&&(t={});var e=fA(null);return e.options=_n({async:!0,ssr:!1},t),e}var SS=function(t){var e=t.sideCar,r=bS(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=e.read();if(!s)throw new Error("Sidecar medium not found");return x.createElement(s,_n({},r))};SS.isSideCarExport=!0;function pA(t,e){return t.useMedium(e),SS}var _S=hA(),Uf=function(){},Md=x.forwardRef(function(t,e){var r=x.useRef(null),s=x.useState({onScrollCapture:Uf,onWheelCapture:Uf,onTouchMoveCapture:Uf}),n=s[0],a=s[1],o=t.forwardProps,i=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,h=t.shards,m=t.sideCar,f=t.noRelative,w=t.noIsolation,p=t.inert,y=t.allowPinchZoom,g=t.as,v=g===void 0?"div":g,b=t.gapMode,S=bS(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,N=uA([r,e]),j=_n(_n({},S),n);return x.createElement(x.Fragment,null,d&&x.createElement(E,{sideCar:_S,removeScrollBar:u,shards:h,noRelative:f,noIsolation:w,inert:p,setCallbacks:a,allowPinchZoom:!!y,lockRef:r,gapMode:b}),o?x.cloneElement(x.Children.only(i),_n(_n({},j),{ref:N})):x.createElement(v,_n({},j,{className:c,ref:N}),i))});Md.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Md.classNames={fullWidth:Yc,zeroRight:Zc};var mA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vA(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=mA();return e&&t.setAttribute("nonce",e),t}function gA(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function yA(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var xA=function(){var t=0,e=null;return{add:function(r){t==0&&(e=vA())&&(gA(e,r),yA(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},wA=function(){var t=xA();return function(e,r){x.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},ES=function(){var t=wA(),e=function(r){var s=r.styles,n=r.dynamic;return t(s,n),null};return e},bA={left:0,top:0,right:0,gap:0},zf=function(t){return parseInt(t||"",10)||0},SA=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],s=e[t==="padding"?"paddingTop":"marginTop"],n=e[t==="padding"?"paddingRight":"marginRight"];return[zf(r),zf(s),zf(n)]},_A=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return bA;var e=SA(t),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,s-r+e[2]-e[0])}},EA=ES(),qo="data-scroll-locked",CA=function(t,e,r,s){var n=t.left,a=t.top,o=t.right,i=t.gap;return r===void 0&&(r="margin"),`
|
|
245
|
+
.`.concat(oA,` {
|
|
246
246
|
overflow: hidden `).concat(s,`;
|
|
247
247
|
padding-right: `).concat(i,"px ").concat(s,`;
|
|
248
248
|
}
|
|
@@ -259,33 +259,41 @@ Error generating stack: `+a.message+`
|
|
|
259
259
|
`),r==="padding"&&"padding-right: ".concat(i,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
.`).concat(
|
|
262
|
+
.`).concat(Zc,` {
|
|
263
263
|
right: `).concat(i,"px ").concat(s,`;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
.`).concat(
|
|
266
|
+
.`).concat(Yc,` {
|
|
267
267
|
margin-right: `).concat(i,"px ").concat(s,`;
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
.`).concat(
|
|
270
|
+
.`).concat(Zc," .").concat(Zc,` {
|
|
271
271
|
right: 0 `).concat(s,`;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
.`).concat(
|
|
274
|
+
.`).concat(Yc," .").concat(Yc,` {
|
|
275
275
|
margin-right: 0 `).concat(s,`;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
body[`).concat(qo,`] {
|
|
279
|
-
`).concat(
|
|
279
|
+
`).concat(iA,": ").concat(i,`px;
|
|
280
280
|
}
|
|
281
|
-
`)},
|
|
281
|
+
`)},y0=function(){var t=parseInt(document.body.getAttribute(qo)||"0",10);return isFinite(t)?t:0},PA=function(){x.useEffect(function(){return document.body.setAttribute(qo,(y0()+1).toString()),function(){var t=y0()-1;t<=0?document.body.removeAttribute(qo):document.body.setAttribute(qo,t.toString())}},[])},kA=function(t){var e=t.noRelative,r=t.noImportant,s=t.gapMode,n=s===void 0?"margin":s;PA();var a=x.useMemo(function(){return _A(n)},[n]);return x.createElement(EA,{styles:CA(a,!e,n,r?"":"!important")})},yp=!1;if(typeof window<"u")try{var kc=Object.defineProperty({},"passive",{get:function(){return yp=!0,!0}});window.addEventListener("test",kc,kc),window.removeEventListener("test",kc,kc)}catch{yp=!1}var co=yp?{passive:!1}:!1,NA=function(t){return t.tagName==="TEXTAREA"},CS=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!NA(t)&&r[e]==="visible")},jA=function(t){return CS(t,"overflowY")},RA=function(t){return CS(t,"overflowX")},x0=function(t,e){var r=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var n=PS(t,s);if(n){var a=kS(t,s),o=a[1],i=a[2];if(o>i)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},TA=function(t){var e=t.scrollTop,r=t.scrollHeight,s=t.clientHeight;return[e,r,s]},AA=function(t){var e=t.scrollLeft,r=t.scrollWidth,s=t.clientWidth;return[e,r,s]},PS=function(t,e){return t==="v"?jA(e):RA(e)},kS=function(t,e){return t==="v"?TA(e):AA(e)},OA=function(t,e){return t==="h"&&e==="rtl"?-1:1},IA=function(t,e,r,s,n){var a=OA(t,window.getComputedStyle(e).direction),o=a*s,i=r.target,c=e.contains(i),u=!1,d=o>0,h=0,m=0;do{if(!i)break;var f=kS(t,i),w=f[0],p=f[1],y=f[2],g=p-y-a*w;(w||g)&&PS(t,i)&&(h+=g,m+=w);var v=i.parentNode;i=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&i!==document.body||c&&(e.contains(i)||e===i));return(d&&Math.abs(h)<1||!d&&Math.abs(m)<1)&&(u=!0),u},Nc=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},w0=function(t){return[t.deltaX,t.deltaY]},b0=function(t){return t&&"current"in t?t.current:t},DA=function(t,e){return t[0]===e[0]&&t[1]===e[1]},MA=function(t){return`
|
|
282
282
|
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
283
283
|
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
284
|
-
`)}
|
|
284
|
+
`)},$A=0,uo=[];function FA(t){var e=x.useRef([]),r=x.useRef([0,0]),s=x.useRef(),n=x.useState($A++)[0],a=x.useState(ES)[0],o=x.useRef(t);x.useEffect(function(){o.current=t},[t]),x.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(n));var p=aA([t.lockRef.current],(t.shards||[]).map(b0),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(n))})}}},[t.inert,t.lockRef.current,t.shards]);var i=x.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var g=Nc(p),v=r.current,b="deltaX"in p?p.deltaX:v[0]-g[0],S="deltaY"in p?p.deltaY:v[1]-g[1],E,N=p.target,j=Math.abs(b)>Math.abs(S)?"h":"v";if("touches"in p&&j==="h"&&N.type==="range")return!1;var R=x0(j,N);if(!R)return!0;if(R?E=j:(E=j==="v"?"h":"v",R=x0(j,N)),!R)return!1;if(!s.current&&"changedTouches"in p&&(b||S)&&(s.current=E),!E)return!0;var A=s.current||E;return IA(A,y,p,A==="h"?b:S)},[]),c=x.useCallback(function(p){var y=p;if(!(!uo.length||uo[uo.length-1]!==a)){var g="deltaY"in y?w0(y):Nc(y),v=e.current.filter(function(E){return E.name===y.type&&(E.target===y.target||y.target===E.shadowParent)&&DA(E.delta,g)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var b=(o.current.shards||[]).map(b0).filter(Boolean).filter(function(E){return E.contains(y.target)}),S=b.length>0?i(y,b[0]):!o.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=x.useCallback(function(p,y,g,v){var b={name:p,delta:y,target:g,should:v,shadowParent:LA(g)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(S){return S!==b})},1)},[]),d=x.useCallback(function(p){r.current=Nc(p),s.current=void 0},[]),h=x.useCallback(function(p){u(p.type,w0(p),p.target,i(p,t.lockRef.current))},[]),m=x.useCallback(function(p){u(p.type,Nc(p),p.target,i(p,t.lockRef.current))},[]);x.useEffect(function(){return uo.push(a),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,co),document.addEventListener("touchmove",c,co),document.addEventListener("touchstart",d,co),function(){uo=uo.filter(function(p){return p!==a}),document.removeEventListener("wheel",c,co),document.removeEventListener("touchmove",c,co),document.removeEventListener("touchstart",d,co)}},[]);var f=t.removeScrollBar,w=t.inert;return x.createElement(x.Fragment,null,w?x.createElement(a,{styles:MA(n)}):null,f?x.createElement(kA,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function LA(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const UA=pA(_S,FA);var Tv=x.forwardRef(function(t,e){return x.createElement(Md,_n({},t,{ref:e,sideCar:UA}))});Tv.classNames=Md.classNames;var zA=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},fo=new WeakMap,jc=new WeakMap,Rc={},Vf=0,NS=function(t){return t&&(t.host||NS(t.parentNode))},VA=function(t,e){return e.map(function(r){if(t.contains(r))return r;var s=NS(r);return s&&t.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},qA=function(t,e,r,s){var n=VA(e,Array.isArray(t)?t:[t]);Rc[r]||(Rc[r]=new WeakMap);var a=Rc[r],o=[],i=new Set,c=new Set(n),u=function(h){!h||i.has(h)||(i.add(h),u(h.parentNode))};n.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(i.has(m))d(m);else try{var f=m.getAttribute(s),w=f!==null&&f!=="false",p=(fo.get(m)||0)+1,y=(a.get(m)||0)+1;fo.set(m,p),a.set(m,y),o.push(m),p===1&&w&&jc.set(m,!0),y===1&&m.setAttribute(r,"true"),w||m.setAttribute(s,"true")}catch(g){console.error("aria-hidden: cannot operate on ",m,g)}})};return d(e),i.clear(),Vf++,function(){o.forEach(function(h){var m=fo.get(h)-1,f=a.get(h)-1;fo.set(h,m),a.set(h,f),m||(jc.has(h)||h.removeAttribute(s),jc.delete(h)),f||h.removeAttribute(r)}),Vf--,Vf||(fo=new WeakMap,fo=new WeakMap,jc=new WeakMap,Rc={})}},jS=function(t,e,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),n=zA(t);return n?(s.push.apply(s,Array.from(n.querySelectorAll("[aria-live], script"))),qA(s,n,r,"aria-hidden")):function(){return null}},$d="Dialog",[RS,_F]=fs($d),[HA,ln]=RS($d),TS=t=>{const{__scopeDialog:e,children:r,open:s,defaultOpen:n,onOpenChange:a,modal:o=!0}=t,i=x.useRef(null),c=x.useRef(null),[u,d]=Wa({prop:s,defaultProp:n??!1,onChange:a,caller:$d});return l.jsx(HA,{scope:e,triggerRef:i,contentRef:c,contentId:ea(),titleId:ea(),descriptionId:ea(),open:u,onOpenChange:d,onOpenToggle:x.useCallback(()=>d(h=>!h),[d]),modal:o,children:r})};TS.displayName=$d;var AS="DialogTrigger",BA=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(AS,r),a=et(e,n.triggerRef);return l.jsx(Ae.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Iv(n.open),...s,ref:a,onClick:Se(t.onClick,n.onOpenToggle)})});BA.displayName=AS;var Av="DialogPortal",[KA,OS]=RS(Av,{forceMount:void 0}),IS=t=>{const{__scopeDialog:e,forceMount:r,children:s,container:n}=t,a=ln(Av,e);return l.jsx(KA,{scope:e,forceMount:r,children:x.Children.map(s,o=>l.jsx(da,{present:r||a.open,children:l.jsx(Ed,{asChild:!0,container:n,children:o})}))})};IS.displayName=Av;var Fu="DialogOverlay",DS=x.forwardRef((t,e)=>{const r=OS(Fu,t.__scopeDialog),{forceMount:s=r.forceMount,...n}=t,a=ln(Fu,t.__scopeDialog);return a.modal?l.jsx(da,{present:s||a.open,children:l.jsx(QA,{...n,ref:e})}):null});DS.displayName=Fu;var WA=fi("DialogOverlay.RemoveScroll"),QA=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(Fu,r);return l.jsx(Tv,{as:WA,allowPinchZoom:!0,shards:[n.contentRef],children:l.jsx(Ae.div,{"data-state":Iv(n.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),Ga="DialogContent",MS=x.forwardRef((t,e)=>{const r=OS(Ga,t.__scopeDialog),{forceMount:s=r.forceMount,...n}=t,a=ln(Ga,t.__scopeDialog);return l.jsx(da,{present:s||a.open,children:a.modal?l.jsx(GA,{...n,ref:e}):l.jsx(ZA,{...n,ref:e})})});MS.displayName=Ga;var GA=x.forwardRef((t,e)=>{const r=ln(Ga,t.__scopeDialog),s=x.useRef(null),n=et(e,r.contentRef,s);return x.useEffect(()=>{const a=s.current;if(a)return jS(a)},[]),l.jsx($S,{...t,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Se(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Se(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,i=o.button===0&&o.ctrlKey===!0;(o.button===2||i)&&a.preventDefault()}),onFocusOutside:Se(t.onFocusOutside,a=>a.preventDefault())})}),ZA=x.forwardRef((t,e)=>{const r=ln(Ga,t.__scopeDialog),s=x.useRef(!1),n=x.useRef(!1);return l.jsx($S,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,i;(o=t.onCloseAutoFocus)==null||o.call(t,a),a.defaultPrevented||(s.current||(i=r.triggerRef.current)==null||i.focus(),a.preventDefault()),s.current=!1,n.current=!1},onInteractOutside:a=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const o=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&n.current&&a.preventDefault()}})}),$S=x.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:a,...o}=t,i=ln(Ga,r),c=x.useRef(null),u=et(e,c);return wS(),l.jsxs(l.Fragment,{children:[l.jsx(Rv,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:n,onUnmountAutoFocus:a,children:l.jsx(Vl,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Iv(i.open),...o,ref:u,onDismiss:()=>i.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(YA,{titleId:i.titleId}),l.jsx(XA,{contentRef:c,descriptionId:i.descriptionId})]})]})}),Ov="DialogTitle",FS=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(Ov,r);return l.jsx(Ae.h2,{id:n.titleId,...s,ref:e})});FS.displayName=Ov;var LS="DialogDescription",US=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(LS,r);return l.jsx(Ae.p,{id:n.descriptionId,...s,ref:e})});US.displayName=LS;var zS="DialogClose",VS=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(zS,r);return l.jsx(Ae.button,{type:"button",...s,ref:e,onClick:Se(t.onClick,()=>n.onOpenChange(!1))})});VS.displayName=zS;function Iv(t){return t?"open":"closed"}var qS="DialogTitleWarning",[EF,HS]=mj(qS,{contentName:Ga,titleName:Ov,docsSlug:"dialog"}),YA=({titleId:t})=>{const e=HS(qS),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
285
285
|
|
|
286
286
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
287
287
|
|
|
288
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return x.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},WA="DialogDescriptionWarning",QA=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${US(WA).contentName}}.`;return x.useEffect(()=>{var a;const n=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&n&&(document.getElementById(e)||console.warn(s))},[s,t,e]),null},GA=kS,ZA=RS,zS=TS,VS=AS,qS=IS,HS=MS,YA=FS;const ao=GA,JA=ZA,BS=x.forwardRef(({className:t,...e},r)=>l.jsx(zS,{ref:r,className:Te("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",t),...e}));BS.displayName=zS.displayName;const fa=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(JA,{children:[l.jsx(BS,{}),l.jsxs(VS,{ref:s,className:Te("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",t),...r,children:[e,l.jsxs(YA,{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(Tu,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));fa.displayName=VS.displayName;const ha=({className:t,...e})=>l.jsx("div",{className:Te("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});ha.displayName="DialogHeader";const pa=x.forwardRef(({className:t,...e},r)=>l.jsx(qS,{ref:r,className:Te("text-lg font-semibold leading-none tracking-tight",t),...e}));pa.displayName=qS.displayName;const Ci=x.forwardRef(({className:t,...e},r)=>l.jsx(HS,{ref:r,className:Te("text-sm text-muted-foreground",t),...e}));Ci.displayName=HS.displayName;const tt=x.forwardRef(({className:t,type:e,...r},s)=>l.jsx("input",{type:e,className:Te("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",t),ref:s,...r}));tt.displayName="Input";const Gn=x.forwardRef(({className:t,...e},r)=>l.jsx("textarea",{className:Te("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",t),ref:r,...e}));Gn.displayName="Textarea";var XA="Label",KS=x.forwardRef((t,e)=>l.jsx(Ae.label,{...t,ref:e,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=t.onMouseDown)==null||n.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));KS.displayName=XA;var WS=KS;const eO=Pd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=x.forwardRef(({className:t,...e},r)=>l.jsx(WS,{ref:r,className:Te(eO(),t),...e}));We.displayName=WS.displayName;var tO=x.createContext(void 0);function Ov(t){const e=x.useContext(tO);return t||e||"ltr"}var Vf="rovingFocusGroup.onEntryFocus",rO={bubbles:!1,cancelable:!0},Hl="RovingFocusGroup",[gp,QS,nO]=fv(Hl),[sO,GS]=ds(Hl,[nO]),[aO,oO]=sO(Hl),ZS=x.forwardRef((t,e)=>l.jsx(gp.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(gp.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(iO,{...t,ref:e})})}));ZS.displayName=Hl;var iO=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:n=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=t,m=x.useRef(null),f=et(e,m),w=Ov(a),[p,v]=Wa({prop:o,defaultProp:i??null,onChange:c,caller:Hl}),[y,g]=x.useState(!1),b=Ur(u),S=QS(r),E=x.useRef(!1),[N,j]=x.useState(0);return x.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(Vf,b),()=>R.removeEventListener(Vf,b)},[b]),l.jsx(aO,{scope:r,orientation:s,dir:w,loop:n,currentTabStopId:p,onItemFocus:x.useCallback(R=>v(R),[v]),onItemShiftTab:x.useCallback(()=>g(!0),[]),onFocusableItemAdd:x.useCallback(()=>j(R=>R+1),[]),onFocusableItemRemove:x.useCallback(()=>j(R=>R-1),[]),children:l.jsx(Ae.div,{tabIndex:y||N===0?-1:0,"data-orientation":s,...h,ref:f,style:{outline:"none",...t.style},onMouseDown:Se(t.onMouseDown,()=>{E.current=!0}),onFocus:Se(t.onFocus,R=>{const A=!E.current;if(R.target===R.currentTarget&&A&&!y){const F=new CustomEvent(Vf,rO);if(R.currentTarget.dispatchEvent(F),!F.defaultPrevented){const T=S().filter(U=>U.focusable),_=T.find(U=>U.active),I=T.find(U=>U.id===p),z=[_,I,...T].filter(Boolean).map(U=>U.ref.current);XS(z,d)}}E.current=!1}),onBlur:Se(t.onBlur,()=>g(!1))})})}),YS="RovingFocusGroupItem",JS=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:n=!1,tabStopId:a,children:o,...i}=t,c=ea(),u=a||c,d=oO(YS,r),h=d.currentTabStopId===u,m=QS(r),{onFocusableItemAdd:f,onFocusableItemRemove:w,currentTabStopId:p}=d;return x.useEffect(()=>{if(s)return f(),()=>w()},[s,f,w]),l.jsx(gp.ItemSlot,{scope:r,id:u,focusable:s,active:n,children:l.jsx(Ae.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...i,ref:e,onMouseDown:Se(t.onMouseDown,v=>{s?d.onItemFocus(u):v.preventDefault()}),onFocus:Se(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:Se(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=uO(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=m().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const S=b.indexOf(v.currentTarget);b=d.loop?dO(b,S+1):b.slice(S+1)}setTimeout(()=>XS(b))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:p!=null}):o})})});JS.displayName=YS;var lO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cO(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function uO(t,e,r){const s=cO(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return lO[s]}function XS(t,e=!1){const r=document.activeElement;for(const s of t)if(s===r||(s.focus({preventScroll:e}),document.activeElement!==r))return}function dO(t,e){return t.map((r,s)=>t[(e+s)%t.length])}var fO=ZS,hO=JS,$d="Tabs",[pO,gF]=ds($d,[GS]),e_=GS(),[mO,Iv]=pO($d),t_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,onValueChange:n,defaultValue:a,orientation:o="horizontal",dir:i,activationMode:c="automatic",...u}=t,d=Ov(i),[h,m]=Wa({prop:s,onChange:n,defaultProp:a??"",caller:$d});return l.jsx(mO,{scope:r,baseId:ea(),value:h,onValueChange:m,orientation:o,dir:d,activationMode:c,children:l.jsx(Ae.div,{dir:d,"data-orientation":o,...u,ref:e})})});t_.displayName=$d;var r_="TabsList",n_=x.forwardRef((t,e)=>{const{__scopeTabs:r,loop:s=!0,...n}=t,a=Iv(r_,r),o=e_(r);return l.jsx(fO,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:s,children:l.jsx(Ae.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:e})})});n_.displayName=r_;var s_="TabsTrigger",a_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,disabled:n=!1,...a}=t,o=Iv(s_,r),i=e_(r),c=l_(o.baseId,s),u=c_(o.baseId,s),d=s===o.value;return l.jsx(hO,{asChild:!0,...i,focusable:!n,active:d,children:l.jsx(Ae.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:c,...a,ref:e,onMouseDown:Se(t.onMouseDown,h=>{!n&&h.button===0&&h.ctrlKey===!1?o.onValueChange(s):h.preventDefault()}),onKeyDown:Se(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(s)}),onFocus:Se(t.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!n&&h&&o.onValueChange(s)})})})});a_.displayName=s_;var o_="TabsContent",i_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,forceMount:n,children:a,...o}=t,i=Iv(o_,r),c=l_(i.baseId,s),u=c_(i.baseId,s),d=s===i.value,h=x.useRef(d);return x.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(da,{present:n||d,children:({present:m})=>l.jsx(Ae.div,{"data-state":d?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:h.current?"0s":void 0},children:m&&a})})});i_.displayName=o_;function l_(t,e){return`${t}-trigger-${e}`}function c_(t,e){return`${t}-content-${e}`}var vO=t_,u_=n_,d_=a_,f_=i_;const gO=vO,h_=x.forwardRef(({className:t,...e},r)=>l.jsx(u_,{ref:r,className:Te("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));h_.displayName=u_.displayName;const yp=x.forwardRef(({className:t,...e},r)=>l.jsx(d_,{ref:r,className:Te("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",t),...e}));yp.displayName=d_.displayName;const xp=x.forwardRef(({className:t,...e},r)=>l.jsx(f_,{ref:r,className:Te("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));xp.displayName=f_.displayName;function yO({type:t,open:e,onOpenChange:r}){const[s,n]=x.useState("remote"),[a,o]=x.useState("json"),[i,c]=x.useState(`{
|
|
288
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return x.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},JA="DialogDescriptionWarning",XA=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${HS(JA).contentName}}.`;return x.useEffect(()=>{var a;const n=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&n&&(document.getElementById(e)||console.warn(s))},[s,t,e]),null},eO=TS,tO=IS,BS=DS,KS=MS,WS=FS,QS=US,rO=VS;const ao=eO,nO=tO,GS=x.forwardRef(({className:t,...e},r)=>l.jsx(BS,{ref:r,className:Te("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",t),...e}));GS.displayName=BS.displayName;const fa=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(nO,{children:[l.jsx(GS,{}),l.jsxs(KS,{ref:s,className:Te("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",t),...r,children:[e,l.jsxs(rO,{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(Au,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));fa.displayName=KS.displayName;const ha=({className:t,...e})=>l.jsx("div",{className:Te("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});ha.displayName="DialogHeader";const pa=x.forwardRef(({className:t,...e},r)=>l.jsx(WS,{ref:r,className:Te("text-lg font-semibold leading-none tracking-tight",t),...e}));pa.displayName=WS.displayName;const Ci=x.forwardRef(({className:t,...e},r)=>l.jsx(QS,{ref:r,className:Te("text-sm text-muted-foreground",t),...e}));Ci.displayName=QS.displayName;const tt=x.forwardRef(({className:t,type:e,...r},s)=>l.jsx("input",{type:e,className:Te("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",t),ref:s,...r}));tt.displayName="Input";const Gn=x.forwardRef(({className:t,...e},r)=>l.jsx("textarea",{className:Te("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",t),ref:r,...e}));Gn.displayName="Textarea";var sO="Label",ZS=x.forwardRef((t,e)=>l.jsx(Ae.label,{...t,ref:e,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=t.onMouseDown)==null||n.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));ZS.displayName=sO;var YS=ZS;const aO=kd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=x.forwardRef(({className:t,...e},r)=>l.jsx(YS,{ref:r,className:Te(aO(),t),...e}));We.displayName=YS.displayName;var oO=x.createContext(void 0);function Dv(t){const e=x.useContext(oO);return t||e||"ltr"}var qf="rovingFocusGroup.onEntryFocus",iO={bubbles:!1,cancelable:!0},Bl="RovingFocusGroup",[xp,JS,lO]=pv(Bl),[cO,XS]=fs(Bl,[lO]),[uO,dO]=cO(Bl),e_=x.forwardRef((t,e)=>l.jsx(xp.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(xp.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(fO,{...t,ref:e})})}));e_.displayName=Bl;var fO=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:n=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=t,m=x.useRef(null),f=et(e,m),w=Dv(a),[p,y]=Wa({prop:o,defaultProp:i??null,onChange:c,caller:Bl}),[g,v]=x.useState(!1),b=Ur(u),S=JS(r),E=x.useRef(!1),[N,j]=x.useState(0);return x.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(qf,b),()=>R.removeEventListener(qf,b)},[b]),l.jsx(uO,{scope:r,orientation:s,dir:w,loop:n,currentTabStopId:p,onItemFocus:x.useCallback(R=>y(R),[y]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>j(R=>R+1),[]),onFocusableItemRemove:x.useCallback(()=>j(R=>R-1),[]),children:l.jsx(Ae.div,{tabIndex:g||N===0?-1:0,"data-orientation":s,...h,ref:f,style:{outline:"none",...t.style},onMouseDown:Se(t.onMouseDown,()=>{E.current=!0}),onFocus:Se(t.onFocus,R=>{const A=!E.current;if(R.target===R.currentTarget&&A&&!g){const F=new CustomEvent(qf,iO);if(R.currentTarget.dispatchEvent(F),!F.defaultPrevented){const T=S().filter(U=>U.focusable),_=T.find(U=>U.active),I=T.find(U=>U.id===p),z=[_,I,...T].filter(Boolean).map(U=>U.ref.current);n_(z,d)}}E.current=!1}),onBlur:Se(t.onBlur,()=>v(!1))})})}),t_="RovingFocusGroupItem",r_=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:n=!1,tabStopId:a,children:o,...i}=t,c=ea(),u=a||c,d=dO(t_,r),h=d.currentTabStopId===u,m=JS(r),{onFocusableItemAdd:f,onFocusableItemRemove:w,currentTabStopId:p}=d;return x.useEffect(()=>{if(s)return f(),()=>w()},[s,f,w]),l.jsx(xp.ItemSlot,{scope:r,id:u,focusable:s,active:n,children:l.jsx(Ae.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...i,ref:e,onMouseDown:Se(t.onMouseDown,y=>{s?d.onItemFocus(u):y.preventDefault()}),onFocus:Se(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:Se(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=mO(y,d.orientation,d.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=m().filter(S=>S.focusable).map(S=>S.ref.current);if(g==="last")b.reverse();else if(g==="prev"||g==="next"){g==="prev"&&b.reverse();const S=b.indexOf(y.currentTarget);b=d.loop?vO(b,S+1):b.slice(S+1)}setTimeout(()=>n_(b))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:p!=null}):o})})});r_.displayName=t_;var hO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pO(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function mO(t,e,r){const s=pO(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return hO[s]}function n_(t,e=!1){const r=document.activeElement;for(const s of t)if(s===r||(s.focus({preventScroll:e}),document.activeElement!==r))return}function vO(t,e){return t.map((r,s)=>t[(e+s)%t.length])}var gO=e_,yO=r_,Fd="Tabs",[xO,CF]=fs(Fd,[XS]),s_=XS(),[wO,Mv]=xO(Fd),a_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,onValueChange:n,defaultValue:a,orientation:o="horizontal",dir:i,activationMode:c="automatic",...u}=t,d=Dv(i),[h,m]=Wa({prop:s,onChange:n,defaultProp:a??"",caller:Fd});return l.jsx(wO,{scope:r,baseId:ea(),value:h,onValueChange:m,orientation:o,dir:d,activationMode:c,children:l.jsx(Ae.div,{dir:d,"data-orientation":o,...u,ref:e})})});a_.displayName=Fd;var o_="TabsList",i_=x.forwardRef((t,e)=>{const{__scopeTabs:r,loop:s=!0,...n}=t,a=Mv(o_,r),o=s_(r);return l.jsx(gO,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:s,children:l.jsx(Ae.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:e})})});i_.displayName=o_;var l_="TabsTrigger",c_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,disabled:n=!1,...a}=t,o=Mv(l_,r),i=s_(r),c=f_(o.baseId,s),u=h_(o.baseId,s),d=s===o.value;return l.jsx(yO,{asChild:!0,...i,focusable:!n,active:d,children:l.jsx(Ae.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:c,...a,ref:e,onMouseDown:Se(t.onMouseDown,h=>{!n&&h.button===0&&h.ctrlKey===!1?o.onValueChange(s):h.preventDefault()}),onKeyDown:Se(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(s)}),onFocus:Se(t.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!n&&h&&o.onValueChange(s)})})})});c_.displayName=l_;var u_="TabsContent",d_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,forceMount:n,children:a,...o}=t,i=Mv(u_,r),c=f_(i.baseId,s),u=h_(i.baseId,s),d=s===i.value,h=x.useRef(d);return x.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(da,{present:n||d,children:({present:m})=>l.jsx(Ae.div,{"data-state":d?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:h.current?"0s":void 0},children:m&&a})})});d_.displayName=u_;function f_(t,e){return`${t}-trigger-${e}`}function h_(t,e){return`${t}-content-${e}`}var bO=a_,p_=i_,m_=c_,v_=d_;const SO=bO,g_=x.forwardRef(({className:t,...e},r)=>l.jsx(p_,{ref:r,className:Te("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));g_.displayName=p_.displayName;const wp=x.forwardRef(({className:t,...e},r)=>l.jsx(m_,{ref:r,className:Te("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",t),...e}));wp.displayName=m_.displayName;const bp=x.forwardRef(({className:t,...e},r)=>l.jsx(v_,{ref:r,className:Te("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));bp.displayName=v_.displayName;function il(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function y_(t){return il(t)&&typeof t.command=="string"}function Hf(t){return!il(t)||Object.keys(t).length===0?!1:Object.values(t).every(y_)}function _O(t){let e=t.trim();return e.startsWith("```")?e.replace(/^```(?:json)?\s*\n?/i,"").replace(/\n?```\s*$/,"").trim():e}function EO(t){if(!il(t))throw new Error("Configuration must be a JSON object");if(il(t.config)&&Hf(t.config.mcpServers))return{mcpServers:t.config.mcpServers};if(Hf(t.mcpServers))return{mcpServers:t.mcpServers};if(il(t)&&typeof t.command=="string"){const e=typeof t.name=="string"&&t.name.trim()?t.name.trim():"local-server",{name:r,...s}=t;if(!y_(s))throw new Error("Missing or invalid command");return{mcpServers:{[e]:s}}}if(Hf(t))return{mcpServers:t};throw new Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
|
|
289
|
+
{
|
|
290
|
+
"mcpServers": {
|
|
291
|
+
"google-drive": {
|
|
292
|
+
"command": "npx",
|
|
293
|
+
"args": ["-y", "@piotr-agier/google-drive-mcp"]
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}`)}function CO(t){let e;try{e=JSON.parse(_O(t))}catch(r){throw new Error(`Failed to parse JSON: ${r instanceof Error?r.message:"Unknown error"}`)}return EO(e)}function PO({type:t,open:e,onOpenChange:r}){const[s,n]=x.useState("remote"),[a,o]=x.useState("json"),[i,c]=x.useState(`{
|
|
289
297
|
"mcpServers": {
|
|
290
298
|
"memory": {
|
|
291
299
|
"command": "npx",
|
|
@@ -295,7 +303,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
295
303
|
}
|
|
296
304
|
}
|
|
297
305
|
}
|
|
298
|
-
}`),[u,d]=x.useState(null),[h,m]=x.useState(null),[f,w]=x.useState(null),[p,
|
|
306
|
+
}`),[u,d]=x.useState(null),[h,m]=x.useState(null),[f,w]=x.useState(null),[p,y]=x.useState({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:wr}),[g,v]=x.useState({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:wr}),[b,S]=x.useState({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:wr}),E=yr(),{toast:N}=or(),j=()=>{try{m(null);const P=CO(i),D=Object.entries(P.mcpServers);if(D.length===0)throw new Error("No MCP servers found in configuration");if(D.length>1)throw new Error("Multiple servers not supported. Please configure one server at a time.");const[L,X]=D[0],{command:G,args:B,env:oe,description:ve}=X;if(!G||typeof G!="string")throw new Error("Missing or invalid command");if(!B||!Array.isArray(B))throw new Error("Missing or invalid args array");const ge={name:L,command:G,args:B.map(String),env:oe&&typeof oe=="object"?oe:void 0,description:ve&&typeof ve=="string"?ve:void 0};d(ge),o("review"),v({name:ge.name,type:"local-mcp",command:ge.command,args:ge.args,env:ge.env||{},description:ge.description||"",cardColor:wr}),R(L)}catch(P){m(P instanceof Error?P.message:"Failed to parse JSON"),d(null)}},R=async P=>{try{const X=((await Oe("GET","/api/services")).data||[]).find(G=>G.name===P);w(X?P:null)}catch(D){console.error("Failed to check name conflict:",D)}},A=async P=>{await R(P)},F=At({mutationFn:async P=>{if(t==="mcp"&&s==="local"){const D={mcpServers:{[P.name]:{command:P.command,args:P.args.filter(L=>L.trim()!==""),...Object.keys(P.env).length>0&&{env:P.env}}}};return console.log("Importing local MCP server:",D),Oe("POST","/api/local-mcp/import",{config:JSON.stringify(D)})}else{const D={name:P.name,type:t,url:t==="mcp"?P.url:P.manifest_url,description:P.description,cardColor:P.cardColor,...P.headers_enabled&&{headers:P.headers}};return console.log("Sending service data:",D),Oe("POST","/api/services",D)}},onSuccess:()=>{E.invalidateQueries({queryKey:["/api/services"]}),E.invalidateQueries({queryKey:["/api/collection/warnings"]}),N({title:"Service registered successfully!",description:`${(t==="mcp"?s==="remote"?p:g:b).name} has been added to your collection.`}),_()},onError:P=>{var D;console.error("Registration failed:",P),console.error("Error details:",{message:P==null?void 0:P.message,name:P==null?void 0:P.name,stack:P==null?void 0:P.stack,toString:P==null?void 0:P.toString(),constructor:(D=P==null?void 0:P.constructor)==null?void 0:D.name}),N({title:"Registration failed",description:(P==null?void 0:P.message)||"Failed to register service. Please try again.",variant:"destructive"})}}),T=async()=>{if(t==="mcp"&&s==="local"){if(a==="json")j();else if(a==="review"){if(await A(g.name),f){N({title:"Name Conflict",description:`A service with the name "${g.name}" already exists. Please choose a different name.`,variant:"destructive"});return}F.mutate(g)}}else{const P=t==="mcp"?s==="remote"?p:g:b;if(await A(P.name),f){N({title:"Name Conflict",description:`A service with the name "${P.name}" already exists. Please choose a different name.`,variant:"destructive"});return}F.mutate(P)}},_=()=>{o("json"),c(`{
|
|
299
307
|
"mcpServers": {
|
|
300
308
|
"memory": {
|
|
301
309
|
"command": "npx",
|
|
@@ -305,7 +313,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
305
313
|
}
|
|
306
314
|
}
|
|
307
315
|
}
|
|
308
|
-
}`),d(null),m(null),w(null),
|
|
316
|
+
}`),d(null),m(null),w(null),y({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:wr}),v({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:wr}),S({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:wr}),r(!1)},I=(P,D)=>{y(L=>({...L,[P]:D}))},C=(P,D)=>{v(L=>({...L,[P]:D}))},z=(P,D)=>{S(L=>({...L,[P]:D}))},U=()=>{if(t==="mcp"&&s==="local"){if(a==="json")return"Parse Configuration";if(a==="review")return f?"Register Anyway":"Register Service"}return"Register Service"},K=()=>{var P,D;if(t==="mcp"&&s==="local"){if(a==="json")return!i.trim();if(a==="review")return!g.name.trim()||!g.command.trim()}else{const L=t==="mcp"?s==="remote"?p:g:b;return!L.name.trim()||t==="mcp"&&s==="remote"&&!((P=L.url)!=null&&P.trim())||t==="a2a"&&!((D=L.manifest_url)!=null&&D.trim())}return!1};return l.jsx(ao,{open:e,onOpenChange:r,children:l.jsxs(fa,{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(ha,{children:[l.jsxs(pa,{className:"text-2xl font-bold flex items-center",style:{background:"linear-gradient(to right, #C4B643, #D4C760)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:[t==="mcp"?l.jsx(Ru,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}):l.jsx(u2,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",t==="mcp"?"MCP Server":"A2A Agent"]}),l.jsx(Ci,{className:"mt-2",style:{color:"#92E4DD",opacity:.8},children:t==="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."})]}),t==="mcp"?l.jsxs(SO,{value:s,onValueChange:P=>n(P),className:"w-full",children:[l.jsxs(g_,{className:"grid w-full grid-cols-2 bg-white/10 border border-white/20",children:[l.jsxs(wp,{value:"remote",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[l.jsx(Ru,{className:"w-4 h-4 mr-2"}),"Remote MCP"]}),l.jsxs(wp,{value:"local",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[l.jsx(v2,{className:"w-4 h-4 mr-2"}),"Local MCP"]})]}),l.jsxs(bp,{value:"remote",className:"space-y-4 mt-4",children:[l.jsxs("div",{children:[l.jsx(We,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),l.jsx(tt,{id:"name",placeholder:"e.g., Database Tools",value:p.name,onChange:P=>{I("name",P.target.value),P.target.value.trim()?A(P.target.value):w(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),f&&l.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[l.jsx(wn,{className:"w-4 h-4"}),l.jsx("span",{children:"A service with this name already exists"})]})]}),l.jsxs("div",{children:[l.jsx(We,{htmlFor:"url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"MCP URL"}),l.jsx(tt,{id:"url",type:"url",placeholder:"http://localhost:8080/mcp or https://mcp.notion.com/mcp",value:p.url,onChange:P=>I("url",P.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(We,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Gn,{id:"description",placeholder:"Brief description of capabilities...",value:p.description,onChange:P=>I("description",P.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),l.jsxs(bp,{value:"local",className:"space-y-4 mt-4",children:[a==="json"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(We,{htmlFor:"local-json",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Local MCP Configuration (JSON)"}),l.jsx(Gn,{id:"local-json",placeholder:`{
|
|
309
317
|
"mcpServers": {
|
|
310
318
|
"memory": {
|
|
311
319
|
"command": "npx",
|
|
@@ -322,12 +330,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
322
330
|
}
|
|
323
331
|
}
|
|
324
332
|
}
|
|
325
|
-
}`})]})]}),l.jsxs(fe,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:j,disabled:!i.trim()||i.trim().length<10,"data-testid":"button-parse-json",children:[l.jsx(
|
|
333
|
+
}`})]})]}),l.jsxs(fe,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:j,disabled:!i.trim()||i.trim().length<10,"data-testid":"button-parse-json",children:[l.jsx(up,{className:"w-4 h-4 mr-2",style:{color:"#0A0A07"}}),"Parse Configuration"]})]}),a==="review"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(We,{htmlFor:"local-name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),l.jsx(tt,{id:"local-name",placeholder:"e.g., Memory Server",value:g.name,onChange:P=>{C("name",P.target.value),P.target.value.trim()?A(P.target.value):w(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-local-service-name"}),f&&l.jsxs("div",{className:"mt-2 text-xs text-red-400 flex items-center",children:[l.jsx(wn,{className:"w-4 h-4 mr-1"}),'A service with the name "',f,'" already exists.']})]}),l.jsxs("div",{children:[l.jsx(We,{htmlFor:"command",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Command"}),l.jsx(tt,{id:"command",placeholder:"e.g., npx, python, node",value:g.command,onChange:P=>C("command",P.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(We,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Arguments"}),g.args.map((P,D)=>l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(tt,{placeholder:`Argument ${D+1}`,value:P,onChange:L=>{const X=[...g.args];X[D]=L.target.value,C("args",X)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-arg-${D}`}),D===g.args.length-1&&l.jsx(fe,{type:"button",size:"sm",onClick:()=>C("args",[...g.args,""]),className:"bg-white/20 hover:bg-white/30 text-white",children:l.jsx(Vs,{className:"w-4 h-4"})}),g.args.length>1&&l.jsx(fe,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const L=g.args.filter((X,G)=>G!==D);C("args",L)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:l.jsx(Au,{className:"w-4 h-4"})})]},D)),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(We,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Environment Variables"}),Object.entries(g.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(g.env).map(([P,D],L)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(tt,{placeholder:"Variable name",value:P,onChange:X=>{const G={...g.env};delete G[P],G[X.target.value]=D,C("env",G)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-key-${L}`}),l.jsx(tt,{placeholder:"Value",value:D,onChange:X=>{const G={...g.env};G[P]=X.target.value,C("env",G)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-value-${L}`}),l.jsx(fe,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const X={...g.env};delete X[P],C("env",X)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:l.jsx(Au,{className:"w-4 h-4"})})]},L))}),l.jsxs(fe,{type:"button",size:"sm",onClick:()=>{const P={...g.env};P[""]="",C("env",P)},className:"mt-2 bg-white/20 hover:bg-white/30 text-white",children:[l.jsx(Vs,{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(We,{htmlFor:"local-description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Gn,{id:"local-description",placeholder:"Brief description of capabilities...",value:g.description,onChange:P=>C("description",P.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(fe,{type:"button",variant:"outline",className:"flex-1 border-white/20 text-white hover:bg-white/10",onClick:()=>o("json"),"data-testid":"button-back-to-json",children:"← Back to JSON"}),l.jsxs(fe,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${bn}`,style:Sn(wr),onClick:T,disabled:K(),"data-testid":"button-register",children:[l.jsx(Vs,{className:"w-4 h-4 mr-2"}),F.isPending?"Registering...":U()]})]})]}),a==="complete"&&l.jsxs("div",{className:"text-center py-8",children:[l.jsx(up,{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(fe,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:_,"data-testid":"button-close",children:"Close"})]})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(We,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Agent Name"}),l.jsx(tt,{id:"name",placeholder:"e.g., Code Assistant",value:b.name,onChange:P=>{z("name",P.target.value),P.target.value.trim()?A(P.target.value):w(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),f&&l.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[l.jsx(wn,{className:"w-4 h-4"}),l.jsx("span",{children:"A service with this name already exists"})]})]}),l.jsxs("div",{children:[l.jsx(We,{htmlFor:"manifest_url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Manifest URL"}),l.jsx(tt,{id:"manifest_url",type:"url",placeholder:"http://localhost:8001/.well-known/a2a/manifest.json",value:b.manifest_url,onChange:P=>z("manifest_url",P.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(We,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Gn,{id:"description",placeholder:"Brief description of capabilities...",value:b.description,onChange:P=>z("description",P.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),t==="mcp"&&s==="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:P=>I("headers_enabled",P.target.checked),className:"rounded border-white/20 bg-white/10"}),l.jsx(We,{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(We,{htmlFor:"headers",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"HTTP Headers (JSON)"}),l.jsx(Gn,{id:"headers",placeholder:`{
|
|
326
334
|
"Authorization": "Bearer YOUR_TOKEN_HERE",
|
|
327
335
|
"X-API-Key": "YOUR_API_KEY_HERE"
|
|
328
|
-
}`,value:JSON.stringify(p.headers,null,2),onChange:P=>{try{const D=JSON.parse(P.target.value);I("headers",D)}catch(D){console.warn("Invalid JSON in headers:",D)}},rows:6,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-headers"}),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."})})]})]})]}),h&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(wn,{className:"w-4 h-4 mr-1"}),h]}),f&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(wn,{className:"w-4 h-4 mr-1"}),'A service with the name "',f,'" 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(fe,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:_,"data-testid":"button-cancel",children:"Cancel"}),!(t==="mcp"&&s==="local")&&l.jsxs(fe,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${bn}`,style:Sn(wr),disabled:F.isPending||K(),"data-testid":"button-register",onClick:T,children:[l.jsx(Vs,{className:"w-4 h-4 mr-2"}),F.isPending?"Registering...":"Register Service"]})]})]})})}function xO({decks:t,editingDeckId:e,onSelectDeck:r,isLoading:s}){const[n,a]=x.useState(!1),[o,i]=x.useState({name:"",description:""}),c=yr(),{toast:u}=or(),d=At({mutationFn:async v=>Oe("POST","/api/decks",{name:v.name,description:v.description,isActive:!1}),onSuccess:async v=>{var g;const y=await v.json();c.invalidateQueries({queryKey:["/api/decks"]}),(g=y.data)!=null&&g.id&&r(y.data.id),u({title:"Deck created",description:`${o.name} has been created successfully.`}),a(!1),i({name:"",description:""})},onError:v=>{u({title:"Failed to create deck",description:v.message,variant:"destructive"})}}),h=At({mutationFn:async v=>Oe("DELETE",`/api/decks/${v}`,{}),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:v=>{v.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:v.message,variant:"destructive"})}}),m=async(v,y)=>{v.stopPropagation();try{const b=await(await Oe("GET",`/api/scope/manifest-template?deckId=${encodeURIComponent(y.id)}&name=${encodeURIComponent(y.name)}`)).json();await navigator.clipboard.writeText(b.data.content),u({title:"Copied deck.yaml snippet",description:"Paste into .agent-deck/deck.yaml in repos that use this deck."})}catch(g){u({title:"Failed to copy manifest",description:g instanceof Error?g.message:"Unknown error",variant:"destructive"})}},f=(v,y)=>{v.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&h.mutate(y)},w=v=>{v.preventDefault(),d.mutate(o)},p=v=>{var y,g;return(((y=v.services)==null?void 0:y.length)??0)+(((g=v.credentials)==null?void 0:g.length)??0)};return s?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((v,y)=>l.jsx("div",{className:"h-16 bg-white/5 rounded-lg"},y))})]})}):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(up,{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(fe,{onClick:()=>a(!0),className:"w-full border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"create-deck-button",children:[l.jsx(Vs,{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:t.map(v=>{const y=v.id===e,g=p(v);return l.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${y?"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(v.id),"data-testid":`deck-item-${v.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(fe,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:b=>m(b,v),title:"Copy .agent-deck/deck.yaml snippet",children:l.jsx(S1,{className:"w-2 h-2"})}),l.jsx(fe,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:b=>f(b,v.id),title:"Delete deck",children:l.jsx(kd,{className:"w-2 h-2"})})]}),l.jsxs("div",{children:[l.jsx("h3",{className:`font-semibold text-sm pr-12 ${y?"text-yellow-300":"text-white"}`,children:v.name}),l.jsx("p",{className:"text-xs text-gray-400",children:g>0?`${g} cards`:"Empty"})]})]},v.id)})})})]}),l.jsx(ao,{open:n,onOpenChange:a,children:l.jsxs(fa,{className:"sm:max-w-md bg-gradient-to-br from-cosmic-900 to-cosmic-800 border border-white/20 text-white",children:[l.jsx(ha,{children:l.jsxs(pa,{className:"text-xl font-bold flex items-center",children:[l.jsx(Vs,{className:"w-5 h-5 mr-2 text-purple-400"}),"Create New Deck"]})}),l.jsxs("form",{onSubmit:w,className:"space-y-4","data-testid":"form-create-deck",children:[l.jsxs("div",{children:[l.jsx(We,{htmlFor:"deckName",className:"text-sm font-semibold",children:"Deck Name"}),l.jsx(tt,{id:"deckName",placeholder:"e.g., Hiring stack",value:o.name,onChange:v=>i(y=>({...y,name:v.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(We,{htmlFor:"deckDescription",className:"text-sm font-semibold",children:"Description"}),l.jsx(Gn,{id:"deckDescription",placeholder:"Brief description of this deck...",value:o.description,onChange:v=>i(y=>({...y,description:v.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(fe,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>a(!1),"data-testid":"button-cancel-create",children:"Cancel"}),l.jsx(fe,{type:"submit",className:"flex-1 bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700",disabled:d.isPending,"data-testid":"button-submit-create",children:d.isPending?"Creating...":"Create Deck"})]})]})]})})]})}function wO({open:t,onOpenChange:e}){const[r,s]=x.useState(""),[n,a]=x.useState(""),o=yr(),{toast:i}=or(),c=At({mutationFn:async()=>Oe("POST","/api/credentials",{label:r.trim(),value:n}),onSuccess:()=>{o.invalidateQueries({queryKey:["/api/credentials/vault"]}),o.invalidateQueries({queryKey:["/api/decks"]}),i({title:"API key saved",description:`${r.trim()} is stored securely. Your agent can use it from the active deck.`}),e(!1),s(""),a("")},onError:d=>{i({title:"Could not save API key",description:d.message,variant:"destructive"})}}),u=r.trim().length>0&&n.trim().length>0;return l.jsx(ao,{open:t,onOpenChange:e,children:l.jsxs(fa,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(ha,{children:[l.jsx(pa,{className:"text-[#E8F6F4]",children:"Register API key"}),l.jsx(Ci,{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(We,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),l.jsx(tt,{id:"credential-name",placeholder:"OpenAI, Linear, Slack…",value:r,onChange:d=>s(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),l.jsx(tt,{id:"credential-value",type:"password",placeholder:"Paste key from the service dashboard",value:n,onChange:d=>a(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(ur),onClick:()=>c.mutate(),disabled:!u||c.isPending,children:"Save to vault"})]})]})})}function bO({open:t,onOpenChange:e}){const[r,s]=x.useState(""),[n,a]=x.useState(""),[o,i]=x.useState(""),[c,u]=x.useState(""),[d,h]=x.useState(""),[m,f]=x.useState([]),[w,p]=x.useState([]),v=yr(),{toast:y}=or(),{data:g}=hr({queryKey:["/api/credentials/vault"],enabled:t}),{data:b}=hr({queryKey:["/api/services"],enabled:t}),S=(g==null?void 0:g.data)??[],E=(b==null?void 0:b.data)??[],N=At({mutationFn:async()=>Oe("POST","/api/playbooks",{title:r.trim(),body:n,triggers:o.split(",").map(A=>A.trim()).filter(Boolean),dependsOnCredentialIds:m,dependsOnServiceIds:w,exec:c.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{v.invalidateQueries({queryKey:["/api/playbooks/vault"]}),y({title:"Playbook saved",description:`${r.trim()} is in your collection.`}),e(!1),s(""),a(""),i(""),u(""),h(""),f([]),p([])},onError:A=>{y({title:"Could not save playbook",description:A.message,variant:"destructive"})}}),j=(A,F,T)=>{T(A.includes(F)?A.filter(_=>_!==F):[...A,F])},R=r.trim().length>0&&n.trim().length>0;return l.jsx(ao,{open:t,onOpenChange:e,children:l.jsxs(fa,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(ha,{children:[l.jsx(pa,{children:"Register Playbook"}),l.jsxs(Ci,{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(We,{htmlFor:"playbook-title",children:"Title"}),l.jsx(tt,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:r,onChange:A=>s(A.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated)"}),l.jsx(tt,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:o,onChange:A=>i(A.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),l.jsx(Gn,{id:"playbook-body",rows:8,placeholder:`# Steps
|
|
336
|
+
}`,value:JSON.stringify(p.headers,null,2),onChange:P=>{try{const D=JSON.parse(P.target.value);I("headers",D)}catch(D){console.warn("Invalid JSON in headers:",D)}},rows:6,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-headers"}),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."})})]})]})]}),h&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(wn,{className:"w-4 h-4 mr-1"}),h]}),f&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(wn,{className:"w-4 h-4 mr-1"}),'A service with the name "',f,'" 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(fe,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:_,"data-testid":"button-cancel",children:"Cancel"}),!(t==="mcp"&&s==="local")&&l.jsxs(fe,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${bn}`,style:Sn(wr),disabled:F.isPending||K(),"data-testid":"button-register",onClick:T,children:[l.jsx(Vs,{className:"w-4 h-4 mr-2"}),F.isPending?"Registering...":"Register Service"]})]})]})})}function kO({decks:t,editingDeckId:e,onSelectDeck:r,isLoading:s}){const[n,a]=x.useState(!1),[o,i]=x.useState({name:"",description:""}),c=yr(),{toast:u}=or(),d=At({mutationFn:async y=>Oe("POST","/api/decks",{name:y.name,description:y.description,isActive:!1}),onSuccess:async y=>{var v;const g=await y.json();c.invalidateQueries({queryKey:["/api/decks"]}),(v=g.data)!=null&&v.id&&r(g.data.id),u({title:"Deck created",description:`${o.name} has been created successfully.`}),a(!1),i({name:"",description:""})},onError:y=>{u({title:"Failed to create deck",description:y.message,variant:"destructive"})}}),h=At({mutationFn:async y=>Oe("DELETE",`/api/decks/${y}`,{}),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:y=>{y.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:y.message,variant:"destructive"})}}),m=async(y,g)=>{y.stopPropagation();try{const b=await(await Oe("GET",`/api/scope/manifest-template?deckId=${encodeURIComponent(g.id)}&name=${encodeURIComponent(g.name)}`)).json();await navigator.clipboard.writeText(b.data.content),u({title:"Copied deck.yaml snippet",description:"Paste into .agent-deck/deck.yaml in repos that use this deck."})}catch(v){u({title:"Failed to copy manifest",description:v instanceof Error?v.message:"Unknown error",variant:"destructive"})}},f=(y,g)=>{y.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&h.mutate(g)},w=y=>{y.preventDefault(),d.mutate(o)},p=y=>{var g,v;return(((g=y.services)==null?void 0:g.length)??0)+(((v=y.credentials)==null?void 0:v.length)??0)};return s?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((y,g)=>l.jsx("div",{className:"h-16 bg-white/5 rounded-lg"},g))})]})}):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(fp,{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(fe,{onClick:()=>a(!0),className:"w-full border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"create-deck-button",children:[l.jsx(Vs,{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:t.map(y=>{const g=y.id===e,v=p(y);return l.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${g?"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(y.id),"data-testid":`deck-item-${y.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(fe,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:b=>m(b,y),title:"Copy .agent-deck/deck.yaml snippet",children:l.jsx(P1,{className:"w-2 h-2"})}),l.jsx(fe,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:b=>f(b,y.id),title:"Delete deck",children:l.jsx(Nd,{className:"w-2 h-2"})})]}),l.jsxs("div",{children:[l.jsx("h3",{className:`font-semibold text-sm pr-12 ${g?"text-yellow-300":"text-white"}`,children:y.name}),l.jsx("p",{className:"text-xs text-gray-400",children:v>0?`${v} cards`:"Empty"})]})]},y.id)})})})]}),l.jsx(ao,{open:n,onOpenChange:a,children:l.jsxs(fa,{className:"sm:max-w-md bg-gradient-to-br from-cosmic-900 to-cosmic-800 border border-white/20 text-white",children:[l.jsx(ha,{children:l.jsxs(pa,{className:"text-xl font-bold flex items-center",children:[l.jsx(Vs,{className:"w-5 h-5 mr-2 text-purple-400"}),"Create New Deck"]})}),l.jsxs("form",{onSubmit:w,className:"space-y-4","data-testid":"form-create-deck",children:[l.jsxs("div",{children:[l.jsx(We,{htmlFor:"deckName",className:"text-sm font-semibold",children:"Deck Name"}),l.jsx(tt,{id:"deckName",placeholder:"e.g., Hiring stack",value:o.name,onChange:y=>i(g=>({...g,name:y.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(We,{htmlFor:"deckDescription",className:"text-sm font-semibold",children:"Description"}),l.jsx(Gn,{id:"deckDescription",placeholder:"Brief description of this deck...",value:o.description,onChange:y=>i(g=>({...g,description:y.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(fe,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>a(!1),"data-testid":"button-cancel-create",children:"Cancel"}),l.jsx(fe,{type:"submit",className:"flex-1 bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700",disabled:d.isPending,"data-testid":"button-submit-create",children:d.isPending?"Creating...":"Create Deck"})]})]})]})})]})}function NO({open:t,onOpenChange:e}){const[r,s]=x.useState(""),[n,a]=x.useState(""),o=yr(),{toast:i}=or(),c=At({mutationFn:async()=>Oe("POST","/api/credentials",{label:r.trim(),value:n}),onSuccess:()=>{o.invalidateQueries({queryKey:["/api/credentials/vault"]}),o.invalidateQueries({queryKey:["/api/decks"]}),i({title:"API key saved",description:`${r.trim()} is stored securely. Your agent can use it from the active deck.`}),e(!1),s(""),a("")},onError:d=>{i({title:"Could not save API key",description:d.message,variant:"destructive"})}}),u=r.trim().length>0&&n.trim().length>0;return l.jsx(ao,{open:t,onOpenChange:e,children:l.jsxs(fa,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(ha,{children:[l.jsx(pa,{className:"text-[#E8F6F4]",children:"Register API key"}),l.jsx(Ci,{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(We,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),l.jsx(tt,{id:"credential-name",placeholder:"OpenAI, Linear, Slack…",value:r,onChange:d=>s(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),l.jsx(tt,{id:"credential-value",type:"password",placeholder:"Paste key from the service dashboard",value:n,onChange:d=>a(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(ur),onClick:()=>c.mutate(),disabled:!u||c.isPending,children:"Save to vault"})]})]})})}function jO({open:t,onOpenChange:e}){const[r,s]=x.useState(""),[n,a]=x.useState(""),[o,i]=x.useState(""),[c,u]=x.useState(""),[d,h]=x.useState(""),[m,f]=x.useState([]),[w,p]=x.useState([]),y=yr(),{toast:g}=or(),{data:v}=hr({queryKey:["/api/credentials/vault"],enabled:t}),{data:b}=hr({queryKey:["/api/services"],enabled:t}),S=(v==null?void 0:v.data)??[],E=(b==null?void 0:b.data)??[],N=At({mutationFn:async()=>Oe("POST","/api/playbooks",{title:r.trim(),body:n,triggers:o.split(",").map(A=>A.trim()).filter(Boolean),dependsOnCredentialIds:m,dependsOnServiceIds:w,exec:c.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{y.invalidateQueries({queryKey:["/api/playbooks/vault"]}),g({title:"Playbook saved",description:`${r.trim()} is in your collection.`}),e(!1),s(""),a(""),i(""),u(""),h(""),f([]),p([])},onError:A=>{g({title:"Could not save playbook",description:A.message,variant:"destructive"})}}),j=(A,F,T)=>{T(A.includes(F)?A.filter(_=>_!==F):[...A,F])},R=r.trim().length>0&&n.trim().length>0;return l.jsx(ao,{open:t,onOpenChange:e,children:l.jsxs(fa,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(ha,{children:[l.jsx(pa,{children:"Register Playbook"}),l.jsxs(Ci,{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(We,{htmlFor:"playbook-title",children:"Title"}),l.jsx(tt,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:r,onChange:A=>s(A.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated)"}),l.jsx(tt,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:o,onChange:A=>i(A.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),l.jsx(Gn,{id:"playbook-body",rows:8,placeholder:`# Steps
|
|
329
337
|
1. …
|
|
330
|
-
2. …`,value:n,onChange:A=>a(A.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(We,{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:S.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No API keys registered yet."}):S.map(A=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:m.includes(A.id),onChange:()=>j(m,A.id,f)}),A.label]},A.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{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:E.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No MCP services registered yet."}):E.map(A=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:w.includes(A.id),onChange:()=>j(w,A.id,p)}),A.name]},A.id))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),l.jsx(tt,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:c,onChange:A=>u(A.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),l.jsx(tt,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:A=>h(A.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(Yr),onClick:()=>N.mutate(),disabled:!R||N.isPending,children:"Save to collection"})]})]})})}function SO({playbookId:t,open:e,onOpenChange:r}){const{data:s,isLoading:n}=hr({queryKey:t?[`/api/playbooks/${t}`]:["playbook-detail-disabled"],enabled:e&&!!t}),a=s==null?void 0:s.data,o=((a==null?void 0:a.dependencies.missingCredentialIds.length)??0)+((a==null?void 0:a.dependencies.missingServiceIds.length)??0);return l.jsx(ao,{open:e,onOpenChange:r,children:l.jsxs(fa,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(ha,{children:[l.jsx(pa,{children:(a==null?void 0:a.title)??"Playbook"}),l.jsx(Ci,{className:"text-[#A8C4C0]",children:(a==null?void 0:a.id)??t})]}),n||!a?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."]}),a.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:a.triggers.join(", ")})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Dependencies"}),a.dependencies.credentials.length===0&&a.dependencies.services.length===0&&o===0?l.jsx("p",{className:"text-gray-400",children:"None declared."}):l.jsxs("ul",{className:"space-y-1 text-gray-300",children:[a.dependencies.credentials.map(i=>l.jsxs("li",{children:["API key: ",i.label]},i.id)),a.dependencies.services.map(i=>l.jsxs("li",{children:["MCP: ",i.label]},i.id)),a.dependencies.missingCredentialIds.map(i=>l.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[l.jsx(wn,{className:"w-3 h-3"})," Missing API key: ",i]},i)),a.dependencies.missingServiceIds.map(i=>l.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[l.jsx(wn,{className:"w-3 h-3"})," Missing MCP: ",i]},i))]})]}),a.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:a.exec})]}),a.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:a.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:a.body})]})]})]})})}function _O({credentialId:t,open:e,onOpenChange:r}){const s=yr(),{toast:n}=or(),[a,o]=x.useState(""),[i,c]=x.useState(""),[u,d]=x.useState(""),{data:h,isLoading:m}=hr({queryKey:t?[`/api/credentials/${t}`]:["credential-detail-disabled"],enabled:e&&!!t}),f=h==null?void 0:h.data;x.useEffect(()=>{f&&(o(f.label),c(f.docsUrl??""),d(""))},[f==null?void 0:f.id,f==null?void 0:f.label,f==null?void 0:f.docsUrl]);const w=At({mutationFn:async()=>{if(!t)throw new Error("No credential selected");const v=a.trim();if(!v)throw new Error("Name is required");const y=i.trim();if(y)try{new URL(y)}catch{throw new Error("Documentation link must be a valid URL")}await Oe("PUT",`/api/credentials/${t}`,{label:v,docsUrl:y}),u.trim()&&await Oe("POST",`/api/credentials/${t}/rotate`,{value:u.trim()})},onSuccess:()=>{s.invalidateQueries({queryKey:["/api/credentials/vault"]}),t&&s.invalidateQueries({queryKey:[`/api/credentials/${t}`]}),s.invalidateQueries({queryKey:["/api/collection/warnings"]}),s.invalidateQueries({queryKey:["/api/decks"]}),n({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:v=>{n({title:"Could not save API key",description:v.message,variant:"destructive"})}}),p=a.trim().length>0&&(a.trim()!==(f==null?void 0:f.label)||i.trim()!==((f==null?void 0:f.docsUrl)??"")||u.trim().length>0);return l.jsx(ao,{open:e,onOpenChange:r,children:l.jsxs(fa,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(ha,{children:[l.jsx(pa,{className:"text-[#E8F6F4]",children:(f==null?void 0:f.label)??"API key"}),l.jsx(Ci,{className:"font-mono text-xs text-[#A8C4C0]",children:(f==null?void 0:f.id)??t})]}),m||!f?l.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):l.jsxs("div",{className:"space-y-4",children:[!f.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(wn,{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(We,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),l.jsx(tt,{id:"credential-detail-name",value:a,onChange:v=>o(v.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:f.hasSecret?"Rotate API key":"API key"}),l.jsx(tt,{id:"credential-detail-key",type:"password",placeholder:f.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:v=>d(v.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),f.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(We,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(tt,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:i,onChange:v=>c(v.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),i.trim()&&l.jsx(fe,{type:"button",variant:"outline",size:"icon",className:"shrink-0 border-white/15 bg-[#0F0F0C] text-[#A8C4C0] hover:bg-white/5",onClick:()=>window.open(i.trim(),"_blank","noopener,noreferrer"),title:"Open documentation",children:l.jsx(zs,{className:"h-4 w-4"})})]})]}),l.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(ur),onClick:()=>w.mutate(),disabled:!p||w.isPending,children:w.isPending?"Saving…":"Save changes"})]})]})})}const EO=Pd("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 hn({className:t,variant:e,...r}){return l.jsx("div",{className:Te(EO({variant:e}),t),...r})}function p_(t){const e=x.useRef({value:t,previous:t});return x.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Fd="Checkbox",[CO,yF]=ds(Fd),[PO,Dv]=CO(Fd);function kO(t){const{__scopeCheckbox:e,checked:r,children:s,defaultChecked:n,disabled:a,form:o,name:i,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=t,[m,f]=Wa({prop:r,defaultProp:n??!1,onChange:c,caller:Fd}),[w,p]=x.useState(null),[v,y]=x.useState(null),g=x.useRef(!1),b=w?!!o||!!w.closest("form"):!0,S={checked:m,disabled:a,setChecked:f,control:w,setControl:p,name:i,form:o,value:d,hasConsumerStoppedPropagationRef:g,required:u,defaultChecked:ta(n)?!1:n,isFormControl:b,bubbleInput:v,setBubbleInput:y};return l.jsx(PO,{scope:e,...S,children:NO(h)?h(S):s})}var m_="CheckboxTrigger",v_=x.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...s},n)=>{const{control:a,value:o,disabled:i,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:f,bubbleInput:w}=Dv(m_,t),p=et(n,d),v=x.useRef(c);return x.useEffect(()=>{const y=a==null?void 0:a.form;if(y){const g=()=>h(v.current);return y.addEventListener("reset",g),()=>y.removeEventListener("reset",g)}},[a,h]),l.jsx(Ae.button,{type:"button",role:"checkbox","aria-checked":ta(c)?"mixed":c,"aria-required":u,"data-state":b_(c),"data-disabled":i?"":void 0,disabled:i,value:o,...s,ref:p,onKeyDown:Se(e,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:Se(r,y=>{h(g=>ta(g)?!0:!g),w&&f&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});v_.displayName=m_;var Mv=x.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:s,checked:n,defaultChecked:a,required:o,disabled:i,value:c,onCheckedChange:u,form:d,...h}=t;return l.jsx(kO,{__scopeCheckbox:r,checked:n,defaultChecked:a,disabled:i,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(v_,{...h,ref:e,__scopeCheckbox:r}),m&&l.jsx(w_,{__scopeCheckbox:r})]})})});Mv.displayName=Fd;var g_="CheckboxIndicator",y_=x.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:s,...n}=t,a=Dv(g_,r);return l.jsx(da,{present:s||ta(a.checked)||a.checked===!0,children:l.jsx(Ae.span,{"data-state":b_(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:e,style:{pointerEvents:"none",...t.style}})})});y_.displayName=g_;var x_="CheckboxBubbleInput",w_=x.forwardRef(({__scopeCheckbox:t,...e},r)=>{const{control:s,hasConsumerStoppedPropagationRef:n,checked:a,defaultChecked:o,required:i,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:f}=Dv(x_,t),w=et(r,f),p=p_(a),v=K1(s);x.useEffect(()=>{const g=m;if(!g)return;const b=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(b,"checked").set,N=!n.current;if(p!==a&&E){const j=new Event("click",{bubbles:N});g.indeterminate=ta(a),E.call(g,ta(a)?!1:a),g.dispatchEvent(j)}},[m,p,a,n]);const y=x.useRef(ta(a)?!1:a);return l.jsx(Ae.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:i,disabled:c,name:u,value:d,form:h,...e,tabIndex:-1,ref:w,style:{...e.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});w_.displayName=x_;function NO(t){return typeof t=="function"}function ta(t){return t==="indeterminate"}function b_(t){return ta(t)?"indeterminate":t?"checked":"unchecked"}const S_=x.forwardRef(({className:t,...e},r)=>l.jsx(Mv,{ref:r,className:Te("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",t),...e,children:l.jsx(y_,{className:Te("flex items-center justify-center text-current"),children:l.jsx(w1,{className:"h-4 w-4"})})}));S_.displayName=Mv.displayName;const __=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:r,className:Te("w-full caption-bottom text-sm",t),...e})}));__.displayName="Table";const E_=x.forwardRef(({className:t,...e},r)=>l.jsx("thead",{ref:r,className:Te("[&_tr]:border-b",t),...e}));E_.displayName="TableHeader";const C_=x.forwardRef(({className:t,...e},r)=>l.jsx("tbody",{ref:r,className:Te("[&_tr:last-child]:border-0",t),...e}));C_.displayName="TableBody";const jO=x.forwardRef(({className:t,...e},r)=>l.jsx("tfoot",{ref:r,className:Te("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));jO.displayName="TableFooter";const Ki=x.forwardRef(({className:t,...e},r)=>l.jsx("tr",{ref:r,className:Te("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Ki.displayName="TableRow";const Yc=x.forwardRef(({className:t,...e},r)=>l.jsx("th",{ref:r,className:Te("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Yc.displayName="TableHead";const ho=x.forwardRef(({className:t,...e},r)=>l.jsx("td",{ref:r,className:Te("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ho.displayName="TableCell";const RO=x.forwardRef(({className:t,...e},r)=>l.jsx("caption",{ref:r,className:Te("mt-4 text-sm text-muted-foreground",t),...e}));RO.displayName="TableCaption";function qf(t){return new Set(t.filter(e=>e.enabled===!1).map(e=>e.name))}function TO({serviceId:t,tools:e,isLoading:r}){const[s,n]=x.useState(""),[a,o]=x.useState(null),[i,c]=x.useState(()=>qf(e)),u=yr(),{toast:d}=or(),h=x.useMemo(()=>e.filter(g=>g.enabled===!1).map(g=>g.name).sort().join("\0"),[e]);x.useEffect(()=>{c(qf(e))},[t,h,e.length]);const m=At({mutationFn:async g=>{await Oe("PUT",`/api/services/${t}/tool-settings`,{disabledTools:g})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/services",t,"tools"]}),u.invalidateQueries({queryKey:["/api/services"]})},onError:g=>{d({title:"Could not save tool settings",description:g.message,variant:"destructive"}),c(qf(e))}}),f=g=>{c(g),m.mutate([...g])},w=(g,b)=>{const S=new Set(i);b?S.delete(g):S.add(g),f(S)},p=g=>{if(g){f(new Set);return}f(new Set(e.map(b=>b.name)))},v=x.useMemo(()=>{const g=s.trim().toLowerCase();return g?e.filter(b=>b.name.toLowerCase().includes(g)||b.description.toLowerCase().includes(g)):e},[e,s]),y=e.length-i.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…"})}):e.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(Ru,{className:"w-5 h-5 mr-2"}),"Tools",l.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:[y," of ",e.length," enabled"]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(fe,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>p(!0),disabled:i.size===0||m.isPending,children:"Enable all"}),l.jsx(fe,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>p(!1),disabled:y===0||m.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(_1,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),l.jsx(tt,{value:s,onChange:g=>n(g.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(__,{children:[l.jsx(E_,{children:l.jsxs(Ki,{className:"border-white/10 hover:bg-transparent",children:[l.jsx(Yc,{className:"w-[72px] text-center text-[#A8C4C0]",children:"Enabled"}),l.jsx(Yc,{className:"w-[220px] text-[#A8C4C0]",children:"Tool"}),l.jsx(Yc,{className:"text-[#A8C4C0]",children:"Description"})]})}),l.jsx(C_,{children:v.length===0?l.jsx(Ki,{className:"border-white/10 hover:bg-transparent",children:l.jsx(ho,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):v.map(g=>{const b=!i.has(g.name),S=a===g.name,E=g.inputSchema&&Object.keys(g.inputSchema).length>0;return l.jsxs(x.Fragment,{children:[l.jsxs(Ki,{className:`border-white/10 ${b?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[l.jsx(ho,{className:"text-center",children:l.jsx("div",{className:"flex justify-center",children:l.jsx(S_,{checked:b,onCheckedChange:N=>w(g.name,N===!0),disabled:m.isPending,"aria-label":`${b?"Disable":"Enable"} ${g.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(ho,{children:E?l.jsxs("button",{type:"button",onClick:()=>o(S?null:g.name),className:"flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white",children:[l.jsx(gv,{className:`h-4 w-4 shrink-0 transition-transform ${S?"rotate-180":""}`}),g.name]}):l.jsx("span",{className:"font-mono text-sm text-[#92E4DD]",children:g.name})}),l.jsx(ho,{className:"text-sm text-gray-300",children:g.description||"—"})]}),E&&S&&l.jsx(Ki,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:l.jsx(ho,{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(g.inputSchema,null,2)})})})]},g.name)})})]})})]})}function AO({serviceId:t,onConnected:e}){const{toast:r}=or(),[s,n]=x.useState(""),[a,o]=x.useState(""),[i,c]=x.useState(!1),[u,d]=x.useState(!1),{data:h,isLoading:m}=hr({queryKey:["/api/oauth",t,"setup"],queryFn:async()=>{const v=await Oe("GET",`/api/oauth/${t}/setup`),y=await v.json();if(!v.ok||!y.success)throw new Error(y.error||"Failed to load OAuth setup");return y.data},enabled:!!t}),f=h==null?void 0:h.guide,w=async(v,y)=>{try{await navigator.clipboard.writeText(y),r({title:"Copied",description:`${v} copied to clipboard.`})}catch{r({title:"Copy failed",description:"Select and copy manually.",variant:"destructive"})}};x.useEffect(()=>{(f==null?void 0:f.setupMode)==="manual"?d(!0):d(!1)},[f==null?void 0:f.setupMode]);const p=async v=>{var y,g,b;c(!0);try{const S=await Oe("POST",`/api/oauth/${t}/connect`,v??{}),E=await S.json();if(!S.ok||!E.success){((y=E.data)!=null&&y.needsCredentials||((g=E.data)==null?void 0:g.setupMode)==="manual")&&d(!0),r({title:"OAuth setup",description:E.error||"Could not start OAuth flow.",variant:"destructive"});return}(b=E.data)!=null&&b.authorizationUrl&&(window.open(E.data.authorizationUrl,"_blank"),r({title:"Continue in browser",description:"Complete sign-in in the new tab, then return here."}),e==null||e())}catch(S){r({title:"OAuth setup failed",description:S instanceof Error?S.message:"Unknown error",variant:"destructive"})}finally{c(!1)}};return m?l.jsx("p",{className:"text-sm text-orange-200",children:"Loading OAuth setup…"}):f?f.setupMode==="unavailable"?l.jsxs("div",{className:"space-y-3 text-sm text-orange-100",children:[l.jsx("p",{children:f.unavailableReason}),f.docsUrl&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(f.docsUrl,"_blank"),children:[l.jsx(zs,{className:"w-4 h-4 mr-1"}),"Provider docs"]})]}):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:f.title}),l.jsxs("p",{className:"mt-1 text-xs text-orange-100/80",children:["Redirect URI:"," ",l.jsx("code",{className:"text-orange-50",children:f.redirectUri})]}),f.easierAlternative&&l.jsx("p",{className:"mt-2 text-xs text-orange-100/70 border-l-2 border-orange-500/30 pl-2",children:f.easierAlternative})]}),(f.manifestJson||f.createAppUrl)&&l.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.manifestJson&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void w("App manifest",f.manifestJson),children:[l.jsx(i2,{className:"w-4 h-4 mr-1"}),"Copy manifest"]}),l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void w("Redirect URI",f.redirectUri),children:[l.jsx(S1,{className:"w-4 h-4 mr-1"}),"Copy redirect URI"]}),f.createAppUrl&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(f.createAppUrl,"_blank"),children:[l.jsx(zs,{className:"w-4 h-4 mr-1"}),"Open Slack app creator"]})]}),f.steps.length>0&&l.jsx("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:f.steps.map(v=>l.jsx("li",{children:v},v))}),u&&f.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(We,{htmlFor:`oauth-client-id-${t}`,className:"text-orange-200",children:"Client ID"}),l.jsx(tt,{id:`oauth-client-id-${t}`,value:s,onChange:v=>n(v.target.value),placeholder:"OAuth Client ID",className:"bg-black/20 border-orange-500/30"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx(We,{htmlFor:`oauth-client-secret-${t}`,className:"text-orange-200",children:"Client Secret"}),l.jsx(tt,{id:`oauth-client-secret-${t}`,type:"password",value:a,onChange:v=>o(v.target.value),placeholder:"OAuth Client Secret",className:"bg-black/20 border-orange-500/30"})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(fe,{size:"sm",className:"bg-orange-600 hover:bg-orange-700",disabled:i||u&&f.setupMode==="manual"&&!s.trim(),onClick:()=>p(u&&f.setupMode==="manual"?{clientId:s.trim(),clientSecret:a.trim()}:void 0),children:i?"Connecting…":f.setupMode==="dynamic"||f.setupMode==="managed"?"Connect":"Connect with credentials"}),f.docsUrl&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(f.docsUrl,"_blank"),children:[l.jsx(zs,{className:"w-4 h-4 mr-1"}),"Docs"]})]})]}):null}function OO({service:t,isOpen:e,onClose:r}){var Ne,rt,pt,Hr,zt,fs,oo,Yt,Br,hs,jr,Dn,ps,ya,ms,ne,Et,Mn,$n,Zl,Yl,Jl;const[s,n]=x.useState(null),[a,o]=x.useState(!1),[i,c]=x.useState(""),[u,d]=x.useState(!1),[h,m]=x.useState(!1),[f,w]=x.useState(!1),[p,v]=x.useState(""),[y,g]=x.useState(""),[b,S]=x.useState(!1),[E,N]=x.useState(!1),[j,R]=x.useState(null),A=yr(),{toast:F}=or(),T=t&&(j==null?void 0:j.id)===t.id?j:t,_=T,I=!!(_&&_.id&&_.url),{data:C,isLoading:z,error:U,refetch:K}=hr({queryKey:["/api/mcp/discover",_==null?void 0:_.url],queryFn:async()=>{if(!_||_.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${_.url}`);try{const je=await(await Oe("POST","/api/mcp/discover",{url:_.url})).json();return console.log(`✅ MCP discovery successful for ${_.url}:`,je),je}catch(le){throw console.log(`❌ MCP discovery failed for ${_.url}:`,le),le}},enabled:I&&_.type==="mcp"&&e,staleTime:0,gcTime:2*60*1e3}),P=((rt=(Ne=C==null?void 0:C.data)==null?void 0:Ne.oauth)==null?void 0:rt.required)===!0,{data:D,refetch:L}=hr({queryKey:["/api/oauth",_==null?void 0:_.id,"status"],queryFn:async()=>{const le=await Oe("GET",`/api/oauth/${_.id}/status`),je=await le.json();if(!le.ok||!je.success)throw new Error(je.error||"Failed to load OAuth status");return je.data},enabled:I&&_.type==="mcp"&&e&&P,refetchInterval:le=>{const je=le.state.data;return je!=null&&je.authenticated?!1:2e3}}),Z=P?D!=null&&D.authenticated?{status:"authenticated",message:null}:D!=null&&D.hasToken&&(D!=null&&D.isExpired)?{status:"expired",message:"OAuth Token Expired - Please re-authenticate"}:{status:"required",message:"OAuth 2.0 Authentication Required"}:{status:"not_required",message:null};console.log("MCP Discovery Query Debug:",{apiService:_==null?void 0:_.id,apiServiceType:_==null?void 0:_.type,apiServiceUrl:_==null?void 0:_.url,isOpen:e,hasValidService:I,enabled:I&&_.type==="mcp"&&e,mcpDiscoveryLoading:z,mcpDiscoveryData:C?JSON.stringify(C,null,2):null,mcpDiscoveryDataKeys:C?Object.keys(C):null,oauthRequired:(Hr=(pt=C==null?void 0:C.data)==null?void 0:pt.oauth)==null?void 0:Hr.required,oauthData:(zt=C==null?void 0:C.data)!=null&&zt.oauth?JSON.stringify(C.data.oauth,null,2):null,toolsQueryEnabled:I&&_.type==="mcp"&&e&&!((oo=(fs=C==null?void 0:C.data)==null?void 0:fs.oauth)!=null&&oo.required)});const{data:B,isLoading:oe,error:ve,refetch:ge}=hr({queryKey:["/api/services",_==null?void 0:_.id,"tools"],queryFn:async()=>{if(!_||_.type!=="mcp"&&_.type!=="local-mcp")return{data:[]};console.log(`🔍 Attempting to discover tools for MCP service: ${_.id} at ${_.url}`);try{const je=await(await Oe("GET",`/api/services/${_.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${_.id}:`,je),je}catch(le){throw console.log(`❌ MCP tools discovery failed for ${_.id}:`,le),le}},enabled:I&&(_.type==="mcp"||_.type==="local-mcp")&&e&&(_.type==="local-mcp"||Z.status==="authenticated"||Z.status==="not_required"),staleTime:0,gcTime:2*60*1e3});x.useEffect(()=>{if(!e||!(_!=null&&_.id)||_.type!=="mcp"&&_.type!=="local-mcp"||!(_.type==="local-mcp"||Z.status==="authenticated"||Z.status==="not_required")||oe)return;let je=!1;return(async()=>{try{const Nt=await(await Oe("GET",`/api/services/${_.id}`)).json();!je&&(Nt!=null&&Nt.success)&&Nt.data&&R(Nt.data),A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]})}catch{}})(),()=>{je=!0}},[e,_==null?void 0:_.id,_==null?void 0:_.type,oe,ve,B,Z.status,A]),x.useEffect(()=>{if(!e||!(_!=null&&_.id)||_.type!=="a2a")return;let le=!1;return(async()=>{try{await Oe("GET",`/api/services/${_.id}/health`);const Dt=await(await Oe("GET",`/api/services/${_.id}`)).json();!le&&(Dt!=null&&Dt.success)&&Dt.data&&R(Dt.data),A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]})}catch{}})(),()=>{le=!0}},[e,_==null?void 0:_.id,_==null?void 0:_.type,A]),console.log("MCP Tools Query Debug:",{hasValidService:I,apiServiceType:_==null?void 0:_.type,isOpen:e,oauthRequired:(Br=(Yt=C==null?void 0:C.data)==null?void 0:Yt.oauth)==null?void 0:Br.required,oauthStatus:Z.status,toolsQueryEnabled:I&&(_.type==="mcp"||_.type==="local-mcp")&&e&&(_.type==="local-mcp"||Z.status==="authenticated"||Z.status==="not_required"),mcpToolsLoading:oe});const{data:re,isLoading:ye,error:ke}=hr({queryKey:["/api/proxy/a2a",_==null?void 0:_.id,"manifest"],queryFn:async()=>{if(!_||_.type!=="a2a")return null;const je=await(await Oe("GET",`/api/proxy/a2a/${_.id}/manifest`)).text();return JSON.parse(je)},enabled:I&&_.type==="a2a"&&e,staleTime:0,gcTime:2*60*1e3}),me=(B==null?void 0:B.data)||[],ee=re,_e=oe||ye;console.log("ServiceDetailsModal Debug:",{service:t==null?void 0:t.id,serviceType:t==null?void 0:t.type,isOpen:e,mcpDiscoveryLoading:z,mcpDiscoveryData:C,mcpDiscoveryError:U?String(U):null,mcpToolsLoading:oe,a2aManifestLoading:ye,mcpToolsError:ve?String(ve):null,a2aManifestError:ke?String(ke):null,mcpToolsCount:me.length,mcpToolsData:B,hasA2aManifest:!!ee,isLoading:_e,oauthRequired:(jr=(hs=C==null?void 0:C.data)==null?void 0:hs.oauth)==null?void 0:jr.required,oauthStatus:Z.status,oauthMessage:Z.message,oauthAuthenticated:D==null?void 0:D.authenticated,expiresAt:D==null?void 0:D.expiresAt}),x.useEffect(()=>{if(!e){R(null);return}t&&(R(t),c(t.cardColor||"#92E4DD"),v(t.name||""),g(t.description||""))},[t,e]);const Pe=x.useRef(!1);x.useEffect(()=>{if(!e||!(_!=null&&_.id)){Pe.current=!1;return}if(!(D!=null&&D.authenticated)){Pe.current=!1;return}if(Pe.current)return;Pe.current=!0,(async()=>{F({title:"OAuth completed",description:"Authentication successful! Refreshing service status..."}),A.invalidateQueries({queryKey:["/api/services",_.id]}),A.invalidateQueries({queryKey:["/api/mcp/discover",_.url]}),A.invalidateQueries({queryKey:["/api/collection-warnings"]});try{const je=await Oe("GET",`/api/services/${_.id}`);if(je.ok){const at=await je.json();R(at.data??at)}}catch{}await K(),A.invalidateQueries({queryKey:["/api/services",_.id,"tools"]}),await ge()})()},[D==null?void 0:D.authenticated,e,_==null?void 0:_.id]),x.useEffect(()=>{const le=je=>{const at=je.target;a&&!at.closest(".color-picker-container")&&o(!1)};return document.addEventListener("mousedown",le),()=>{document.removeEventListener("mousedown",le)}},[a]);const De=()=>(t==null?void 0:t.type)==="mcp"?l.jsx(Qy,{className:"w-6 h-6"}):l.jsx(Tf,{className:"w-6 h-6"}),X=()=>(t==null?void 0:t.type)==="mcp"?"text-blue-400":"text-purple-400",ce=()=>(t==null?void 0:t.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",Y=le=>new Date(le).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),ze=async le=>{if(t){d(!0),c(le);try{if((await Oe("PUT",`/api/services/${t.id}`,{cardColor:le})).ok)A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]}),A.invalidateQueries({queryKey:["/api/decks"]}),A.invalidateQueries({queryKey:["/api/decks"]}),F({title:"Color updated",description:"Card color has been updated successfully."}),o(!1);else throw new Error("Failed to update color")}catch{c(t.cardColor||"#92E4DD"),F({title:"Update failed",description:"Failed to update card color. Please try again.",variant:"destructive"})}finally{d(!1)}}},te=async()=>{if(!(!t||!p.trim())){S(!0);try{if((await Oe("PUT",`/api/services/${t.id}`,{name:p.trim()})).ok){if(j){const je={...j,name:p.trim()};R(je)}A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]}),A.invalidateQueries({queryKey:["/api/decks"]}),A.invalidateQueries({queryKey:["/api/decks"]}),F({title:"Name updated",description:"Service name has been updated successfully."}),m(!1)}else throw new Error("Failed to update name")}catch{F({title:"Update failed",description:"Failed to update service name. Please try again.",variant:"destructive"})}finally{S(!1)}}},Me=async()=>{if(t){N(!0);try{if((await Oe("PUT",`/api/services/${t.id}`,{description:y.trim()})).ok){if(j){const je={...j,description:y.trim()};R(je)}A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]}),A.invalidateQueries({queryKey:["/api/decks"]}),A.invalidateQueries({queryKey:["/api/decks"]}),F({title:"Description updated",description:"Service description has been updated successfully."}),w(!1)}else throw new Error("Failed to update description")}catch{F({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{N(!1)}}},Ue=[{value:"#92E4DD",label:"Default"},{value:"#F9386D",label:"Red"},{value:"#E0E0E0",label:"Gray"},{value:"#FF6B00",label:"Orange"}];return l.jsx(ao,{open:e,onOpenChange:r,children:l.jsxs(fa,{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(ha,{children:l.jsxs(pa,{className:"text-2xl font-bold flex items-center",children:[De(),l.jsx("div",{className:"ml-3 flex items-center",children:h?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:p,onChange:le=>v(le.target.value),onKeyDown:le=>{le.key==="Enter"?te():le.key==="Escape"&&(m(!1),v((T==null?void 0:T.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(fe,{size:"sm",onClick:te,disabled:b,className:"h-6 px-2 text-xs",children:b?"Saving...":"Save"}),l.jsx(fe,{size:"sm",variant:"outline",onClick:()=>{m(!1),v((T==null?void 0:T.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:()=>m(!0),title:"Click to edit name",children:T==null?void 0:T.name}),l.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>m(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit name",children:l.jsx(Ru,{className:"w-3 h-3"})})]})}),l.jsx(hn,{className:`ml-3 ${ce()} ${X()}`,children:(Dn=t==null?void 0:t.type)==null?void 0:Dn.toUpperCase()})]})}),t&&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(s2,{className:"w-5 h-5 mr-2"}),"Service Overview"]}),l.jsxs("div",{className:"relative color-picker-container",children:[l.jsx(fe,{size:"sm",variant:"outline",className:"h-8 w-8 p-0 border-white/20 hover:bg-white/10",onClick:()=>o(!a),title:"Change card color",children:l.jsx("div",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:i||t.cardColor||"#92E4DD"}})}),a&&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:Ue.map(le=>l.jsxs("button",{className:`flex items-center gap-2 px-2 py-1 rounded text-xs hover:bg-white/10 transition-colors ${(i||t.cardColor)===le.value?"bg-white/20":""}`,onClick:()=>ze(le.value),disabled:u,children:[l.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:le.value}}),l.jsx("span",{className:"text-white",children:le.label}),u&&t.cardColor===le.value&&l.jsx("div",{className:"ml-auto w-3 h-3 border border-white/20 border-t-transparent rounded-full animate-spin"})]},le.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"}),!f&&l.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>w(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit description",children:l.jsx(Ru,{className:"w-3 h-3"})})]}),f?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{value:y,onChange:le=>g(le.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(fe,{size:"sm",onClick:Me,disabled:E,className:"h-6 px-2 text-xs",children:E?"Saving...":"Save"}),l.jsx(fe,{size:"sm",variant:"outline",onClick:()=>{w(!1),g((T==null?void 0:T.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:()=>w(!0),title:"Click to edit description",children:(T==null?void 0:T.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(hn,{variant:"outline",className:"border-blue-500/30 text-blue-300",children:_.type.toUpperCase()}),t.headers&&typeof t.headers=="object"&&Object.keys(t.headers).length>0&&l.jsx(hn,{variant:"outline",className:"border-green-500/30 text-green-300",children:"Custom Headers"})]}),l.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>window.open(_.url,"_blank"),className:"p-1 h-auto",children:l.jsx(zs,{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:_.url||"No URL available"}),t.headers&&typeof t.headers=="object"&&Object.keys(t.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(t.headers,null,2)})]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Health Status"}),l.jsx(hn,{className:_.health==="healthy"?"bg-green-500/20 text-green-300":_.health==="unhealthy"?"bg-red-500/20 text-red-300":"bg-amber-500/20 text-amber-200",children:_.health==="healthy"?"Healthy":_.health==="unhealthy"?"Unreachable":Z.status==="required"||Z.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:Y(_.registeredAt)})]})]})]}),_e&&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..."})]}),s&&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:s})}),(t.type==="mcp"||t.type==="local-mcp")&&l.jsx(TO,{serviceId:_.id,tools:me,isLoading:oe}),t.type==="a2a"&&ee&&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(f2,{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:ee.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:ee.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:ee.description})]}),ee.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:ee.provider.organization})]}),ee.documentationUrl&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),l.jsxs(fe,{size:"sm",variant:"ghost",onClick:()=>window.open(ee.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[l.jsx(zs,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),ee.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(x1,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[ee.capabilities.streaming&&l.jsx(hn,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),ee.capabilities.pushNotifications&&l.jsx(hn,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),ee.capabilities.stateTransitionHistory&&l.jsx(hn,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),ee.skills&&ee.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(Tf,{className:"w-5 h-5 mr-2"}),"Skills (",ee.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:ee.skills.map((le,je)=>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(Tf,{className:"w-6 h-6"})}),l.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:le.name}),l.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:le.description}),le.tags&&le.tags.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:le.tags.slice(0,2).map((at,Dt)=>l.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:at},Dt))})]}),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"})]},je))})]}),(ee.defaultInputModes||ee.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(Qy,{className:"w-5 h-5 mr-2"}),"Data Modes"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ee.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:ee.defaultInputModes.map((le,je)=>l.jsx(hn,{className:"bg-blue-500/20 text-blue-300 text-xs",children:le},je))})]}),ee.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:ee.defaultOutputModes.map((le,je)=>l.jsx(hn,{className:"bg-green-500/20 text-green-300 text-xs",children:le},je))})]})]})]})]}),(t==null?void 0:t.type)==="mcp"&&Z.status!=="authenticated"&&Z.status!=="not_required"&&l.jsxs("div",{className:`${Z.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:`${Z.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:Z.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),l.jsxs("div",{className:`${Z.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[l.jsx("p",{children:l.jsx("strong",{children:Z.message})}),l.jsx("p",{children:Z.status==="expired"?"Your OAuth token has expired. Please re-authenticate to continue using this service.":"This MCP server requires OAuth authentication to access its tools. Please authenticate to continue."}),(_==null?void 0:_.id)&&l.jsx(AO,{serviceId:_.id,onConnected:()=>void L()}),((ya=(ps=C==null?void 0:C.data)==null?void 0:ps.oauth)==null?void 0:ya.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:"})," ",C.data.oauth.resourceName]})})]})]}),(t==null?void 0:t.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: ",t==null?void 0:t.id]}),l.jsxs("p",{children:["Service URL: ",_==null?void 0:_.url]}),l.jsxs("p",{children:["Status: ",oe?"🔄 Loading...":ve?"❌ Failed":"✅ Complete"]})]}),oe&&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/",t==null?void 0:t.id,"/tools"]})]}),l.jsxs("p",{children:["Target MCP server: ",l.jsx("code",{children:_==null?void 0:_.url})]})]}),ve&&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:ve instanceof Error?ve.message:String(ve)}),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: ",t==null?void 0:t.id]}),l.jsxs("p",{children:["• Target URL: ",_==null?void 0:_.url]}),l.jsxs("p",{children:["• Request: GET /api/services/",t==null?void 0:t.id,"/tools"]}),(_==null?void 0:_.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(_.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 ",_==null?void 0:_.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"})]})]})]}),!oe&&!ve&&me.length>0&&l.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:l.jsxs("p",{children:["✅ Successfully discovered ",me.length," tools from MCP server"]})}),!oe&&!ve&&me.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"})]})]})]}),ve&&(t.type==="mcp"||t.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:ve instanceof Error?ve.message:String(ve)}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service URL:"})," ",_==null?void 0:_.url]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service ID:"})," ",_==null?void 0:_.id]}),(_==null?void 0:_.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(_.headers,null,2)})]})]})]}),ke&&t.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:ke instanceof Error?ke.message:String(ke)}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service URL:"})," ",_==null?void 0:_.url]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service ID:"})," ",_==null?void 0:_.id]})]})]}),!_e&&!ve&&!ke&&(t.type==="mcp"||t.type==="local-mcp")&&me.length===0&&(t.type==="local-mcp"||!((ne=(ms=C==null?void 0:C.data)==null?void 0:ms.oauth)!=null&&ne.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 ",_==null?void 0:_.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"})]})]})]}),(t.type==="mcp"||t.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:"})," ",_==null?void 0:_.url]}),z&&l.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:l.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),C&&l.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 What we discovered:"})}),C.error&&C.analysis&&l.jsxs("div",{className:"text-yellow-200",children:[C.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"})]}),C.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"})]}),C.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"})]}),C.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"})]}),C.analysis.message&&l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Analysis:"})," ",C.analysis.message]})]}),((Mn=(Et=C==null?void 0:C.data)==null?void 0:Et.oauth)==null?void 0:Mn.required)&&l.jsxs("div",{className:"text-yellow-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),C.data.oauth.authorizationUrl&&l.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[l.jsx(fe,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var le,je;if(_!=null&&_.id)try{F({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const at=await Oe("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!at.ok){const Nt=await at.json();(le=Nt.data)!=null&&le.registrationUrl?(window.open(Nt.data.registrationUrl,"_blank"),F({title:"OAuth Registration Required",description:`${Nt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):F({title:"OAuth Setup Failed",description:Nt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Dt=await at.json();Dt.success&&((je=Dt.data)!=null&&je.authorizationUrl)?(window.open(Dt.data.authorizationUrl,"_blank"),F({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),L()):F({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(at){F({title:"OAuth Setup Failed",description:at instanceof Error?at.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsxs(fe,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(C.data.oauth.authorizationUrl,"_blank"),children:[l.jsx(zs,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!C.data.oauth.authorizationUrl&&C.data.oauth.protectedResourceConfigUrl&&l.jsx("div",{className:"mt-2",children:l.jsxs(fe,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(C.data.oauth.protectedResourceConfigUrl,"_blank"),children:[l.jsx(zs,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),C.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(C.data.oauth.authorizationServerMetadataUrl,"_blank"),children:C.data.oauth.authorizationServerMetadataUrl})]})]}),(C==null?void 0:C.success)&&!((Zl=($n=C==null?void 0:C.data)==null?void 0:$n.oauth)!=null&&Zl.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"})]}),((Jl=(Yl=C==null?void 0:C.data)==null?void 0:Yl.oauth)==null?void 0:Jl.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"}),C.data.oauth.resourceName&&l.jsxs("p",{children:["• Service: ",C.data.oauth.resourceName]}),C.data.oauth.authorizationUrl&&l.jsxs("p",{children:["• Authorization URL: ",C.data.oauth.authorizationUrl]}),C.data.oauth.tokenUrl&&l.jsxs("p",{children:["• Token URL: ",C.data.oauth.tokenUrl]}),l.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[l.jsx(fe,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var le,je;if(_!=null&&_.id)try{F({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const at=await Oe("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!at.ok){const Nt=await at.json();(le=Nt.data)!=null&&le.registrationUrl?(window.open(Nt.data.registrationUrl,"_blank"),F({title:"OAuth Registration Required",description:`${Nt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):F({title:"OAuth Setup Failed",description:Nt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Dt=await at.json();Dt.success&&((je=Dt.data)!=null&&je.authorizationUrl)?(window.open(Dt.data.authorizationUrl,"_blank"),F({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),L()):F({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(at){F({title:"OAuth Setup Failed",description:at instanceof Error?at.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsx(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const le=`OAuth Setup Instructions:
|
|
338
|
+
2. …`,value:n,onChange:A=>a(A.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(We,{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:S.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No API keys registered yet."}):S.map(A=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:m.includes(A.id),onChange:()=>j(m,A.id,f)}),A.label]},A.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{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:E.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No MCP services registered yet."}):E.map(A=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:w.includes(A.id),onChange:()=>j(w,A.id,p)}),A.name]},A.id))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),l.jsx(tt,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:c,onChange:A=>u(A.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),l.jsx(tt,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:A=>h(A.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(Yr),onClick:()=>N.mutate(),disabled:!R||N.isPending,children:"Save to collection"})]})]})})}function RO({playbookId:t,open:e,onOpenChange:r}){const{data:s,isLoading:n}=hr({queryKey:t?[`/api/playbooks/${t}`]:["playbook-detail-disabled"],enabled:e&&!!t}),a=s==null?void 0:s.data,o=((a==null?void 0:a.dependencies.missingCredentialIds.length)??0)+((a==null?void 0:a.dependencies.missingServiceIds.length)??0);return l.jsx(ao,{open:e,onOpenChange:r,children:l.jsxs(fa,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(ha,{children:[l.jsx(pa,{children:(a==null?void 0:a.title)??"Playbook"}),l.jsx(Ci,{className:"text-[#A8C4C0]",children:(a==null?void 0:a.id)??t})]}),n||!a?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."]}),a.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:a.triggers.join(", ")})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Dependencies"}),a.dependencies.credentials.length===0&&a.dependencies.services.length===0&&o===0?l.jsx("p",{className:"text-gray-400",children:"None declared."}):l.jsxs("ul",{className:"space-y-1 text-gray-300",children:[a.dependencies.credentials.map(i=>l.jsxs("li",{children:["API key: ",i.label]},i.id)),a.dependencies.services.map(i=>l.jsxs("li",{children:["MCP: ",i.label]},i.id)),a.dependencies.missingCredentialIds.map(i=>l.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[l.jsx(wn,{className:"w-3 h-3"})," Missing API key: ",i]},i)),a.dependencies.missingServiceIds.map(i=>l.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[l.jsx(wn,{className:"w-3 h-3"})," Missing MCP: ",i]},i))]})]}),a.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:a.exec})]}),a.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:a.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:a.body})]})]})]})})}function TO({credentialId:t,open:e,onOpenChange:r}){const s=yr(),{toast:n}=or(),[a,o]=x.useState(""),[i,c]=x.useState(""),[u,d]=x.useState(""),{data:h,isLoading:m}=hr({queryKey:t?[`/api/credentials/${t}`]:["credential-detail-disabled"],enabled:e&&!!t}),f=h==null?void 0:h.data;x.useEffect(()=>{f&&(o(f.label),c(f.docsUrl??""),d(""))},[f==null?void 0:f.id,f==null?void 0:f.label,f==null?void 0:f.docsUrl]);const w=At({mutationFn:async()=>{if(!t)throw new Error("No credential selected");const y=a.trim();if(!y)throw new Error("Name is required");const g=i.trim();if(g)try{new URL(g)}catch{throw new Error("Documentation link must be a valid URL")}await Oe("PUT",`/api/credentials/${t}`,{label:y,docsUrl:g}),u.trim()&&await Oe("POST",`/api/credentials/${t}/rotate`,{value:u.trim()})},onSuccess:()=>{s.invalidateQueries({queryKey:["/api/credentials/vault"]}),t&&s.invalidateQueries({queryKey:[`/api/credentials/${t}`]}),s.invalidateQueries({queryKey:["/api/collection/warnings"]}),s.invalidateQueries({queryKey:["/api/decks"]}),n({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=>{n({title:"Could not save API key",description:y.message,variant:"destructive"})}}),p=a.trim().length>0&&(a.trim()!==(f==null?void 0:f.label)||i.trim()!==((f==null?void 0:f.docsUrl)??"")||u.trim().length>0);return l.jsx(ao,{open:e,onOpenChange:r,children:l.jsxs(fa,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(ha,{children:[l.jsx(pa,{className:"text-[#E8F6F4]",children:(f==null?void 0:f.label)??"API key"}),l.jsx(Ci,{className:"font-mono text-xs text-[#A8C4C0]",children:(f==null?void 0:f.id)??t})]}),m||!f?l.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):l.jsxs("div",{className:"space-y-4",children:[!f.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(wn,{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(We,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),l.jsx(tt,{id:"credential-detail-name",value:a,onChange:y=>o(y.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:f.hasSecret?"Rotate API key":"API key"}),l.jsx(tt,{id:"credential-detail-key",type:"password",placeholder:f.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]"}),f.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(We,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(tt,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:i,onChange:y=>c(y.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),i.trim()&&l.jsx(fe,{type:"button",variant:"outline",size:"icon",className:"shrink-0 border-white/15 bg-[#0F0F0C] text-[#A8C4C0] hover:bg-white/5",onClick:()=>window.open(i.trim(),"_blank","noopener,noreferrer"),title:"Open documentation",children:l.jsx(Jn,{className:"h-4 w-4"})})]})]}),l.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(ur),onClick:()=>w.mutate(),disabled:!p||w.isPending,children:w.isPending?"Saving…":"Save changes"})]})]})})}const AO=kd("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 hn({className:t,variant:e,...r}){return l.jsx("div",{className:Te(AO({variant:e}),t),...r})}function x_(t){const e=x.useRef({value:t,previous:t});return x.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Ld="Checkbox",[OO,PF]=fs(Ld),[IO,$v]=OO(Ld);function DO(t){const{__scopeCheckbox:e,checked:r,children:s,defaultChecked:n,disabled:a,form:o,name:i,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=t,[m,f]=Wa({prop:r,defaultProp:n??!1,onChange:c,caller:Ld}),[w,p]=x.useState(null),[y,g]=x.useState(null),v=x.useRef(!1),b=w?!!o||!!w.closest("form"):!0,S={checked:m,disabled:a,setChecked:f,control:w,setControl:p,name:i,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:ta(n)?!1:n,isFormControl:b,bubbleInput:y,setBubbleInput:g};return l.jsx(IO,{scope:e,...S,children:MO(h)?h(S):s})}var w_="CheckboxTrigger",b_=x.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...s},n)=>{const{control:a,value:o,disabled:i,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:f,bubbleInput:w}=$v(w_,t),p=et(n,d),y=x.useRef(c);return x.useEffect(()=>{const g=a==null?void 0:a.form;if(g){const v=()=>h(y.current);return g.addEventListener("reset",v),()=>g.removeEventListener("reset",v)}},[a,h]),l.jsx(Ae.button,{type:"button",role:"checkbox","aria-checked":ta(c)?"mixed":c,"aria-required":u,"data-state":P_(c),"data-disabled":i?"":void 0,disabled:i,value:o,...s,ref:p,onKeyDown:Se(e,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:Se(r,g=>{h(v=>ta(v)?!0:!v),w&&f&&(m.current=g.isPropagationStopped(),m.current||g.stopPropagation())})})});b_.displayName=w_;var Fv=x.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:s,checked:n,defaultChecked:a,required:o,disabled:i,value:c,onCheckedChange:u,form:d,...h}=t;return l.jsx(DO,{__scopeCheckbox:r,checked:n,defaultChecked:a,disabled:i,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(b_,{...h,ref:e,__scopeCheckbox:r}),m&&l.jsx(C_,{__scopeCheckbox:r})]})})});Fv.displayName=Ld;var S_="CheckboxIndicator",__=x.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:s,...n}=t,a=$v(S_,r);return l.jsx(da,{present:s||ta(a.checked)||a.checked===!0,children:l.jsx(Ae.span,{"data-state":P_(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:e,style:{pointerEvents:"none",...t.style}})})});__.displayName=S_;var E_="CheckboxBubbleInput",C_=x.forwardRef(({__scopeCheckbox:t,...e},r)=>{const{control:s,hasConsumerStoppedPropagationRef:n,checked:a,defaultChecked:o,required:i,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:f}=$v(E_,t),w=et(r,f),p=x_(a),y=Z1(s);x.useEffect(()=>{const v=m;if(!v)return;const b=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(b,"checked").set,N=!n.current;if(p!==a&&E){const j=new Event("click",{bubbles:N});v.indeterminate=ta(a),E.call(v,ta(a)?!1:a),v.dispatchEvent(j)}},[m,p,a,n]);const g=x.useRef(ta(a)?!1:a);return l.jsx(Ae.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??g.current,required:i,disabled:c,name:u,value:d,form:h,...e,tabIndex:-1,ref:w,style:{...e.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});C_.displayName=E_;function MO(t){return typeof t=="function"}function ta(t){return t==="indeterminate"}function P_(t){return ta(t)?"indeterminate":t?"checked":"unchecked"}const k_=x.forwardRef(({className:t,...e},r)=>l.jsx(Fv,{ref:r,className:Te("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",t),...e,children:l.jsx(__,{className:Te("flex items-center justify-center text-current"),children:l.jsx(E1,{className:"h-4 w-4"})})}));k_.displayName=Fv.displayName;const N_=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:r,className:Te("w-full caption-bottom text-sm",t),...e})}));N_.displayName="Table";const j_=x.forwardRef(({className:t,...e},r)=>l.jsx("thead",{ref:r,className:Te("[&_tr]:border-b",t),...e}));j_.displayName="TableHeader";const R_=x.forwardRef(({className:t,...e},r)=>l.jsx("tbody",{ref:r,className:Te("[&_tr:last-child]:border-0",t),...e}));R_.displayName="TableBody";const $O=x.forwardRef(({className:t,...e},r)=>l.jsx("tfoot",{ref:r,className:Te("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));$O.displayName="TableFooter";const Ki=x.forwardRef(({className:t,...e},r)=>l.jsx("tr",{ref:r,className:Te("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Ki.displayName="TableRow";const Jc=x.forwardRef(({className:t,...e},r)=>l.jsx("th",{ref:r,className:Te("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Jc.displayName="TableHead";const ho=x.forwardRef(({className:t,...e},r)=>l.jsx("td",{ref:r,className:Te("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ho.displayName="TableCell";const FO=x.forwardRef(({className:t,...e},r)=>l.jsx("caption",{ref:r,className:Te("mt-4 text-sm text-muted-foreground",t),...e}));FO.displayName="TableCaption";function Bf(t){return new Set(t.filter(e=>e.enabled===!1).map(e=>e.name))}function LO({serviceId:t,tools:e,isLoading:r}){const[s,n]=x.useState(""),[a,o]=x.useState(null),[i,c]=x.useState(()=>Bf(e)),u=yr(),{toast:d}=or(),h=x.useMemo(()=>e.filter(v=>v.enabled===!1).map(v=>v.name).sort().join("\0"),[e]);x.useEffect(()=>{c(Bf(e))},[t,h,e.length]);const m=At({mutationFn:async v=>{await Oe("PUT",`/api/services/${t}/tool-settings`,{disabledTools:v})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/services",t,"tools"]}),u.invalidateQueries({queryKey:["/api/services"]})},onError:v=>{d({title:"Could not save tool settings",description:v.message,variant:"destructive"}),c(Bf(e))}}),f=v=>{c(v),m.mutate([...v])},w=(v,b)=>{const S=new Set(i);b?S.delete(v):S.add(v),f(S)},p=v=>{if(v){f(new Set);return}f(new Set(e.map(b=>b.name)))},y=x.useMemo(()=>{const v=s.trim().toLowerCase();return v?e.filter(b=>b.name.toLowerCase().includes(v)||b.description.toLowerCase().includes(v)):e},[e,s]),g=e.length-i.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…"})}):e.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(Tu,{className:"w-5 h-5 mr-2"}),"Tools",l.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:[g," of ",e.length," enabled"]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(fe,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>p(!0),disabled:i.size===0||m.isPending,children:"Enable all"}),l.jsx(fe,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>p(!1),disabled:g===0||m.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(k1,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),l.jsx(tt,{value:s,onChange:v=>n(v.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(N_,{children:[l.jsx(j_,{children:l.jsxs(Ki,{className:"border-white/10 hover:bg-transparent",children:[l.jsx(Jc,{className:"w-[72px] text-center text-[#A8C4C0]",children:"Enabled"}),l.jsx(Jc,{className:"w-[220px] text-[#A8C4C0]",children:"Tool"}),l.jsx(Jc,{className:"text-[#A8C4C0]",children:"Description"})]})}),l.jsx(R_,{children:y.length===0?l.jsx(Ki,{className:"border-white/10 hover:bg-transparent",children:l.jsx(ho,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):y.map(v=>{const b=!i.has(v.name),S=a===v.name,E=v.inputSchema&&Object.keys(v.inputSchema).length>0;return l.jsxs(x.Fragment,{children:[l.jsxs(Ki,{className:`border-white/10 ${b?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[l.jsx(ho,{className:"text-center",children:l.jsx("div",{className:"flex justify-center",children:l.jsx(k_,{checked:b,onCheckedChange:N=>w(v.name,N===!0),disabled:m.isPending,"aria-label":`${b?"Disable":"Enable"} ${v.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(ho,{children:E?l.jsxs("button",{type:"button",onClick:()=>o(S?null:v.name),className:"flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white",children:[l.jsx(xv,{className:`h-4 w-4 shrink-0 transition-transform ${S?"rotate-180":""}`}),v.name]}):l.jsx("span",{className:"font-mono text-sm text-[#92E4DD]",children:v.name})}),l.jsx(ho,{className:"text-sm text-gray-300",children:v.description||"—"})]}),E&&S&&l.jsx(Ki,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:l.jsx(ho,{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(v.inputSchema,null,2)})})})]},v.name)})})]})})]})}function S0({items:t,className:e}){return t.length===0?null:l.jsx("ol",{className:`list-decimal list-inside space-y-1 text-xs ${e??""}`,children:t.map((r,s)=>l.jsx("li",{children:r},`${s}-${r.slice(0,24)}`))})}function _0({serviceId:t,onConnected:e}){const{toast:r}=or(),[s,n]=x.useState(""),[a,o]=x.useState(""),[i,c]=x.useState(!1),[u,d]=x.useState(!1),{data:h,isLoading:m}=hr({queryKey:["/api/oauth",t,"setup"],queryFn:async()=>{const g=await Oe("GET",`/api/oauth/${t}/setup`),v=await g.json();if(!g.ok||!v.success)throw new Error(v.error||"Failed to load OAuth setup");return v.data},enabled:!!t}),f=h==null?void 0:h.guide,w=async(g,v)=>{try{await navigator.clipboard.writeText(v),r({title:"Copied",description:`${g} copied to clipboard.`})}catch{r({title:"Copy failed",description:"Select and copy manually.",variant:"destructive"})}};x.useEffect(()=>{(f==null?void 0:f.setupMode)==="manual"?d(!0):d(!1)},[f==null?void 0:f.setupMode]);const p=async g=>{var v,b,S;c(!0);try{const E=await Oe("POST",`/api/oauth/${t}/connect`,g??{}),N=await E.json();if(!E.ok||!N.success){((v=N.data)!=null&&v.needsCredentials||((b=N.data)==null?void 0:b.setupMode)==="manual")&&d(!0),r({title:"OAuth setup",description:N.error||"Could not start OAuth flow.",variant:"destructive"});return}(S=N.data)!=null&&S.authorizationUrl&&(window.open(N.data.authorizationUrl,"_blank"),r({title:"Continue in browser",description:"Complete sign-in in the new tab, then return here."}),e==null||e())}catch(E){r({title:"OAuth setup failed",description:E instanceof Error?E.message:"Unknown error",variant:"destructive"})}finally{c(!1)}};if(m)return l.jsx("p",{className:"text-sm text-orange-200",children:"Loading setup guide…"});if(!f)return null;if(f.setupMode==="unavailable")return l.jsxs("div",{className:"space-y-3 text-sm text-orange-100",children:[l.jsx("p",{children:f.unavailableReason}),f.docsUrl&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(f.docsUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"Provider docs"]})]});const y=f.setupMode==="dynamic"||f.setupMode==="managed"||f.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:f.title}),f.summary&&l.jsx("p",{className:"mt-1 text-xs text-orange-100/90",children:f.summary}),y&&l.jsxs("p",{className:"mt-2 text-xs text-orange-100/80",children:["Redirect URI:"," ",l.jsx("code",{className:"text-orange-50",children:f.redirectUri})]}),f.easierAlternative&&l.jsx("p",{className:"mt-2 text-xs text-orange-100/70 border-l-2 border-orange-500/30 pl-2",children:f.easierAlternative})]}),f.prerequisites&&f.prerequisites.length>0&&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:f.prerequisites.map(g=>l.jsx("li",{children:g},g))})]}),(f.manifestJson||f.createAppUrl||y)&&l.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.manifestJson&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void w("App manifest",f.manifestJson),children:[l.jsx(f2,{className:"w-4 h-4 mr-1"}),"Copy manifest"]}),y&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void w("Redirect URI",f.redirectUri),children:[l.jsx(P1,{className:"w-4 h-4 mr-1"}),"Copy redirect URI"]}),f.createAppUrl&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(f.createAppUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),f.createAppLabel??"Open app creator"]})]}),f.steps.length>0&&l.jsxs("div",{children:[f.setupMode==="informational"?l.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"What to do"}):null,l.jsx(S0,{items:f.steps})]}),f.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: "}),f.tokenAlternative]}),u&&f.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(We,{htmlFor:`oauth-client-id-${t}`,className:"text-orange-200",children:"Client ID"}),l.jsx(tt,{id:`oauth-client-id-${t}`,value:s,onChange:g=>n(g.target.value),placeholder:"OAuth Client ID",className:"bg-black/20 border-orange-500/30"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx(We,{htmlFor:`oauth-client-secret-${t}`,className:"text-orange-200",children:"Client Secret"}),l.jsx(tt,{id:`oauth-client-secret-${t}`,type:"password",value:a,onChange:g=>o(g.target.value),placeholder:"OAuth Client Secret",className:"bg-black/20 border-orange-500/30"})]})]}),f.afterConnect&&f.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(S0,{items:f.afterConnect,className:"text-orange-100/80"})]}),y&&l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(fe,{size:"sm",className:"bg-orange-600 hover:bg-orange-700",disabled:i||u&&f.setupMode==="manual"&&!s.trim(),onClick:()=>p(u&&f.setupMode==="manual"?{clientId:s.trim(),clientSecret:a.trim()}:void 0),children:i?"Connecting…":f.setupMode==="dynamic"||f.setupMode==="managed"?"Connect":"Connect with credentials"}),f.docsUrl&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(f.docsUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"Docs"]})]}),f.setupMode==="informational"&&f.docsUrl&&l.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(f.docsUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"Docs"]})]})}function UO(t){if(!t||t.type!=="local-mcp")return!1;const e=[t.localCommand,...t.localArgs??[],t.url,t.name].filter(Boolean).join(" ").toLowerCase();return e.includes("google-drive")||e.includes("google_drive")}function zO({service:t,isOpen:e,onClose:r}){var Ne,rt,pt,Hr,zt,hs,oo,Yt,Br,ps,jr,Dn,ms,ya,vs,ne,Et,Mn,$n,Yl,Jl,Xl;const[s,n]=x.useState(null),[a,o]=x.useState(!1),[i,c]=x.useState(""),[u,d]=x.useState(!1),[h,m]=x.useState(!1),[f,w]=x.useState(!1),[p,y]=x.useState(""),[g,v]=x.useState(""),[b,S]=x.useState(!1),[E,N]=x.useState(!1),[j,R]=x.useState(null),A=yr(),{toast:F}=or(),T=t&&(j==null?void 0:j.id)===t.id?j:t,_=T,I=!!(_&&_.id&&_.url),{data:C,isLoading:z,error:U,refetch:K}=hr({queryKey:["/api/mcp/discover",_==null?void 0:_.url],queryFn:async()=>{if(!_||_.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${_.url}`);try{const je=await(await Oe("POST","/api/mcp/discover",{url:_.url})).json();return console.log(`✅ MCP discovery successful for ${_.url}:`,je),je}catch(le){throw console.log(`❌ MCP discovery failed for ${_.url}:`,le),le}},enabled:I&&_.type==="mcp"&&e,staleTime:0,gcTime:2*60*1e3}),P=((rt=(Ne=C==null?void 0:C.data)==null?void 0:Ne.oauth)==null?void 0:rt.required)===!0,{data:D,refetch:L}=hr({queryKey:["/api/oauth",_==null?void 0:_.id,"status"],queryFn:async()=>{const le=await Oe("GET",`/api/oauth/${_.id}/status`),je=await le.json();if(!le.ok||!je.success)throw new Error(je.error||"Failed to load OAuth status");return je.data},enabled:I&&_.type==="mcp"&&e&&P,refetchInterval:le=>{const je=le.state.data;return je!=null&&je.authenticated?!1:2e3}}),G=P?D!=null&&D.authenticated?{status:"authenticated",message:null}:D!=null&&D.hasToken&&(D!=null&&D.isExpired)?{status:"expired",message:"OAuth Token Expired - Please re-authenticate"}:{status:"required",message:"OAuth 2.0 Authentication Required"}:{status:"not_required",message:null};console.log("MCP Discovery Query Debug:",{apiService:_==null?void 0:_.id,apiServiceType:_==null?void 0:_.type,apiServiceUrl:_==null?void 0:_.url,isOpen:e,hasValidService:I,enabled:I&&_.type==="mcp"&&e,mcpDiscoveryLoading:z,mcpDiscoveryData:C?JSON.stringify(C,null,2):null,mcpDiscoveryDataKeys:C?Object.keys(C):null,oauthRequired:(Hr=(pt=C==null?void 0:C.data)==null?void 0:pt.oauth)==null?void 0:Hr.required,oauthData:(zt=C==null?void 0:C.data)!=null&&zt.oauth?JSON.stringify(C.data.oauth,null,2):null,toolsQueryEnabled:I&&_.type==="mcp"&&e&&!((oo=(hs=C==null?void 0:C.data)==null?void 0:hs.oauth)!=null&&oo.required)});const{data:B,isLoading:oe,error:ve,refetch:ge}=hr({queryKey:["/api/services",_==null?void 0:_.id,"tools"],queryFn:async()=>{if(!_||_.type!=="mcp"&&_.type!=="local-mcp")return{data:[]};console.log(`🔍 Attempting to discover tools for MCP service: ${_.id} at ${_.url}`);try{const je=await(await Oe("GET",`/api/services/${_.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${_.id}:`,je),je}catch(le){throw console.log(`❌ MCP tools discovery failed for ${_.id}:`,le),le}},enabled:I&&(_.type==="mcp"||_.type==="local-mcp")&&e&&(_.type==="local-mcp"||G.status==="authenticated"||G.status==="not_required"),staleTime:0,gcTime:2*60*1e3});x.useEffect(()=>{if(!e||!(_!=null&&_.id)||_.type!=="mcp"&&_.type!=="local-mcp"||!(_.type==="local-mcp"||G.status==="authenticated"||G.status==="not_required")||oe)return;let je=!1;return(async()=>{try{const Nt=await(await Oe("GET",`/api/services/${_.id}`)).json();!je&&(Nt!=null&&Nt.success)&&Nt.data&&R(Nt.data),A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]})}catch{}})(),()=>{je=!0}},[e,_==null?void 0:_.id,_==null?void 0:_.type,oe,ve,B,G.status,A]),x.useEffect(()=>{if(!e||!(_!=null&&_.id)||_.type!=="a2a")return;let le=!1;return(async()=>{try{await Oe("GET",`/api/services/${_.id}/health`);const Dt=await(await Oe("GET",`/api/services/${_.id}`)).json();!le&&(Dt!=null&&Dt.success)&&Dt.data&&R(Dt.data),A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]})}catch{}})(),()=>{le=!0}},[e,_==null?void 0:_.id,_==null?void 0:_.type,A]),console.log("MCP Tools Query Debug:",{hasValidService:I,apiServiceType:_==null?void 0:_.type,isOpen:e,oauthRequired:(Br=(Yt=C==null?void 0:C.data)==null?void 0:Yt.oauth)==null?void 0:Br.required,oauthStatus:G.status,toolsQueryEnabled:I&&(_.type==="mcp"||_.type==="local-mcp")&&e&&(_.type==="local-mcp"||G.status==="authenticated"||G.status==="not_required"),mcpToolsLoading:oe});const{data:re,isLoading:ye,error:ke}=hr({queryKey:["/api/proxy/a2a",_==null?void 0:_.id,"manifest"],queryFn:async()=>{if(!_||_.type!=="a2a")return null;const je=await(await Oe("GET",`/api/proxy/a2a/${_.id}/manifest`)).text();return JSON.parse(je)},enabled:I&&_.type==="a2a"&&e,staleTime:0,gcTime:2*60*1e3}),me=(B==null?void 0:B.data)||[],ee=re,_e=oe||ye;console.log("ServiceDetailsModal Debug:",{service:t==null?void 0:t.id,serviceType:t==null?void 0:t.type,isOpen:e,mcpDiscoveryLoading:z,mcpDiscoveryData:C,mcpDiscoveryError:U?String(U):null,mcpToolsLoading:oe,a2aManifestLoading:ye,mcpToolsError:ve?String(ve):null,a2aManifestError:ke?String(ke):null,mcpToolsCount:me.length,mcpToolsData:B,hasA2aManifest:!!ee,isLoading:_e,oauthRequired:(jr=(ps=C==null?void 0:C.data)==null?void 0:ps.oauth)==null?void 0:jr.required,oauthStatus:G.status,oauthMessage:G.message,oauthAuthenticated:D==null?void 0:D.authenticated,expiresAt:D==null?void 0:D.expiresAt}),x.useEffect(()=>{if(!e){R(null);return}t&&(R(t),c(t.cardColor||"#92E4DD"),y(t.name||""),v(t.description||""))},[t,e]);const Pe=x.useRef(!1);x.useEffect(()=>{if(!e||!(_!=null&&_.id)){Pe.current=!1;return}if(!(D!=null&&D.authenticated)){Pe.current=!1;return}if(Pe.current)return;Pe.current=!0,(async()=>{F({title:"OAuth completed",description:"Authentication successful! Refreshing service status..."}),A.invalidateQueries({queryKey:["/api/services",_.id]}),A.invalidateQueries({queryKey:["/api/mcp/discover",_.url]}),A.invalidateQueries({queryKey:["/api/collection-warnings"]});try{const je=await Oe("GET",`/api/services/${_.id}`);if(je.ok){const at=await je.json();R(at.data??at)}}catch{}await K(),A.invalidateQueries({queryKey:["/api/services",_.id,"tools"]}),await ge()})()},[D==null?void 0:D.authenticated,e,_==null?void 0:_.id]),x.useEffect(()=>{const le=je=>{const at=je.target;a&&!at.closest(".color-picker-container")&&o(!1)};return document.addEventListener("mousedown",le),()=>{document.removeEventListener("mousedown",le)}},[a]);const De=()=>(t==null?void 0:t.type)==="mcp"?l.jsx(Zy,{className:"w-6 h-6"}):l.jsx(Af,{className:"w-6 h-6"}),J=()=>(t==null?void 0:t.type)==="mcp"?"text-blue-400":"text-purple-400",ce=()=>(t==null?void 0:t.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",Y=le=>new Date(le).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),ze=async le=>{if(t){d(!0),c(le);try{if((await Oe("PUT",`/api/services/${t.id}`,{cardColor:le})).ok)A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]}),A.invalidateQueries({queryKey:["/api/decks"]}),A.invalidateQueries({queryKey:["/api/decks"]}),F({title:"Color updated",description:"Card color has been updated successfully."}),o(!1);else throw new Error("Failed to update color")}catch{c(t.cardColor||"#92E4DD"),F({title:"Update failed",description:"Failed to update card color. Please try again.",variant:"destructive"})}finally{d(!1)}}},te=async()=>{if(!(!t||!p.trim())){S(!0);try{if((await Oe("PUT",`/api/services/${t.id}`,{name:p.trim()})).ok){if(j){const je={...j,name:p.trim()};R(je)}A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]}),A.invalidateQueries({queryKey:["/api/decks"]}),A.invalidateQueries({queryKey:["/api/decks"]}),F({title:"Name updated",description:"Service name has been updated successfully."}),m(!1)}else throw new Error("Failed to update name")}catch{F({title:"Update failed",description:"Failed to update service name. Please try again.",variant:"destructive"})}finally{S(!1)}}},Me=async()=>{if(t){N(!0);try{if((await Oe("PUT",`/api/services/${t.id}`,{description:g.trim()})).ok){if(j){const je={...j,description:g.trim()};R(je)}A.invalidateQueries({queryKey:["/api/services"]}),A.invalidateQueries({queryKey:["/api/collection/warnings"]}),A.invalidateQueries({queryKey:["/api/decks"]}),A.invalidateQueries({queryKey:["/api/decks"]}),F({title:"Description updated",description:"Service description has been updated successfully."}),w(!1)}else throw new Error("Failed to update description")}catch{F({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{N(!1)}}},Ue=[{value:"#92E4DD",label:"Default"},{value:"#F9386D",label:"Red"},{value:"#E0E0E0",label:"Gray"},{value:"#FF6B00",label:"Orange"}];return l.jsx(ao,{open:e,onOpenChange:r,children:l.jsxs(fa,{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(ha,{children:l.jsxs(pa,{className:"text-2xl font-bold flex items-center",children:[De(),l.jsx("div",{className:"ml-3 flex items-center",children:h?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:p,onChange:le=>y(le.target.value),onKeyDown:le=>{le.key==="Enter"?te():le.key==="Escape"&&(m(!1),y((T==null?void 0:T.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(fe,{size:"sm",onClick:te,disabled:b,className:"h-6 px-2 text-xs",children:b?"Saving...":"Save"}),l.jsx(fe,{size:"sm",variant:"outline",onClick:()=>{m(!1),y((T==null?void 0:T.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:()=>m(!0),title:"Click to edit name",children:T==null?void 0:T.name}),l.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>m(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit name",children:l.jsx(Tu,{className:"w-3 h-3"})})]})}),l.jsx(hn,{className:`ml-3 ${ce()} ${J()}`,children:(Dn=t==null?void 0:t.type)==null?void 0:Dn.toUpperCase()})]})}),t&&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(c2,{className:"w-5 h-5 mr-2"}),"Service Overview"]}),l.jsxs("div",{className:"relative color-picker-container",children:[l.jsx(fe,{size:"sm",variant:"outline",className:"h-8 w-8 p-0 border-white/20 hover:bg-white/10",onClick:()=>o(!a),title:"Change card color",children:l.jsx("div",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:i||t.cardColor||"#92E4DD"}})}),a&&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:Ue.map(le=>l.jsxs("button",{className:`flex items-center gap-2 px-2 py-1 rounded text-xs hover:bg-white/10 transition-colors ${(i||t.cardColor)===le.value?"bg-white/20":""}`,onClick:()=>ze(le.value),disabled:u,children:[l.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:le.value}}),l.jsx("span",{className:"text-white",children:le.label}),u&&t.cardColor===le.value&&l.jsx("div",{className:"ml-auto w-3 h-3 border border-white/20 border-t-transparent rounded-full animate-spin"})]},le.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"}),!f&&l.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>w(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit description",children:l.jsx(Tu,{className:"w-3 h-3"})})]}),f?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{value:g,onChange:le=>v(le.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(fe,{size:"sm",onClick:Me,disabled:E,className:"h-6 px-2 text-xs",children:E?"Saving...":"Save"}),l.jsx(fe,{size:"sm",variant:"outline",onClick:()=>{w(!1),v((T==null?void 0:T.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:()=>w(!0),title:"Click to edit description",children:(T==null?void 0:T.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(hn,{variant:"outline",className:"border-blue-500/30 text-blue-300",children:_.type.toUpperCase()}),t.headers&&typeof t.headers=="object"&&Object.keys(t.headers).length>0&&l.jsx(hn,{variant:"outline",className:"border-green-500/30 text-green-300",children:"Custom Headers"})]}),l.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>window.open(_.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:_.url||"No URL available"}),t.headers&&typeof t.headers=="object"&&Object.keys(t.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(t.headers,null,2)})]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Health Status"}),l.jsx(hn,{className:_.health==="healthy"?"bg-green-500/20 text-green-300":_.health==="unhealthy"?"bg-red-500/20 text-red-300":"bg-amber-500/20 text-amber-200",children:_.health==="healthy"?"Healthy":_.health==="unhealthy"?"Unreachable":G.status==="required"||G.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:Y(_.registeredAt)})]})]})]}),_e&&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..."})]}),s&&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:s})}),(t.type==="mcp"||t.type==="local-mcp")&&l.jsxs(l.Fragment,{children:[t.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:UO(_)?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"
|
|
339
|
+
export GOOGLE_DRIVE_MCP_AUTH_PORT=3100
|
|
340
|
+
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(LO,{serviceId:_.id,tools:me,isLoading:oe})]}),t.type==="a2a"&&ee&&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(g2,{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:ee.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:ee.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:ee.description})]}),ee.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:ee.provider.organization})]}),ee.documentationUrl&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),l.jsxs(fe,{size:"sm",variant:"ghost",onClick:()=>window.open(ee.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),ee.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(_1,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[ee.capabilities.streaming&&l.jsx(hn,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),ee.capabilities.pushNotifications&&l.jsx(hn,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),ee.capabilities.stateTransitionHistory&&l.jsx(hn,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),ee.skills&&ee.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(Af,{className:"w-5 h-5 mr-2"}),"Skills (",ee.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:ee.skills.map((le,je)=>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(Af,{className:"w-6 h-6"})}),l.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:le.name}),l.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:le.description}),le.tags&&le.tags.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:le.tags.slice(0,2).map((at,Dt)=>l.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:at},Dt))})]}),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"})]},je))})]}),(ee.defaultInputModes||ee.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(Zy,{className:"w-5 h-5 mr-2"}),"Data Modes"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ee.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:ee.defaultInputModes.map((le,je)=>l.jsx(hn,{className:"bg-blue-500/20 text-blue-300 text-xs",children:le},je))})]}),ee.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:ee.defaultOutputModes.map((le,je)=>l.jsx(hn,{className:"bg-green-500/20 text-green-300 text-xs",children:le},je))})]})]})]})]}),(t==null?void 0:t.type)==="mcp"&&G.status==="not_required"&&(_==null?void 0:_.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(_0,{serviceId:_.id})]}),(t==null?void 0:t.type)==="mcp"&&G.status!=="authenticated"&&G.status!=="not_required"&&l.jsxs("div",{className:`${G.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:`${G.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:G.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),l.jsxs("div",{className:`${G.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[l.jsx("p",{children:l.jsx("strong",{children:G.message})}),l.jsx("p",{children:G.status==="expired"?"Your OAuth token has expired. Please re-authenticate to continue using this service.":"This MCP server requires OAuth authentication to access its tools. Please authenticate to continue."}),(_==null?void 0:_.id)&&l.jsx(_0,{serviceId:_.id,onConnected:()=>void L()}),((ya=(ms=C==null?void 0:C.data)==null?void 0:ms.oauth)==null?void 0:ya.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:"})," ",C.data.oauth.resourceName]})})]})]}),(t==null?void 0:t.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: ",t==null?void 0:t.id]}),l.jsxs("p",{children:["Service URL: ",_==null?void 0:_.url]}),l.jsxs("p",{children:["Status: ",oe?"🔄 Loading...":ve?"❌ Failed":"✅ Complete"]})]}),oe&&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/",t==null?void 0:t.id,"/tools"]})]}),l.jsxs("p",{children:["Target MCP server: ",l.jsx("code",{children:_==null?void 0:_.url})]})]}),ve&&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:ve instanceof Error?ve.message:String(ve)}),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: ",t==null?void 0:t.id]}),l.jsxs("p",{children:["• Target URL: ",_==null?void 0:_.url]}),l.jsxs("p",{children:["• Request: GET /api/services/",t==null?void 0:t.id,"/tools"]}),(_==null?void 0:_.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(_.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 ",_==null?void 0:_.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"})]})]})]}),!oe&&!ve&&me.length>0&&l.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:l.jsxs("p",{children:["✅ Successfully discovered ",me.length," tools from MCP server"]})}),!oe&&!ve&&me.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"})]})]})]}),ve&&(t.type==="mcp"||t.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:ve instanceof Error?ve.message:String(ve)}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service URL:"})," ",_==null?void 0:_.url]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service ID:"})," ",_==null?void 0:_.id]}),(_==null?void 0:_.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(_.headers,null,2)})]})]})]}),ke&&t.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:ke instanceof Error?ke.message:String(ke)}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service URL:"})," ",_==null?void 0:_.url]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service ID:"})," ",_==null?void 0:_.id]})]})]}),!_e&&!ve&&!ke&&(t.type==="mcp"||t.type==="local-mcp")&&me.length===0&&(t.type==="local-mcp"||!((ne=(vs=C==null?void 0:C.data)==null?void 0:vs.oauth)!=null&&ne.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 ",_==null?void 0:_.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"})]})]})]}),(t.type==="mcp"||t.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:"})," ",_==null?void 0:_.url]}),z&&l.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:l.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),C&&l.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 What we discovered:"})}),C.error&&C.analysis&&l.jsxs("div",{className:"text-yellow-200",children:[C.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"})]}),C.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"})]}),C.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"})]}),C.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"})]}),C.analysis.message&&l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Analysis:"})," ",C.analysis.message]})]}),((Mn=(Et=C==null?void 0:C.data)==null?void 0:Et.oauth)==null?void 0:Mn.required)&&l.jsxs("div",{className:"text-yellow-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),C.data.oauth.authorizationUrl&&l.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[l.jsx(fe,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var le,je;if(_!=null&&_.id)try{F({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const at=await Oe("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!at.ok){const Nt=await at.json();(le=Nt.data)!=null&&le.registrationUrl?(window.open(Nt.data.registrationUrl,"_blank"),F({title:"OAuth Registration Required",description:`${Nt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):F({title:"OAuth Setup Failed",description:Nt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Dt=await at.json();Dt.success&&((je=Dt.data)!=null&&je.authorizationUrl)?(window.open(Dt.data.authorizationUrl,"_blank"),F({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),L()):F({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(at){F({title:"OAuth Setup Failed",description:at instanceof Error?at.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsxs(fe,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(C.data.oauth.authorizationUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!C.data.oauth.authorizationUrl&&C.data.oauth.protectedResourceConfigUrl&&l.jsx("div",{className:"mt-2",children:l.jsxs(fe,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(C.data.oauth.protectedResourceConfigUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),C.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(C.data.oauth.authorizationServerMetadataUrl,"_blank"),children:C.data.oauth.authorizationServerMetadataUrl})]})]}),(C==null?void 0:C.success)&&!((Yl=($n=C==null?void 0:C.data)==null?void 0:$n.oauth)!=null&&Yl.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"})]}),((Xl=(Jl=C==null?void 0:C.data)==null?void 0:Jl.oauth)==null?void 0:Xl.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"}),C.data.oauth.resourceName&&l.jsxs("p",{children:["• Service: ",C.data.oauth.resourceName]}),C.data.oauth.authorizationUrl&&l.jsxs("p",{children:["• Authorization URL: ",C.data.oauth.authorizationUrl]}),C.data.oauth.tokenUrl&&l.jsxs("p",{children:["• Token URL: ",C.data.oauth.tokenUrl]}),l.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[l.jsx(fe,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var le,je;if(_!=null&&_.id)try{F({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const at=await Oe("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!at.ok){const Nt=await at.json();(le=Nt.data)!=null&&le.registrationUrl?(window.open(Nt.data.registrationUrl,"_blank"),F({title:"OAuth Registration Required",description:`${Nt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):F({title:"OAuth Setup Failed",description:Nt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Dt=await at.json();Dt.success&&((je=Dt.data)!=null&&je.authorizationUrl)?(window.open(Dt.data.authorizationUrl,"_blank"),F({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),L()):F({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(at){F({title:"OAuth Setup Failed",description:at instanceof Error?at.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsx(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const le=`OAuth Setup Instructions:
|
|
331
341
|
|
|
332
342
|
1. Go to the service provider's OAuth/Developer settings
|
|
333
343
|
2. Create a new OAuth application
|
|
@@ -337,8 +347,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
337
347
|
|
|
338
348
|
${C.data.oauth.authorizationUrl?`Authorization URL: ${C.data.oauth.authorizationUrl}`:""}
|
|
339
349
|
${C.data.oauth.tokenUrl?`Token URL: ${C.data.oauth.tokenUrl}`:""}
|
|
340
|
-
${C.data.oauth.issuer?`Issuer: ${C.data.oauth.issuer}`:""}`;F({title:"OAuth Setup Instructions",description:le,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"})]})]})]}),U&&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:U instanceof Error?U.message:String(U)})]})]})]}),!_e&&!ve&&!ke&&t.type==="a2a"&&!ee&&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 ",_==null?void 0:_.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 IO(){const[t,e]=x.useState("connecting"),[r,s]=x.useState(null),n=x.useRef(null),a=x.useRef(null),o=yr();return x.useEffect(()=>{const c=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws/events`,u=()=>{try{const d=new WebSocket(c);n.current=d,d.onopen=()=>{console.log("WebSocket connected"),e("connected")},d.onmessage=h=>{try{const m=JSON.parse(h.data);s(m),m.type==="deck_update"?(console.log("Received deck update:",m),o.invalidateQueries({queryKey:["/api/decks"]}),o.invalidateQueries({queryKey:["/api/decks"]})):m.type==="service_update"?(console.log("Received service update:",m),o.invalidateQueries({queryKey:["/api/services"]}),o.invalidateQueries({queryKey:["/api/collection/warnings"]})):m.type==="connection_status"&&e(m.status==="connected"?"connected":"disconnected")}catch(m){console.error("Failed to parse WebSocket message:",m)}},d.onclose=()=>{console.log("WebSocket disconnected"),e("disconnected"),a.current=setTimeout(()=>{console.log("Attempting to reconnect WebSocket..."),e("connecting"),u()},3e3)},d.onerror=h=>{console.error("WebSocket error:",h),e("disconnected")}}catch(d){console.error("Failed to connect WebSocket:",d),e("disconnected")}};return u(),()=>{a.current&&clearTimeout(a.current),n.current&&n.current.readyState===WebSocket.OPEN&&n.current.close()}},[o]),{connectionStatus:t,lastMessage:r}}async function w0(t,e){const r=t==="credential"?`credentialId=${encodeURIComponent(e)}`:`serviceId=${encodeURIComponent(e)}`;return(await(await Oe("GET",`/api/playbooks/dependents/check?${r}`)).json()).data??[]}function DO(t){const[e,r]=x.useState(null),[s,n]=x.useState(null),[a,o]=x.useState(null),[i,c]=x.useState(!1),u=yr(),{toast:d}=or(),h=()=>{if(!t)throw new Error("Select a deck to edit first");return t},m=At({mutationFn:async T=>{var K,P,D;const _=h(),z=(K=(await(await Oe("GET","/api/decks")).json()).data)==null?void 0:K.find(L=>L.id===_);if(!z)throw new Error("Selected deck not found");if((P=z.services)!=null&&P.some(L=>L.id===T))throw new Error("Service is already in the deck");const U=((D=z.services)==null?void 0:D.length)??0;return Oe("POST",`/api/decks/${_}/services`,{serviceId:T,position:U})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service added to deck",description:`${(e==null?void 0:e.name)||"Service"} has been added to the deck.`})},onError:T=>{d({title:"Failed to add service",description:T.message,variant:"destructive"})}}),f=At({mutationFn:async T=>{var U,K;const _=h(),z=(U=(await(await Oe("GET","/api/decks")).json()).data)==null?void 0:U.find(P=>P.id===_);if((K=z==null?void 0:z.credentials)!=null&&K.some(P=>P.id===T))throw new Error("API key is already in the deck");return Oe("POST",`/api/decks/${_}/credentials`,{credentialId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key added to deck",description:`${(s==null?void 0:s.label)||"API key"} is scoped to this deck.`})},onError:T=>{d({title:"Failed to add API key",description:T.message,variant:"destructive"})}}),w=At({mutationFn:async T=>{var U,K;const _=h(),z=(U=(await(await Oe("GET","/api/decks")).json()).data)==null?void 0:U.find(P=>P.id===_);if((K=z==null?void 0:z.playbooks)!=null&&K.some(P=>P.id===T))throw new Error("Playbook is already in the deck");return Oe("POST",`/api/decks/${_}/playbooks`,{playbookId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook added to deck",description:`${(a==null?void 0:a.title)||"Playbook"} is on this deck.`})},onError:T=>{d({title:"Failed to add playbook",description:T.message,variant:"destructive"})}}),p=At({mutationFn:async T=>{const _=await w0("service",T);if(_.length>0){const C=_.map(U=>U.title).join(", ");if(!window.confirm(`Warning: ${_.length} playbook(s) depend on this MCP (${C}). Remove from deck anyway?`))throw new Error("Cancelled")}const I=h();return Oe("DELETE",`/api/decks/${I}/services`,{serviceId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service removed from deck",description:`${(e==null?void 0:e.name)||"Service"} has been removed from the deck.`})},onError:T=>{T.message!=="Cancelled"&&d({title:"Failed to remove service",description:T.message,variant:"destructive"})}}),v=At({mutationFn:async T=>{const _=await w0("credential",T);if(_.length>0){const C=_.map(U=>U.title).join(", ");if(!window.confirm(`Warning: ${_.length} playbook(s) depend on this API key (${C}). Remove from deck anyway?`))throw new Error("Cancelled")}const I=h();return Oe("DELETE",`/api/decks/${I}/credentials`,{credentialId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key removed from deck",description:`${(s==null?void 0:s.label)||"API key"} is no longer on this deck.`})},onError:T=>{T.message!=="Cancelled"&&d({title:"Failed to remove API key",description:T.message,variant:"destructive"})}}),y=At({mutationFn:async T=>{const _=h();return Oe("DELETE",`/api/decks/${_}/playbooks`,{playbookId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook removed from deck",description:`${(a==null?void 0:a.title)||"Playbook"} is no longer on this deck.`})},onError:T=>{d({title:"Failed to remove playbook",description:T.message,variant:"destructive"})}}),g=(T,_)=>{T.currentTarget instanceof HTMLElement&&(T.currentTarget.style.opacity=_)},b=(T,_)=>{T.dataTransfer.setData("text/plain",_.id),T.dataTransfer.setData("application/json",JSON.stringify(_)),T.dataTransfer.effectAllowed=_.fromDeck?"move":"copy"},S=(T,_,I=!1)=>{r(_),n(null),o(null),c(I),b(T,{kind:"service",id:_.id,fromDeck:I}),g(T,"0.5")},E=(T,_,I=!1)=>{n(_),r(null),o(null),c(I),b(T,{kind:"credential",id:_.id,fromDeck:I}),g(T,"0.5")},N=(T,_,I=!1)=>{o(_),r(null),n(null),c(I),b(T,{kind:"playbook",id:_.id,fromDeck:I}),g(T,"0.5")},j=T=>{r(null),n(null),o(null),g(T,"1")},R=T=>{if(T.kind==="service"){T.fromDeck?p.mutate(T.id):m.mutate(T.id);return}if(T.kind==="credential"){T.fromDeck?v.mutate(T.id):f.mutate(T.id);return}T.fromDeck?y.mutate(T.id):w.mutate(T.id)};return{draggedService:e,draggedCredential:s,draggedPlaybook:a,isDraggingFromDeck:i,handleDragStart:S,handleCredentialDragStart:E,handlePlaybookDragStart:N,handleDragEnd:j,handleDrop:T=>{T.preventDefault();const _=T.dataTransfer.getData("application/json");if(_){try{R(JSON.parse(_))}catch{const I=T.dataTransfer.getData("text/plain");I&&e&&m.mutate(I)}r(null),n(null),o(null),c(!1)}},handleGlobalDrop:T=>{T.preventDefault();const _=T.dataTransfer.getData("application/json");if(_){try{const I=JSON.parse(_);I.fromDeck&&R(I)}catch{}r(null),n(null),o(null),c(!1)}},isDropping:m.isPending||f.isPending||w.isPending||p.isPending||v.isPending||y.isPending}}const Hf="agent-deck-editing-deck-id";function MO(t){const[e,r]=x.useState(()=>typeof window>"u"?null:localStorage.getItem(Hf));x.useEffect(()=>{if(t.length===0)return;if(!(e&&t.some(o=>o.id===e))){const o=t[0].id;r(o),localStorage.setItem(Hf,o)}},[t,e]);const s=a=>{r(a),localStorage.setItem(Hf,a)};return{editingDeck:t.find(a=>a.id===e)??null,editingDeckId:e,setEditingDeckId:s}}function b0(t,[e,r]){return Math.min(r,Math.max(e,t))}var $O=[" ","Enter","ArrowUp","ArrowDown"],FO=[" ","Enter"],Za="Select",[Ld,Ud,LO]=fv(Za),[Pi,xF]=ds(Za,[LO,Ad]),zd=Ad(),[UO,ma]=Pi(Za),[zO,VO]=Pi(Za),P_=t=>{const{__scopeSelect:e,children:r,open:s,defaultOpen:n,onOpenChange:a,value:o,defaultValue:i,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:f,form:w}=t,p=zd(e),[v,y]=x.useState(null),[g,b]=x.useState(null),[S,E]=x.useState(!1),N=Ov(u),[j,R]=Wa({prop:s,defaultProp:n??!1,onChange:a,caller:Za}),[A,F]=Wa({prop:o,defaultProp:i,onChange:c,caller:Za}),T=x.useRef(null),_=v?w||!!v.closest("form"):!0,[I,C]=x.useState(new Set),z=Array.from(I).map(U=>U.props.value).join(";");return l.jsx(mT,{...p,children:l.jsxs(UO,{required:f,scope:e,trigger:v,onTriggerChange:y,valueNode:g,onValueNodeChange:b,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:ea(),value:A,onValueChange:F,open:j,onOpenChange:R,dir:N,triggerPointerDownPosRef:T,disabled:m,children:[l.jsx(Ld.Provider,{scope:e,children:l.jsx(zO,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(U=>{C(K=>new Set(K).add(U))},[]),onNativeOptionRemove:x.useCallback(U=>{C(K=>{const P=new Set(K);return P.delete(U),P})},[]),children:r})}),_?l.jsxs(Z_,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:h,value:A,onChange:U=>F(U.target.value),disabled:m,form:w,children:[A===void 0?l.jsx("option",{value:""}):null,Array.from(I)]},z):null]})})};P_.displayName=Za;var k_="SelectTrigger",N_=x.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:s=!1,...n}=t,a=zd(r),o=ma(k_,r),i=o.disabled||s,c=et(e,o.onTriggerChange),u=Ud(r),d=x.useRef("touch"),[h,m,f]=J_(p=>{const v=u().filter(b=>!b.disabled),y=v.find(b=>b.value===o.value),g=X_(v,p,y);g!==void 0&&o.onValueChange(g.value)}),w=p=>{i||(o.onOpenChange(!0),f()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return l.jsx(rS,{asChild:!0,...a,children:l.jsx(Ae.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":Y_(o.value)?"":void 0,...n,ref:c,onClick:Se(n.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&w(p)}),onPointerDown:Se(n.onPointerDown,p=>{d.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(w(p),p.preventDefault())}),onKeyDown:Se(n.onKeyDown,p=>{const v=h.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(v&&p.key===" ")&&$O.includes(p.key)&&(w(),p.preventDefault())})})})});N_.displayName=k_;var j_="SelectValue",R_=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:s,style:n,children:a,placeholder:o="",...i}=t,c=ma(j_,r),{onValueNodeHasChildrenChange:u}=c,d=a!==void 0,h=et(e,c.onValueNodeChange);return Bt(()=>{u(d)},[u,d]),l.jsx(Ae.span,{...i,ref:h,style:{pointerEvents:"none"},children:Y_(c.value)?l.jsx(l.Fragment,{children:o}):a})});R_.displayName=j_;var qO="SelectIcon",T_=x.forwardRef((t,e)=>{const{__scopeSelect:r,children:s,...n}=t;return l.jsx(Ae.span,{"aria-hidden":!0,...n,ref:e,children:s||"▼"})});T_.displayName=qO;var HO="SelectPortal",A_=t=>l.jsx(_d,{asChild:!0,...t});A_.displayName=HO;var Ya="SelectContent",O_=x.forwardRef((t,e)=>{const r=ma(Ya,t.__scopeSelect),[s,n]=x.useState();if(Bt(()=>{n(new DocumentFragment)},[]),!r.open){const a=s;return a?so.createPortal(l.jsx(I_,{scope:t.__scopeSelect,children:l.jsx(Ld.Slot,{scope:t.__scopeSelect,children:l.jsx("div",{children:t.children})})}),a):null}return l.jsx(D_,{...t,ref:e})});O_.displayName=Ya;var Qr=10,[I_,va]=Pi(Ya),BO="SelectContentImpl",KO=fi("SelectContent.RemoveScroll"),D_=x.forwardRef((t,e)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:a,onPointerDownOutside:o,side:i,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:w,hideWhenDetached:p,avoidCollisions:v,...y}=t,g=ma(Ya,r),[b,S]=x.useState(null),[E,N]=x.useState(null),j=et(e,re=>S(re)),[R,A]=x.useState(null),[F,T]=x.useState(null),_=Ud(r),[I,C]=x.useState(!1),z=x.useRef(!1);x.useEffect(()=>{if(b)return CS(b)},[b]),vS();const U=x.useCallback(re=>{const[ye,...ke]=_().map(_e=>_e.ref.current),[me]=ke.slice(-1),ee=document.activeElement;for(const _e of re)if(_e===ee||(_e==null||_e.scrollIntoView({block:"nearest"}),_e===ye&&E&&(E.scrollTop=0),_e===me&&E&&(E.scrollTop=E.scrollHeight),_e==null||_e.focus(),document.activeElement!==ee))return},[_,E]),K=x.useCallback(()=>U([R,b]),[U,R,b]);x.useEffect(()=>{I&&K()},[I,K]);const{onOpenChange:P,triggerPointerDownPosRef:D}=g;x.useEffect(()=>{if(b){let re={x:0,y:0};const ye=me=>{var ee,_e;re={x:Math.abs(Math.round(me.pageX)-(((ee=D.current)==null?void 0:ee.x)??0)),y:Math.abs(Math.round(me.pageY)-(((_e=D.current)==null?void 0:_e.y)??0))}},ke=me=>{re.x<=10&&re.y<=10?me.preventDefault():b.contains(me.target)||P(!1),document.removeEventListener("pointermove",ye),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[b,P,D]),x.useEffect(()=>{const re=()=>P(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[P]);const[L,J]=J_(re=>{const ye=_().filter(ee=>!ee.disabled),ke=ye.find(ee=>ee.ref.current===document.activeElement),me=X_(ye,re,ke);me&&setTimeout(()=>me.ref.current.focus())}),Z=x.useCallback((re,ye,ke)=>{const me=!z.current&&!ke;(g.value!==void 0&&g.value===ye||me)&&(A(re),me&&(z.current=!0))},[g.value]),B=x.useCallback(()=>b==null?void 0:b.focus(),[b]),oe=x.useCallback((re,ye,ke)=>{const me=!z.current&&!ke;(g.value!==void 0&&g.value===ye||me)&&T(re)},[g.value]),ve=s==="popper"?wp:M_,ge=ve===wp?{side:i,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:w,hideWhenDetached:p,avoidCollisions:v}:{};return l.jsx(I_,{scope:r,content:b,viewport:E,onViewportChange:N,itemRefCallback:Z,selectedItem:R,onItemLeave:B,itemTextRefCallback:oe,focusSelectedItem:K,selectedItemText:F,position:s,isPositioned:I,searchRef:L,children:l.jsx(jv,{as:KO,allowPinchZoom:!0,children:l.jsx(Nv,{asChild:!0,trapped:g.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Se(n,re=>{var ye;(ye=g.trigger)==null||ye.focus({preventScroll:!0}),re.preventDefault()}),children:l.jsx(zl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:l.jsx(ve,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:re=>re.preventDefault(),...y,...ge,onPlaced:()=>C(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Se(y.onKeyDown,re=>{const ye=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ye&&re.key.length===1&&J(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let me=_().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);if(["ArrowUp","End"].includes(re.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const ee=re.target,_e=me.indexOf(ee);me=me.slice(_e+1)}setTimeout(()=>U(me)),re.preventDefault()}})})})})})})});D_.displayName=BO;var WO="SelectItemAlignedPosition",M_=x.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:s,...n}=t,a=ma(Ya,r),o=va(Ya,r),[i,c]=x.useState(null),[u,d]=x.useState(null),h=et(e,j=>d(j)),m=Ud(r),f=x.useRef(!1),w=x.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:y,focusSelectedItem:g}=o,b=x.useCallback(()=>{if(a.trigger&&a.valueNode&&i&&u&&p&&v&&y){const j=a.trigger.getBoundingClientRect(),R=u.getBoundingClientRect(),A=a.valueNode.getBoundingClientRect(),F=y.getBoundingClientRect();if(a.dir!=="rtl"){const ee=F.left-R.left,_e=A.left-ee,Pe=j.left-_e,De=j.width+Pe,X=Math.max(De,R.width),ce=window.innerWidth-Qr,Y=b0(_e,[Qr,Math.max(Qr,ce-X)]);i.style.minWidth=De+"px",i.style.left=Y+"px"}else{const ee=R.right-F.right,_e=window.innerWidth-A.right-ee,Pe=window.innerWidth-j.right-_e,De=j.width+Pe,X=Math.max(De,R.width),ce=window.innerWidth-Qr,Y=b0(_e,[Qr,Math.max(Qr,ce-X)]);i.style.minWidth=De+"px",i.style.right=Y+"px"}const T=m(),_=window.innerHeight-Qr*2,I=p.scrollHeight,C=window.getComputedStyle(u),z=parseInt(C.borderTopWidth,10),U=parseInt(C.paddingTop,10),K=parseInt(C.borderBottomWidth,10),P=parseInt(C.paddingBottom,10),D=z+U+I+P+K,L=Math.min(v.offsetHeight*5,D),J=window.getComputedStyle(p),Z=parseInt(J.paddingTop,10),B=parseInt(J.paddingBottom,10),oe=j.top+j.height/2-Qr,ve=_-oe,ge=v.offsetHeight/2,re=v.offsetTop+ge,ye=z+U+re,ke=D-ye;if(ye<=oe){const ee=T.length>0&&v===T[T.length-1].ref.current;i.style.bottom="0px";const _e=u.clientHeight-p.offsetTop-p.offsetHeight,Pe=Math.max(ve,ge+(ee?B:0)+_e+K),De=ye+Pe;i.style.height=De+"px"}else{const ee=T.length>0&&v===T[0].ref.current;i.style.top="0px";const Pe=Math.max(oe,z+p.offsetTop+(ee?Z:0)+ge)+ke;i.style.height=Pe+"px",p.scrollTop=ye-oe+p.offsetTop}i.style.margin=`${Qr}px 0`,i.style.minHeight=L+"px",i.style.maxHeight=_+"px",s==null||s(),requestAnimationFrame(()=>f.current=!0)}},[m,a.trigger,a.valueNode,i,u,p,v,y,a.dir,s]);Bt(()=>b(),[b]);const[S,E]=x.useState();Bt(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const N=x.useCallback(j=>{j&&w.current===!0&&(b(),g==null||g(),w.current=!1)},[b,g]);return l.jsx(GO,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:f,onScrollButtonChange:N,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:l.jsx(Ae.div,{...n,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});M_.displayName=WO;var QO="SelectPopperPosition",wp=x.forwardRef((t,e)=>{const{__scopeSelect:r,align:s="start",collisionPadding:n=Qr,...a}=t,o=zd(r);return l.jsx(nS,{...o,...a,ref:e,align:s,collisionPadding:n,style:{boxSizing:"border-box",...a.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)"}})});wp.displayName=QO;var[GO,$v]=Pi(Ya,{}),bp="SelectViewport",$_=x.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:s,...n}=t,a=va(bp,r),o=$v(bp,r),i=et(e,a.onViewportChange),c=x.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:s}),l.jsx(Ld.Slot,{scope:r,children:l.jsx(Ae.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:Se(n.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const f=Math.abs(c.current-d.scrollTop);if(f>0){const w=window.innerHeight-Qr*2,p=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),y=Math.max(p,v);if(y<w){const g=y+f,b=Math.min(w,g),S=g-b;h.style.height=b+"px",h.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});$_.displayName=bp;var F_="SelectGroup",[ZO,YO]=Pi(F_),JO=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=ea();return l.jsx(ZO,{scope:r,id:n,children:l.jsx(Ae.div,{role:"group","aria-labelledby":n,...s,ref:e})})});JO.displayName=F_;var L_="SelectLabel",U_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=YO(L_,r);return l.jsx(Ae.div,{id:n.id,...s,ref:e})});U_.displayName=L_;var Fu="SelectItem",[XO,z_]=Pi(Fu),V_=x.forwardRef((t,e)=>{const{__scopeSelect:r,value:s,disabled:n=!1,textValue:a,...o}=t,i=ma(Fu,r),c=va(Fu,r),u=i.value===s,[d,h]=x.useState(a??""),[m,f]=x.useState(!1),w=et(e,g=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,g,s,n)}),p=ea(),v=x.useRef("touch"),y=()=>{n||(i.onValueChange(s),i.onOpenChange(!1))};if(s==="")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(XO,{scope:r,value:s,disabled:n,textId:p,isSelected:u,onItemTextChange:x.useCallback(g=>{h(b=>b||((g==null?void 0:g.textContent)??"").trim())},[]),children:l.jsx(Ld.ItemSlot,{scope:r,value:s,disabled:n,textValue:d,children:l.jsx(Ae.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...o,ref:w,onFocus:Se(o.onFocus,()=>f(!0)),onBlur:Se(o.onBlur,()=>f(!1)),onClick:Se(o.onClick,()=>{v.current!=="mouse"&&y()}),onPointerUp:Se(o.onPointerUp,()=>{v.current==="mouse"&&y()}),onPointerDown:Se(o.onPointerDown,g=>{v.current=g.pointerType}),onPointerMove:Se(o.onPointerMove,g=>{var b;v.current=g.pointerType,n?(b=c.onItemLeave)==null||b.call(c):v.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(o.onPointerLeave,g=>{var b;g.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:Se(o.onKeyDown,g=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&g.key===" "||(FO.includes(g.key)&&y(),g.key===" "&&g.preventDefault())})})})})});V_.displayName=Fu;var Wi="SelectItemText",q_=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:s,style:n,...a}=t,o=ma(Wi,r),i=va(Wi,r),c=z_(Wi,r),u=VO(Wi,r),[d,h]=x.useState(null),m=et(e,y=>h(y),c.onItemTextChange,y=>{var g;return(g=i.itemTextRefCallback)==null?void 0:g.call(i,y,c.value,c.disabled)}),f=d==null?void 0:d.textContent,w=x.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return Bt(()=>(p(w),()=>v(w)),[p,v,w]),l.jsxs(l.Fragment,{children:[l.jsx(Ae.span,{id:c.textId,...a,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?so.createPortal(a.children,o.valueNode):null]})});q_.displayName=Wi;var H_="SelectItemIndicator",B_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t;return z_(H_,r).isSelected?l.jsx(Ae.span,{"aria-hidden":!0,...s,ref:e}):null});B_.displayName=H_;var Sp="SelectScrollUpButton",K_=x.forwardRef((t,e)=>{const r=va(Sp,t.__scopeSelect),s=$v(Sp,t.__scopeSelect),[n,a]=x.useState(!1),o=et(e,s.onScrollButtonChange);return Bt(()=>{if(r.viewport&&r.isPositioned){let i=function(){const u=c.scrollTop>0;a(u)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?l.jsx(Q_,{...t,ref:o,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});K_.displayName=Sp;var _p="SelectScrollDownButton",W_=x.forwardRef((t,e)=>{const r=va(_p,t.__scopeSelect),s=$v(_p,t.__scopeSelect),[n,a]=x.useState(!1),o=et(e,s.onScrollButtonChange);return Bt(()=>{if(r.viewport&&r.isPositioned){let i=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;a(d)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?l.jsx(Q_,{...t,ref:o,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});W_.displayName=_p;var Q_=x.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:s,...n}=t,a=va("SelectScrollButton",r),o=x.useRef(null),i=Ud(r),c=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),Bt(()=>{var d;const u=i().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[i]),l.jsx(Ae.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:Se(n.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:Se(n.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:Se(n.onPointerLeave,()=>{c()})})}),eI="SelectSeparator",G_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t;return l.jsx(Ae.div,{"aria-hidden":!0,...s,ref:e})});G_.displayName=eI;var Ep="SelectArrow",tI=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=zd(r),a=ma(Ep,r),o=va(Ep,r);return a.open&&o.position==="popper"?l.jsx(sS,{...n,...s,ref:e}):null});tI.displayName=Ep;var rI="SelectBubbleInput",Z_=x.forwardRef(({__scopeSelect:t,value:e,...r},s)=>{const n=x.useRef(null),a=et(s,n),o=p_(e);return x.useEffect(()=>{const i=n.current;if(!i)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&d){const h=new Event("change",{bubbles:!0});d.call(i,e),i.dispatchEvent(h)}},[o,e]),l.jsx(Ae.select,{...r,style:{...Zb,...r.style},ref:a,defaultValue:e})});Z_.displayName=rI;function Y_(t){return t===""||t===void 0}function J_(t){const e=Ur(t),r=x.useRef(""),s=x.useRef(0),n=x.useCallback(o=>{const i=r.current+o;e(i),function c(u){r.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(i)},[e]),a=x.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,n,a]}function X_(t,e,r){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,a=r?t.indexOf(r):-1;let o=nI(t,Math.max(a,0));n.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return c!==r?c:void 0}function nI(t,e){return t.map((r,s)=>t[(e+s)%t.length])}var sI=P_,eE=N_,aI=R_,oI=T_,iI=A_,tE=O_,lI=$_,rE=U_,nE=V_,cI=q_,uI=B_,sE=K_,aE=W_,oE=G_;const dI=sI,fI=aI,iE=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(eE,{ref:s,className:Te("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",t),...r,children:[e,l.jsx(oI,{asChild:!0,children:l.jsx(gv,{className:"h-4 w-4 opacity-50"})})]}));iE.displayName=eE.displayName;const lE=x.forwardRef(({className:t,...e},r)=>l.jsx(sE,{ref:r,className:Te("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(o2,{className:"h-4 w-4"})}));lE.displayName=sE.displayName;const cE=x.forwardRef(({className:t,...e},r)=>l.jsx(aE,{ref:r,className:Te("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(gv,{className:"h-4 w-4"})}));cE.displayName=aE.displayName;const uE=x.forwardRef(({className:t,children:e,position:r="popper",...s},n)=>l.jsx(iI,{children:l.jsxs(tE,{ref:n,className:Te("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",t),position:r,...s,children:[l.jsx(lE,{}),l.jsx(lI,{className:Te("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(cE,{})]})}));uE.displayName=tE.displayName;const hI=x.forwardRef(({className:t,...e},r)=>l.jsx(rE,{ref:r,className:Te("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));hI.displayName=rE.displayName;const po=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(nE,{ref:s,className:Te("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",t),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(uI,{children:l.jsx(w1,{className:"h-4 w-4"})})}),l.jsx(cI,{children:e})]}));po.displayName=nE.displayName;const pI=x.forwardRef(({className:t,...e},r)=>l.jsx(oE,{ref:r,className:Te("-mx-1 my-1 h-px bg-muted",t),...e}));pI.displayName=oE.displayName;const mI="/assets/AgentDeckLogo2-z3pVqJJ3.png";function vI(){var ps,ya,ms;const[t,e]=x.useState(""),[r,s]=x.useState(""),[n,a]=x.useState(!1),[o,i]=x.useState(!1),[c,u]=x.useState(null),[d,h]=x.useState(!1),[m,f]=x.useState(!1),[w,p]=x.useState(null),[v,y]=x.useState(!1),[g,b]=x.useState(!1),[S,E]=x.useState(null),[N,j]=x.useState(!1),[R,A]=x.useState(null),{toast:F}=or(),{connectionStatus:T}=IO(),{data:_,isLoading:I,error:C}=hr({queryKey:["/api/decks"]}),z=(_==null?void 0:_.data)||[],{editingDeck:U,editingDeckId:K,setEditingDeckId:P}=MO(z),{handleDragStart:D,handleCredentialDragStart:L,handlePlaybookDragStart:J,handleDragEnd:Z,handleDrop:B,handleGlobalDrop:oe,isDraggingFromDeck:ve}=DO(K),{data:ge,isLoading:re,error:ye}=hr({queryKey:["/api/services"]}),{data:ke,isLoading:me}=hr({queryKey:["/api/credentials/vault"]}),{data:ee,isLoading:_e}=hr({queryKey:["/api/playbooks/vault"]}),{data:Pe}=hr({queryKey:["/api/collection/warnings"],staleTime:6e4}),De=(ge==null?void 0:ge.data)||[],X=(ke==null?void 0:ke.data)||[],ce=(ee==null?void 0:ee.data)||[],Y=x.useMemo(()=>MT(Pe==null?void 0:Pe.data),[Pe==null?void 0:Pe.data]),ze=(ne,Et)=>n?ne==="service"?Y.serviceWarnings.has(Et):ne==="credential"?Y.credentialWarnings.has(Et):Y.playbookWarnings.has(Et):!0,te=De.filter(ne=>{var $n;if(!ze("service",ne.id)||r==="api-key"||r==="playbook")return!1;const Et=ne.name.toLowerCase().includes(t.toLowerCase())||(($n=ne.description)==null?void 0:$n.toLowerCase().includes(t.toLowerCase())),Mn=!r||r==="all"||ne.type===r;return Et&&Mn}),Me=X.filter(ne=>!ze("credential",ne.id)||r&&r!=="all"&&r!=="api-key"?!1:ne.label.toLowerCase().includes(t.toLowerCase())),Ue=ce.filter(ne=>!ze("playbook",ne.id)||r&&r!=="all"&&r!=="playbook"?!1:ne.title.toLowerCase().includes(t.toLowerCase())||ne.body.toLowerCase().includes(t.toLowerCase())),Ne=te.length+Me.length+Ue.length;ye&&console.error("Services error:",ye),C&&console.error("Decks error:",C);const rt=()=>{e(""),s(""),a(!1)},pt=!!(t||r||n),Hr=new Set(((U==null?void 0:U.credentials)??[]).map(ne=>ne.id)),zt=new Set(((U==null?void 0:U.playbooks)??[]).map(ne=>ne.id)),fs=(U==null?void 0:U.services)||[],oo=(U==null?void 0:U.playbooks)||[],Yt=ne=>{u(ne),h(!0)},Br=ne=>{E(ne.id),j(!0)},hs=ne=>{p(ne.id),y(!0)},jr=ne=>{A(ne)};if(ye||C){const ne=(C instanceof Error?C.message:null)??(ye instanceof Error?ye.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:ne}),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 re||I||me||_e?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:oe,onDragOver:ne=>ne.preventDefault(),style:{position:"relative",...ve&&{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("div",{className:"w-16 h-16 rounded-xl flex items-center justify-center shadow-lg overflow-hidden",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)"},children:l.jsx("img",{src:mI,alt:"Agent Deck Logo",className:"w-14 h-14 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 ${T==="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 ${T==="connected"?"bg-emerald-400":"bg-red-400"}`}),l.jsx("button",{className:`text-sm hover:underline cursor-pointer ${T==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{F({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"})]}),U&&l.jsx("div",{className:"px-4 py-2 rounded-lg border",style:{backgroundColor:"rgba(196, 182, 67, 0.2)",borderColor:"rgba(196, 182, 67, 0.4)"},children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("i",{className:"fas fa-star",style:{color:"#C4B643"}}),l.jsx("span",{className:"text-sm font-medium","data-testid":"editing-deck-name",style:{color:"#92E4DD"},children:U.name}),l.jsxs("span",{className:"text-xs",style:{color:"#92E4DD",opacity:.7},"data-testid":"editing-deck-count",children:[(((ps=U.services)==null?void 0:ps.length)??0)+(((ya=U.credentials)==null?void 0:ya.length)??0)+(((ms=U.playbooks)==null?void 0:ms.length)??0)," ","cards"]})]})})]})]})})}),ve&&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",children:[l.jsxs("div",{className:"xl:col-span-1 space-y-6",children:[l.jsx("div",{className:"panel-surface p-4 h-80",children:l.jsx(xO,{decks:z,editingDeckId:K,onSelectDeck:P,isLoading:I})}),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(x1,{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(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(wr),onClick:()=>i(!0),"data-testid":"button-register-mcp",children:[l.jsx(ju,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),l.jsxs(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(ur),onClick:()=>f(!0),"data-testid":"button-register-api-key",children:[l.jsx(cp,{className:"w-3 h-3 mr-2"}),"Register API key"]}),l.jsxs(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(Yr),onClick:()=>b(!0),"data-testid":"button-register-playbook",children:[l.jsx(vv,{className:"w-3 h-3 mr-2"}),"Register Playbook"]})]})]})]}),l.jsxs("div",{className:"xl:col-span-3 space-y-6",children:[l.jsx("div",{className:"panel-surface p-4 h-80",children:U?l.jsx("div",{className:"h-full",children:l.jsx(KT,{deck:U,services:fs,credentials:U.credentials??[],playbooks:oo,allServices:De,collectionWarnings:Y,onDrop:B,onDragStart:D,onCredentialDragStart:L,onPlaybookDragStart:J,onDragEnd:Z,onCardClick:Yt,onPlaybookClick:Br,onCredentialClick:hs})}):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(up,{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(fe,{onClick:()=>{const ne=document.querySelector('[data-testid="create-deck-button"]');ne&&ne.click()},className:"border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},children:[l.jsx(Vs,{className:"w-4 h-4 mr-2"}),"Create New Deck"]}),l.jsxs(fe,{variant:"outline",className:"border-white/20 text-white hover:bg-white/10 text-sm py-2",onClick:()=>{const ne=document.querySelector('[data-testid="deck-management-panel"]');ne&&ne.scrollIntoView({behavior:"smooth"})},children:[l.jsx(up,{className:"w-4 h-4 mr-2"}),"Manage Decks"]})]})]})}),l.jsxs("div",{className:"panel-surface p-4 h-80",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("h2",{className:"text-lg font-bold flex items-center",children:[l.jsx(c2,{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:["(",Ne," cards)"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(_1,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),l.jsx(tt,{placeholder:"Search...",value:t,onChange:ne=>e(ne.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(dI,{value:r,onValueChange:s,children:[l.jsxs(iE,{className:"w-20 h-8 bg-white/10 border-white/20 text-white text-sm","data-testid":"select-type",children:[l.jsx(l2,{className:"w-3 h-3 mr-1"}),l.jsx(fI,{placeholder:"Type"})]}),l.jsxs(uE,{children:[l.jsx(po,{value:"all",children:"All"}),l.jsx(po,{value:"mcp",children:"MCP"}),l.jsx(po,{value:"local-mcp",children:"Local MCP"}),l.jsx(po,{value:"api-key",children:"API Key"}),l.jsx(po,{value:"playbook",children:"Playbook"})]})]}),(t||r||n)&&l.jsx(fe,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:rt,title:"Clear all filters",children:"Clear"})]})]}),Y.total>0&&l.jsx("button",{type:"button",onClick:()=>a(ne=>!ne),className:`mb-4 w-full rounded-lg border px-3 py-2 text-left text-sm transition-colors ${n?"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(wn,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),l.jsx("span",{children:n?l.jsxs(l.Fragment,{children:["Showing ",l.jsx("strong",{children:Ne})," card",Ne===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:Y.total})," card",Y.total===1?"":"s"," need attention",Y.byKind.oauth_expired+Y.byKind.oauth_required>0&&l.jsxs(l.Fragment,{children:[" ","(",Y.byKind.oauth_expired+Y.byKind.oauth_required," ","OAuth)"]}),". ",l.jsx("span",{className:"text-amber-200/80",children:"Click to filter."})]})})]})}),re||me||_e?l.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,80px)] gap-0",children:Array.from({length:10}).map((ne,Et)=>l.jsx("div",{className:"animate-pulse",children:l.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},Et))}):Ne===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:pt?n?"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"}),!pt&&l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsxs(fe,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${bn}`,style:Sn(wr),onClick:()=>i(!0),"data-testid":"button-register-mcp-empty",children:[l.jsx(ju,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),l.jsxs(fe,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${bn}`,style:Sn(ur),onClick:()=>f(!0),"data-testid":"button-register-api-key-empty",children:[l.jsx(cp,{className:"w-3 h-3 mr-1"}),"Register API key"]})]})]}):l.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,80px)] gap-0 relative isolate",style:{isolation:"isolate"},children:[Ue.map((ne,Et)=>l.jsx("div",{className:"relative group",style:{zIndex:R===ne.id?999999:Ne-Et},children:l.jsx(BT,{playbook:ne,isInActiveDeck:zt.has(ne.id),activeDeck:U??void 0,isInCollection:!0,onDragStart:J,onDragEnd:Z,onCardClick:Br,onMouseEnter:()=>jr(ne.id),onMouseLeave:()=>jr(null),warnings:Y.playbookWarnings.get(ne.id)})},ne.id)),Me.map((ne,Et)=>l.jsx("div",{className:"relative group",style:{zIndex:R===ne.id?999999:Ne-Ue.length-Et},children:l.jsx(qT,{credential:ne,isInActiveDeck:Hr.has(ne.id),activeDeck:U??void 0,isInCollection:!0,onDragStart:L,onDragEnd:Z,onMouseEnter:()=>jr(ne.id),onMouseLeave:()=>jr(null),onCardClick:hs,warnings:Y.credentialWarnings.get(ne.id)})},ne.id)),te.map((ne,Et)=>{var Mn;return l.jsx("div",{className:"relative group",style:{zIndex:R===ne.id?999999:Ne-Ue.length-Me.length-Et},children:l.jsx(UT,{service:ne,onDragStart:D,onDragEnd:Z,isInActiveDeck:((Mn=U==null?void 0:U.services)==null?void 0:Mn.some($n=>$n.id===ne.id))||!1,onCardClick:Yt,isInCollection:!0,onMouseEnter:()=>jr(ne.id),onMouseLeave:()=>jr(null),activeDeck:U??void 0,warnings:Y.serviceWarnings.get(ne.id)})},ne.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(yO,{type:"mcp",open:o,onOpenChange:i}),l.jsx(OO,{service:c,isOpen:d,onClose:()=>h(!1)}),l.jsx(wO,{open:m,onOpenChange:f}),l.jsx(_O,{credentialId:w,open:v,onOpenChange:y}),l.jsx(bO,{open:g,onOpenChange:b}),l.jsx(SO,{playbookId:S,open:N,onOpenChange:j})]})}const Es=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Es.displayName="Card";const _a=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("flex flex-col space-y-1.5 p-6",t),...e}));_a.displayName="CardHeader";const Ea=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("text-2xl font-semibold leading-none tracking-tight",t),...e}));Ea.displayName="CardTitle";const Jc=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("text-sm text-muted-foreground",t),...e}));Jc.displayName="CardDescription";const Cs=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("p-6 pt-0",t),...e}));Cs.displayName="CardContent";const gI=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("flex items-center p-6 pt-0",t),...e}));gI.displayName="CardFooter";function yI(){return l.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:l.jsx(Es,{className:"w-full max-w-md mx-4",children:l.jsxs(Cs,{className:"pt-6",children:[l.jsxs("div",{className:"flex mb-4 gap-2",children:[l.jsx(b1,{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 xI(){const[t]=xN(),[e,r]=x.useState("loading"),[s,n]=x.useState("Authenticating...");return x.useEffect(()=>{(async()=>{try{const o=new URL(window.location.href),i=o.searchParams.get("success"),c=o.searchParams.get("error");i==="true"?(r("success"),n("Authentication successful! This window will close automatically."),setTimeout(()=>{window.close()},2e3)):i==="false"?(r("error"),n(`OAuth Error: ${c||"Authentication failed"}`)):(r("error"),n("Invalid OAuth callback - please try again"))}catch(o){r("error"),n(o instanceof Error?o.message:"Authentication failed")}})()},[t]),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:[e==="loading"&&l.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),e==="success"&&l.jsx("div",{className:"text-green-500 text-4xl",children:"✓"}),e==="error"&&l.jsx("div",{className:"text-red-500 text-4xl",children:"✗"}),l.jsx("h1",{className:"text-xl font-semibold",children:s}),e==="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 To(t){const e=()=>{throw new Error(`Invalid url to pass to open(): ${t}`)};let r;try{r=new URL(t)}catch{e()}return r.protocol!=="https:"&&r.protocol!=="http:"&&e(),r.hostname!==encodeURIComponent(r.hostname)&&e(),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(wI).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function wI([t,e]){return`${encodeURIComponent(t)}${e.length>0?`=${encodeURIComponent(e)}`:""}`}var S0=class{constructor(t,e={}){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=t,this.storageKeyPrefix=e.storageKeyPrefix||"mcp:auth",this.serverUrlHash=this.hashString(t),this.clientName=e.clientName||"MCP Browser Client",this.clientUri=e.clientUri||(typeof window<"u"?window.location.origin:""),this.callbackUrl=To(e.callbackUrl||(typeof window<"u"?new URL("/oauth/callback",window.location.origin).toString():"/oauth/callback")),this.preventAutoAuth=e.preventAutoAuth,this.onPopupWindow=e.onPopupWindow}get redirectUrl(){return To(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 t=this.getKey("client_info"),e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,r),localStorage.removeItem(t);return}}async saveClientInformation(t){const e=this.getKey("client_info");localStorage.setItem(e,JSON.stringify(t))}async tokens(){const t=this.getKey("tokens"),e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,r),localStorage.removeItem(t);return}}async saveTokens(t){const e=this.getKey("tokens");localStorage.setItem(e,JSON.stringify(t)),localStorage.removeItem(this.getKey("code_verifier")),localStorage.removeItem(this.getKey("last_auth_url"))}async saveCodeVerifier(t){const e=this.getKey("code_verifier");localStorage.setItem(e,t)}async codeVerifier(){const t=this.getKey("code_verifier"),e=localStorage.getItem(t);if(!e)throw new Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${t}. Auth flow likely corrupted or timed out.`);return e}async prepareAuthorizationUrl(t){const e=crypto.randomUUID(),r=`${this.storageKeyPrefix}:state_${e}`,s={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(s)),t.searchParams.set("state",e);const n=t.toString(),a=To(n);return localStorage.setItem(this.getKey("last_auth_url"),a),a}async redirectToAuthorization(t){if(this.preventAutoAuth)return;const e=await this.prepareAuthorizationUrl(t),r="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const s=window.open(e,`mcp_auth_${this.serverUrlHash}`,r);this.onPopupWindow&&this.onPopupWindow(e,r,s),!s||s.closed||typeof s.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(s.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(s){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,s)}}getLastAttemptedAuthUrl(){const t=localStorage.getItem(this.getKey("last_auth_url"));return t?To(t):null}clearStorage(){const t=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,e=`${this.storageKeyPrefix}:state_`,r=[];let s=0;for(let a=0;a<localStorage.length;a++){const o=localStorage.key(a);if(o){if(o.startsWith(t))r.push(o);else if(o.startsWith(e))try{const i=localStorage.getItem(o);i&&JSON.parse(i).serverUrlHash===this.serverUrlHash&&r.push(o)}catch(i){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${o} during clearStorage:`,i)}}}return[...new Set(r)].forEach(a=>{localStorage.removeItem(a),s++}),s}hashString(t){let e=0;for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);e=(e<<5)-e+s,e=e&e}return Math.abs(e).toString(16)}getKey(t){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${t}`}},Ge;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{const a={};for(const o of n)a[o]=o;return a},t.getValidEnumValues=n=>{const a=t.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(const i of a)o[i]=n[i];return t.objectValues(o)},t.objectValues=n=>t.objectKeys(n).map(function(a){return n[a]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},t.find=(n,a)=>{for(const o of n)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(Ge||(Ge={}));var _0;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(_0||(_0={}));const de=Ge.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ps=t=>{switch(typeof t){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(t)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":return Array.isArray(t)?de.array:t===null?de.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?de.promise:typeof Map<"u"&&t instanceof Map?de.map:typeof Set<"u"&&t instanceof Set?de.set:typeof Date<"u"&&t instanceof Date?de.date:de.object;default:return de.unknown}},G=Ge.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ls extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(r(o));else{let i=s,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(r(o))):i[u]=i[u]||{_errors:[]},i=i[u],c++}}};return n(this),s}static assert(e){if(!(e instanceof ls))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ge.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];r[a]=r[a]||[],r[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}ls.create=t=>new ls(t);const Cp=(t,e)=>{let r;switch(t.code){case G.invalid_type:t.received===de.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ge.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ge.joinValues(t.keys,", ")}`;break;case G.invalid_union:r="Invalid input";break;case G.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ge.joinValues(t.options)}`;break;case G.invalid_enum_value:r=`Invalid enum value. Expected ${Ge.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:r="Invalid function arguments";break;case G.invalid_return_type:r="Invalid function return type";break;case G.invalid_date:r="Invalid date";break;case G.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ge.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case G.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case G.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case G.custom:r="Invalid input";break;case G.invalid_intersection_types:r="Intersection results could not be merged";break;case G.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ge.assertNever(t)}return{message:r}};let bI=Cp;function SI(){return bI}const _I=t=>{const{data:e,path:r,errorMaps:s,issueData:n}=t,a=[...r,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="";const c=s.filter(u=>!!u).slice().reverse();for(const u of c)i=u(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}};function ae(t,e){const r=SI(),s=_I({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Cp?void 0:Cp].filter(n=>!!n)});t.common.issues.push(s)}class nr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const n of r){if(n.status==="aborted")return Ee;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const n of r){const a=await n.key,o=await n.value;s.push({key:a,value:o})}return nr.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const n of r){const{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return Ee;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}}const Ee=Object.freeze({status:"aborted"}),Qi=t=>({status:"dirty",value:t}),zr=t=>({status:"valid",value:t}),E0=t=>t.status==="aborted",C0=t=>t.status==="dirty",mi=t=>t.status==="valid",Lu=t=>typeof Promise<"u"&&t instanceof Promise;var pe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(pe||(pe={}));class An{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const P0=(t,e)=>{if(mi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new ls(t.common.issues);return this._error=r,this._error}}};function Fe(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{const{message:c}=t;return o.code==="invalid_enum_value"?{message:c??i.defaultError}:typeof i.data>"u"?{message:c??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:c??r??i.defaultError}},description:n}}class Be{get description(){return this._def.description}_getType(e){return Ps(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ps(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nr,ctx:{common:e.parent.common,data:e.data,parsedType:Ps(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Lu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){const s={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ps(e)},n=this._parseSync({data:e,path:s.path,parent:s});return P0(s,n)}"~validate"(e){var s,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ps(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return mi(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>mi(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ps(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(Lu(n)?n:Promise.resolve(n));return P0(s,a)}refine(e,r){const s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{const o=e(n),i=()=>a.addIssue({code:G.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new eo({schema:this,typeName:Ce.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return es.create(this,this._def)}nullable(){return to.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rn.create(this)}promise(){return Bu.create(this,this._def)}or(e){return zu.create([this,e],this._def)}and(e){return Vu.create(this,e,this._def)}transform(e){return new eo({...Fe(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Ku({...Fe(this._def),innerType:this,defaultValue:r,typeName:Ce.ZodDefault})}brand(){return new pE({typeName:Ce.ZodBranded,type:this,...Fe(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Wu({...Fe(this._def),innerType:this,catchValue:r,typeName:Ce.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Lv.create(this,e)}readonly(){return Qu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const EI=/^c[^\s-]{8,}$/i,CI=/^[0-9a-z]+$/,PI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,kI=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,NI=/^[a-z0-9_-]{21}$/i,jI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,AI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bf;const OI=/^(?:(?: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])$/,II=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,DI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,MI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$I=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,FI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dE="((\\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])))",LI=new RegExp(`^${dE}$`);function fE(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function UI(t){return new RegExp(`^${fE(t)}$`)}function zI(t){let e=`${dE}T${fE(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function VI(t,e){return!!((e==="v4"||!e)&&OI.test(t)||(e==="v6"||!e)&&DI.test(t))}function qI(t,e){if(!jI.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function HI(t,e){return!!((e==="v4"||!e)&&II.test(t)||(e==="v6"||!e)&&MI.test(t))}class Jn extends Be{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==de.string){const a=this._getOrReturnCtx(e);return ae(a,{code:G.invalid_type,expected:de.string,received:a.parsedType}),Ee}const s=new nr;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),ae(n,{code:G.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),ae(n,{code:G.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?ae(n,{code:G.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&ae(n,{code:G.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")TI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"email",code:G.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Bf||(Bf=new RegExp(AI,"u")),Bf.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"emoji",code:G.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")kI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"uuid",code:G.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")NI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"nanoid",code:G.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")EI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"cuid",code:G.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")CI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"cuid2",code:G.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")PI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"ulid",code:G.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),ae(n,{validation:"url",code:G.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"regex",code:G.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),ae(n,{code:G.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),ae(n,{code:G.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),ae(n,{code:G.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?zI(a).test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{code:G.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?LI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{code:G.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?UI(a).test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{code:G.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?RI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"duration",code:G.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?VI(e.data,a.version)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"ip",code:G.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?qI(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"jwt",code:G.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?HI(e.data,a.version)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"cidr",code:G.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?$I.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"base64",code:G.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?FI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"base64url",code:G.invalid_string,message:a.message}),s.dirty()):Ge.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:G.invalid_string,...pe.errToObj(s)})}_addCheck(e){return new Jn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...pe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...pe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...pe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...pe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...pe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...pe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...pe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...pe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...pe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...pe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...pe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...pe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...pe.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...pe.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...pe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...pe.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...pe.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...pe.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...pe.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...pe.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...pe.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...pe.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...pe.errToObj(r)})}nonempty(e){return this.min(1,pe.errToObj(e))}trim(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Jn.create=t=>new Jn({checks:[],typeName:Ce.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Fe(t)});function BI(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,a=Number.parseInt(t.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}class vi extends Be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==de.number){const a=this._getOrReturnCtx(e);return ae(a,{code:G.invalid_type,expected:de.number,received:a.parsedType}),Ee}let s;const n=new nr;for(const a of this._def.checks)a.kind==="int"?Ge.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:G.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:G.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:G.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?BI(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),ae(s,{code:G.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:G.not_finite,message:a.message}),n.dirty()):Ge.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,pe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,pe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,pe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,pe.toString(r))}setLimit(e,r,s,n){return new vi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:pe.toString(n)}]})}_addCheck(e){return new vi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:pe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:pe.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:pe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pe.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ge.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}}vi.create=t=>new vi({checks:[],typeName:Ce.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Fe(t)});class jl extends Be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==de.bigint)return this._getInvalidInput(e);let s;const n=new nr;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:G.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:G.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:G.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ge.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return ae(r,{code:G.invalid_type,expected:de.bigint,received:r.parsedType}),Ee}gte(e,r){return this.setLimit("min",e,!0,pe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,pe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,pe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,pe.toString(r))}setLimit(e,r,s,n){return new jl({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:pe.toString(n)}]})}_addCheck(e){return new jl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:pe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:pe.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}jl.create=t=>new jl({checks:[],typeName:Ce.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Fe(t)});class Pp extends Be{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==de.boolean){const s=this._getOrReturnCtx(e);return ae(s,{code:G.invalid_type,expected:de.boolean,received:s.parsedType}),Ee}return zr(e.data)}}Pp.create=t=>new Pp({typeName:Ce.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Fe(t)});class Uu extends Be{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==de.date){const a=this._getOrReturnCtx(e);return ae(a,{code:G.invalid_type,expected:de.date,received:a.parsedType}),Ee}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return ae(a,{code:G.invalid_date}),Ee}const s=new nr;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),ae(n,{code:G.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),ae(n,{code:G.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):Ge.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Uu({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:pe.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:pe.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Uu.create=t=>new Uu({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ce.ZodDate,...Fe(t)});class k0 extends Be{_parse(e){if(this._getType(e)!==de.symbol){const s=this._getOrReturnCtx(e);return ae(s,{code:G.invalid_type,expected:de.symbol,received:s.parsedType}),Ee}return zr(e.data)}}k0.create=t=>new k0({typeName:Ce.ZodSymbol,...Fe(t)});class kp extends Be{_parse(e){if(this._getType(e)!==de.undefined){const s=this._getOrReturnCtx(e);return ae(s,{code:G.invalid_type,expected:de.undefined,received:s.parsedType}),Ee}return zr(e.data)}}kp.create=t=>new kp({typeName:Ce.ZodUndefined,...Fe(t)});class Np extends Be{_parse(e){if(this._getType(e)!==de.null){const s=this._getOrReturnCtx(e);return ae(s,{code:G.invalid_type,expected:de.null,received:s.parsedType}),Ee}return zr(e.data)}}Np.create=t=>new Np({typeName:Ce.ZodNull,...Fe(t)});class jp extends Be{constructor(){super(...arguments),this._any=!0}_parse(e){return zr(e.data)}}jp.create=t=>new jp({typeName:Ce.ZodAny,...Fe(t)});class Rp extends Be{constructor(){super(...arguments),this._unknown=!0}_parse(e){return zr(e.data)}}Rp.create=t=>new Rp({typeName:Ce.ZodUnknown,...Fe(t)});class ia extends Be{_parse(e){const r=this._getOrReturnCtx(e);return ae(r,{code:G.invalid_type,expected:de.never,received:r.parsedType}),Ee}}ia.create=t=>new ia({typeName:Ce.ZodNever,...Fe(t)});class N0 extends Be{_parse(e){if(this._getType(e)!==de.undefined){const s=this._getOrReturnCtx(e);return ae(s,{code:G.invalid_type,expected:de.void,received:s.parsedType}),Ee}return zr(e.data)}}N0.create=t=>new N0({typeName:Ce.ZodVoid,...Fe(t)});class Rn extends Be{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==de.array)return ae(r,{code:G.invalid_type,expected:de.array,received:r.parsedType}),Ee;if(n.exactLength!==null){const o=r.data.length>n.exactLength.value,i=r.data.length<n.exactLength.value;(o||i)&&(ae(r,{code:o?G.too_big:G.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(ae(r,{code:G.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(ae(r,{code:G.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((o,i)=>n.type._parseAsync(new An(r,o,r.path,i)))).then(o=>nr.mergeArray(s,o));const a=[...r.data].map((o,i)=>n.type._parseSync(new An(r,o,r.path,i)));return nr.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new Rn({...this._def,minLength:{value:e,message:pe.toString(r)}})}max(e,r){return new Rn({...this._def,maxLength:{value:e,message:pe.toString(r)}})}length(e,r){return new Rn({...this._def,exactLength:{value:e,message:pe.toString(r)}})}nonempty(e){return this.min(1,e)}}Rn.create=(t,e)=>new Rn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Fe(e)});function mo(t){if(t instanceof Pt){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=es.create(mo(s))}return new Pt({...t._def,shape:()=>e})}else return t instanceof Rn?new Rn({...t._def,type:mo(t.element)}):t instanceof es?es.create(mo(t.unwrap())):t instanceof to?to.create(mo(t.unwrap())):t instanceof Ja?Ja.create(t.items.map(e=>mo(e))):t}class Pt extends Be{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Ge.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==de.object){const u=this._getOrReturnCtx(e);return ae(u,{code:G.invalid_type,expected:de.object,received:u.parsedType}),Ee}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof ia&&this._def.unknownKeys==="strip"))for(const u in n.data)o.includes(u)||i.push(u);const c=[];for(const u of o){const d=a[u],h=n.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new An(n,h,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof ia){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of i)c.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(u==="strict")i.length>0&&(ae(n,{code:G.unrecognized_keys,keys:i}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of i){const h=n.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new An(n,h,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const h=await d.key,m=await d.value;u.push({key:h,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>nr.mergeObjectSync(s,u)):nr.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return pe.errToObj,new Pt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{var a,o;const n=((o=(a=this._def).errorMap)==null?void 0:o.call(a,r,s).message)??s.defaultError;return r.code==="unrecognized_keys"?{message:pe.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new Pt({...this._def,unknownKeys:"strip"})}passthrough(){return new Pt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ce.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Pt({...this._def,catchall:e})}pick(e){const r={};for(const s of Ge.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new Pt({...this._def,shape:()=>r})}omit(e){const r={};for(const s of Ge.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new Pt({...this._def,shape:()=>r})}deepPartial(){return mo(this)}partial(e){const r={};for(const s of Ge.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new Pt({...this._def,shape:()=>r})}required(e){const r={};for(const s of Ge.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof es;)a=a._def.innerType;r[s]=a}return new Pt({...this._def,shape:()=>r})}keyof(){return hE(Ge.objectKeys(this.shape))}}Pt.create=(t,e)=>new Pt({shape:()=>t,unknownKeys:"strip",catchall:ia.create(),typeName:Ce.ZodObject,...Fe(e)});Pt.strictCreate=(t,e)=>new Pt({shape:()=>t,unknownKeys:"strict",catchall:ia.create(),typeName:Ce.ZodObject,...Fe(e)});Pt.lazycreate=(t,e)=>new Pt({shape:t,unknownKeys:"strip",catchall:ia.create(),typeName:Ce.ZodObject,...Fe(e)});class zu extends Be{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function n(a){for(const i of a)if(i.result.status==="valid")return i.result;for(const i of a)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(i=>new ls(i.ctx.common.issues));return ae(r,{code:G.invalid_union,unionErrors:o}),Ee}if(r.common.async)return Promise.all(s.map(async a=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(n);{let a;const o=[];for(const c of s){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(c=>new ls(c));return ae(r,{code:G.invalid_union,unionErrors:i}),Ee}}get options(){return this._def.options}}zu.create=(t,e)=>new zu({options:t,typeName:Ce.ZodUnion,...Fe(e)});const Vn=t=>t instanceof Ap?Vn(t.schema):t instanceof eo?Vn(t.innerType()):t instanceof Hu?[t.value]:t instanceof Xa?t.options:t instanceof Op?Ge.objectValues(t.enum):t instanceof Ku?Vn(t._def.innerType):t instanceof kp?[void 0]:t instanceof Np?[null]:t instanceof es?[void 0,...Vn(t.unwrap())]:t instanceof to?[null,...Vn(t.unwrap())]:t instanceof pE||t instanceof Qu?Vn(t.unwrap()):t instanceof Wu?Vn(t._def.innerType):[];class Fv extends Be{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==de.object)return ae(r,{code:G.invalid_type,expected:de.object,received:r.parsedType}),Ee;const s=this.discriminator,n=r.data[s],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(ae(r,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){const n=new Map;for(const a of r){const o=Vn(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of o){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new Fv({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...Fe(s)})}}function Tp(t,e){const r=Ps(t),s=Ps(e);if(t===e)return{valid:!0,data:t};if(r===de.object&&s===de.object){const n=Ge.objectKeys(e),a=Ge.objectKeys(t).filter(i=>n.indexOf(i)!==-1),o={...t,...e};for(const i of a){const c=Tp(t[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(r===de.array&&s===de.array){if(t.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<t.length;a++){const o=t[a],i=e[a],c=Tp(o,i);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===de.date&&s===de.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Vu extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(E0(a)||E0(o))return Ee;const i=Tp(a.value,o.value);return i.valid?((C0(a)||C0(o))&&r.dirty(),{status:r.value,value:i.data}):(ae(s,{code:G.invalid_intersection_types}),Ee)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Vu.create=(t,e,r)=>new Vu({left:t,right:e,typeName:Ce.ZodIntersection,...Fe(r)});class Ja extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==de.array)return ae(s,{code:G.invalid_type,expected:de.array,received:s.parsedType}),Ee;if(s.data.length<this._def.items.length)return ae(s,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&s.data.length>this._def.items.length&&(ae(s,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...s.data].map((o,i)=>{const c=this._def.items[i]||this._def.rest;return c?c._parse(new An(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>nr.mergeArray(r,o)):nr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Ja({...this._def,rest:e})}}Ja.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ja({items:t,typeName:Ce.ZodTuple,rest:null,...Fe(e)})};class qu extends Be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==de.object)return ae(s,{code:G.invalid_type,expected:de.object,received:s.parsedType}),Ee;const n=[],a=this._def.keyType,o=this._def.valueType;for(const i in s.data)n.push({key:a._parse(new An(s,i,s.path,i)),value:o._parse(new An(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?nr.mergeObjectAsync(r,n):nr.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof Be?new qu({keyType:e,valueType:r,typeName:Ce.ZodRecord,...Fe(s)}):new qu({keyType:Jn.create(),valueType:e,typeName:Ce.ZodRecord,...Fe(r)})}}class j0 extends Be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==de.map)return ae(s,{code:G.invalid_type,expected:de.map,received:s.parsedType}),Ee;const n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,c],u)=>({key:n._parse(new An(s,i,s.path,[u,"key"])),value:a._parse(new An(s,c,s.path,[u,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Ee;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}})}else{const i=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Ee;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}}}}j0.create=(t,e,r)=>new j0({valueType:e,keyType:t,typeName:Ce.ZodMap,...Fe(r)});class Rl extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==de.set)return ae(s,{code:G.invalid_type,expected:de.set,received:s.parsedType}),Ee;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(ae(s,{code:G.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(ae(s,{code:G.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());const a=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Ee;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const i=[...s.data.values()].map((c,u)=>a._parse(new An(s,c,s.path,u)));return s.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,r){return new Rl({...this._def,minSize:{value:e,message:pe.toString(r)}})}max(e,r){return new Rl({...this._def,maxSize:{value:e,message:pe.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Rl.create=(t,e)=>new Rl({valueType:t,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Fe(e)});class Ap extends Be{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Ap.create=(t,e)=>new Ap({getter:t,typeName:Ce.ZodLazy,...Fe(e)});class Hu extends Be{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return ae(r,{received:r.data,code:G.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:e.data}}get value(){return this._def.value}}Hu.create=(t,e)=>new Hu({value:t,typeName:Ce.ZodLiteral,...Fe(e)});function hE(t,e){return new Xa({values:t,typeName:Ce.ZodEnum,...Fe(e)})}class Xa extends Be{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return ae(r,{expected:Ge.joinValues(s),received:r.parsedType,code:G.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return ae(r,{received:r.data,code:G.invalid_enum_value,options:s}),Ee}return zr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Xa.create(e,{...this._def,...r})}exclude(e,r=this._def){return Xa.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}Xa.create=hE;class Op extends Be{_parse(e){const r=Ge.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==de.string&&s.parsedType!==de.number){const n=Ge.objectValues(r);return ae(s,{expected:Ge.joinValues(n),received:s.parsedType,code:G.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Ge.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=Ge.objectValues(r);return ae(s,{received:s.data,code:G.invalid_enum_value,options:n}),Ee}return zr(e.data)}get enum(){return this._def.values}}Op.create=(t,e)=>new Op({values:t,typeName:Ce.ZodNativeEnum,...Fe(e)});class Bu extends Be{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==de.promise&&r.common.async===!1)return ae(r,{code:G.invalid_type,expected:de.promise,received:r.parsedType}),Ee;const s=r.parsedType===de.promise?r.data:Promise.resolve(r.data);return zr(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Bu.create=(t,e)=>new Bu({type:t,typeName:Ce.ZodPromise,...Fe(e)});class eo extends Be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{ae(s,o),o.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(r.value==="aborted")return Ee;const c=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return c.status==="aborted"?Ee:c.status==="dirty"||r.value==="dirty"?Qi(c.value):c});{if(r.value==="aborted")return Ee;const i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?Ee:i.status==="dirty"||r.value==="dirty"?Qi(i.value):i}}if(n.type==="refinement"){const o=i=>{const c=n.refinement(i,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Ee:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?Ee:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!mi(o))return Ee;const i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>mi(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:r.value,value:i})):Ee);Ge.assertNever(n)}}eo.create=(t,e,r)=>new eo({schema:t,typeName:Ce.ZodEffects,effect:e,...Fe(r)});eo.createWithPreprocess=(t,e,r)=>new eo({schema:e,effect:{type:"preprocess",transform:t},typeName:Ce.ZodEffects,...Fe(r)});class es extends Be{_parse(e){return this._getType(e)===de.undefined?zr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}es.create=(t,e)=>new es({innerType:t,typeName:Ce.ZodOptional,...Fe(e)});class to extends Be{_parse(e){return this._getType(e)===de.null?zr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}to.create=(t,e)=>new to({innerType:t,typeName:Ce.ZodNullable,...Fe(e)});class Ku extends Be{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===de.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Ku.create=(t,e)=>new Ku({innerType:t,typeName:Ce.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fe(e)});class Wu extends Be{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Lu(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ls(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ls(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Wu.create=(t,e)=>new Wu({innerType:t,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fe(e)});class R0 extends Be{_parse(e){if(this._getType(e)!==de.nan){const s=this._getOrReturnCtx(e);return ae(s,{code:G.invalid_type,expected:de.nan,received:s.parsedType}),Ee}return{status:"valid",value:e.data}}}R0.create=t=>new R0({typeName:Ce.ZodNaN,...Fe(t)});class pE extends Be{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class Lv extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Ee:a.status==="dirty"?(r.dirty(),Qi(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?Ee:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new Lv({in:e,out:r,typeName:Ce.ZodPipeline})}}class Qu extends Be{_parse(e){const r=this._def.innerType._parse(e),s=n=>(mi(n)&&(n.value=Object.freeze(n.value)),n);return Lu(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}}Qu.create=(t,e)=>new Qu({innerType:t,typeName:Ce.ZodReadonly,...Fe(e)});var Ce;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));const V=Jn.create,Ut=vi.create,It=Pp.create,KI=jp.create,Bl=Rp.create;ia.create;const he=Rn.create,se=Pt.create,ir=zu.create,WI=Fv.create;Vu.create;Ja.create;const Kl=qu.create,Ie=Hu.create,cs=Xa.create;Bu.create;const W=es.create;to.create;const QI=Ee,Vd="2025-06-18",GI=[Vd,"2025-03-26","2024-11-05","2024-10-07"],qd="2.0",mE=ir([V(),Ut().int()]),vE=V(),ZI=se({progressToken:W(mE)}).passthrough(),Vr=se({_meta:W(ZI)}).passthrough(),xr=se({method:V(),params:W(Vr)}),Wl=se({_meta:W(se({}).passthrough())}).passthrough(),In=se({method:V(),params:W(Wl)}),qr=se({_meta:W(se({}).passthrough())}).passthrough(),Hd=ir([V(),Ut().int()]),gE=se({jsonrpc:Ie(qd),id:Hd}).merge(xr).strict(),yE=t=>gE.safeParse(t).success,xE=se({jsonrpc:Ie(qd)}).merge(In).strict(),YI=t=>xE.safeParse(t).success,wE=se({jsonrpc:Ie(qd),id:Hd,result:qr}).strict(),Ip=t=>wE.safeParse(t).success;var En;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(En||(En={}));const bE=se({jsonrpc:Ie(qd),id:Hd,error:se({code:Ut().int(),message:V(),data:W(Bl())})}).strict(),JI=t=>bE.safeParse(t).success,Xc=ir([gE,xE,wE,bE]),Ao=qr.strict(),Uv=In.extend({method:Ie("notifications/cancelled"),params:Wl.extend({requestId:Hd,reason:V().optional()})}),Ql=se({name:V(),title:W(V())}).passthrough(),SE=Ql.extend({version:V()}),XI=se({experimental:W(se({}).passthrough()),sampling:W(se({}).passthrough()),elicitation:W(se({}).passthrough()),roots:W(se({listChanged:W(It())}).passthrough())}).passthrough(),e4=xr.extend({method:Ie("initialize"),params:Vr.extend({protocolVersion:V(),capabilities:XI,clientInfo:SE})}),t4=se({experimental:W(se({}).passthrough()),logging:W(se({}).passthrough()),completions:W(se({}).passthrough()),prompts:W(se({listChanged:W(It())}).passthrough()),resources:W(se({subscribe:W(It()),listChanged:W(It())}).passthrough()),tools:W(se({listChanged:W(It())}).passthrough())}).passthrough(),_E=qr.extend({protocolVersion:V(),capabilities:t4,serverInfo:SE,instructions:W(V())}),EE=In.extend({method:Ie("notifications/initialized")}),r4=t=>EE.safeParse(t).success,zv=xr.extend({method:Ie("ping")}),n4=se({progress:Ut(),total:W(Ut()),message:W(V())}).passthrough(),Vv=In.extend({method:Ie("notifications/progress"),params:Wl.merge(n4).extend({progressToken:mE})}),Bd=xr.extend({params:Vr.extend({cursor:W(vE)}).optional()}),Kd=qr.extend({nextCursor:W(vE)}),CE=se({uri:V(),mimeType:W(V()),_meta:W(se({}).passthrough())}).passthrough(),PE=CE.extend({text:V()}),qv=V().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),kE=CE.extend({blob:qv}),NE=Ql.extend({uri:V(),description:W(V()),mimeType:W(V()),_meta:W(se({}).passthrough())}),s4=Ql.extend({uriTemplate:V(),description:W(V()),mimeType:W(V()),_meta:W(se({}).passthrough())}),a4=Bd.extend({method:Ie("resources/list")}),Gu=Kd.extend({resources:he(NE)}),o4=Bd.extend({method:Ie("resources/templates/list")}),jE=Kd.extend({resourceTemplates:he(s4)}),i4=xr.extend({method:Ie("resources/read"),params:Vr.extend({uri:V()})}),Hv=qr.extend({contents:he(ir([PE,kE]))}),l4=In.extend({method:Ie("notifications/resources/list_changed")}),c4=xr.extend({method:Ie("resources/subscribe"),params:Vr.extend({uri:V()})}),u4=xr.extend({method:Ie("resources/unsubscribe"),params:Vr.extend({uri:V()})}),d4=In.extend({method:Ie("notifications/resources/updated"),params:Wl.extend({uri:V()})}),f4=se({name:V(),description:W(V()),required:W(It())}).passthrough(),h4=Ql.extend({description:W(V()),arguments:W(he(f4)),_meta:W(se({}).passthrough())}),p4=Bd.extend({method:Ie("prompts/list")}),Zu=Kd.extend({prompts:he(h4)}),m4=xr.extend({method:Ie("prompts/get"),params:Vr.extend({name:V(),arguments:W(Kl(V()))})}),Bv=se({type:Ie("text"),text:V(),_meta:W(se({}).passthrough())}).passthrough(),Kv=se({type:Ie("image"),data:qv,mimeType:V(),_meta:W(se({}).passthrough())}).passthrough(),Wv=se({type:Ie("audio"),data:qv,mimeType:V(),_meta:W(se({}).passthrough())}).passthrough(),v4=se({type:Ie("resource"),resource:ir([PE,kE]),_meta:W(se({}).passthrough())}).passthrough(),g4=NE.extend({type:Ie("resource_link")}),RE=ir([Bv,Kv,Wv,g4,v4]),y4=se({role:cs(["user","assistant"]),content:RE}).passthrough(),Qv=qr.extend({description:W(V()),messages:he(y4)}),x4=In.extend({method:Ie("notifications/prompts/list_changed")}),w4=se({title:W(V()),readOnlyHint:W(It()),destructiveHint:W(It()),idempotentHint:W(It()),openWorldHint:W(It())}).passthrough(),b4=Ql.extend({description:W(V()),inputSchema:se({type:Ie("object"),properties:W(se({}).passthrough()),required:W(he(V()))}).passthrough(),outputSchema:W(se({type:Ie("object"),properties:W(se({}).passthrough()),required:W(he(V()))}).passthrough()),annotations:W(w4),_meta:W(se({}).passthrough())}),S4=Bd.extend({method:Ie("tools/list")}),Gv=Kd.extend({tools:he(b4)}),Wd=qr.extend({content:he(RE).default([]),structuredContent:se({}).passthrough().optional(),isError:W(It())});Wd.or(qr.extend({toolResult:Bl()}));const _4=xr.extend({method:Ie("tools/call"),params:Vr.extend({name:V(),arguments:W(Kl(Bl()))})}),E4=In.extend({method:Ie("notifications/tools/list_changed")}),TE=cs(["debug","info","notice","warning","error","critical","alert","emergency"]),C4=xr.extend({method:Ie("logging/setLevel"),params:Vr.extend({level:TE})}),P4=In.extend({method:Ie("notifications/message"),params:Wl.extend({level:TE,logger:W(V()),data:Bl()})}),k4=se({name:V().optional()}).passthrough(),N4=se({hints:W(he(k4)),costPriority:W(Ut().min(0).max(1)),speedPriority:W(Ut().min(0).max(1)),intelligencePriority:W(Ut().min(0).max(1))}).passthrough(),j4=se({role:cs(["user","assistant"]),content:ir([Bv,Kv,Wv])}).passthrough(),R4=xr.extend({method:Ie("sampling/createMessage"),params:Vr.extend({messages:he(j4),systemPrompt:W(V()),includeContext:W(cs(["none","thisServer","allServers"])),temperature:W(Ut()),maxTokens:Ut().int(),stopSequences:W(he(V())),metadata:W(se({}).passthrough()),modelPreferences:W(N4)})}),T4=qr.extend({model:V(),stopReason:W(cs(["endTurn","stopSequence","maxTokens"]).or(V())),role:cs(["user","assistant"]),content:WI("type",[Bv,Kv,Wv])}),A4=se({type:Ie("boolean"),title:W(V()),description:W(V()),default:W(It())}).passthrough(),O4=se({type:Ie("string"),title:W(V()),description:W(V()),minLength:W(Ut()),maxLength:W(Ut()),format:W(cs(["email","uri","date","date-time"]))}).passthrough(),I4=se({type:cs(["number","integer"]),title:W(V()),description:W(V()),minimum:W(Ut()),maximum:W(Ut())}).passthrough(),D4=se({type:Ie("string"),title:W(V()),description:W(V()),enum:he(V()),enumNames:W(he(V()))}).passthrough(),M4=ir([A4,O4,I4,D4]),$4=xr.extend({method:Ie("elicitation/create"),params:Vr.extend({message:V(),requestedSchema:se({type:Ie("object"),properties:Kl(V(),M4),required:W(he(V()))}).passthrough()})}),F4=qr.extend({action:cs(["accept","decline","cancel"]),content:W(Kl(V(),Bl()))}),L4=se({type:Ie("ref/resource"),uri:V()}).passthrough(),U4=se({type:Ie("ref/prompt"),name:V()}).passthrough(),z4=xr.extend({method:Ie("completion/complete"),params:Vr.extend({ref:ir([U4,L4]),argument:se({name:V(),value:V()}).passthrough(),context:W(se({arguments:W(Kl(V(),V()))}))})}),AE=qr.extend({completion:se({values:he(V()).max(100),total:W(Ut().int()),hasMore:W(It())}).passthrough()}),V4=se({uri:V().startsWith("file://"),name:W(V()),_meta:W(se({}).passthrough())}).passthrough(),q4=xr.extend({method:Ie("roots/list")}),H4=qr.extend({roots:he(V4)}),B4=In.extend({method:Ie("notifications/roots/list_changed")});ir([zv,e4,z4,C4,m4,p4,a4,o4,i4,c4,u4,_4,S4]);ir([Uv,Vv,EE,B4]);ir([Ao,T4,F4,H4]);ir([zv,R4,$4,q4]);ir([Uv,Vv,P4,d4,l4,E4,x4]);ir([Ao,_E,AE,Qv,Zu,Gu,jE,Hv,Wd,Gv]);class qs extends Error{constructor(e,r,s){super(`MCP error ${e}: ${r}`),this.code=e,this.data=s,this.name="McpError"}}class T0 extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Kf(t){}function OE(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Kf,onError:r=Kf,onRetry:s=Kf,onComment:n}=t;let a="",o=!0,i,c="",u="";function d(p){const v=o?p.replace(/^\xEF\xBB\xBF/,""):p,[y,g]=K4(`${a}${v}`);for(const b of y)h(b);a=g,o=!1}function h(p){if(p===""){f();return}if(p.startsWith(":")){n&&n(p.slice(p.startsWith(": ")?2:1));return}const v=p.indexOf(":");if(v!==-1){const y=p.slice(0,v),g=p[v+1]===" "?2:1,b=p.slice(v+g);m(y,b,p);return}m(p,"",p)}function m(p,v,y){switch(p){case"event":u=v;break;case"data":c=`${c}${v}
|
|
341
|
-
`;break;case"id":i=
|
|
342
|
-
`)?c.slice(0,-1):c}),i=void 0,c="",u=""}function w(p={}){a&&p.consume&&h(a),o=!0,i=void 0,c="",u="",a=""}return{feed:d,reset:w}}function
|
|
350
|
+
${C.data.oauth.issuer?`Issuer: ${C.data.oauth.issuer}`:""}`;F({title:"OAuth Setup Instructions",description:le,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"})]})]})]}),U&&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:U instanceof Error?U.message:String(U)})]})]})]}),!_e&&!ve&&!ke&&t.type==="a2a"&&!ee&&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 ",_==null?void 0:_.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 VO(){const[t,e]=x.useState("connecting"),[r,s]=x.useState(null),n=x.useRef(null),a=x.useRef(null),o=yr();return x.useEffect(()=>{const c=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws/events`,u=()=>{try{const d=new WebSocket(c);n.current=d,d.onopen=()=>{console.log("WebSocket connected"),e("connected")},d.onmessage=h=>{try{const m=JSON.parse(h.data);s(m),m.type==="deck_update"?(console.log("Received deck update:",m),o.invalidateQueries({queryKey:["/api/decks"]}),o.invalidateQueries({queryKey:["/api/decks"]})):m.type==="service_update"?(console.log("Received service update:",m),o.invalidateQueries({queryKey:["/api/services"]}),o.invalidateQueries({queryKey:["/api/collection/warnings"]})):m.type==="connection_status"&&e(m.status==="connected"?"connected":"disconnected")}catch(m){console.error("Failed to parse WebSocket message:",m)}},d.onclose=()=>{console.log("WebSocket disconnected"),e("disconnected"),a.current=setTimeout(()=>{console.log("Attempting to reconnect WebSocket..."),e("connecting"),u()},3e3)},d.onerror=h=>{console.error("WebSocket error:",h),e("disconnected")}}catch(d){console.error("Failed to connect WebSocket:",d),e("disconnected")}};return u(),()=>{a.current&&clearTimeout(a.current),n.current&&n.current.readyState===WebSocket.OPEN&&n.current.close()}},[o]),{connectionStatus:t,lastMessage:r}}async function E0(t,e){const r=t==="credential"?`credentialId=${encodeURIComponent(e)}`:`serviceId=${encodeURIComponent(e)}`;return(await(await Oe("GET",`/api/playbooks/dependents/check?${r}`)).json()).data??[]}function qO(t){const[e,r]=x.useState(null),[s,n]=x.useState(null),[a,o]=x.useState(null),[i,c]=x.useState(!1),u=yr(),{toast:d}=or(),h=()=>{if(!t)throw new Error("Select a deck to edit first");return t},m=At({mutationFn:async T=>{var K,P,D;const _=h(),z=(K=(await(await Oe("GET","/api/decks")).json()).data)==null?void 0:K.find(L=>L.id===_);if(!z)throw new Error("Selected deck not found");if((P=z.services)!=null&&P.some(L=>L.id===T))throw new Error("Service is already in the deck");const U=((D=z.services)==null?void 0:D.length)??0;return Oe("POST",`/api/decks/${_}/services`,{serviceId:T,position:U})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service added to deck",description:`${(e==null?void 0:e.name)||"Service"} has been added to the deck.`})},onError:T=>{d({title:"Failed to add service",description:T.message,variant:"destructive"})}}),f=At({mutationFn:async T=>{var U,K;const _=h(),z=(U=(await(await Oe("GET","/api/decks")).json()).data)==null?void 0:U.find(P=>P.id===_);if((K=z==null?void 0:z.credentials)!=null&&K.some(P=>P.id===T))throw new Error("API key is already in the deck");return Oe("POST",`/api/decks/${_}/credentials`,{credentialId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key added to deck",description:`${(s==null?void 0:s.label)||"API key"} is scoped to this deck.`})},onError:T=>{d({title:"Failed to add API key",description:T.message,variant:"destructive"})}}),w=At({mutationFn:async T=>{var U,K;const _=h(),z=(U=(await(await Oe("GET","/api/decks")).json()).data)==null?void 0:U.find(P=>P.id===_);if((K=z==null?void 0:z.playbooks)!=null&&K.some(P=>P.id===T))throw new Error("Playbook is already in the deck");return Oe("POST",`/api/decks/${_}/playbooks`,{playbookId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook added to deck",description:`${(a==null?void 0:a.title)||"Playbook"} is on this deck.`})},onError:T=>{d({title:"Failed to add playbook",description:T.message,variant:"destructive"})}}),p=At({mutationFn:async T=>{const _=await E0("service",T);if(_.length>0){const C=_.map(U=>U.title).join(", ");if(!window.confirm(`Warning: ${_.length} playbook(s) depend on this MCP (${C}). Remove from deck anyway?`))throw new Error("Cancelled")}const I=h();return Oe("DELETE",`/api/decks/${I}/services`,{serviceId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service removed from deck",description:`${(e==null?void 0:e.name)||"Service"} has been removed from the deck.`})},onError:T=>{T.message!=="Cancelled"&&d({title:"Failed to remove service",description:T.message,variant:"destructive"})}}),y=At({mutationFn:async T=>{const _=await E0("credential",T);if(_.length>0){const C=_.map(U=>U.title).join(", ");if(!window.confirm(`Warning: ${_.length} playbook(s) depend on this API key (${C}). Remove from deck anyway?`))throw new Error("Cancelled")}const I=h();return Oe("DELETE",`/api/decks/${I}/credentials`,{credentialId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key removed from deck",description:`${(s==null?void 0:s.label)||"API key"} is no longer on this deck.`})},onError:T=>{T.message!=="Cancelled"&&d({title:"Failed to remove API key",description:T.message,variant:"destructive"})}}),g=At({mutationFn:async T=>{const _=h();return Oe("DELETE",`/api/decks/${_}/playbooks`,{playbookId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook removed from deck",description:`${(a==null?void 0:a.title)||"Playbook"} is no longer on this deck.`})},onError:T=>{d({title:"Failed to remove playbook",description:T.message,variant:"destructive"})}}),v=(T,_)=>{T.currentTarget instanceof HTMLElement&&(T.currentTarget.style.opacity=_)},b=(T,_)=>{T.dataTransfer.setData("text/plain",_.id),T.dataTransfer.setData("application/json",JSON.stringify(_)),T.dataTransfer.effectAllowed=_.fromDeck?"move":"copy"},S=(T,_,I=!1)=>{r(_),n(null),o(null),c(I),b(T,{kind:"service",id:_.id,fromDeck:I}),v(T,"0.5")},E=(T,_,I=!1)=>{n(_),r(null),o(null),c(I),b(T,{kind:"credential",id:_.id,fromDeck:I}),v(T,"0.5")},N=(T,_,I=!1)=>{o(_),r(null),n(null),c(I),b(T,{kind:"playbook",id:_.id,fromDeck:I}),v(T,"0.5")},j=T=>{r(null),n(null),o(null),v(T,"1")},R=T=>{if(T.kind==="service"){T.fromDeck?p.mutate(T.id):m.mutate(T.id);return}if(T.kind==="credential"){T.fromDeck?y.mutate(T.id):f.mutate(T.id);return}T.fromDeck?g.mutate(T.id):w.mutate(T.id)};return{draggedService:e,draggedCredential:s,draggedPlaybook:a,isDraggingFromDeck:i,handleDragStart:S,handleCredentialDragStart:E,handlePlaybookDragStart:N,handleDragEnd:j,handleDrop:T=>{T.preventDefault();const _=T.dataTransfer.getData("application/json");if(_){try{R(JSON.parse(_))}catch{const I=T.dataTransfer.getData("text/plain");I&&e&&m.mutate(I)}r(null),n(null),o(null),c(!1)}},handleGlobalDrop:T=>{T.preventDefault();const _=T.dataTransfer.getData("application/json");if(_){try{const I=JSON.parse(_);I.fromDeck&&R(I)}catch{}r(null),n(null),o(null),c(!1)}},isDropping:m.isPending||f.isPending||w.isPending||p.isPending||y.isPending||g.isPending}}const Kf="agent-deck-editing-deck-id";function HO(t){const[e,r]=x.useState(()=>typeof window>"u"?null:localStorage.getItem(Kf));x.useEffect(()=>{if(t.length===0)return;if(!(e&&t.some(o=>o.id===e))){const o=t[0].id;r(o),localStorage.setItem(Kf,o)}},[t,e]);const s=a=>{r(a),localStorage.setItem(Kf,a)};return{editingDeck:t.find(a=>a.id===e)??null,editingDeckId:e,setEditingDeckId:s}}function C0(t,[e,r]){return Math.min(r,Math.max(e,t))}var BO=[" ","Enter","ArrowUp","ArrowDown"],KO=[" ","Enter"],Za="Select",[Ud,zd,WO]=pv(Za),[Pi,kF]=fs(Za,[WO,Od]),Vd=Od(),[QO,ma]=Pi(Za),[GO,ZO]=Pi(Za),T_=t=>{const{__scopeSelect:e,children:r,open:s,defaultOpen:n,onOpenChange:a,value:o,defaultValue:i,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:f,form:w}=t,p=Vd(e),[y,g]=x.useState(null),[v,b]=x.useState(null),[S,E]=x.useState(!1),N=Dv(u),[j,R]=Wa({prop:s,defaultProp:n??!1,onChange:a,caller:Za}),[A,F]=Wa({prop:o,defaultProp:i,onChange:c,caller:Za}),T=x.useRef(null),_=y?w||!!y.closest("form"):!0,[I,C]=x.useState(new Set),z=Array.from(I).map(U=>U.props.value).join(";");return l.jsx(wT,{...p,children:l.jsxs(QO,{required:f,scope:e,trigger:y,onTriggerChange:g,valueNode:v,onValueNodeChange:b,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:ea(),value:A,onValueChange:F,open:j,onOpenChange:R,dir:N,triggerPointerDownPosRef:T,disabled:m,children:[l.jsx(Ud.Provider,{scope:e,children:l.jsx(GO,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(U=>{C(K=>new Set(K).add(U))},[]),onNativeOptionRemove:x.useCallback(U=>{C(K=>{const P=new Set(K);return P.delete(U),P})},[]),children:r})}),_?l.jsxs(tE,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:h,value:A,onChange:U=>F(U.target.value),disabled:m,form:w,children:[A===void 0?l.jsx("option",{value:""}):null,Array.from(I)]},z):null]})})};T_.displayName=Za;var A_="SelectTrigger",O_=x.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:s=!1,...n}=t,a=Vd(r),o=ma(A_,r),i=o.disabled||s,c=et(e,o.onTriggerChange),u=zd(r),d=x.useRef("touch"),[h,m,f]=nE(p=>{const y=u().filter(b=>!b.disabled),g=y.find(b=>b.value===o.value),v=sE(y,p,g);v!==void 0&&o.onValueChange(v.value)}),w=p=>{i||(o.onOpenChange(!0),f()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return l.jsx(oS,{asChild:!0,...a,children:l.jsx(Ae.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":rE(o.value)?"":void 0,...n,ref:c,onClick:Se(n.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&w(p)}),onPointerDown:Se(n.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"&&(w(p),p.preventDefault())}),onKeyDown:Se(n.onKeyDown,p=>{const y=h.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(y&&p.key===" ")&&BO.includes(p.key)&&(w(),p.preventDefault())})})})});O_.displayName=A_;var I_="SelectValue",D_=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:s,style:n,children:a,placeholder:o="",...i}=t,c=ma(I_,r),{onValueNodeHasChildrenChange:u}=c,d=a!==void 0,h=et(e,c.onValueNodeChange);return Bt(()=>{u(d)},[u,d]),l.jsx(Ae.span,{...i,ref:h,style:{pointerEvents:"none"},children:rE(c.value)?l.jsx(l.Fragment,{children:o}):a})});D_.displayName=I_;var YO="SelectIcon",M_=x.forwardRef((t,e)=>{const{__scopeSelect:r,children:s,...n}=t;return l.jsx(Ae.span,{"aria-hidden":!0,...n,ref:e,children:s||"▼"})});M_.displayName=YO;var JO="SelectPortal",$_=t=>l.jsx(Ed,{asChild:!0,...t});$_.displayName=JO;var Ya="SelectContent",F_=x.forwardRef((t,e)=>{const r=ma(Ya,t.__scopeSelect),[s,n]=x.useState();if(Bt(()=>{n(new DocumentFragment)},[]),!r.open){const a=s;return a?so.createPortal(l.jsx(L_,{scope:t.__scopeSelect,children:l.jsx(Ud.Slot,{scope:t.__scopeSelect,children:l.jsx("div",{children:t.children})})}),a):null}return l.jsx(U_,{...t,ref:e})});F_.displayName=Ya;var Qr=10,[L_,va]=Pi(Ya),XO="SelectContentImpl",eI=fi("SelectContent.RemoveScroll"),U_=x.forwardRef((t,e)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:a,onPointerDownOutside:o,side:i,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:w,hideWhenDetached:p,avoidCollisions:y,...g}=t,v=ma(Ya,r),[b,S]=x.useState(null),[E,N]=x.useState(null),j=et(e,re=>S(re)),[R,A]=x.useState(null),[F,T]=x.useState(null),_=zd(r),[I,C]=x.useState(!1),z=x.useRef(!1);x.useEffect(()=>{if(b)return jS(b)},[b]),wS();const U=x.useCallback(re=>{const[ye,...ke]=_().map(_e=>_e.ref.current),[me]=ke.slice(-1),ee=document.activeElement;for(const _e of re)if(_e===ee||(_e==null||_e.scrollIntoView({block:"nearest"}),_e===ye&&E&&(E.scrollTop=0),_e===me&&E&&(E.scrollTop=E.scrollHeight),_e==null||_e.focus(),document.activeElement!==ee))return},[_,E]),K=x.useCallback(()=>U([R,b]),[U,R,b]);x.useEffect(()=>{I&&K()},[I,K]);const{onOpenChange:P,triggerPointerDownPosRef:D}=v;x.useEffect(()=>{if(b){let re={x:0,y:0};const ye=me=>{var ee,_e;re={x:Math.abs(Math.round(me.pageX)-(((ee=D.current)==null?void 0:ee.x)??0)),y:Math.abs(Math.round(me.pageY)-(((_e=D.current)==null?void 0:_e.y)??0))}},ke=me=>{re.x<=10&&re.y<=10?me.preventDefault():b.contains(me.target)||P(!1),document.removeEventListener("pointermove",ye),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[b,P,D]),x.useEffect(()=>{const re=()=>P(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[P]);const[L,X]=nE(re=>{const ye=_().filter(ee=>!ee.disabled),ke=ye.find(ee=>ee.ref.current===document.activeElement),me=sE(ye,re,ke);me&&setTimeout(()=>me.ref.current.focus())}),G=x.useCallback((re,ye,ke)=>{const me=!z.current&&!ke;(v.value!==void 0&&v.value===ye||me)&&(A(re),me&&(z.current=!0))},[v.value]),B=x.useCallback(()=>b==null?void 0:b.focus(),[b]),oe=x.useCallback((re,ye,ke)=>{const me=!z.current&&!ke;(v.value!==void 0&&v.value===ye||me)&&T(re)},[v.value]),ve=s==="popper"?Sp:z_,ge=ve===Sp?{side:i,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:w,hideWhenDetached:p,avoidCollisions:y}:{};return l.jsx(L_,{scope:r,content:b,viewport:E,onViewportChange:N,itemRefCallback:G,selectedItem:R,onItemLeave:B,itemTextRefCallback:oe,focusSelectedItem:K,selectedItemText:F,position:s,isPositioned:I,searchRef:L,children:l.jsx(Tv,{as:eI,allowPinchZoom:!0,children:l.jsx(Rv,{asChild:!0,trapped:v.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Se(n,re=>{var ye;(ye=v.trigger)==null||ye.focus({preventScroll:!0}),re.preventDefault()}),children:l.jsx(Vl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(ve,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:re=>re.preventDefault(),...g,...ge,onPlaced:()=>C(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:Se(g.onKeyDown,re=>{const ye=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ye&&re.key.length===1&&X(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let me=_().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);if(["ArrowUp","End"].includes(re.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const ee=re.target,_e=me.indexOf(ee);me=me.slice(_e+1)}setTimeout(()=>U(me)),re.preventDefault()}})})})})})})});U_.displayName=XO;var tI="SelectItemAlignedPosition",z_=x.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:s,...n}=t,a=ma(Ya,r),o=va(Ya,r),[i,c]=x.useState(null),[u,d]=x.useState(null),h=et(e,j=>d(j)),m=zd(r),f=x.useRef(!1),w=x.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:g,focusSelectedItem:v}=o,b=x.useCallback(()=>{if(a.trigger&&a.valueNode&&i&&u&&p&&y&&g){const j=a.trigger.getBoundingClientRect(),R=u.getBoundingClientRect(),A=a.valueNode.getBoundingClientRect(),F=g.getBoundingClientRect();if(a.dir!=="rtl"){const ee=F.left-R.left,_e=A.left-ee,Pe=j.left-_e,De=j.width+Pe,J=Math.max(De,R.width),ce=window.innerWidth-Qr,Y=C0(_e,[Qr,Math.max(Qr,ce-J)]);i.style.minWidth=De+"px",i.style.left=Y+"px"}else{const ee=R.right-F.right,_e=window.innerWidth-A.right-ee,Pe=window.innerWidth-j.right-_e,De=j.width+Pe,J=Math.max(De,R.width),ce=window.innerWidth-Qr,Y=C0(_e,[Qr,Math.max(Qr,ce-J)]);i.style.minWidth=De+"px",i.style.right=Y+"px"}const T=m(),_=window.innerHeight-Qr*2,I=p.scrollHeight,C=window.getComputedStyle(u),z=parseInt(C.borderTopWidth,10),U=parseInt(C.paddingTop,10),K=parseInt(C.borderBottomWidth,10),P=parseInt(C.paddingBottom,10),D=z+U+I+P+K,L=Math.min(y.offsetHeight*5,D),X=window.getComputedStyle(p),G=parseInt(X.paddingTop,10),B=parseInt(X.paddingBottom,10),oe=j.top+j.height/2-Qr,ve=_-oe,ge=y.offsetHeight/2,re=y.offsetTop+ge,ye=z+U+re,ke=D-ye;if(ye<=oe){const ee=T.length>0&&y===T[T.length-1].ref.current;i.style.bottom="0px";const _e=u.clientHeight-p.offsetTop-p.offsetHeight,Pe=Math.max(ve,ge+(ee?B:0)+_e+K),De=ye+Pe;i.style.height=De+"px"}else{const ee=T.length>0&&y===T[0].ref.current;i.style.top="0px";const Pe=Math.max(oe,z+p.offsetTop+(ee?G:0)+ge)+ke;i.style.height=Pe+"px",p.scrollTop=ye-oe+p.offsetTop}i.style.margin=`${Qr}px 0`,i.style.minHeight=L+"px",i.style.maxHeight=_+"px",s==null||s(),requestAnimationFrame(()=>f.current=!0)}},[m,a.trigger,a.valueNode,i,u,p,y,g,a.dir,s]);Bt(()=>b(),[b]);const[S,E]=x.useState();Bt(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const N=x.useCallback(j=>{j&&w.current===!0&&(b(),v==null||v(),w.current=!1)},[b,v]);return l.jsx(nI,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:f,onScrollButtonChange:N,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:l.jsx(Ae.div,{...n,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});z_.displayName=tI;var rI="SelectPopperPosition",Sp=x.forwardRef((t,e)=>{const{__scopeSelect:r,align:s="start",collisionPadding:n=Qr,...a}=t,o=Vd(r);return l.jsx(iS,{...o,...a,ref:e,align:s,collisionPadding:n,style:{boxSizing:"border-box",...a.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)"}})});Sp.displayName=rI;var[nI,Lv]=Pi(Ya,{}),_p="SelectViewport",V_=x.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:s,...n}=t,a=va(_p,r),o=Lv(_p,r),i=et(e,a.onViewportChange),c=x.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:s}),l.jsx(Ud.Slot,{scope:r,children:l.jsx(Ae.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:Se(n.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const f=Math.abs(c.current-d.scrollTop);if(f>0){const w=window.innerHeight-Qr*2,p=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),g=Math.max(p,y);if(g<w){const v=g+f,b=Math.min(w,v),S=v-b;h.style.height=b+"px",h.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});V_.displayName=_p;var q_="SelectGroup",[sI,aI]=Pi(q_),oI=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=ea();return l.jsx(sI,{scope:r,id:n,children:l.jsx(Ae.div,{role:"group","aria-labelledby":n,...s,ref:e})})});oI.displayName=q_;var H_="SelectLabel",B_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=aI(H_,r);return l.jsx(Ae.div,{id:n.id,...s,ref:e})});B_.displayName=H_;var Lu="SelectItem",[iI,K_]=Pi(Lu),W_=x.forwardRef((t,e)=>{const{__scopeSelect:r,value:s,disabled:n=!1,textValue:a,...o}=t,i=ma(Lu,r),c=va(Lu,r),u=i.value===s,[d,h]=x.useState(a??""),[m,f]=x.useState(!1),w=et(e,v=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,v,s,n)}),p=ea(),y=x.useRef("touch"),g=()=>{n||(i.onValueChange(s),i.onOpenChange(!1))};if(s==="")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(iI,{scope:r,value:s,disabled:n,textId:p,isSelected:u,onItemTextChange:x.useCallback(v=>{h(b=>b||((v==null?void 0:v.textContent)??"").trim())},[]),children:l.jsx(Ud.ItemSlot,{scope:r,value:s,disabled:n,textValue:d,children:l.jsx(Ae.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...o,ref:w,onFocus:Se(o.onFocus,()=>f(!0)),onBlur:Se(o.onBlur,()=>f(!1)),onClick:Se(o.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:Se(o.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:Se(o.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:Se(o.onPointerMove,v=>{var b;y.current=v.pointerType,n?(b=c.onItemLeave)==null||b.call(c):y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(o.onPointerLeave,v=>{var b;v.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:Se(o.onKeyDown,v=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&v.key===" "||(KO.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})});W_.displayName=Lu;var Wi="SelectItemText",Q_=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:s,style:n,...a}=t,o=ma(Wi,r),i=va(Wi,r),c=K_(Wi,r),u=ZO(Wi,r),[d,h]=x.useState(null),m=et(e,g=>h(g),c.onItemTextChange,g=>{var v;return(v=i.itemTextRefCallback)==null?void 0:v.call(i,g,c.value,c.disabled)}),f=d==null?void 0:d.textContent,w=x.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:p,onNativeOptionRemove:y}=u;return Bt(()=>(p(w),()=>y(w)),[p,y,w]),l.jsxs(l.Fragment,{children:[l.jsx(Ae.span,{id:c.textId,...a,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?so.createPortal(a.children,o.valueNode):null]})});Q_.displayName=Wi;var G_="SelectItemIndicator",Z_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t;return K_(G_,r).isSelected?l.jsx(Ae.span,{"aria-hidden":!0,...s,ref:e}):null});Z_.displayName=G_;var Ep="SelectScrollUpButton",Y_=x.forwardRef((t,e)=>{const r=va(Ep,t.__scopeSelect),s=Lv(Ep,t.__scopeSelect),[n,a]=x.useState(!1),o=et(e,s.onScrollButtonChange);return Bt(()=>{if(r.viewport&&r.isPositioned){let i=function(){const u=c.scrollTop>0;a(u)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?l.jsx(X_,{...t,ref:o,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});Y_.displayName=Ep;var Cp="SelectScrollDownButton",J_=x.forwardRef((t,e)=>{const r=va(Cp,t.__scopeSelect),s=Lv(Cp,t.__scopeSelect),[n,a]=x.useState(!1),o=et(e,s.onScrollButtonChange);return Bt(()=>{if(r.viewport&&r.isPositioned){let i=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;a(d)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?l.jsx(X_,{...t,ref:o,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});J_.displayName=Cp;var X_=x.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:s,...n}=t,a=va("SelectScrollButton",r),o=x.useRef(null),i=zd(r),c=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),Bt(()=>{var d;const u=i().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[i]),l.jsx(Ae.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:Se(n.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:Se(n.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:Se(n.onPointerLeave,()=>{c()})})}),lI="SelectSeparator",eE=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t;return l.jsx(Ae.div,{"aria-hidden":!0,...s,ref:e})});eE.displayName=lI;var Pp="SelectArrow",cI=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=Vd(r),a=ma(Pp,r),o=va(Pp,r);return a.open&&o.position==="popper"?l.jsx(lS,{...n,...s,ref:e}):null});cI.displayName=Pp;var uI="SelectBubbleInput",tE=x.forwardRef(({__scopeSelect:t,value:e,...r},s)=>{const n=x.useRef(null),a=et(s,n),o=x_(e);return x.useEffect(()=>{const i=n.current;if(!i)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&d){const h=new Event("change",{bubbles:!0});d.call(i,e),i.dispatchEvent(h)}},[o,e]),l.jsx(Ae.select,{...r,style:{...e1,...r.style},ref:a,defaultValue:e})});tE.displayName=uI;function rE(t){return t===""||t===void 0}function nE(t){const e=Ur(t),r=x.useRef(""),s=x.useRef(0),n=x.useCallback(o=>{const i=r.current+o;e(i),function c(u){r.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(i)},[e]),a=x.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,n,a]}function sE(t,e,r){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,a=r?t.indexOf(r):-1;let o=dI(t,Math.max(a,0));n.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return c!==r?c:void 0}function dI(t,e){return t.map((r,s)=>t[(e+s)%t.length])}var fI=T_,aE=O_,hI=D_,pI=M_,mI=$_,oE=F_,vI=V_,iE=B_,lE=W_,gI=Q_,yI=Z_,cE=Y_,uE=J_,dE=eE;const xI=fI,wI=hI,fE=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(aE,{ref:s,className:Te("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",t),...r,children:[e,l.jsx(pI,{asChild:!0,children:l.jsx(xv,{className:"h-4 w-4 opacity-50"})})]}));fE.displayName=aE.displayName;const hE=x.forwardRef(({className:t,...e},r)=>l.jsx(cE,{ref:r,className:Te("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(d2,{className:"h-4 w-4"})}));hE.displayName=cE.displayName;const pE=x.forwardRef(({className:t,...e},r)=>l.jsx(uE,{ref:r,className:Te("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(xv,{className:"h-4 w-4"})}));pE.displayName=uE.displayName;const mE=x.forwardRef(({className:t,children:e,position:r="popper",...s},n)=>l.jsx(mI,{children:l.jsxs(oE,{ref:n,className:Te("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",t),position:r,...s,children:[l.jsx(hE,{}),l.jsx(vI,{className:Te("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(pE,{})]})}));mE.displayName=oE.displayName;const bI=x.forwardRef(({className:t,...e},r)=>l.jsx(iE,{ref:r,className:Te("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));bI.displayName=iE.displayName;const po=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(lE,{ref:s,className:Te("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",t),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(yI,{children:l.jsx(E1,{className:"h-4 w-4"})})}),l.jsx(gI,{children:e})]}));po.displayName=lE.displayName;const SI=x.forwardRef(({className:t,...e},r)=>l.jsx(dE,{ref:r,className:Te("-mx-1 my-1 h-px bg-muted",t),...e}));SI.displayName=dE.displayName;const _I="/assets/AgentDeckLogo3-CEDxeHlz.png";function EI(){var ms,ya,vs;const[t,e]=x.useState(""),[r,s]=x.useState(""),[n,a]=x.useState(!1),[o,i]=x.useState(!1),[c,u]=x.useState(null),[d,h]=x.useState(!1),[m,f]=x.useState(!1),[w,p]=x.useState(null),[y,g]=x.useState(!1),[v,b]=x.useState(!1),[S,E]=x.useState(null),[N,j]=x.useState(!1),[R,A]=x.useState(null),{toast:F}=or(),{connectionStatus:T}=VO(),{data:_,isLoading:I,error:C}=hr({queryKey:["/api/decks"]}),z=(_==null?void 0:_.data)||[],{editingDeck:U,editingDeckId:K,setEditingDeckId:P}=HO(z),{handleDragStart:D,handleCredentialDragStart:L,handlePlaybookDragStart:X,handleDragEnd:G,handleDrop:B,handleGlobalDrop:oe,isDraggingFromDeck:ve}=qO(K),{data:ge,isLoading:re,error:ye}=hr({queryKey:["/api/services"]}),{data:ke,isLoading:me}=hr({queryKey:["/api/credentials/vault"]}),{data:ee,isLoading:_e}=hr({queryKey:["/api/playbooks/vault"]}),{data:Pe}=hr({queryKey:["/api/collection/warnings"],staleTime:6e4}),De=(ge==null?void 0:ge.data)||[],J=(ke==null?void 0:ke.data)||[],ce=(ee==null?void 0:ee.data)||[],Y=x.useMemo(()=>zT(Pe==null?void 0:Pe.data),[Pe==null?void 0:Pe.data]),ze=(ne,Et)=>n?ne==="service"?Y.serviceWarnings.has(Et):ne==="credential"?Y.credentialWarnings.has(Et):Y.playbookWarnings.has(Et):!0,te=De.filter(ne=>{var $n;if(!ze("service",ne.id)||r==="api-key"||r==="playbook")return!1;const Et=ne.name.toLowerCase().includes(t.toLowerCase())||(($n=ne.description)==null?void 0:$n.toLowerCase().includes(t.toLowerCase())),Mn=!r||r==="all"||ne.type===r;return Et&&Mn}),Me=J.filter(ne=>!ze("credential",ne.id)||r&&r!=="all"&&r!=="api-key"?!1:ne.label.toLowerCase().includes(t.toLowerCase())),Ue=ce.filter(ne=>!ze("playbook",ne.id)||r&&r!=="all"&&r!=="playbook"?!1:ne.title.toLowerCase().includes(t.toLowerCase())||ne.body.toLowerCase().includes(t.toLowerCase())),Ne=te.length+Me.length+Ue.length;ye&&console.error("Services error:",ye),C&&console.error("Decks error:",C);const rt=()=>{e(""),s(""),a(!1)},pt=!!(t||r||n),Hr=new Set(((U==null?void 0:U.credentials)??[]).map(ne=>ne.id)),zt=new Set(((U==null?void 0:U.playbooks)??[]).map(ne=>ne.id)),hs=(U==null?void 0:U.services)||[],oo=(U==null?void 0:U.playbooks)||[],Yt=ne=>{u(ne),h(!0)},Br=ne=>{E(ne.id),j(!0)},ps=ne=>{p(ne.id),g(!0)},jr=ne=>{A(ne)};if(ye||C){const ne=(C instanceof Error?C.message:null)??(ye instanceof Error?ye.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:ne}),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 re||I||me||_e?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:oe,onDragOver:ne=>ne.preventDefault(),style:{position:"relative",...ve&&{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:_I,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 ${T==="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 ${T==="connected"?"bg-emerald-400":"bg-red-400"}`}),l.jsx("button",{className:`text-sm hover:underline cursor-pointer ${T==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{F({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"})]}),U&&l.jsx("div",{className:"px-4 py-2 rounded-lg border",style:{backgroundColor:"rgba(196, 182, 67, 0.2)",borderColor:"rgba(196, 182, 67, 0.4)"},children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("i",{className:"fas fa-star",style:{color:"#C4B643"}}),l.jsx("span",{className:"text-sm font-medium","data-testid":"editing-deck-name",style:{color:"#92E4DD"},children:U.name}),l.jsxs("span",{className:"text-xs",style:{color:"#92E4DD",opacity:.7},"data-testid":"editing-deck-count",children:[(((ms=U.services)==null?void 0:ms.length)??0)+(((ya=U.credentials)==null?void 0:ya.length)??0)+(((vs=U.playbooks)==null?void 0:vs.length)??0)," ","cards"]})]})})]})]})})}),ve&&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",children:[l.jsxs("div",{className:"xl:col-span-1 space-y-6",children:[l.jsx("div",{className:"panel-surface p-4 h-80",children:l.jsx(kO,{decks:z,editingDeckId:K,onSelectDeck:P,isLoading:I})}),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(_1,{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(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(wr),onClick:()=>i(!0),"data-testid":"button-register-mcp",children:[l.jsx(Ru,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),l.jsxs(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(ur),onClick:()=>f(!0),"data-testid":"button-register-api-key",children:[l.jsx(dp,{className:"w-3 h-3 mr-2"}),"Register API key"]}),l.jsxs(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(Yr),onClick:()=>b(!0),"data-testid":"button-register-playbook",children:[l.jsx(yv,{className:"w-3 h-3 mr-2"}),"Register Playbook"]})]})]})]}),l.jsxs("div",{className:"xl:col-span-3 space-y-6",children:[l.jsx("div",{className:"panel-surface p-4 h-80",children:U?l.jsx("div",{className:"h-full",children:l.jsx(YT,{deck:U,services:hs,credentials:U.credentials??[],playbooks:oo,allServices:De,collectionWarnings:Y,onDrop:B,onDragStart:D,onCredentialDragStart:L,onPlaybookDragStart:X,onDragEnd:G,onCardClick:Yt,onPlaybookClick:Br,onCredentialClick:ps})}):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(fp,{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(fe,{onClick:()=>{const ne=document.querySelector('[data-testid="create-deck-button"]');ne&&ne.click()},className:"border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},children:[l.jsx(Vs,{className:"w-4 h-4 mr-2"}),"Create New Deck"]}),l.jsxs(fe,{variant:"outline",className:"border-white/20 text-white hover:bg-white/10 text-sm py-2",onClick:()=>{const ne=document.querySelector('[data-testid="deck-management-panel"]');ne&&ne.scrollIntoView({behavior:"smooth"})},children:[l.jsx(fp,{className:"w-4 h-4 mr-2"}),"Manage Decks"]})]})]})}),l.jsxs("div",{className:"panel-surface p-4 h-80",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("h2",{className:"text-lg font-bold flex items-center",children:[l.jsx(p2,{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:["(",Ne," cards)"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(k1,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),l.jsx(tt,{placeholder:"Search...",value:t,onChange:ne=>e(ne.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(xI,{value:r,onValueChange:s,children:[l.jsxs(fE,{className:"w-20 h-8 bg-white/10 border-white/20 text-white text-sm","data-testid":"select-type",children:[l.jsx(h2,{className:"w-3 h-3 mr-1"}),l.jsx(wI,{placeholder:"Type"})]}),l.jsxs(mE,{children:[l.jsx(po,{value:"all",children:"All"}),l.jsx(po,{value:"mcp",children:"MCP"}),l.jsx(po,{value:"local-mcp",children:"Local MCP"}),l.jsx(po,{value:"api-key",children:"API Key"}),l.jsx(po,{value:"playbook",children:"Playbook"})]})]}),(t||r||n)&&l.jsx(fe,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:rt,title:"Clear all filters",children:"Clear"})]})]}),Y.total>0&&l.jsx("button",{type:"button",onClick:()=>a(ne=>!ne),className:`mb-4 w-full rounded-lg border px-3 py-2 text-left text-sm transition-colors ${n?"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(wn,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),l.jsx("span",{children:n?l.jsxs(l.Fragment,{children:["Showing ",l.jsx("strong",{children:Ne})," card",Ne===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:Y.total})," card",Y.total===1?"":"s"," need attention",Y.byKind.oauth_expired+Y.byKind.oauth_required>0&&l.jsxs(l.Fragment,{children:[" ","(",Y.byKind.oauth_expired+Y.byKind.oauth_required," ","OAuth)"]}),". ",l.jsx("span",{className:"text-amber-200/80",children:"Click to filter."})]})})]})}),re||me||_e?l.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,80px)] gap-0",children:Array.from({length:10}).map((ne,Et)=>l.jsx("div",{className:"animate-pulse",children:l.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},Et))}):Ne===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:pt?n?"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"}),!pt&&l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsxs(fe,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${bn}`,style:Sn(wr),onClick:()=>i(!0),"data-testid":"button-register-mcp-empty",children:[l.jsx(Ru,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),l.jsxs(fe,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${bn}`,style:Sn(ur),onClick:()=>f(!0),"data-testid":"button-register-api-key-empty",children:[l.jsx(dp,{className:"w-3 h-3 mr-1"}),"Register API key"]})]})]}):l.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,80px)] gap-0 relative isolate",style:{isolation:"isolate"},children:[Ue.map((ne,Et)=>l.jsx("div",{className:"relative group",style:{zIndex:R===ne.id?999999:Ne-Et},children:l.jsx(ZT,{playbook:ne,isInActiveDeck:zt.has(ne.id),activeDeck:U??void 0,isInCollection:!0,onDragStart:X,onDragEnd:G,onCardClick:Br,onMouseEnter:()=>jr(ne.id),onMouseLeave:()=>jr(null),warnings:Y.playbookWarnings.get(ne.id)})},ne.id)),Me.map((ne,Et)=>l.jsx("div",{className:"relative group",style:{zIndex:R===ne.id?999999:Ne-Ue.length-Et},children:l.jsx(QT,{credential:ne,isInActiveDeck:Hr.has(ne.id),activeDeck:U??void 0,isInCollection:!0,onDragStart:L,onDragEnd:G,onMouseEnter:()=>jr(ne.id),onMouseLeave:()=>jr(null),onCardClick:ps,warnings:Y.credentialWarnings.get(ne.id)})},ne.id)),te.map((ne,Et)=>{var Mn;return l.jsx("div",{className:"relative group",style:{zIndex:R===ne.id?999999:Ne-Ue.length-Me.length-Et},children:l.jsx(BT,{service:ne,onDragStart:D,onDragEnd:G,isInActiveDeck:((Mn=U==null?void 0:U.services)==null?void 0:Mn.some($n=>$n.id===ne.id))||!1,onCardClick:Yt,isInCollection:!0,onMouseEnter:()=>jr(ne.id),onMouseLeave:()=>jr(null),activeDeck:U??void 0,warnings:Y.serviceWarnings.get(ne.id)})},ne.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(PO,{type:"mcp",open:o,onOpenChange:i}),l.jsx(zO,{service:c,isOpen:d,onClose:()=>h(!1)}),l.jsx(NO,{open:m,onOpenChange:f}),l.jsx(TO,{credentialId:w,open:y,onOpenChange:g}),l.jsx(jO,{open:v,onOpenChange:b}),l.jsx(RO,{playbookId:S,open:N,onOpenChange:j})]})}const Cs=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Cs.displayName="Card";const _a=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("flex flex-col space-y-1.5 p-6",t),...e}));_a.displayName="CardHeader";const Ea=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("text-2xl font-semibold leading-none tracking-tight",t),...e}));Ea.displayName="CardTitle";const Xc=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("text-sm text-muted-foreground",t),...e}));Xc.displayName="CardDescription";const Ps=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("p-6 pt-0",t),...e}));Ps.displayName="CardContent";const CI=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:Te("flex items-center p-6 pt-0",t),...e}));CI.displayName="CardFooter";function PI(){return l.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:l.jsx(Cs,{className:"w-full max-w-md mx-4",children:l.jsxs(Ps,{className:"pt-6",children:[l.jsxs("div",{className:"flex mb-4 gap-2",children:[l.jsx(C1,{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 kI(){const[t]=EN(),[e,r]=x.useState("loading"),[s,n]=x.useState("Authenticating...");return x.useEffect(()=>{(async()=>{try{const o=new URL(window.location.href),i=o.searchParams.get("success"),c=o.searchParams.get("error");i==="true"?(r("success"),n("Authentication successful! This window will close automatically."),setTimeout(()=>{window.close()},2e3)):i==="false"?(r("error"),n(`OAuth Error: ${c||"Authentication failed"}`)):(r("error"),n("Invalid OAuth callback - please try again"))}catch(o){r("error"),n(o instanceof Error?o.message:"Authentication failed")}})()},[t]),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:[e==="loading"&&l.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),e==="success"&&l.jsx("div",{className:"text-green-500 text-4xl",children:"✓"}),e==="error"&&l.jsx("div",{className:"text-red-500 text-4xl",children:"✗"}),l.jsx("h1",{className:"text-xl font-semibold",children:s}),e==="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 To(t){const e=()=>{throw new Error(`Invalid url to pass to open(): ${t}`)};let r;try{r=new URL(t)}catch{e()}return r.protocol!=="https:"&&r.protocol!=="http:"&&e(),r.hostname!==encodeURIComponent(r.hostname)&&e(),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(NI).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function NI([t,e]){return`${encodeURIComponent(t)}${e.length>0?`=${encodeURIComponent(e)}`:""}`}var P0=class{constructor(t,e={}){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=t,this.storageKeyPrefix=e.storageKeyPrefix||"mcp:auth",this.serverUrlHash=this.hashString(t),this.clientName=e.clientName||"MCP Browser Client",this.clientUri=e.clientUri||(typeof window<"u"?window.location.origin:""),this.callbackUrl=To(e.callbackUrl||(typeof window<"u"?new URL("/oauth/callback",window.location.origin).toString():"/oauth/callback")),this.preventAutoAuth=e.preventAutoAuth,this.onPopupWindow=e.onPopupWindow}get redirectUrl(){return To(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 t=this.getKey("client_info"),e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,r),localStorage.removeItem(t);return}}async saveClientInformation(t){const e=this.getKey("client_info");localStorage.setItem(e,JSON.stringify(t))}async tokens(){const t=this.getKey("tokens"),e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,r),localStorage.removeItem(t);return}}async saveTokens(t){const e=this.getKey("tokens");localStorage.setItem(e,JSON.stringify(t)),localStorage.removeItem(this.getKey("code_verifier")),localStorage.removeItem(this.getKey("last_auth_url"))}async saveCodeVerifier(t){const e=this.getKey("code_verifier");localStorage.setItem(e,t)}async codeVerifier(){const t=this.getKey("code_verifier"),e=localStorage.getItem(t);if(!e)throw new Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${t}. Auth flow likely corrupted or timed out.`);return e}async prepareAuthorizationUrl(t){const e=crypto.randomUUID(),r=`${this.storageKeyPrefix}:state_${e}`,s={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(s)),t.searchParams.set("state",e);const n=t.toString(),a=To(n);return localStorage.setItem(this.getKey("last_auth_url"),a),a}async redirectToAuthorization(t){if(this.preventAutoAuth)return;const e=await this.prepareAuthorizationUrl(t),r="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const s=window.open(e,`mcp_auth_${this.serverUrlHash}`,r);this.onPopupWindow&&this.onPopupWindow(e,r,s),!s||s.closed||typeof s.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(s.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(s){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,s)}}getLastAttemptedAuthUrl(){const t=localStorage.getItem(this.getKey("last_auth_url"));return t?To(t):null}clearStorage(){const t=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,e=`${this.storageKeyPrefix}:state_`,r=[];let s=0;for(let a=0;a<localStorage.length;a++){const o=localStorage.key(a);if(o){if(o.startsWith(t))r.push(o);else if(o.startsWith(e))try{const i=localStorage.getItem(o);i&&JSON.parse(i).serverUrlHash===this.serverUrlHash&&r.push(o)}catch(i){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${o} during clearStorage:`,i)}}}return[...new Set(r)].forEach(a=>{localStorage.removeItem(a),s++}),s}hashString(t){let e=0;for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);e=(e<<5)-e+s,e=e&e}return Math.abs(e).toString(16)}getKey(t){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${t}`}},Ge;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{const a={};for(const o of n)a[o]=o;return a},t.getValidEnumValues=n=>{const a=t.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(const i of a)o[i]=n[i];return t.objectValues(o)},t.objectValues=n=>t.objectKeys(n).map(function(a){return n[a]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},t.find=(n,a)=>{for(const o of n)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(Ge||(Ge={}));var k0;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(k0||(k0={}));const de=Ge.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ks=t=>{switch(typeof t){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(t)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":return Array.isArray(t)?de.array:t===null?de.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?de.promise:typeof Map<"u"&&t instanceof Map?de.map:typeof Set<"u"&&t instanceof Set?de.set:typeof Date<"u"&&t instanceof Date?de.date:de.object;default:return de.unknown}},Z=Ge.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class cs extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(r(o));else{let i=s,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(r(o))):i[u]=i[u]||{_errors:[]},i=i[u],c++}}};return n(this),s}static assert(e){if(!(e instanceof cs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ge.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];r[a]=r[a]||[],r[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}cs.create=t=>new cs(t);const kp=(t,e)=>{let r;switch(t.code){case Z.invalid_type:t.received===de.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ge.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ge.joinValues(t.keys,", ")}`;break;case Z.invalid_union:r="Invalid input";break;case Z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ge.joinValues(t.options)}`;break;case Z.invalid_enum_value:r=`Invalid enum value. Expected ${Ge.joinValues(t.options)}, received '${t.received}'`;break;case Z.invalid_arguments:r="Invalid function arguments";break;case Z.invalid_return_type:r="Invalid function return type";break;case Z.invalid_date:r="Invalid date";break;case Z.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ge.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Z.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Z.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Z.custom:r="Invalid input";break;case Z.invalid_intersection_types:r="Intersection results could not be merged";break;case Z.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Z.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ge.assertNever(t)}return{message:r}};let jI=kp;function RI(){return jI}const TI=t=>{const{data:e,path:r,errorMaps:s,issueData:n}=t,a=[...r,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="";const c=s.filter(u=>!!u).slice().reverse();for(const u of c)i=u(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}};function ae(t,e){const r=RI(),s=TI({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===kp?void 0:kp].filter(n=>!!n)});t.common.issues.push(s)}class nr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const n of r){if(n.status==="aborted")return Ee;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const n of r){const a=await n.key,o=await n.value;s.push({key:a,value:o})}return nr.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const n of r){const{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return Ee;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}}const Ee=Object.freeze({status:"aborted"}),Qi=t=>({status:"dirty",value:t}),zr=t=>({status:"valid",value:t}),N0=t=>t.status==="aborted",j0=t=>t.status==="dirty",mi=t=>t.status==="valid",Uu=t=>typeof Promise<"u"&&t instanceof Promise;var pe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(pe||(pe={}));class An{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const R0=(t,e)=>{if(mi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new cs(t.common.issues);return this._error=r,this._error}}};function Fe(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{const{message:c}=t;return o.code==="invalid_enum_value"?{message:c??i.defaultError}:typeof i.data>"u"?{message:c??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:c??r??i.defaultError}},description:n}}class Be{get description(){return this._def.description}_getType(e){return ks(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nr,ctx:{common:e.parent.common,data:e.data,parsedType:ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Uu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){const s={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)},n=this._parseSync({data:e,path:s.path,parent:s});return R0(s,n)}"~validate"(e){var s,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return mi(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>mi(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(Uu(n)?n:Promise.resolve(n));return R0(s,a)}refine(e,r){const s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{const o=e(n),i=()=>a.addIssue({code:Z.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new eo({schema:this,typeName:Ce.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ts.create(this,this._def)}nullable(){return to.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rn.create(this)}promise(){return Ku.create(this,this._def)}or(e){return Vu.create([this,e],this._def)}and(e){return qu.create(this,e,this._def)}transform(e){return new eo({...Fe(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Wu({...Fe(this._def),innerType:this,defaultValue:r,typeName:Ce.ZodDefault})}brand(){return new xE({typeName:Ce.ZodBranded,type:this,...Fe(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Qu({...Fe(this._def),innerType:this,catchValue:r,typeName:Ce.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return zv.create(this,e)}readonly(){return Gu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const AI=/^c[^\s-]{8,}$/i,OI=/^[0-9a-z]+$/,II=/^[0-9A-HJKMNP-TV-Z]{26}$/i,DI=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,MI=/^[a-z0-9_-]{21}$/i,$I=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,FI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,LI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Wf;const zI=/^(?:(?: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])$/,VI=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,qI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,HI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,KI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vE="((\\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])))",WI=new RegExp(`^${vE}$`);function gE(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function QI(t){return new RegExp(`^${gE(t)}$`)}function GI(t){let e=`${vE}T${gE(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function ZI(t,e){return!!((e==="v4"||!e)&&zI.test(t)||(e==="v6"||!e)&&qI.test(t))}function YI(t,e){if(!$I.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function JI(t,e){return!!((e==="v4"||!e)&&VI.test(t)||(e==="v6"||!e)&&HI.test(t))}class Xn extends Be{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==de.string){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:de.string,received:a.parsedType}),Ee}const s=new nr;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?ae(n,{code:Z.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&ae(n,{code:Z.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")LI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"email",code:Z.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Wf||(Wf=new RegExp(UI,"u")),Wf.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"emoji",code:Z.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")DI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"uuid",code:Z.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")MI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"nanoid",code:Z.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")AI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"cuid",code:Z.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")OI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"cuid2",code:Z.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")II.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"ulid",code:Z.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),ae(n,{validation:"url",code:Z.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"regex",code:Z.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?GI(a).test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?WI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?QI(a).test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?FI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"duration",code:Z.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?ZI(e.data,a.version)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"ip",code:Z.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?YI(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"jwt",code:Z.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?JI(e.data,a.version)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"cidr",code:Z.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?BI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"base64",code:Z.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?KI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"base64url",code:Z.invalid_string,message:a.message}),s.dirty()):Ge.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:Z.invalid_string,...pe.errToObj(s)})}_addCheck(e){return new Xn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...pe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...pe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...pe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...pe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...pe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...pe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...pe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...pe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...pe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...pe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...pe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...pe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...pe.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...pe.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...pe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...pe.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...pe.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...pe.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...pe.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...pe.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...pe.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...pe.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...pe.errToObj(r)})}nonempty(e){return this.min(1,pe.errToObj(e))}trim(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Xn.create=t=>new Xn({checks:[],typeName:Ce.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Fe(t)});function XI(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,a=Number.parseInt(t.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}class vi extends Be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==de.number){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:de.number,received:a.parsedType}),Ee}let s;const n=new nr;for(const a of this._def.checks)a.kind==="int"?Ge.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:Z.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:Z.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:Z.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?XI(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),ae(s,{code:Z.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:Z.not_finite,message:a.message}),n.dirty()):Ge.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,pe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,pe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,pe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,pe.toString(r))}setLimit(e,r,s,n){return new vi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:pe.toString(n)}]})}_addCheck(e){return new vi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:pe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:pe.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:pe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pe.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ge.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}}vi.create=t=>new vi({checks:[],typeName:Ce.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Fe(t)});class Rl extends Be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==de.bigint)return this._getInvalidInput(e);let s;const n=new nr;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:Z.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:Z.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),ae(s,{code:Z.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ge.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return ae(r,{code:Z.invalid_type,expected:de.bigint,received:r.parsedType}),Ee}gte(e,r){return this.setLimit("min",e,!0,pe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,pe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,pe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,pe.toString(r))}setLimit(e,r,s,n){return new Rl({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:pe.toString(n)}]})}_addCheck(e){return new Rl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:pe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:pe.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Rl.create=t=>new Rl({checks:[],typeName:Ce.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Fe(t)});class Np extends Be{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==de.boolean){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:de.boolean,received:s.parsedType}),Ee}return zr(e.data)}}Np.create=t=>new Np({typeName:Ce.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Fe(t)});class zu extends Be{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==de.date){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:de.date,received:a.parsedType}),Ee}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_date}),Ee}const s=new nr;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):Ge.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new zu({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:pe.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:pe.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}zu.create=t=>new zu({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ce.ZodDate,...Fe(t)});class T0 extends Be{_parse(e){if(this._getType(e)!==de.symbol){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:de.symbol,received:s.parsedType}),Ee}return zr(e.data)}}T0.create=t=>new T0({typeName:Ce.ZodSymbol,...Fe(t)});class jp extends Be{_parse(e){if(this._getType(e)!==de.undefined){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:de.undefined,received:s.parsedType}),Ee}return zr(e.data)}}jp.create=t=>new jp({typeName:Ce.ZodUndefined,...Fe(t)});class Rp extends Be{_parse(e){if(this._getType(e)!==de.null){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:de.null,received:s.parsedType}),Ee}return zr(e.data)}}Rp.create=t=>new Rp({typeName:Ce.ZodNull,...Fe(t)});class Tp extends Be{constructor(){super(...arguments),this._any=!0}_parse(e){return zr(e.data)}}Tp.create=t=>new Tp({typeName:Ce.ZodAny,...Fe(t)});class Ap extends Be{constructor(){super(...arguments),this._unknown=!0}_parse(e){return zr(e.data)}}Ap.create=t=>new Ap({typeName:Ce.ZodUnknown,...Fe(t)});class ia extends Be{_parse(e){const r=this._getOrReturnCtx(e);return ae(r,{code:Z.invalid_type,expected:de.never,received:r.parsedType}),Ee}}ia.create=t=>new ia({typeName:Ce.ZodNever,...Fe(t)});class A0 extends Be{_parse(e){if(this._getType(e)!==de.undefined){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:de.void,received:s.parsedType}),Ee}return zr(e.data)}}A0.create=t=>new A0({typeName:Ce.ZodVoid,...Fe(t)});class Rn extends Be{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==de.array)return ae(r,{code:Z.invalid_type,expected:de.array,received:r.parsedType}),Ee;if(n.exactLength!==null){const o=r.data.length>n.exactLength.value,i=r.data.length<n.exactLength.value;(o||i)&&(ae(r,{code:o?Z.too_big:Z.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(ae(r,{code:Z.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(ae(r,{code:Z.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((o,i)=>n.type._parseAsync(new An(r,o,r.path,i)))).then(o=>nr.mergeArray(s,o));const a=[...r.data].map((o,i)=>n.type._parseSync(new An(r,o,r.path,i)));return nr.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new Rn({...this._def,minLength:{value:e,message:pe.toString(r)}})}max(e,r){return new Rn({...this._def,maxLength:{value:e,message:pe.toString(r)}})}length(e,r){return new Rn({...this._def,exactLength:{value:e,message:pe.toString(r)}})}nonempty(e){return this.min(1,e)}}Rn.create=(t,e)=>new Rn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Fe(e)});function mo(t){if(t instanceof Pt){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=ts.create(mo(s))}return new Pt({...t._def,shape:()=>e})}else return t instanceof Rn?new Rn({...t._def,type:mo(t.element)}):t instanceof ts?ts.create(mo(t.unwrap())):t instanceof to?to.create(mo(t.unwrap())):t instanceof Ja?Ja.create(t.items.map(e=>mo(e))):t}class Pt extends Be{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Ge.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==de.object){const u=this._getOrReturnCtx(e);return ae(u,{code:Z.invalid_type,expected:de.object,received:u.parsedType}),Ee}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof ia&&this._def.unknownKeys==="strip"))for(const u in n.data)o.includes(u)||i.push(u);const c=[];for(const u of o){const d=a[u],h=n.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new An(n,h,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof ia){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of i)c.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(u==="strict")i.length>0&&(ae(n,{code:Z.unrecognized_keys,keys:i}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of i){const h=n.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new An(n,h,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const h=await d.key,m=await d.value;u.push({key:h,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>nr.mergeObjectSync(s,u)):nr.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return pe.errToObj,new Pt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{var a,o;const n=((o=(a=this._def).errorMap)==null?void 0:o.call(a,r,s).message)??s.defaultError;return r.code==="unrecognized_keys"?{message:pe.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new Pt({...this._def,unknownKeys:"strip"})}passthrough(){return new Pt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ce.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Pt({...this._def,catchall:e})}pick(e){const r={};for(const s of Ge.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new Pt({...this._def,shape:()=>r})}omit(e){const r={};for(const s of Ge.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new Pt({...this._def,shape:()=>r})}deepPartial(){return mo(this)}partial(e){const r={};for(const s of Ge.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new Pt({...this._def,shape:()=>r})}required(e){const r={};for(const s of Ge.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof ts;)a=a._def.innerType;r[s]=a}return new Pt({...this._def,shape:()=>r})}keyof(){return yE(Ge.objectKeys(this.shape))}}Pt.create=(t,e)=>new Pt({shape:()=>t,unknownKeys:"strip",catchall:ia.create(),typeName:Ce.ZodObject,...Fe(e)});Pt.strictCreate=(t,e)=>new Pt({shape:()=>t,unknownKeys:"strict",catchall:ia.create(),typeName:Ce.ZodObject,...Fe(e)});Pt.lazycreate=(t,e)=>new Pt({shape:t,unknownKeys:"strip",catchall:ia.create(),typeName:Ce.ZodObject,...Fe(e)});class Vu extends Be{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function n(a){for(const i of a)if(i.result.status==="valid")return i.result;for(const i of a)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(i=>new cs(i.ctx.common.issues));return ae(r,{code:Z.invalid_union,unionErrors:o}),Ee}if(r.common.async)return Promise.all(s.map(async a=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(n);{let a;const o=[];for(const c of s){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(c=>new cs(c));return ae(r,{code:Z.invalid_union,unionErrors:i}),Ee}}get options(){return this._def.options}}Vu.create=(t,e)=>new Vu({options:t,typeName:Ce.ZodUnion,...Fe(e)});const Vn=t=>t instanceof Ip?Vn(t.schema):t instanceof eo?Vn(t.innerType()):t instanceof Bu?[t.value]:t instanceof Xa?t.options:t instanceof Dp?Ge.objectValues(t.enum):t instanceof Wu?Vn(t._def.innerType):t instanceof jp?[void 0]:t instanceof Rp?[null]:t instanceof ts?[void 0,...Vn(t.unwrap())]:t instanceof to?[null,...Vn(t.unwrap())]:t instanceof xE||t instanceof Gu?Vn(t.unwrap()):t instanceof Qu?Vn(t._def.innerType):[];class Uv extends Be{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==de.object)return ae(r,{code:Z.invalid_type,expected:de.object,received:r.parsedType}),Ee;const s=this.discriminator,n=r.data[s],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(ae(r,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){const n=new Map;for(const a of r){const o=Vn(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of o){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new Uv({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...Fe(s)})}}function Op(t,e){const r=ks(t),s=ks(e);if(t===e)return{valid:!0,data:t};if(r===de.object&&s===de.object){const n=Ge.objectKeys(e),a=Ge.objectKeys(t).filter(i=>n.indexOf(i)!==-1),o={...t,...e};for(const i of a){const c=Op(t[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(r===de.array&&s===de.array){if(t.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<t.length;a++){const o=t[a],i=e[a],c=Op(o,i);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===de.date&&s===de.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class qu extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(N0(a)||N0(o))return Ee;const i=Op(a.value,o.value);return i.valid?((j0(a)||j0(o))&&r.dirty(),{status:r.value,value:i.data}):(ae(s,{code:Z.invalid_intersection_types}),Ee)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}qu.create=(t,e,r)=>new qu({left:t,right:e,typeName:Ce.ZodIntersection,...Fe(r)});class Ja extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==de.array)return ae(s,{code:Z.invalid_type,expected:de.array,received:s.parsedType}),Ee;if(s.data.length<this._def.items.length)return ae(s,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&s.data.length>this._def.items.length&&(ae(s,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...s.data].map((o,i)=>{const c=this._def.items[i]||this._def.rest;return c?c._parse(new An(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>nr.mergeArray(r,o)):nr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Ja({...this._def,rest:e})}}Ja.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ja({items:t,typeName:Ce.ZodTuple,rest:null,...Fe(e)})};class Hu extends Be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==de.object)return ae(s,{code:Z.invalid_type,expected:de.object,received:s.parsedType}),Ee;const n=[],a=this._def.keyType,o=this._def.valueType;for(const i in s.data)n.push({key:a._parse(new An(s,i,s.path,i)),value:o._parse(new An(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?nr.mergeObjectAsync(r,n):nr.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof Be?new Hu({keyType:e,valueType:r,typeName:Ce.ZodRecord,...Fe(s)}):new Hu({keyType:Xn.create(),valueType:e,typeName:Ce.ZodRecord,...Fe(r)})}}class O0 extends Be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==de.map)return ae(s,{code:Z.invalid_type,expected:de.map,received:s.parsedType}),Ee;const n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,c],u)=>({key:n._parse(new An(s,i,s.path,[u,"key"])),value:a._parse(new An(s,c,s.path,[u,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Ee;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}})}else{const i=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Ee;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}}}}O0.create=(t,e,r)=>new O0({valueType:e,keyType:t,typeName:Ce.ZodMap,...Fe(r)});class Tl extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==de.set)return ae(s,{code:Z.invalid_type,expected:de.set,received:s.parsedType}),Ee;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(ae(s,{code:Z.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(ae(s,{code:Z.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());const a=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Ee;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const i=[...s.data.values()].map((c,u)=>a._parse(new An(s,c,s.path,u)));return s.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,r){return new Tl({...this._def,minSize:{value:e,message:pe.toString(r)}})}max(e,r){return new Tl({...this._def,maxSize:{value:e,message:pe.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Tl.create=(t,e)=>new Tl({valueType:t,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Fe(e)});class Ip extends Be{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Ip.create=(t,e)=>new Ip({getter:t,typeName:Ce.ZodLazy,...Fe(e)});class Bu extends Be{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return ae(r,{received:r.data,code:Z.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:e.data}}get value(){return this._def.value}}Bu.create=(t,e)=>new Bu({value:t,typeName:Ce.ZodLiteral,...Fe(e)});function yE(t,e){return new Xa({values:t,typeName:Ce.ZodEnum,...Fe(e)})}class Xa extends Be{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return ae(r,{expected:Ge.joinValues(s),received:r.parsedType,code:Z.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return ae(r,{received:r.data,code:Z.invalid_enum_value,options:s}),Ee}return zr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Xa.create(e,{...this._def,...r})}exclude(e,r=this._def){return Xa.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}Xa.create=yE;class Dp extends Be{_parse(e){const r=Ge.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==de.string&&s.parsedType!==de.number){const n=Ge.objectValues(r);return ae(s,{expected:Ge.joinValues(n),received:s.parsedType,code:Z.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Ge.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=Ge.objectValues(r);return ae(s,{received:s.data,code:Z.invalid_enum_value,options:n}),Ee}return zr(e.data)}get enum(){return this._def.values}}Dp.create=(t,e)=>new Dp({values:t,typeName:Ce.ZodNativeEnum,...Fe(e)});class Ku extends Be{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==de.promise&&r.common.async===!1)return ae(r,{code:Z.invalid_type,expected:de.promise,received:r.parsedType}),Ee;const s=r.parsedType===de.promise?r.data:Promise.resolve(r.data);return zr(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Ku.create=(t,e)=>new Ku({type:t,typeName:Ce.ZodPromise,...Fe(e)});class eo extends Be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{ae(s,o),o.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(r.value==="aborted")return Ee;const c=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return c.status==="aborted"?Ee:c.status==="dirty"||r.value==="dirty"?Qi(c.value):c});{if(r.value==="aborted")return Ee;const i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?Ee:i.status==="dirty"||r.value==="dirty"?Qi(i.value):i}}if(n.type==="refinement"){const o=i=>{const c=n.refinement(i,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Ee:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?Ee:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!mi(o))return Ee;const i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>mi(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:r.value,value:i})):Ee);Ge.assertNever(n)}}eo.create=(t,e,r)=>new eo({schema:t,typeName:Ce.ZodEffects,effect:e,...Fe(r)});eo.createWithPreprocess=(t,e,r)=>new eo({schema:e,effect:{type:"preprocess",transform:t},typeName:Ce.ZodEffects,...Fe(r)});class ts extends Be{_parse(e){return this._getType(e)===de.undefined?zr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ts.create=(t,e)=>new ts({innerType:t,typeName:Ce.ZodOptional,...Fe(e)});class to extends Be{_parse(e){return this._getType(e)===de.null?zr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}to.create=(t,e)=>new to({innerType:t,typeName:Ce.ZodNullable,...Fe(e)});class Wu extends Be{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===de.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Wu.create=(t,e)=>new Wu({innerType:t,typeName:Ce.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fe(e)});class Qu extends Be{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Uu(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new cs(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new cs(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Qu.create=(t,e)=>new Qu({innerType:t,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fe(e)});class I0 extends Be{_parse(e){if(this._getType(e)!==de.nan){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:de.nan,received:s.parsedType}),Ee}return{status:"valid",value:e.data}}}I0.create=t=>new I0({typeName:Ce.ZodNaN,...Fe(t)});class xE extends Be{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class zv extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Ee:a.status==="dirty"?(r.dirty(),Qi(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?Ee:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new zv({in:e,out:r,typeName:Ce.ZodPipeline})}}class Gu extends Be{_parse(e){const r=this._def.innerType._parse(e),s=n=>(mi(n)&&(n.value=Object.freeze(n.value)),n);return Uu(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}}Gu.create=(t,e)=>new Gu({innerType:t,typeName:Ce.ZodReadonly,...Fe(e)});var Ce;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));const V=Xn.create,Ut=vi.create,It=Np.create,eD=Tp.create,Kl=Ap.create;ia.create;const he=Rn.create,se=Pt.create,ir=Vu.create,tD=Uv.create;qu.create;Ja.create;const Wl=Hu.create,Ie=Bu.create,us=Xa.create;Ku.create;const W=ts.create;to.create;const rD=Ee,qd="2025-06-18",nD=[qd,"2025-03-26","2024-11-05","2024-10-07"],Hd="2.0",wE=ir([V(),Ut().int()]),bE=V(),sD=se({progressToken:W(wE)}).passthrough(),Vr=se({_meta:W(sD)}).passthrough(),xr=se({method:V(),params:W(Vr)}),Ql=se({_meta:W(se({}).passthrough())}).passthrough(),In=se({method:V(),params:W(Ql)}),qr=se({_meta:W(se({}).passthrough())}).passthrough(),Bd=ir([V(),Ut().int()]),SE=se({jsonrpc:Ie(Hd),id:Bd}).merge(xr).strict(),_E=t=>SE.safeParse(t).success,EE=se({jsonrpc:Ie(Hd)}).merge(In).strict(),aD=t=>EE.safeParse(t).success,CE=se({jsonrpc:Ie(Hd),id:Bd,result:qr}).strict(),Mp=t=>CE.safeParse(t).success;var En;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(En||(En={}));const PE=se({jsonrpc:Ie(Hd),id:Bd,error:se({code:Ut().int(),message:V(),data:W(Kl())})}).strict(),oD=t=>PE.safeParse(t).success,eu=ir([SE,EE,CE,PE]),Ao=qr.strict(),Vv=In.extend({method:Ie("notifications/cancelled"),params:Ql.extend({requestId:Bd,reason:V().optional()})}),Gl=se({name:V(),title:W(V())}).passthrough(),kE=Gl.extend({version:V()}),iD=se({experimental:W(se({}).passthrough()),sampling:W(se({}).passthrough()),elicitation:W(se({}).passthrough()),roots:W(se({listChanged:W(It())}).passthrough())}).passthrough(),lD=xr.extend({method:Ie("initialize"),params:Vr.extend({protocolVersion:V(),capabilities:iD,clientInfo:kE})}),cD=se({experimental:W(se({}).passthrough()),logging:W(se({}).passthrough()),completions:W(se({}).passthrough()),prompts:W(se({listChanged:W(It())}).passthrough()),resources:W(se({subscribe:W(It()),listChanged:W(It())}).passthrough()),tools:W(se({listChanged:W(It())}).passthrough())}).passthrough(),NE=qr.extend({protocolVersion:V(),capabilities:cD,serverInfo:kE,instructions:W(V())}),jE=In.extend({method:Ie("notifications/initialized")}),uD=t=>jE.safeParse(t).success,qv=xr.extend({method:Ie("ping")}),dD=se({progress:Ut(),total:W(Ut()),message:W(V())}).passthrough(),Hv=In.extend({method:Ie("notifications/progress"),params:Ql.merge(dD).extend({progressToken:wE})}),Kd=xr.extend({params:Vr.extend({cursor:W(bE)}).optional()}),Wd=qr.extend({nextCursor:W(bE)}),RE=se({uri:V(),mimeType:W(V()),_meta:W(se({}).passthrough())}).passthrough(),TE=RE.extend({text:V()}),Bv=V().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),AE=RE.extend({blob:Bv}),OE=Gl.extend({uri:V(),description:W(V()),mimeType:W(V()),_meta:W(se({}).passthrough())}),fD=Gl.extend({uriTemplate:V(),description:W(V()),mimeType:W(V()),_meta:W(se({}).passthrough())}),hD=Kd.extend({method:Ie("resources/list")}),Zu=Wd.extend({resources:he(OE)}),pD=Kd.extend({method:Ie("resources/templates/list")}),IE=Wd.extend({resourceTemplates:he(fD)}),mD=xr.extend({method:Ie("resources/read"),params:Vr.extend({uri:V()})}),Kv=qr.extend({contents:he(ir([TE,AE]))}),vD=In.extend({method:Ie("notifications/resources/list_changed")}),gD=xr.extend({method:Ie("resources/subscribe"),params:Vr.extend({uri:V()})}),yD=xr.extend({method:Ie("resources/unsubscribe"),params:Vr.extend({uri:V()})}),xD=In.extend({method:Ie("notifications/resources/updated"),params:Ql.extend({uri:V()})}),wD=se({name:V(),description:W(V()),required:W(It())}).passthrough(),bD=Gl.extend({description:W(V()),arguments:W(he(wD)),_meta:W(se({}).passthrough())}),SD=Kd.extend({method:Ie("prompts/list")}),Yu=Wd.extend({prompts:he(bD)}),_D=xr.extend({method:Ie("prompts/get"),params:Vr.extend({name:V(),arguments:W(Wl(V()))})}),Wv=se({type:Ie("text"),text:V(),_meta:W(se({}).passthrough())}).passthrough(),Qv=se({type:Ie("image"),data:Bv,mimeType:V(),_meta:W(se({}).passthrough())}).passthrough(),Gv=se({type:Ie("audio"),data:Bv,mimeType:V(),_meta:W(se({}).passthrough())}).passthrough(),ED=se({type:Ie("resource"),resource:ir([TE,AE]),_meta:W(se({}).passthrough())}).passthrough(),CD=OE.extend({type:Ie("resource_link")}),DE=ir([Wv,Qv,Gv,CD,ED]),PD=se({role:us(["user","assistant"]),content:DE}).passthrough(),Zv=qr.extend({description:W(V()),messages:he(PD)}),kD=In.extend({method:Ie("notifications/prompts/list_changed")}),ND=se({title:W(V()),readOnlyHint:W(It()),destructiveHint:W(It()),idempotentHint:W(It()),openWorldHint:W(It())}).passthrough(),jD=Gl.extend({description:W(V()),inputSchema:se({type:Ie("object"),properties:W(se({}).passthrough()),required:W(he(V()))}).passthrough(),outputSchema:W(se({type:Ie("object"),properties:W(se({}).passthrough()),required:W(he(V()))}).passthrough()),annotations:W(ND),_meta:W(se({}).passthrough())}),RD=Kd.extend({method:Ie("tools/list")}),Yv=Wd.extend({tools:he(jD)}),Qd=qr.extend({content:he(DE).default([]),structuredContent:se({}).passthrough().optional(),isError:W(It())});Qd.or(qr.extend({toolResult:Kl()}));const TD=xr.extend({method:Ie("tools/call"),params:Vr.extend({name:V(),arguments:W(Wl(Kl()))})}),AD=In.extend({method:Ie("notifications/tools/list_changed")}),ME=us(["debug","info","notice","warning","error","critical","alert","emergency"]),OD=xr.extend({method:Ie("logging/setLevel"),params:Vr.extend({level:ME})}),ID=In.extend({method:Ie("notifications/message"),params:Ql.extend({level:ME,logger:W(V()),data:Kl()})}),DD=se({name:V().optional()}).passthrough(),MD=se({hints:W(he(DD)),costPriority:W(Ut().min(0).max(1)),speedPriority:W(Ut().min(0).max(1)),intelligencePriority:W(Ut().min(0).max(1))}).passthrough(),$D=se({role:us(["user","assistant"]),content:ir([Wv,Qv,Gv])}).passthrough(),FD=xr.extend({method:Ie("sampling/createMessage"),params:Vr.extend({messages:he($D),systemPrompt:W(V()),includeContext:W(us(["none","thisServer","allServers"])),temperature:W(Ut()),maxTokens:Ut().int(),stopSequences:W(he(V())),metadata:W(se({}).passthrough()),modelPreferences:W(MD)})}),LD=qr.extend({model:V(),stopReason:W(us(["endTurn","stopSequence","maxTokens"]).or(V())),role:us(["user","assistant"]),content:tD("type",[Wv,Qv,Gv])}),UD=se({type:Ie("boolean"),title:W(V()),description:W(V()),default:W(It())}).passthrough(),zD=se({type:Ie("string"),title:W(V()),description:W(V()),minLength:W(Ut()),maxLength:W(Ut()),format:W(us(["email","uri","date","date-time"]))}).passthrough(),VD=se({type:us(["number","integer"]),title:W(V()),description:W(V()),minimum:W(Ut()),maximum:W(Ut())}).passthrough(),qD=se({type:Ie("string"),title:W(V()),description:W(V()),enum:he(V()),enumNames:W(he(V()))}).passthrough(),HD=ir([UD,zD,VD,qD]),BD=xr.extend({method:Ie("elicitation/create"),params:Vr.extend({message:V(),requestedSchema:se({type:Ie("object"),properties:Wl(V(),HD),required:W(he(V()))}).passthrough()})}),KD=qr.extend({action:us(["accept","decline","cancel"]),content:W(Wl(V(),Kl()))}),WD=se({type:Ie("ref/resource"),uri:V()}).passthrough(),QD=se({type:Ie("ref/prompt"),name:V()}).passthrough(),GD=xr.extend({method:Ie("completion/complete"),params:Vr.extend({ref:ir([QD,WD]),argument:se({name:V(),value:V()}).passthrough(),context:W(se({arguments:W(Wl(V(),V()))}))})}),$E=qr.extend({completion:se({values:he(V()).max(100),total:W(Ut().int()),hasMore:W(It())}).passthrough()}),ZD=se({uri:V().startsWith("file://"),name:W(V()),_meta:W(se({}).passthrough())}).passthrough(),YD=xr.extend({method:Ie("roots/list")}),JD=qr.extend({roots:he(ZD)}),XD=In.extend({method:Ie("notifications/roots/list_changed")});ir([qv,lD,GD,OD,_D,SD,hD,pD,mD,gD,yD,TD,RD]);ir([Vv,Hv,jE,XD]);ir([Ao,LD,KD,JD]);ir([qv,FD,BD,YD]);ir([Vv,Hv,ID,xD,vD,AD,kD]);ir([Ao,NE,$E,Zv,Yu,Zu,IE,Kv,Qd,Yv]);class qs extends Error{constructor(e,r,s){super(`MCP error ${e}: ${r}`),this.code=e,this.data=s,this.name="McpError"}}class D0 extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Qf(t){}function FE(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Qf,onError:r=Qf,onRetry:s=Qf,onComment:n}=t;let a="",o=!0,i,c="",u="";function d(p){const y=o?p.replace(/^\xEF\xBB\xBF/,""):p,[g,v]=e4(`${a}${y}`);for(const b of g)h(b);a=v,o=!1}function h(p){if(p===""){f();return}if(p.startsWith(":")){n&&n(p.slice(p.startsWith(": ")?2:1));return}const y=p.indexOf(":");if(y!==-1){const g=p.slice(0,y),v=p[y+1]===" "?2:1,b=p.slice(y+v);m(g,b,p);return}m(p,"",p)}function m(p,y,g){switch(p){case"event":u=y;break;case"data":c=`${c}${y}
|
|
351
|
+
`;break;case"id":i=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?s(parseInt(y,10)):r(new D0(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:g}));break;default:r(new D0(`Unknown field "${p.length>20?`${p.slice(0,20)}…`:p}"`,{type:"unknown-field",field:p,value:y,line:g}));break}}function f(){c.length>0&&e({id:i,event:u||void 0,data:c.endsWith(`
|
|
352
|
+
`)?c.slice(0,-1):c}),i=void 0,c="",u=""}function w(p={}){a&&p.consume&&h(a),o=!0,i=void 0,c="",u="",a=""}return{feed:d,reset:w}}function e4(t){const e=[];let r="",s=0;for(;s<t.length;){const n=t.indexOf("\r",s),a=t.indexOf(`
|
|
343
353
|
`,s);let o=-1;if(n!==-1&&a!==-1?o=Math.min(n,a):n!==-1?n===t.length-1?o=-1:o=n:a!==-1&&(o=a),o===-1){r=t.slice(s);break}else{const i=t.slice(s,o);e.push(i),s=o+1,t[s-1]==="\r"&&t[s]===`
|
|
344
|
-
`&&s++}}return[e,r]}class A0 extends Event{constructor(e,r){var s,n;super(e),this.code=(s=r==null?void 0:r.code)!=null?s:void 0,this.message=(n=r==null?void 0:r.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,s){return s(O0(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(O0(this),r)}}function W4(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Dp(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Dp).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Dp(t.cause)}`:t.message:`${t}`}function O0(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var IE=t=>{throw TypeError(t)},Zv=(t,e,r)=>e.has(t)||IE("Cannot "+r),Ve=(t,e,r)=>(Zv(t,e,"read from private field"),r?r.call(t):e.get(t)),jt=(t,e,r)=>e.has(t)?IE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ft=(t,e,r,s)=>(Zv(t,e,"write to private field"),e.set(t,r),r),qn=(t,e,r)=>(Zv(t,e,"access private method"),r),dr,Ca,vo,eu,Yu,il,Oo,ll,js,go,Ho,yo,Gi,Gr,Mp,$p,Fp,I0,Lp,Up,Zi,zp,Vp;class tu extends EventTarget{constructor(e,r){var s,n;super(),jt(this,Gr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,jt(this,dr),jt(this,Ca),jt(this,vo),jt(this,eu),jt(this,Yu),jt(this,il),jt(this,Oo),jt(this,ll,null),jt(this,js),jt(this,go),jt(this,Ho,null),jt(this,yo,null),jt(this,Gi,null),jt(this,$p,async a=>{var o;Ve(this,go).reset();const{body:i,redirected:c,status:u,headers:d}=a;if(u===204){qn(this,Gr,Zi).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?ft(this,vo,new URL(a.url)):ft(this,vo,void 0),u!==200){qn(this,Gr,Zi).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){qn(this,Gr,Zi).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ve(this,dr)===this.CLOSED)return;ft(this,dr,this.OPEN);const h=new Event("open");if((o=Ve(this,Gi))==null||o.call(this,h),this.dispatchEvent(h),typeof i!="object"||!i||!("getReader"in i)){qn(this,Gr,Zi).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const m=new TextDecoder,f=i.getReader();let w=!0;do{const{done:p,value:v}=await f.read();v&&Ve(this,go).feed(m.decode(v,{stream:!p})),p&&(w=!1,Ve(this,go).reset(),qn(this,Gr,zp).call(this))}while(w)}),jt(this,Fp,a=>{ft(this,js,void 0),!(a.name==="AbortError"||a.type==="aborted")&&qn(this,Gr,zp).call(this,Dp(a))}),jt(this,Lp,a=>{typeof a.id=="string"&&ft(this,ll,a.id);const o=new MessageEvent(a.event||"message",{data:a.data,origin:Ve(this,vo)?Ve(this,vo).origin:Ve(this,Ca).origin,lastEventId:a.id||""});Ve(this,yo)&&(!a.event||a.event==="message")&&Ve(this,yo).call(this,o),this.dispatchEvent(o)}),jt(this,Up,a=>{ft(this,il,a)}),jt(this,Vp,()=>{ft(this,Oo,void 0),Ve(this,dr)===this.CONNECTING&&qn(this,Gr,Mp).call(this)});try{if(e instanceof URL)ft(this,Ca,e);else if(typeof e=="string")ft(this,Ca,new URL(e,Q4()));else throw new Error("Invalid URL")}catch{throw W4("An invalid or illegal string was specified")}ft(this,go,OE({onEvent:Ve(this,Lp),onRetry:Ve(this,Up)})),ft(this,dr,this.CONNECTING),ft(this,il,3e3),ft(this,Yu,(s=r==null?void 0:r.fetch)!=null?s:globalThis.fetch),ft(this,eu,(n=r==null?void 0:r.withCredentials)!=null?n:!1),qn(this,Gr,Mp).call(this)}get readyState(){return Ve(this,dr)}get url(){return Ve(this,Ca).href}get withCredentials(){return Ve(this,eu)}get onerror(){return Ve(this,Ho)}set onerror(e){ft(this,Ho,e)}get onmessage(){return Ve(this,yo)}set onmessage(e){ft(this,yo,e)}get onopen(){return Ve(this,Gi)}set onopen(e){ft(this,Gi,e)}addEventListener(e,r,s){const n=r;super.addEventListener(e,n,s)}removeEventListener(e,r,s){const n=r;super.removeEventListener(e,n,s)}close(){Ve(this,Oo)&&clearTimeout(Ve(this,Oo)),Ve(this,dr)!==this.CLOSED&&(Ve(this,js)&&Ve(this,js).abort(),ft(this,dr,this.CLOSED),ft(this,js,void 0))}}dr=new WeakMap,Ca=new WeakMap,vo=new WeakMap,eu=new WeakMap,Yu=new WeakMap,il=new WeakMap,Oo=new WeakMap,ll=new WeakMap,js=new WeakMap,go=new WeakMap,Ho=new WeakMap,yo=new WeakMap,Gi=new WeakMap,Gr=new WeakSet,Mp=function(){ft(this,dr,this.CONNECTING),ft(this,js,new AbortController),Ve(this,Yu)(Ve(this,Ca),qn(this,Gr,I0).call(this)).then(Ve(this,$p)).catch(Ve(this,Fp))},$p=new WeakMap,Fp=new WeakMap,I0=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ve(this,ll)?{"Last-Event-ID":Ve(this,ll)}:void 0},cache:"no-store",signal:(t=Ve(this,js))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Lp=new WeakMap,Up=new WeakMap,Zi=function(t,e){var r;Ve(this,dr)!==this.CLOSED&&ft(this,dr,this.CLOSED);const s=new A0("error",{code:e,message:t});(r=Ve(this,Ho))==null||r.call(this,s),this.dispatchEvent(s)},zp=function(t,e){var r;if(Ve(this,dr)===this.CLOSED)return;ft(this,dr,this.CONNECTING);const s=new A0("error",{code:e,message:t});(r=Ve(this,Ho))==null||r.call(this,s),this.dispatchEvent(s),ft(this,Oo,setTimeout(Ve(this,Vp),Ve(this,il)))},Vp=new WeakMap,tu.CONNECTING=0,tu.OPEN=1,tu.CLOSED=2;function Q4(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}let Yv;Yv=globalThis.crypto;async function G4(t){return(await Yv).getRandomValues(new Uint8Array(t))}async function Z4(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const s=await G4(t);for(let n=0;n<t;n++){const a=s[n]%e.length;r+=e[a]}return r}async function Y4(t){return await Z4(t)}async function J4(t){const e=await(await Yv).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function X4(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await Y4(t),r=await J4(e);return{code_verifier:e,code_challenge:r}}const Ft=V().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:G.custom,message:"URL must be parseable",fatal:!0}),QI}).refine(t=>{const e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),eD=se({resource:V().url(),authorization_servers:he(Ft).optional(),jwks_uri:V().url().optional(),scopes_supported:he(V()).optional(),bearer_methods_supported:he(V()).optional(),resource_signing_alg_values_supported:he(V()).optional(),resource_name:V().optional(),resource_documentation:V().optional(),resource_policy_uri:V().url().optional(),resource_tos_uri:V().url().optional(),tls_client_certificate_bound_access_tokens:It().optional(),authorization_details_types_supported:he(V()).optional(),dpop_signing_alg_values_supported:he(V()).optional(),dpop_bound_access_tokens_required:It().optional()}).passthrough(),DE=se({issuer:V(),authorization_endpoint:Ft,token_endpoint:Ft,registration_endpoint:Ft.optional(),scopes_supported:he(V()).optional(),response_types_supported:he(V()),response_modes_supported:he(V()).optional(),grant_types_supported:he(V()).optional(),token_endpoint_auth_methods_supported:he(V()).optional(),token_endpoint_auth_signing_alg_values_supported:he(V()).optional(),service_documentation:Ft.optional(),revocation_endpoint:Ft.optional(),revocation_endpoint_auth_methods_supported:he(V()).optional(),revocation_endpoint_auth_signing_alg_values_supported:he(V()).optional(),introspection_endpoint:V().optional(),introspection_endpoint_auth_methods_supported:he(V()).optional(),introspection_endpoint_auth_signing_alg_values_supported:he(V()).optional(),code_challenge_methods_supported:he(V()).optional()}).passthrough(),tD=se({issuer:V(),authorization_endpoint:Ft,token_endpoint:Ft,userinfo_endpoint:Ft.optional(),jwks_uri:Ft,registration_endpoint:Ft.optional(),scopes_supported:he(V()).optional(),response_types_supported:he(V()),response_modes_supported:he(V()).optional(),grant_types_supported:he(V()).optional(),acr_values_supported:he(V()).optional(),subject_types_supported:he(V()),id_token_signing_alg_values_supported:he(V()),id_token_encryption_alg_values_supported:he(V()).optional(),id_token_encryption_enc_values_supported:he(V()).optional(),userinfo_signing_alg_values_supported:he(V()).optional(),userinfo_encryption_alg_values_supported:he(V()).optional(),userinfo_encryption_enc_values_supported:he(V()).optional(),request_object_signing_alg_values_supported:he(V()).optional(),request_object_encryption_alg_values_supported:he(V()).optional(),request_object_encryption_enc_values_supported:he(V()).optional(),token_endpoint_auth_methods_supported:he(V()).optional(),token_endpoint_auth_signing_alg_values_supported:he(V()).optional(),display_values_supported:he(V()).optional(),claim_types_supported:he(V()).optional(),claims_supported:he(V()).optional(),service_documentation:V().optional(),claims_locales_supported:he(V()).optional(),ui_locales_supported:he(V()).optional(),claims_parameter_supported:It().optional(),request_parameter_supported:It().optional(),request_uri_parameter_supported:It().optional(),require_request_uri_registration:It().optional(),op_policy_uri:Ft.optional(),op_tos_uri:Ft.optional()}).passthrough(),rD=tD.merge(DE.pick({code_challenge_methods_supported:!0})),ME=se({access_token:V(),id_token:V().optional(),token_type:V(),expires_in:Ut().optional(),scope:V().optional(),refresh_token:V().optional()}).strip(),nD=se({error:V(),error_description:V().optional(),error_uri:V().optional()}),sD=se({redirect_uris:he(Ft),token_endpoint_auth_method:V().optional(),grant_types:he(V()).optional(),response_types:he(V()).optional(),client_name:V().optional(),client_uri:Ft.optional(),logo_uri:Ft.optional(),scope:V().optional(),contacts:he(V()).optional(),tos_uri:Ft.optional(),policy_uri:V().optional(),jwks_uri:Ft.optional(),jwks:KI().optional(),software_id:V().optional(),software_version:V().optional(),software_statement:V().optional()}).strip(),aD=se({client_id:V(),client_secret:V().optional(),client_id_issued_at:Ut().optional(),client_secret_expires_at:Ut().optional()}).strip(),oD=sD.merge(aD);se({error:V(),error_description:V().optional()}).strip();se({token:V(),token_type_hint:V().optional()}).strip();function iD(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function lD({requestedResource:t,configuredResource:e}){const r=typeof t=="string"?new URL(t):new URL(t.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==s.origin||r.pathname.length<s.pathname.length)return!1;const n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return n.startsWith(a)}class Kt extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class qp extends Kt{}qp.errorCode="invalid_request";class Ju extends Kt{}Ju.errorCode="invalid_client";class Xu extends Kt{}Xu.errorCode="invalid_grant";class ed extends Kt{}ed.errorCode="unauthorized_client";class Hp extends Kt{}Hp.errorCode="unsupported_grant_type";class Bp extends Kt{}Bp.errorCode="invalid_scope";class Kp extends Kt{}Kp.errorCode="access_denied";class gi extends Kt{}gi.errorCode="server_error";class Wp extends Kt{}Wp.errorCode="temporarily_unavailable";class Qp extends Kt{}Qp.errorCode="unsupported_response_type";class Gp extends Kt{}Gp.errorCode="unsupported_token_type";class Zp extends Kt{}Zp.errorCode="invalid_token";class Yp extends Kt{}Yp.errorCode="method_not_allowed";class Jp extends Kt{}Jp.errorCode="too_many_requests";class Xp extends Kt{}Xp.errorCode="invalid_client_metadata";class em extends Kt{}em.errorCode="insufficient_scope";const cD={[qp.errorCode]:qp,[Ju.errorCode]:Ju,[Xu.errorCode]:Xu,[ed.errorCode]:ed,[Hp.errorCode]:Hp,[Bp.errorCode]:Bp,[Kp.errorCode]:Kp,[gi.errorCode]:gi,[Wp.errorCode]:Wp,[Qp.errorCode]:Qp,[Gp.errorCode]:Gp,[Zp.errorCode]:Zp,[Yp.errorCode]:Yp,[Jp.errorCode]:Jp,[Xp.errorCode]:Xp,[em.errorCode]:em};class Dr extends Error{constructor(e){super(e??"Unauthorized")}}function $E(t,e){const r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function FE(t,e,r,s){const{client_id:n,client_secret:a}=e;switch(t){case"client_secret_basic":uD(n,a,r);return;case"client_secret_post":dD(n,a,s);return;case"none":fD(n,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function uD(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const s=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${s}`)}function dD(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function fD(t,e){e.set("client_id",t)}async function Jv(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const s=nD.parse(JSON.parse(r)),{error:n,error_description:a,error_uri:o}=s,i=cD[n]||gi;return new i(a||"",o)}catch(s){const n=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${r}`;return new gi(n)}}async function Pn(t,e){var r,s;try{return await Wf(t,e)}catch(n){if(n instanceof Ju||n instanceof ed)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await Wf(t,e);if(n instanceof Xu)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await Wf(t,e);throw n}}async function Wf(t,{serverUrl:e,authorizationCode:r,scope:s,resourceMetadataUrl:n,fetchFn:a}){let o,i;try{o=await pD(e,{resourceMetadataUrl:n},a),o.authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch{}i||(i=e);const c=await hD(e,t,o),u=await xD(i,{fetchFn:a});let d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const p=await _D(i,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:a});await t.saveClientInformation(p),d=p}if(r!==void 0){const p=await t.codeVerifier(),v=await bD(i,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:p,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(v),"AUTHORIZED"}const h=await t.tokens();if(h!=null&&h.refresh_token)try{const p=await SD(i,{metadata:u,clientInformation:d,refreshToken:h.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof Kt)||p instanceof gi))throw p}const m=t.state?await t.state():void 0,{authorizationUrl:f,codeVerifier:w}=await wD(i,{metadata:u,clientInformation:d,state:m,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(w),await t.redirectToAuthorization(f),"REDIRECT"}async function hD(t,e,r){const s=iD(t);if(e.validateResourceURL)return await e.validateResourceURL(s,r==null?void 0:r.resource);if(r){if(!lD({requestedResource:s,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${s} (or origin)`);return new URL(r.resource)}}function tm(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[r,s]=e.split(" ");if(r.toLowerCase()!=="bearer"||!s)return;const a=/resource_metadata="([^"]*)"/.exec(e);if(a)try{return new URL(a[1])}catch{return}}async function pD(t,e,r=fetch){const s=await gD(t,"oauth-protected-resource",r,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return eD.parse(await s.json())}async function Xv(t,e,r=fetch){try{return await r(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?Xv(t,void 0,r):void 0;throw s}}function mD(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function D0(t,e,r=fetch){return await Xv(t,{"MCP-Protocol-Version":e},r)}function vD(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function gD(t,e,r,s){var n,a;const o=new URL(t),i=(n=s==null?void 0:s.protocolVersion)!==null&&n!==void 0?n:Vd;let c;if(s!=null&&s.metadataUrl)c=new URL(s.metadataUrl);else{const d=mD(e,o.pathname);c=new URL(d,(a=s==null?void 0:s.metadataServerUrl)!==null&&a!==void 0?a:o),c.search=o.search}let u=await D0(c,i,r);if(!(s!=null&&s.metadataUrl)&&vD(u,o.pathname)){const d=new URL(`/.well-known/${e}`,o);u=await D0(d,i,r)}return u}function yD(t){const e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",s=[];if(!r)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let n=e.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${n}`,e.origin),type:"oidc"}),s.push({url:new URL(`${n}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function xD(t,{fetchFn:e=fetch,protocolVersion:r=Vd}={}){var s;const n={"MCP-Protocol-Version":r},a=yD(t);for(const{url:o,type:i}of a){const c=await Xv(o,n,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(i==="oauth")return DE.parse(await c.json());{const u=rD.parse(await c.json());if(!(!((s=u.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${o}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function wD(t,{metadata:e,clientInformation:r,redirectUrl:s,scope:n,state:a,resource:o}){const i="code",c="S256";let u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(i))throw new Error(`Incompatible auth server: does not support response type ${i}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);const d=await X4(),h=d.code_verifier,m=d.code_challenge;return u.searchParams.set("response_type",i),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",m),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(s)),a&&u.searchParams.set("state",a),n&&u.searchParams.set("scope",n),n!=null&&n.includes("offline_access")&&u.searchParams.append("prompt","consent"),o&&u.searchParams.set("resource",o.href),{authorizationUrl:u,codeVerifier:h}}async function bD(t,{metadata:e,clientInformation:r,authorizationCode:s,codeVerifier:n,redirectUri:a,resource:o,addClientAuthentication:i,fetchFn:c}){var u;const d="authorization_code",h=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);const m=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),f=new URLSearchParams({grant_type:d,code:s,code_verifier:n,redirect_uri:String(a)});if(i)i(m,f,t,e);else{const p=(u=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],v=$E(r,p);FE(v,r,m,f)}o&&f.set("resource",o.href);const w=await(c??fetch)(h,{method:"POST",headers:m,body:f});if(!w.ok)throw await Jv(w);return ME.parse(await w.json())}async function SD(t,{metadata:e,clientInformation:r,refreshToken:s,resource:n,addClientAuthentication:a,fetchFn:o}){var i;const c="refresh_token";let u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);const d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),h=new URLSearchParams({grant_type:c,refresh_token:s});if(a)a(d,h,t,e);else{const f=(i=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&i!==void 0?i:[],w=$E(r,f);FE(w,r,d,h)}n&&h.set("resource",n.href);const m=await(o??fetch)(u,{method:"POST",headers:d,body:h});if(!m.ok)throw await Jv(m);return ME.parse({refresh_token:s,...await m.json()})}async function _D(t,{metadata:e,clientMetadata:r,fetchFn:s}){let n;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");n=new URL(e.registration_endpoint)}else n=new URL("/register",t);const a=await(s??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await Jv(a);return oD.parse(await a.json())}class ED extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class CD{constructor(e,r){this._url=e,this._resourceMetadataUrl=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}async _authThenStart(){var e;if(!this._authProvider)throw new Dr("No auth provider");let r;try{r=await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(r!=="AUTHORIZED")throw new Dr;return await this._startOrAuth()}async _commonHeaders(){var e;const r={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(r.Authorization=`Bearer ${s.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,s;const n=(s=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&s!==void 0?s:fetch;return new Promise((a,o)=>{this._eventSource=new tu(this._url.href,{...this._eventSourceInit,fetch:async(i,c)=>{const u=await this._commonHeaders();u.set("Accept","text/event-stream");const d=await n(i,{...c,headers:u});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=tm(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{var c;if(i.code===401&&this._authProvider){this._authThenStart().then(a,o);return}const u=new ED(i.code,i.message,i);o(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{var c;const u=i;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){o(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}a()}),this._eventSource.onmessage=i=>{var c,u;const d=i;let h;try{h=Xc.parse(JSON.parse(d.data))}catch(m){(c=this.onerror)===null||c===void 0||c.call(this,m);return}(u=this.onmessage)===null||u===void 0||u.call(this,h)}})}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(e){if(!this._authProvider)throw new Dr("No auth provider");if(await Pn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr("Failed to authorize")}async close(){var e,r,s;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(s=this.onclose)===null||s===void 0||s.call(this)}async send(e){var r,s,n;if(!this._endpoint)throw new Error("Not connected");try{const a=await this._commonHeaders();a.set("content-type","application/json");const o={...this._requestInit,method:"POST",headers:a,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},i=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._endpoint,o);if(!i.ok){if(i.status===401&&this._authProvider){if(this._resourceMetadataUrl=tm(i),await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr;return this.send(e)}const c=await i.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${c}`)}}catch(a){throw(n=this.onerror)===null||n===void 0||n.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}}class PD extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let n;super({start(a){n=OE({onEvent:o=>{a.enqueue(o)},onError(o){e==="terminate"?a.error(o):typeof e=="function"&&e(o)},onRetry:r,onComment:s})},transform(a){n.feed(a)}})}}const kD={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Qf extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class ND{constructor(e,r){var s;this._url=e,this._resourceMetadataUrl=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._sessionId=r==null?void 0:r.sessionId,this._reconnectionOptions=(s=r==null?void 0:r.reconnectionOptions)!==null&&s!==void 0?s:kD}async _authThenStart(){var e;if(!this._authProvider)throw new Dr("No auth provider");let r;try{r=await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(r!=="AUTHORIZED")throw new Dr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const r={};if(this._authProvider){const n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...s})}async _startOrAuthSse(e){var r,s,n;const{resumptionToken:a}=e;try{const o=await this._commonHeaders();o.set("Accept","text/event-stream"),a&&o.set("last-event-id",a);const i=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:o,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!i.ok){if(i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Qf(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(o){throw(n=this.onerror)===null||n===void 0||n.call(this,o),o}}_getNextReconnectionDelay(e){const r=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(s,e),n)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var s;const n=this._reconnectionOptions.maxRetries;if(n>0&&r>=n){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}const a=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},a)}_handleSseStream(e,r,s){if(!e)return;const{onresumptiontoken:n,replayMessageId:a}=r;let o;(async()=>{var c,u,d,h;try{const m=e.pipeThrough(new TextDecoderStream).pipeThrough(new PD).getReader();for(;;){const{value:f,done:w}=await m.read();if(w)break;if(f.id&&(o=f.id,n==null||n(f.id)),!f.event||f.event==="message")try{const p=Xc.parse(JSON.parse(f.data));a!==void 0&&Ip(p)&&(p.id=a),(c=this.onmessage)===null||c===void 0||c.call(this,p)}catch(p){(u=this.onerror)===null||u===void 0||u.call(this,p)}}}catch(m){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${m}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:n,replayMessageId:a},0)}catch(f){(h=this.onerror)===null||h===void 0||h.call(this,new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}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(e){if(!this._authProvider)throw new Dr("No auth provider");if(await Pn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var s,n,a,o;try{const{resumptionToken:i,onresumptiontoken:c}=r||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:yE(e)?e.id:void 0}).catch(v=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,v)});return}const u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");const d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},h=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,d),m=h.headers.get("mcp-session-id");if(m&&(this._sessionId=m),!h.ok){if(h.status===401&&this._authProvider){if(this._resourceMetadataUrl=tm(h),await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr;return this.send(e)}const v=await h.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${h.status}): ${v}`)}if(h.status===202){r4(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,v)});return}const w=(Array.isArray(e)?e:[e]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,p=h.headers.get("content-type");if(w)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(h.body,{onresumptiontoken:c},!1);else if(p!=null&&p.includes("application/json")){const v=await h.json(),y=Array.isArray(v)?v.map(g=>Xc.parse(g)):[Xc.parse(v)];for(const g of y)(a=this.onmessage)===null||a===void 0||a.call(this,g)}else throw new Qf(-1,`Unexpected content type: ${p}`)}catch(i){throw(o=this.onerror)===null||o===void 0||o.call(this,i),i}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,s;if(this._sessionId)try{const n=await this._commonHeaders(),a={...this._requestInit,method:"DELETE",headers:n,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},o=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,a);if(!o.ok&&o.status!==405)throw new Qf(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(n){throw(s=this.onerror)===null||s===void 0||s.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}const jD=6e4;class RD{constructor(e){this._options=e,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.setNotificationHandler(Uv,r=>{const s=this._requestHandlerAbortControllers.get(r.params.requestId);s==null||s.abort(r.params.reason)}),this.setNotificationHandler(Vv,r=>{this._onprogress(r)}),this.setRequestHandler(zv,r=>({}))}_setupTimeout(e,r,s,n,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:s,resetTimeoutOnProgress:a,onTimeout:n})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const s=Date.now()-r.startTime;if(r.maxTotalTimeout&&s>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new qs(En.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:s});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,s,n;this._transport=e;const a=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{a==null||a(),this._onclose()};const o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{o==null||o(c),this._onerror(c)};const i=(n=this._transport)===null||n===void 0?void 0:n.onmessage;this._transport.onmessage=(c,u)=>{i==null||i(c,u),Ip(c)||JI(c)?this._onresponse(c):yE(c)?this._onrequest(c,u):YI(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;const r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const s=new qs(En.ConnectionClosed,"Connection closed");for(const n of r.values())n(s)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const s=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){var s,n;const a=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,o=this._transport;if(a===void 0){o==null||o.send({jsonrpc:"2.0",id:e.id,error:{code:En.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);const c={signal:i.signal,sessionId:o==null?void 0:o.sessionId,_meta:(n=e.params)===null||n===void 0?void 0:n._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,h)=>this.request(u,d,{...h,relatedRequestId:e.id}),authInfo:r==null?void 0:r.authInfo,requestId:e.id,requestInfo:r==null?void 0:r.requestInfo};Promise.resolve().then(()=>a(e,c)).then(u=>{if(!i.signal.aborted)return o==null?void 0:o.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var d;if(!i.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:En.InternalError,message:(d=u.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...s}=e.params,n=Number(r),a=this._progressHandlers.get(n);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const o=this._responseHandlers.get(n),i=this._timeoutInfo.get(n);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){o(c);return}a(s)}_onresponse(e){const r=Number(e.id),s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Ip(e))s(e);else{const n=new qs(e.error.code,e.error.message,e.error.data);s(n)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,s){const{relatedRequestId:n,resumptionToken:a,onresumptiontoken:o}=s??{};return new Promise((i,c)=>{var u,d,h,m,f,w;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=s==null?void 0:s.signal)===null||d===void 0||d.throwIfAborted();const p=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),v.params={...e.params,_meta:{...((h=e.params)===null||h===void 0?void 0:h._meta)||{},progressToken:p}});const y=S=>{var E;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(E=this._transport)===null||E===void 0||E.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:n,resumptionToken:a,onresumptiontoken:o}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`))),c(S)};this._responseHandlers.set(p,S=>{var E;if(!(!((E=s==null?void 0:s.signal)===null||E===void 0)&&E.aborted)){if(S instanceof Error)return c(S);try{const N=r.parse(S.result);i(N)}catch(N){c(N)}}}),(m=s==null?void 0:s.signal)===null||m===void 0||m.addEventListener("abort",()=>{var S;y((S=s==null?void 0:s.signal)===null||S===void 0?void 0:S.reason)});const g=(f=s==null?void 0:s.timeout)!==null&&f!==void 0?f:jD,b=()=>y(new qs(En.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,s==null?void 0:s.maxTotalTimeout,b,(w=s==null?void 0:s.resetTimeoutOnProgress)!==null&&w!==void 0?w:!1),this._transport.send(v,{relatedRequestId:n,resumptionToken:a,onresumptiontoken:o}).catch(S=>{this._cleanupTimeout(p),c(S)})})}async notification(e,r){var s,n;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((n=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&n!==void 0?n:[]).includes(e.method)&&!e.params&&!(r!=null&&r.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(d=>this._onerror(d))});return}const i={...e,jsonrpc:"2.0"};await this._transport.send(i,r)}setRequestHandler(e,r){const s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(n,a)=>Promise.resolve(r(e.parse(n),a)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(r(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function TD(t,e){return Object.entries(e).reduce((r,[s,n])=>(n&&typeof n=="object"?r[s]=r[s]?{...r[s],...n}:n:r[s]=n,r),{...t})}var rm={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(t,e){(function(r,s){s(e)})(xC,function(r){function s(){for(var M=arguments.length,k=Array(M),$=0;$<M;$++)k[$]=arguments[$];if(k.length>1){k[0]=k[0].slice(0,-1);for(var H=k.length-1,q=1;q<H;++q)k[q]=k[q].slice(1,-1);return k[H]=k[H].slice(1),k.join("")}else return k[0]}function n(M){return"(?:"+M+")"}function a(M){return M===void 0?"undefined":M===null?"null":Object.prototype.toString.call(M).split(" ").pop().split("]").shift().toLowerCase()}function o(M){return M.toUpperCase()}function i(M){return M!=null?M instanceof Array?M:typeof M.length!="number"||M.split||M.setInterval||M.call?[M]:Array.prototype.slice.call(M):[]}function c(M,k){var $=M;if(k)for(var H in k)$[H]=k[H];return $}function u(M){var k="[A-Za-z]",$="[0-9]",H=s($,"[A-Fa-f]"),q=n(n("%[EFef]"+H+"%"+H+H+"%"+H+H)+"|"+n("%[89A-Fa-f]"+H+"%"+H+H)+"|"+n("%"+H+H)),xe="[\\:\\/\\?\\#\\[\\]\\@]",we="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Qe=s(xe,we),ot=M?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",bt=M?"[\\uE000-\\uF8FF]":"[]",He=s(k,$,"[\\-\\.\\_\\~]",ot);n(k+s(k,$,"[\\+\\-\\.]")+"*"),n(n(q+"|"+s(He,we,"[\\:]"))+"*");var nt=n(n("25[0-5]")+"|"+n("2[0-4]"+$)+"|"+n("1"+$+$)+"|"+n("0?[1-9]"+$)+"|0?0?"+$),St=n(nt+"\\."+nt+"\\."+nt+"\\."+nt),Re=n(H+"{1,4}"),ut=n(n(Re+"\\:"+Re)+"|"+St),Ct=n(n(Re+"\\:")+"{6}"+ut),dt=n("\\:\\:"+n(Re+"\\:")+"{5}"+ut),vs=n(n(Re)+"?\\:\\:"+n(Re+"\\:")+"{4}"+ut),cn=n(n(n(Re+"\\:")+"{0,1}"+Re)+"?\\:\\:"+n(Re+"\\:")+"{3}"+ut),un=n(n(n(Re+"\\:")+"{0,2}"+Re)+"?\\:\\:"+n(Re+"\\:")+"{2}"+ut),io=n(n(n(Re+"\\:")+"{0,3}"+Re)+"?\\:\\:"+Re+"\\:"+ut),xa=n(n(n(Re+"\\:")+"{0,4}"+Re)+"?\\:\\:"+ut),Rr=n(n(n(Re+"\\:")+"{0,5}"+Re)+"?\\:\\:"+Re),dn=n(n(n(Re+"\\:")+"{0,6}"+Re)+"?\\:\\:"),wa=n([Ct,dt,vs,cn,un,io,xa,Rr,dn].join("|")),Fn=n(n(He+"|"+q)+"+");n("[vV]"+H+"+\\."+s(He,we,"[\\:]")+"+"),n(n(q+"|"+s(He,we))+"*");var Ni=n(q+"|"+s(He,we,"[\\:\\@]"));return n(n(q+"|"+s(He,we,"[\\@]"))+"+"),n(n(Ni+"|"+s("[\\/\\?]",bt))+"*"),{NOT_SCHEME:new RegExp(s("[^]",k,$,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",He,we),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",He,we),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",He,we),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",He,we),"g"),NOT_QUERY:new RegExp(s("[^\\%]",He,we,"[\\:\\@\\/\\?]",bt),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",He,we,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",He,we),"g"),UNRESERVED:new RegExp(He,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",He,Qe),"g"),PCT_ENCODED:new RegExp(q,"g"),IPV4ADDRESS:new RegExp("^("+St+")$"),IPV6ADDRESS:new RegExp("^\\[?("+wa+")"+n(n("\\%25|\\%(?!"+H+"{2})")+"("+Fn+")")+"?\\]?$")}}var d=u(!1),h=u(!0),m=function(){function M(k,$){var H=[],q=!0,xe=!1,we=void 0;try{for(var Qe=k[Symbol.iterator](),ot;!(q=(ot=Qe.next()).done)&&(H.push(ot.value),!($&&H.length===$));q=!0);}catch(bt){xe=!0,we=bt}finally{try{!q&&Qe.return&&Qe.return()}finally{if(xe)throw we}}return H}return function(k,$){if(Array.isArray(k))return k;if(Symbol.iterator in Object(k))return M(k,$);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function(M){if(Array.isArray(M)){for(var k=0,$=Array(M.length);k<M.length;k++)$[k]=M[k];return $}else return Array.from(M)},w=2147483647,p=36,v=1,y=26,g=38,b=700,S=72,E=128,N="-",j=/^xn--/,R=/[^\0-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=p-v,_=Math.floor,I=String.fromCharCode;function C(M){throw new RangeError(F[M])}function z(M,k){for(var $=[],H=M.length;H--;)$[H]=k(M[H]);return $}function U(M,k){var $=M.split("@"),H="";$.length>1&&(H=$[0]+"@",M=$[1]),M=M.replace(A,".");var q=M.split("."),xe=z(q,k).join(".");return H+xe}function K(M){for(var k=[],$=0,H=M.length;$<H;){var q=M.charCodeAt($++);if(q>=55296&&q<=56319&&$<H){var xe=M.charCodeAt($++);(xe&64512)==56320?k.push(((q&1023)<<10)+(xe&1023)+65536):(k.push(q),$--)}else k.push(q)}return k}var P=function(k){return String.fromCodePoint.apply(String,f(k))},D=function(k){return k-48<10?k-22:k-65<26?k-65:k-97<26?k-97:p},L=function(k,$){return k+22+75*(k<26)-(($!=0)<<5)},J=function(k,$,H){var q=0;for(k=H?_(k/b):k>>1,k+=_(k/$);k>T*y>>1;q+=p)k=_(k/T);return _(q+(T+1)*k/(k+g))},Z=function(k){var $=[],H=k.length,q=0,xe=E,we=S,Qe=k.lastIndexOf(N);Qe<0&&(Qe=0);for(var ot=0;ot<Qe;++ot)k.charCodeAt(ot)>=128&&C("not-basic"),$.push(k.charCodeAt(ot));for(var bt=Qe>0?Qe+1:0;bt<H;){for(var He=q,nt=1,St=p;;St+=p){bt>=H&&C("invalid-input");var Re=D(k.charCodeAt(bt++));(Re>=p||Re>_((w-q)/nt))&&C("overflow"),q+=Re*nt;var ut=St<=we?v:St>=we+y?y:St-we;if(Re<ut)break;var Ct=p-ut;nt>_(w/Ct)&&C("overflow"),nt*=Ct}var dt=$.length+1;we=J(q-He,dt,He==0),_(q/dt)>w-xe&&C("overflow"),xe+=_(q/dt),q%=dt,$.splice(q++,0,xe)}return String.fromCodePoint.apply(String,$)},B=function(k){var $=[];k=K(k);var H=k.length,q=E,xe=0,we=S,Qe=!0,ot=!1,bt=void 0;try{for(var He=k[Symbol.iterator](),nt;!(Qe=(nt=He.next()).done);Qe=!0){var St=nt.value;St<128&&$.push(I(St))}}catch(ji){ot=!0,bt=ji}finally{try{!Qe&&He.return&&He.return()}finally{if(ot)throw bt}}var Re=$.length,ut=Re;for(Re&&$.push(N);ut<H;){var Ct=w,dt=!0,vs=!1,cn=void 0;try{for(var un=k[Symbol.iterator](),io;!(dt=(io=un.next()).done);dt=!0){var xa=io.value;xa>=q&&xa<Ct&&(Ct=xa)}}catch(ji){vs=!0,cn=ji}finally{try{!dt&&un.return&&un.return()}finally{if(vs)throw cn}}var Rr=ut+1;Ct-q>_((w-xe)/Rr)&&C("overflow"),xe+=(Ct-q)*Rr,q=Ct;var dn=!0,wa=!1,Fn=void 0;try{for(var Ni=k[Symbol.iterator](),fg;!(dn=(fg=Ni.next()).done);dn=!0){var hg=fg.value;if(hg<q&&++xe>w&&C("overflow"),hg==q){for(var Xl=xe,ec=p;;ec+=p){var tc=ec<=we?v:ec>=we+y?y:ec-we;if(Xl<tc)break;var pg=Xl-tc,mg=p-tc;$.push(I(L(tc+pg%mg,0))),Xl=_(pg/mg)}$.push(I(L(Xl,0))),we=J(xe,Rr,ut==Re),xe=0,++ut}}}catch(ji){wa=!0,Fn=ji}finally{try{!dn&&Ni.return&&Ni.return()}finally{if(wa)throw Fn}}++xe,++q}return $.join("")},oe=function(k){return U(k,function($){return j.test($)?Z($.slice(4).toLowerCase()):$})},ve=function(k){return U(k,function($){return R.test($)?"xn--"+B($):$})},ge={version:"2.1.0",ucs2:{decode:K,encode:P},decode:Z,encode:B,toASCII:ve,toUnicode:oe},re={};function ye(M){var k=M.charCodeAt(0),$=void 0;return k<16?$="%0"+k.toString(16).toUpperCase():k<128?$="%"+k.toString(16).toUpperCase():k<2048?$="%"+(k>>6|192).toString(16).toUpperCase()+"%"+(k&63|128).toString(16).toUpperCase():$="%"+(k>>12|224).toString(16).toUpperCase()+"%"+(k>>6&63|128).toString(16).toUpperCase()+"%"+(k&63|128).toString(16).toUpperCase(),$}function ke(M){for(var k="",$=0,H=M.length;$<H;){var q=parseInt(M.substr($+1,2),16);if(q<128)k+=String.fromCharCode(q),$+=3;else if(q>=194&&q<224){if(H-$>=6){var xe=parseInt(M.substr($+4,2),16);k+=String.fromCharCode((q&31)<<6|xe&63)}else k+=M.substr($,6);$+=6}else if(q>=224){if(H-$>=9){var we=parseInt(M.substr($+4,2),16),Qe=parseInt(M.substr($+7,2),16);k+=String.fromCharCode((q&15)<<12|(we&63)<<6|Qe&63)}else k+=M.substr($,9);$+=9}else k+=M.substr($,3),$+=3}return k}function me(M,k){function $(H){var q=ke(H);return q.match(k.UNRESERVED)?q:H}return M.scheme&&(M.scheme=String(M.scheme).replace(k.PCT_ENCODED,$).toLowerCase().replace(k.NOT_SCHEME,"")),M.userinfo!==void 0&&(M.userinfo=String(M.userinfo).replace(k.PCT_ENCODED,$).replace(k.NOT_USERINFO,ye).replace(k.PCT_ENCODED,o)),M.host!==void 0&&(M.host=String(M.host).replace(k.PCT_ENCODED,$).toLowerCase().replace(k.NOT_HOST,ye).replace(k.PCT_ENCODED,o)),M.path!==void 0&&(M.path=String(M.path).replace(k.PCT_ENCODED,$).replace(M.scheme?k.NOT_PATH:k.NOT_PATH_NOSCHEME,ye).replace(k.PCT_ENCODED,o)),M.query!==void 0&&(M.query=String(M.query).replace(k.PCT_ENCODED,$).replace(k.NOT_QUERY,ye).replace(k.PCT_ENCODED,o)),M.fragment!==void 0&&(M.fragment=String(M.fragment).replace(k.PCT_ENCODED,$).replace(k.NOT_FRAGMENT,ye).replace(k.PCT_ENCODED,o)),M}function ee(M){return M.replace(/^0*(.*)/,"$1")||"0"}function _e(M,k){var $=M.match(k.IPV4ADDRESS)||[],H=m($,2),q=H[1];return q?q.split(".").map(ee).join("."):M}function Pe(M,k){var $=M.match(k.IPV6ADDRESS)||[],H=m($,3),q=H[1],xe=H[2];if(q){for(var we=q.toLowerCase().split("::").reverse(),Qe=m(we,2),ot=Qe[0],bt=Qe[1],He=bt?bt.split(":").map(ee):[],nt=ot.split(":").map(ee),St=k.IPV4ADDRESS.test(nt[nt.length-1]),Re=St?7:8,ut=nt.length-Re,Ct=Array(Re),dt=0;dt<Re;++dt)Ct[dt]=He[dt]||nt[ut+dt]||"";St&&(Ct[Re-1]=_e(Ct[Re-1],k));var vs=Ct.reduce(function(Rr,dn,wa){if(!dn||dn==="0"){var Fn=Rr[Rr.length-1];Fn&&Fn.index+Fn.length===wa?Fn.length++:Rr.push({index:wa,length:1})}return Rr},[]),cn=vs.sort(function(Rr,dn){return dn.length-Rr.length})[0],un=void 0;if(cn&&cn.length>1){var io=Ct.slice(0,cn.index),xa=Ct.slice(cn.index+cn.length);un=io.join(":")+"::"+xa.join(":")}else un=Ct.join(":");return xe&&(un+="%"+xe),un}else return M}var De=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,X="".match(/(){0}/)[1]===void 0;function ce(M){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$={},H=k.iri!==!1?h:d;k.reference==="suffix"&&(M=(k.scheme?k.scheme+":":"")+"//"+M);var q=M.match(De);if(q){X?($.scheme=q[1],$.userinfo=q[3],$.host=q[4],$.port=parseInt(q[5],10),$.path=q[6]||"",$.query=q[7],$.fragment=q[8],isNaN($.port)&&($.port=q[5])):($.scheme=q[1]||void 0,$.userinfo=M.indexOf("@")!==-1?q[3]:void 0,$.host=M.indexOf("//")!==-1?q[4]:void 0,$.port=parseInt(q[5],10),$.path=q[6]||"",$.query=M.indexOf("?")!==-1?q[7]:void 0,$.fragment=M.indexOf("#")!==-1?q[8]:void 0,isNaN($.port)&&($.port=M.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?q[4]:void 0)),$.host&&($.host=Pe(_e($.host,H),H)),$.scheme===void 0&&$.userinfo===void 0&&$.host===void 0&&$.port===void 0&&!$.path&&$.query===void 0?$.reference="same-document":$.scheme===void 0?$.reference="relative":$.fragment===void 0?$.reference="absolute":$.reference="uri",k.reference&&k.reference!=="suffix"&&k.reference!==$.reference&&($.error=$.error||"URI is not a "+k.reference+" reference.");var xe=re[(k.scheme||$.scheme||"").toLowerCase()];if(!k.unicodeSupport&&(!xe||!xe.unicodeSupport)){if($.host&&(k.domainHost||xe&&xe.domainHost))try{$.host=ge.toASCII($.host.replace(H.PCT_ENCODED,ke).toLowerCase())}catch(we){$.error=$.error||"Host's domain name can not be converted to ASCII via punycode: "+we}me($,d)}else me($,H);xe&&xe.parse&&xe.parse($,k)}else $.error=$.error||"URI can not be parsed.";return $}function Y(M,k){var $=k.iri!==!1?h:d,H=[];return M.userinfo!==void 0&&(H.push(M.userinfo),H.push("@")),M.host!==void 0&&H.push(Pe(_e(String(M.host),$),$).replace($.IPV6ADDRESS,function(q,xe,we){return"["+xe+(we?"%25"+we:"")+"]"})),(typeof M.port=="number"||typeof M.port=="string")&&(H.push(":"),H.push(String(M.port))),H.length?H.join(""):void 0}var ze=/^\.\.?\//,te=/^\/\.(\/|$)/,Me=/^\/\.\.(\/|$)/,Ue=/^\/?(?:.|\n)*?(?=\/|$)/;function Ne(M){for(var k=[];M.length;)if(M.match(ze))M=M.replace(ze,"");else if(M.match(te))M=M.replace(te,"/");else if(M.match(Me))M=M.replace(Me,"/"),k.pop();else if(M==="."||M==="..")M="";else{var $=M.match(Ue);if($){var H=$[0];M=M.slice(H.length),k.push(H)}else throw new Error("Unexpected dot segment condition")}return k.join("")}function rt(M){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=k.iri?h:d,H=[],q=re[(k.scheme||M.scheme||"").toLowerCase()];if(q&&q.serialize&&q.serialize(M,k),M.host&&!$.IPV6ADDRESS.test(M.host)){if(k.domainHost||q&&q.domainHost)try{M.host=k.iri?ge.toUnicode(M.host):ge.toASCII(M.host.replace($.PCT_ENCODED,ke).toLowerCase())}catch(Qe){M.error=M.error||"Host's domain name can not be converted to "+(k.iri?"Unicode":"ASCII")+" via punycode: "+Qe}}me(M,$),k.reference!=="suffix"&&M.scheme&&(H.push(M.scheme),H.push(":"));var xe=Y(M,k);if(xe!==void 0&&(k.reference!=="suffix"&&H.push("//"),H.push(xe),M.path&&M.path.charAt(0)!=="/"&&H.push("/")),M.path!==void 0){var we=M.path;!k.absolutePath&&(!q||!q.absolutePath)&&(we=Ne(we)),xe===void 0&&(we=we.replace(/^\/\//,"/%2F")),H.push(we)}return M.query!==void 0&&(H.push("?"),H.push(M.query)),M.fragment!==void 0&&(H.push("#"),H.push(M.fragment)),H.join("")}function pt(M,k){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},H=arguments[3],q={};return H||(M=ce(rt(M,$),$),k=ce(rt(k,$),$)),$=$||{},!$.tolerant&&k.scheme?(q.scheme=k.scheme,q.userinfo=k.userinfo,q.host=k.host,q.port=k.port,q.path=Ne(k.path||""),q.query=k.query):(k.userinfo!==void 0||k.host!==void 0||k.port!==void 0?(q.userinfo=k.userinfo,q.host=k.host,q.port=k.port,q.path=Ne(k.path||""),q.query=k.query):(k.path?(k.path.charAt(0)==="/"?q.path=Ne(k.path):((M.userinfo!==void 0||M.host!==void 0||M.port!==void 0)&&!M.path?q.path="/"+k.path:M.path?q.path=M.path.slice(0,M.path.lastIndexOf("/")+1)+k.path:q.path=k.path,q.path=Ne(q.path)),q.query=k.query):(q.path=M.path,k.query!==void 0?q.query=k.query:q.query=M.query),q.userinfo=M.userinfo,q.host=M.host,q.port=M.port),q.scheme=M.scheme),q.fragment=k.fragment,q}function Hr(M,k,$){var H=c({scheme:"null"},$);return rt(pt(ce(M,H),ce(k,H),H,!0),H)}function zt(M,k){return typeof M=="string"?M=rt(ce(M,k),k):a(M)==="object"&&(M=ce(rt(M,k),k)),M}function fs(M,k,$){return typeof M=="string"?M=rt(ce(M,$),$):a(M)==="object"&&(M=rt(M,$)),typeof k=="string"?k=rt(ce(k,$),$):a(k)==="object"&&(k=rt(k,$)),M===k}function oo(M,k){return M&&M.toString().replace(!k||!k.iri?d.ESCAPE:h.ESCAPE,ye)}function Yt(M,k){return M&&M.toString().replace(!k||!k.iri?d.PCT_ENCODED:h.PCT_ENCODED,ke)}var Br={scheme:"http",domainHost:!0,parse:function(k,$){return k.host||(k.error=k.error||"HTTP URIs must have a host."),k},serialize:function(k,$){var H=String(k.scheme).toLowerCase()==="https";return(k.port===(H?443:80)||k.port==="")&&(k.port=void 0),k.path||(k.path="/"),k}},hs={scheme:"https",domainHost:Br.domainHost,parse:Br.parse,serialize:Br.serialize};function jr(M){return typeof M.secure=="boolean"?M.secure:String(M.scheme).toLowerCase()==="wss"}var Dn={scheme:"ws",domainHost:!0,parse:function(k,$){var H=k;return H.secure=jr(H),H.resourceName=(H.path||"/")+(H.query?"?"+H.query:""),H.path=void 0,H.query=void 0,H},serialize:function(k,$){if((k.port===(jr(k)?443:80)||k.port==="")&&(k.port=void 0),typeof k.secure=="boolean"&&(k.scheme=k.secure?"wss":"ws",k.secure=void 0),k.resourceName){var H=k.resourceName.split("?"),q=m(H,2),xe=q[0],we=q[1];k.path=xe&&xe!=="/"?xe:void 0,k.query=we,k.resourceName=void 0}return k.fragment=void 0,k}},ps={scheme:"wss",domainHost:Dn.domainHost,parse:Dn.parse,serialize:Dn.serialize},ya={},ms="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ne="[0-9A-Fa-f]",Et=n(n("%[EFef]"+ne+"%"+ne+ne+"%"+ne+ne)+"|"+n("%[89A-Fa-f]"+ne+"%"+ne+ne)+"|"+n("%"+ne+ne)),Mn="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",$n="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Zl=s($n,'[\\"\\\\]'),Yl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Jl=new RegExp(ms,"g"),le=new RegExp(Et,"g"),je=new RegExp(s("[^]",Mn,"[\\.]",'[\\"]',Zl),"g"),at=new RegExp(s("[^]",ms,Yl),"g"),Dt=at;function Nt(M){var k=ke(M);return k.match(Jl)?k:M}var cg={scheme:"mailto",parse:function(k,$){var H=k,q=H.to=H.path?H.path.split(","):[];if(H.path=void 0,H.query){for(var xe=!1,we={},Qe=H.query.split("&"),ot=0,bt=Qe.length;ot<bt;++ot){var He=Qe[ot].split("=");switch(He[0]){case"to":for(var nt=He[1].split(","),St=0,Re=nt.length;St<Re;++St)q.push(nt[St]);break;case"subject":H.subject=Yt(He[1],$);break;case"body":H.body=Yt(He[1],$);break;default:xe=!0,we[Yt(He[0],$)]=Yt(He[1],$);break}}xe&&(H.headers=we)}H.query=void 0;for(var ut=0,Ct=q.length;ut<Ct;++ut){var dt=q[ut].split("@");if(dt[0]=Yt(dt[0]),$.unicodeSupport)dt[1]=Yt(dt[1],$).toLowerCase();else try{dt[1]=ge.toASCII(Yt(dt[1],$).toLowerCase())}catch(vs){H.error=H.error||"Email address's domain name can not be converted to ASCII via punycode: "+vs}q[ut]=dt.join("@")}return H},serialize:function(k,$){var H=k,q=i(k.to);if(q){for(var xe=0,we=q.length;xe<we;++xe){var Qe=String(q[xe]),ot=Qe.lastIndexOf("@"),bt=Qe.slice(0,ot).replace(le,Nt).replace(le,o).replace(je,ye),He=Qe.slice(ot+1);try{He=$.iri?ge.toUnicode(He):ge.toASCII(Yt(He,$).toLowerCase())}catch(ut){H.error=H.error||"Email address's domain name can not be converted to "+($.iri?"Unicode":"ASCII")+" via punycode: "+ut}q[xe]=bt+"@"+He}H.path=q.join(",")}var nt=k.headers=k.headers||{};k.subject&&(nt.subject=k.subject),k.body&&(nt.body=k.body);var St=[];for(var Re in nt)nt[Re]!==ya[Re]&&St.push(Re.replace(le,Nt).replace(le,o).replace(at,ye)+"="+nt[Re].replace(le,Nt).replace(le,o).replace(Dt,ye));return St.length&&(H.query=St.join("&")),H}},pC=/^([^\:]+)\:(.*)/,ug={scheme:"urn",parse:function(k,$){var H=k.path&&k.path.match(pC),q=k;if(H){var xe=$.scheme||q.scheme||"urn",we=H[1].toLowerCase(),Qe=H[2],ot=xe+":"+($.nid||we),bt=re[ot];q.nid=we,q.nss=Qe,q.path=void 0,bt&&(q=bt.parse(q,$))}else q.error=q.error||"URN can not be parsed.";return q},serialize:function(k,$){var H=$.scheme||k.scheme||"urn",q=k.nid,xe=H+":"+($.nid||q),we=re[xe];we&&(k=we.serialize(k,$));var Qe=k,ot=k.nss;return Qe.path=(q||$.nid)+":"+ot,Qe}},mC=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,dg={scheme:"urn:uuid",parse:function(k,$){var H=k;return H.uuid=H.nss,H.nss=void 0,!$.tolerant&&(!H.uuid||!H.uuid.match(mC))&&(H.error=H.error||"UUID is not valid."),H},serialize:function(k,$){var H=k;return H.nss=(k.uuid||"").toLowerCase(),H}};re[Br.scheme]=Br,re[hs.scheme]=hs,re[Dn.scheme]=Dn,re[ps.scheme]=ps,re[cg.scheme]=cg,re[ug.scheme]=ug,re[dg.scheme]=dg,r.SCHEMES=re,r.pctEncChar=ye,r.pctDecChars=ke,r.parse=ce,r.removeDotSegments=Ne,r.serialize=rt,r.resolveComponents=pt,r.resolve=Hr,r.normalize=zt,r.equal=fs,r.escapeComponent=oo,r.unescapeComponent=Yt,Object.defineProperty(r,"__esModule",{value:!0})})})(rm,rm.exports);var AD=rm.exports,eg=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var s,n,a;if(Array.isArray(e)){if(s=e.length,s!=r.length)return!1;for(n=s;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(a=Object.keys(e),s=a.length,s!==Object.keys(r).length)return!1;for(n=s;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[n]))return!1;for(n=s;n--!==0;){var o=a[n];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r},OD=function(e){for(var r=0,s=e.length,n=0,a;n<s;)r++,a=e.charCodeAt(n++),a>=55296&&a<=56319&&n<s&&(a=e.charCodeAt(n),(a&64512)==56320&&n++);return r},ki={copy:ID,checkDataType:nm,checkDataTypes:DD,coerceToTypes:MD,toHash:tg,getProperty:rg,escapeQuotes:ng,equal:eg,ucs2length:OD,varOccurences:LD,varReplace:UD,schemaHasRules:zD,schemaHasRulesExcept:VD,schemaUnknownRules:qD,toQuotedString:sm,getPathExpr:HD,getPath:BD,getData:QD,unescapeFragment:GD,unescapeJsonPointer:ag,escapeFragment:ZD,escapeJsonPointer:sg};function ID(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function nm(t,e,r,s){var n=s?" !== ":" === ",a=s?" || ":" && ",o=s?"!":"",i=s?"":"!";switch(t){case"null":return e+n+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+a+"typeof "+e+n+'"object"'+a+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+n+'"number"'+a+i+"("+e+" % 1)"+a+e+n+e+(r?a+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+n+'"'+t+'"'+(r?a+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+n+'"'+t+'"'}}function DD(t,e,r){switch(t.length){case 1:return nm(t[0],e,r,!0);default:var s="",n=tg(t);n.array&&n.object&&(s=n.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer;for(var a in n)s+=(s?" && ":"")+nm(a,e,r,!0);return s}}var M0=tg(["string","number","integer","boolean","null"]);function MD(t,e){if(Array.isArray(e)){for(var r=[],s=0;s<e.length;s++){var n=e[s];(M0[n]||t==="array"&&n==="array")&&(r[r.length]=n)}if(r.length)return r}else{if(M0[e])return[e];if(t==="array"&&e==="array")return["array"]}}function tg(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var $D=/^[a-z$_][a-z$_0-9]*$/i,FD=/'|\\/g;function rg(t){return typeof t=="number"?"["+t+"]":$D.test(t)?"."+t:"['"+ng(t)+"']"}function ng(t){return t.replace(FD,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function LD(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function UD(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function zD(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function VD(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var s in t)if(s!=r&&e[s])return!0}function qD(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function sm(t){return"'"+ng(t)+"'"}function HD(t,e,r,s){var n=r?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return LE(t,n)}function BD(t,e,r){var s=sm(r?"/"+sg(e):rg(e));return LE(t,s)}var KD=/^\/(?:[^~]|~0|~1)*$/,WD=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function QD(t,e,r){var s,n,a,o;if(t==="")return"rootData";if(t[0]=="/"){if(!KD.test(t))throw new Error("Invalid JSON-pointer: "+t);n=t,a="rootData"}else{if(o=t.match(WD),!o)throw new Error("Invalid JSON-pointer: "+t);if(s=+o[1],n=o[2],n=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return r[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(a="data"+(e-s||""),!n)return a}for(var i=a,c=n.split("/"),u=0;u<c.length;u++){var d=c[u];d&&(a+=rg(ag(d)),i+=" && "+a)}return i}function LE(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function GD(t){return ag(decodeURIComponent(t))}function ZD(t){return encodeURIComponent(sg(t))}function sg(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ag(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var YD=ki,UE=JD;function JD(t){YD.copy(t,this)}var zE={exports:{}},Hs=zE.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var s=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};ru(e,s,n,t,"",t)};Hs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Hs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Hs.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Hs.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 ru(t,e,r,s,n,a,o,i,c,u){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,n,a,o,i,c,u);for(var d in s){var h=s[d];if(Array.isArray(h)){if(d in Hs.arrayKeywords)for(var m=0;m<h.length;m++)ru(t,e,r,h[m],n+"/"+d+"/"+m,a,n,d,s,m)}else if(d in Hs.propsKeywords){if(h&&typeof h=="object")for(var f in h)ru(t,e,r,h[f],n+"/"+d+"/"+XD(f),a,n,d,s,f)}else(d in Hs.keywords||t.allKeys&&!(d in Hs.skipKeywords))&&ru(t,e,r,h,n+"/"+d,a,n,d,s)}r(s,n,a,o,i,c,u)}}function XD(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var eM=zE.exports,Gl=AD,$0=eg,Qd=ki,td=UE,tM=eM,og=ga;ga.normalizeId=ra;ga.fullPath=rd;ga.url=nd;ga.ids=oM;ga.inlineRef=am;ga.schema=Gd;function ga(t,e,r){var s=this._refs[r];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return ga.call(this,t,e,s);if(s=s||this._schemas[r],s instanceof td)return am(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var n=Gd.call(this,e,r),a,o,i;return n&&(a=n.schema,e=n.root,i=n.baseId),a instanceof td?o=a.validate||t.call(this,a.schema,e,void 0,i):a!==void 0&&(o=am(a,this._opts.inlineRefs)?a:t.call(this,a,e,void 0,i)),o}function Gd(t,e){var r=Gl.parse(e),s=qE(r),n=rd(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==n){var a=ra(s),o=this._refs[a];if(typeof o=="string")return rM.call(this,t,o,r);if(o instanceof td)o.validate||this._compile(o),t=o;else if(o=this._schemas[a],o instanceof td){if(o.validate||this._compile(o),a==ra(e))return{schema:o,root:t,baseId:n};t=o}else return;if(!t.schema)return;n=rd(this._getId(t.schema))}return VE.call(this,r,n,t.schema,t)}function rM(t,e,r){var s=Gd.call(this,t,e);if(s){var n=s.schema,a=s.baseId;t=s.root;var o=this._getId(n);return o&&(a=nd(a,o)),VE.call(this,r,a,n,t)}}var nM=Qd.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function VE(t,e,r,s){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var n=t.fragment.split("/"),a=1;a<n.length;a++){var o=n[a];if(o){if(o=Qd.unescapeFragment(o),r=r[o],r===void 0)break;var i;if(!nM[o]&&(i=this._getId(r),i&&(e=nd(e,i)),r.$ref)){var c=nd(e,r.$ref),u=Gd.call(this,s,c);u&&(r=u.schema,s=u.root,e=u.baseId)}}}if(r!==void 0&&r!==s.schema)return{schema:r,root:s,baseId:e}}}var sM=Qd.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function am(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return om(t);if(e)return im(t)<=e}function om(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!om(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!om(e)))return!1;return!0}function im(t){var e=0,r;if(Array.isArray(t)){for(var s=0;s<t.length;s++)if(r=t[s],typeof r=="object"&&(e+=im(r)),e==1/0)return 1/0}else for(var n in t){if(n=="$ref")return 1/0;if(sM[n])e++;else if(r=t[n],typeof r=="object"&&(e+=im(r)+1),e==1/0)return 1/0}return e}function rd(t,e){e!==!1&&(t=ra(t));var r=Gl.parse(t);return qE(r)}function qE(t){return Gl.serialize(t).split("#")[0]+"#"}var aM=/#\/?$/;function ra(t){return t?t.replace(aM,""):""}function nd(t,e){return e=ra(e),Gl.resolve(t,e)}function oM(t){var e=ra(this._getId(t)),r={"":e},s={"":rd(e,!1)},n={},a=this;return tM(t,{allKeys:!0},function(o,i,c,u,d,h,m){if(i!==""){var f=a._getId(o),w=r[u],p=s[u]+"/"+d;if(m!==void 0&&(p+="/"+(typeof m=="number"?m:Qd.escapeFragment(m))),typeof f=="string"){f=w=ra(w?Gl.resolve(w,f):f);var v=a._refs[f];if(typeof v=="string"&&(v=a._refs[v]),v&&v.schema){if(!$0(o,v.schema))throw new Error('id "'+f+'" resolves to more than one schema')}else if(f!=ra(p))if(f[0]=="#"){if(n[f]&&!$0(o,n[f]))throw new Error('id "'+f+'" resolves to more than one schema');n[f]=o}else a._refs[f]=p}r[i]=w,s[i]=p}}),n}var Gf=og,ig={Validation:F0(iM),MissingRef:F0(lg)};function iM(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}lg.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function lg(t,e,r){this.message=r||lg.message(t,e),this.missingRef=Gf.url(t,e),this.missingSchema=Gf.normalizeId(Gf.fullPath(this.missingRef))}function F0(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var HE=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(a){return function(o){return function(i,c){var u={key:i,value:o[i]},d={key:c,value:o[c]};return a(u,d)}}}(e.cmp),n=[];return function a(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,c;if(Array.isArray(o)){for(c="[",i=0;i<o.length;i++)i&&(c+=","),c+=a(o[i])||"null";return c+"]"}if(o===null)return"null";if(n.indexOf(o)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=n.push(o)-1,d=Object.keys(o).sort(s&&s(o));for(c="",i=0;i<d.length;i++){var h=d[i],m=a(o[h]);m&&(c&&(c+=","),c+=JSON.stringify(h)+":"+m)}return n.splice(u,1),"{"+c+"}"}}(t)},BE=function(e,r,s){var n="",a=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(n+=" var validate = ",a&&(e.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(n+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var r="false schema",d=e.level,h=e.dataLevel,m=e.schema[r],f=e.schemaPath+e.util.getProperty(r),w=e.errSchemaPath+"/"+r,E=!e.opts.allErrors,R,p="data"+(h||""),S="valid"+d;if(e.schema===!1){e.isTop?E=!0:n+=" var "+S+" = false; ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(R||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=v.pop(),!e.compositeRule&&E?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?a?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+S+" = true; ";return e.isTop&&(n+=" }; return validate; "),n}if(e.isTop){var g=e.isTop,d=e.level=0,h=e.dataLevel=0,p="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var b="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var d=e.level,h=e.dataLevel,p="data"+(h||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),a&&!e.async)throw new Error("async schema in sync schema");n+=" var errs_"+d+" = errors;"}var S="valid"+d,E=!e.opts.allErrors,N="",j="",R,A=e.schema.type,F=Array.isArray(A);if(A&&e.opts.nullable&&e.schema.nullable===!0&&(F?A.indexOf("null")==-1&&(A=A.concat("null")):A!="null"&&(A=[A,"null"],F=!0)),F&&A.length==1&&(A=A[0],F=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(n+=" "+e.RULES.all.$comment.code(e,"$comment")),A){if(e.opts.coerceTypes)var T=e.util.coerceToTypes(e.opts.coerceTypes,A);var _=e.RULES.types[A];if(T||F||_===!0||_&&!te(_)){var f=e.schemaPath+".type",w=e.errSchemaPath+"/type",f=e.schemaPath+".type",w=e.errSchemaPath+"/type",I=F?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[I](A,p,e.opts.strictNumbers,!0)+") { ",T){var C="dataType"+d,z="coerced"+d;n+=" var "+C+" = typeof "+p+"; var "+z+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+C+" == 'object' && Array.isArray("+p+") && "+p+".length == 1) { "+p+" = "+p+"[0]; "+C+" = typeof "+p+"; if ("+e.util.checkDataType(e.schema.type,p,e.opts.strictNumbers)+") "+z+" = "+p+"; } "),n+=" if ("+z+" !== undefined) ; ";var U=T;if(U)for(var K,P=-1,D=U.length-1;P<D;)K=U[P+=1],K=="string"?n+=" else if ("+C+" == 'number' || "+C+" == 'boolean') "+z+" = '' + "+p+"; else if ("+p+" === null) "+z+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+C+" == 'boolean' || "+p+" === null || ("+C+" == 'string' && "+p+" && "+p+" == +"+p+" ",K=="integer"&&(n+=" && !("+p+" % 1)"),n+=")) "+z+" = +"+p+"; "):K=="boolean"?n+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+z+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+z+" = true; ":K=="null"?n+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+z+" = null; ":e.opts.coerceTypes=="array"&&K=="array"&&(n+=" else if ("+C+" == 'string' || "+C+" == 'number' || "+C+" == 'boolean' || "+p+" == null) "+z+" = ["+p+"]; ");n+=" else { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(R||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",F?n+=""+A.join(","):n+=""+A,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",F?n+=""+A.join(","):n+=""+A,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=v.pop(),!e.compositeRule&&E?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } if ("+z+" !== undefined) { ";var L=h?"data"+(h-1||""):"parentData",J=h?e.dataPathArr[h]:"parentDataProperty";n+=" "+p+" = "+z+"; ",h||(n+="if ("+L+" !== undefined)"),n+=" "+L+"["+J+"] = "+z+"; } "}else{var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(R||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",F?n+=""+A.join(","):n+=""+A,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",F?n+=""+A.join(","):n+=""+A,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=v.pop(),!e.compositeRule&&E?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}n+=" } "}}if(e.schema.$ref&&!o)n+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",E&&(n+=" } if (errors === ",g?n+="0":n+="errs_"+d,n+=") { ",j+="}");else{var Z=e.RULES;if(Z){for(var _,B=-1,oe=Z.length-1;B<oe;)if(_=Z[B+=1],te(_)){if(_.type&&(n+=" if ("+e.util.checkDataType(_.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(_.type=="object"&&e.schema.properties){var m=e.schema.properties,ve=Object.keys(m),ge=ve;if(ge)for(var re,ye=-1,ke=ge.length-1;ye<ke;){re=ge[ye+=1];var me=m[re];if(me.default!==void 0){var ee=p+e.util.getProperty(re);if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+ee;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else n+=" if ("+ee+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+ee+" === null || "+ee+" === '' "),n+=" ) "+ee+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(me.default)+" ":n+=" "+JSON.stringify(me.default)+" ",n+="; "}}}else if(_.type=="array"&&Array.isArray(e.schema.items)){var _e=e.schema.items;if(_e){for(var me,P=-1,Pe=_e.length-1;P<Pe;)if(me=_e[P+=1],me.default!==void 0){var ee=p+"["+P+"]";if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+ee;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else n+=" if ("+ee+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+ee+" === null || "+ee+" === '' "),n+=" ) "+ee+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(me.default)+" ":n+=" "+JSON.stringify(me.default)+" ",n+="; "}}}}var De=_.rules;if(De){for(var X,ce=-1,Y=De.length-1;ce<Y;)if(X=De[ce+=1],Me(X)){var ze=X.code(e,X.keyword,_.type);ze&&(n+=" "+ze+" ",E&&(N+="}"))}}if(E&&(n+=" "+N+" ",N=""),_.type&&(n+=" } ",A&&A===_.type&&!T)){n+=" else { ";var f=e.schemaPath+".type",w=e.errSchemaPath+"/type",v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(R||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",F?n+=""+A.join(","):n+=""+A,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",F?n+=""+A.join(","):n+=""+A,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=v.pop(),!e.compositeRule&&E?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } "}E&&(n+=" if (errors === ",g?n+="0":n+="errs_"+d,n+=") { ",j+="}")}}}E&&(n+=" "+j+" "),g?(a?(n+=" if (errors === 0) return data; ",n+=" else throw new ValidationError(vErrors); "):(n+=" validate.errors = vErrors; ",n+=" return errors === 0; "),n+=" }; return validate;"):n+=" var "+S+" = errors === errs_"+d+";";function te(Ne){for(var rt=Ne.rules,pt=0;pt<rt.length;pt++)if(Me(rt[pt]))return!0}function Me(Ne){return e.schema[Ne.keyword]!==void 0||Ne.implements&&Ue(Ne)}function Ue(Ne){for(var rt=Ne.implements,pt=0;pt<rt.length;pt++)if(e.schema[rt[pt]]!==void 0)return!0}return n},Rc=og,sd=ki,KE=ig,lM=HE,L0=BE,cM=sd.ucs2length,uM=eg,dM=KE.Validation,fM=lm;function lm(t,e,r,s){var n=this,a=this._opts,o=[void 0],i={},c=[],u={},d=[],h={},m=[];e=e||{schema:t,refVal:o,refs:i};var f=hM.call(this,t,e,s),w=this._compilations[f.index];if(f.compiling)return w.callValidate=b;var p=this._formats,v=this.RULES;try{var y=S(t,e,r,s);w.validate=y;var g=w.callValidate;return g&&(g.schema=y.schema,g.errors=null,g.refs=y.refs,g.refVal=y.refVal,g.root=y.root,g.$async=y.$async,a.sourceCode&&(g.source=y.source)),y}finally{pM.call(this,t,e,s)}function b(){var I=w.validate,C=I.apply(this,arguments);return b.errors=I.errors,C}function S(I,C,z,U){var K=!C||C&&C.schema==I;if(C.schema!=e.schema)return lm.call(n,I,C,z,U);var P=I.$async===!0,D=L0({isTop:!0,schema:I,isRoot:K,baseId:U,root:C,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:KE.MissingRef,RULES:v,validate:L0,util:sd,resolve:Rc,resolveRef:E,usePattern:F,useDefault:T,useCustomRule:_,opts:a,formats:p,logger:n.logger,self:n});D=Tc(o,gM)+Tc(c,mM)+Tc(d,vM)+Tc(m,yM)+D,a.processCode&&(D=a.processCode(D,I));var L;try{var J=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",D);L=J(n,v,p,e,o,d,m,uM,cM,dM),o[0]=L}catch(Z){throw n.logger.error("Error compiling schema, function code:",D),Z}return L.schema=I,L.errors=null,L.refs=i,L.refVal=o,L.root=K?L:C,P&&(L.$async=!0),a.sourceCode===!0&&(L.source={code:D,patterns:c,defaults:d}),L}function E(I,C,z){C=Rc.url(I,C);var U=i[C],K,P;if(U!==void 0)return K=o[U],P="refVal["+U+"]",A(K,P);if(!z&&e.refs){var D=e.refs[C];if(D!==void 0)return K=e.refVal[D],P=N(C,K),A(K,P)}P=N(C);var L=Rc.call(n,S,e,C);if(L===void 0){var J=r&&r[C];J&&(L=Rc.inlineRef(J,a.inlineRefs)?J:lm.call(n,J,e,r,I))}if(L===void 0)j(C);else return R(C,L),A(L,P)}function N(I,C){var z=o.length;return o[z]=C,i[I]=z,"refVal"+z}function j(I){delete i[I]}function R(I,C){var z=i[I];o[z]=C}function A(I,C){return typeof I=="object"||typeof I=="boolean"?{code:C,schema:I,inline:!0}:{code:C,$async:I&&!!I.$async}}function F(I){var C=u[I];return C===void 0&&(C=u[I]=c.length,c[C]=I),"pattern"+C}function T(I){switch(typeof I){case"boolean":case"number":return""+I;case"string":return sd.toQuotedString(I);case"object":if(I===null)return"null";var C=lM(I),z=h[C];return z===void 0&&(z=h[C]=d.length,d[z]=I),"default"+z}}function _(I,C,z,U){if(n._opts.validateSchema!==!1){var K=I.definition.dependencies;if(K&&!K.every(function(ge){return Object.prototype.hasOwnProperty.call(z,ge)}))throw new Error("parent schema must have all required keywords: "+K.join(","));var P=I.definition.validateSchema;if(P){var D=P(C);if(!D){var L="keyword schema is invalid: "+n.errorsText(P.errors);if(n._opts.validateSchema=="log")n.logger.error(L);else throw new Error(L)}}}var J=I.definition.compile,Z=I.definition.inline,B=I.definition.macro,oe;if(J)oe=J.call(n,C,z,U);else if(B)oe=B.call(n,C,z,U),a.validateSchema!==!1&&n.validateSchema(oe,!0);else if(Z)oe=Z.call(n,U,I.keyword,C,z);else if(oe=I.definition.validate,!oe)return;if(oe===void 0)throw new Error('custom keyword "'+I.keyword+'"failed to compile');var ve=m.length;return m[ve]=oe,{code:"customRule"+ve,validate:oe}}}function hM(t,e,r){var s=WE.call(this,t,e,r);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:t,root:e,baseId:r},{index:s,compiling:!1})}function pM(t,e,r){var s=WE.call(this,t,e,r);s>=0&&this._compilations.splice(s,1)}function WE(t,e,r){for(var s=0;s<this._compilations.length;s++){var n=this._compilations[s];if(n.schema==t&&n.root==e&&n.baseId==r)return s}return-1}function mM(t,e){return"var pattern"+t+" = new RegExp("+sd.toQuotedString(e[t])+");"}function vM(t){return"var default"+t+" = defaults["+t+"];"}function gM(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function yM(t){return"var customRule"+t+" = customRules["+t+"];"}function Tc(t,e){if(!t.length)return"";for(var r="",s=0;s<t.length;s++)r+=e(s,t);return r}var QE={exports:{}},Zd=QE.exports=function(){this._cache={}};Zd.prototype.put=function(e,r){this._cache[e]=r};Zd.prototype.get=function(e){return this._cache[e]};Zd.prototype.del=function(e){delete this._cache[e]};Zd.prototype.clear=function(){this._cache={}};var xM=QE.exports,wM=ki,bM=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,SM=[0,31,28,31,30,31,30,31,31,30,31,30,31],_M=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,GE=/^(?=.{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,EM=/^(?:[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,CM=/^(?:[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,ZE=/^(?:(?:[^\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,YE=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,JE=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,XE=/^(?:\/(?:[^~/]|~0|~1)*)*$/,eC=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,tC=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,PM=Yd;function Yd(t){return t=t=="full"?"full":"fast",wM.copy(Yd[t])}Yd.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\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,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":ZE,url:YE,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,hostname:GE,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:sC,uuid:JE,"json-pointer":XE,"json-pointer-uri-fragment":eC,"relative-json-pointer":tC};Yd.full={date:rC,time:nC,"date-time":jM,uri:TM,"uri-reference":CM,"uri-template":ZE,url:YE,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:GE,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:sC,uuid:JE,"json-pointer":XE,"json-pointer-uri-fragment":eC,"relative-json-pointer":tC};function kM(t){return t%4===0&&(t%100!==0||t%400===0)}function rC(t){var e=t.match(bM);if(!e)return!1;var r=+e[1],s=+e[2],n=+e[3];return s>=1&&s<=12&&n>=1&&n<=(s==2&&kM(r)?29:SM[s])}function nC(t,e){var r=t.match(_M);if(!r)return!1;var s=r[1],n=r[2],a=r[3],o=r[5];return(s<=23&&n<=59&&a<=59||s==23&&n==59&&a==60)&&(!e||o)}var NM=/t|\s/i;function jM(t){var e=t.split(NM);return e.length==2&&rC(e[0])&&nC(e[1],!0)}var RM=/\/|:/;function TM(t){return RM.test(t)&&EM.test(t)}var AM=/[^\\]\\Z/;function sC(t){if(AM.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var OM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(o||""),h="valid"+a,m,f;if(i=="#"||i=="#/")e.isRoot?(m=e.async,f="validate"):(m=e.root.schema.$async===!0,f="root.refVal[0]");else{var w=e.resolveRef(e.baseId,i,e.isRoot);if(w===void 0){var p=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(p);var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var y=n;n=v.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),u&&(n+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,p)}else if(w.inline){var g=e.util.copy(e);g.level++;var b="valid"+g.level;g.schema=w.schema,g.schemaPath="",g.errSchemaPath=i;var S=e.validate(g).replace(/validate\.schema/g,w.code);n+=" "+S+" ",u&&(n+=" if ("+b+") { ")}else m=w.$async===!0||e.async&&w.$async!==!1,f=w.code}if(f){var v=v||[];v.push(n),n="",e.opts.passContext?n+=" "+f+".call(this, ":n+=" "+f+"( ",n+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var E=o?"data"+(o-1||""):"parentData",N=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+E+" , "+N+", rootData) ";var j=n;if(n=v.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+h+"; "),n+=" try { await "+j+"; ",u&&(n+=" "+h+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(n+=" "+h+" = false; "),n+=" } ",u&&(n+=" if ("+h+") { ")}else n+=" if (!"+j+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n},IM=function(e,r,s){var n=" ",a=e.schema[r],o=e.schemaPath+e.util.getProperty(r),i=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u=e.util.copy(e),d="";u.level++;var h="valid"+u.level,m=u.baseId,f=!0,w=a;if(w)for(var p,v=-1,y=w.length-1;v<y;)p=w[v+=1],(e.opts.strictKeywords?typeof p=="object"&&Object.keys(p).length>0||p===!1:e.util.schemaHasRules(p,e.RULES.all))&&(f=!1,u.schema=p,u.schemaPath=o+"["+v+"]",u.errSchemaPath=i+"/"+v,n+=" "+e.validate(u)+" ",u.baseId=m,c&&(n+=" if ("+h+") { ",d+="}"));return c&&(f?n+=" if (true) { ":n+=" "+d.slice(0,-1)+" "),n},DM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e),p="";w.level++;var v="valid"+w.level,y=i.every(function(R){return e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:e.util.schemaHasRules(R,e.RULES.all)});if(y){var g=w.baseId;n+=" var "+f+" = errors; var "+m+" = false; ";var b=e.compositeRule;e.compositeRule=w.compositeRule=!0;var S=i;if(S)for(var E,N=-1,j=S.length-1;N<j;)E=S[N+=1],w.schema=E,w.schemaPath=c+"["+N+"]",w.errSchemaPath=u+"/"+N,n+=" "+e.validate(w)+" ",w.baseId=g,n+=" "+m+" = "+m+" || "+v+"; if (!"+m+") { ",p+="}";e.compositeRule=w.compositeRule=b,n+=" "+p+" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else d&&(n+=" if (true) { ");return n},MM=function(e,r,s){var n=" ",a=e.schema[r],o=e.errSchemaPath+"/"+r;e.opts.allErrors;var i=e.util.toQuotedString(a);return e.opts.$comment===!0?n+=" console.log("+i+");":typeof e.opts.$comment=="function"&&(n+=" self._opts.$comment("+i+", "+e.util.toQuotedString(o)+", validate.root.schema);"),n},$M=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f=e.opts.$data&&i&&i.$data;f&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; "),f||(n+=" var schema"+a+" = validate.schema"+c+";"),n+="var "+m+" = equal("+h+", schema"+a+"); if (!"+m+") { ";var w=w||[];w.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+a+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var p=n;return n=w.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n},FM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e),p="";w.level++;var v="valid"+w.level,y="i"+a,g=w.dataLevel=e.dataLevel+1,b="data"+g,S=e.baseId,E=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(n+="var "+f+" = errors;var "+m+";",E){var N=e.compositeRule;e.compositeRule=w.compositeRule=!0,w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" var "+v+" = false; for (var "+y+" = 0; "+y+" < "+h+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var j=h+"["+y+"]";w.dataPathArr[g]=y;var R=e.validate(w);w.baseId=S,e.util.varOccurences(R,b)<2?n+=" "+e.util.varReplace(R,b,j)+" ":n+=" var "+b+" = "+j+"; "+R+" ",n+=" if ("+v+") break; } ",e.compositeRule=w.compositeRule=N,n+=" "+p+" if (!"+v+") {"}else n+=" if ("+h+".length == 0) {";var A=A||[];A.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var F=n;return n=A.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+F+"]); ":n+=" validate.errors = ["+F+"]; return false; ":n+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",E&&(n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n},LM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="errs__"+a,f=e.util.copy(e),w="";f.level++;var p="valid"+f.level,v={},y={},g=e.opts.ownProperties;for(N in i)if(N!="__proto__"){var b=i[N],S=Array.isArray(b)?y:v;S[N]=b}n+="var "+m+" = errors;";var E=e.errorPath;n+="var missing"+a+";";for(var N in y)if(S=y[N],S.length){if(n+=" if ( "+h+e.util.getProperty(N)+" !== undefined ",g&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(N)+"') "),d){n+=" && ( ";var j=S;if(j)for(var R,A=-1,F=j.length-1;A<F;){R=j[A+=1],A&&(n+=" || ");var T=e.util.getProperty(R),_=h+T;n+=" ( ( "+_+" === undefined ",g&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(R)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?R:T)+") ) "}n+=")) { ";var I="missing"+a,C="' + "+I+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,I,!0):E+" + "+I);var z=z||[];z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(N)+"', missingProperty: '"+C+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",S.length==1?n+="property "+e.util.escapeQuotes(S[0]):n+="properties "+e.util.escapeQuotes(S.join(", ")),n+=" when property "+e.util.escapeQuotes(N)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var U=n;n=z.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+U+"]); ":n+=" validate.errors = ["+U+"]; return false; ":n+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=S;if(K)for(var R,P=-1,D=K.length-1;P<D;){R=K[P+=1];var T=e.util.getProperty(R),C=e.util.escapeQuotes(R),_=h+T;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,R,e.opts.jsonPointers)),n+=" if ( "+_+" === undefined ",g&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(R)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(N)+"', missingProperty: '"+C+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",S.length==1?n+="property "+e.util.escapeQuotes(S[0]):n+="properties "+e.util.escapeQuotes(S.join(", ")),n+=" when property "+e.util.escapeQuotes(N)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",d&&(w+="}",n+=" else { ")}e.errorPath=E;var L=f.baseId;for(var N in v){var b=v[N];(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(n+=" "+p+" = true; if ( "+h+e.util.getProperty(N)+" !== undefined ",g&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(N)+"') "),n+=") { ",f.schema=b,f.schemaPath=c+e.util.getProperty(N),f.errSchemaPath=u+"/"+e.util.escapeFragment(N),n+=" "+e.validate(f)+" ",f.baseId=L,n+=" } ",d&&(n+=" if ("+p+") { ",w+="}"))}return d&&(n+=" "+w+" if ("+m+" == errors) {"),n},UM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f=e.opts.$data&&i&&i.$data;f&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var w="i"+a,p="schema"+a;f||(n+=" var "+p+" = validate.schema"+c+";"),n+="var "+m+";",f&&(n+=" if (schema"+a+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+a+")) "+m+" = false; else {"),n+=""+m+" = false;for (var "+w+"=0; "+w+"<"+p+".length; "+w+"++) if (equal("+h+", "+p+"["+w+"])) { "+m+" = true; break; }",f&&(n+=" } "),n+=" if (!"+m+") { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+a+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=v.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n},zM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||"");if(e.opts.format===!1)return d&&(n+=" if (true) { "),n;var m=e.opts.$data&&i&&i.$data,f;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i;var w=e.opts.unknownFormats,p=Array.isArray(w);if(m){var v="format"+a,y="isObject"+a,g="formatType"+a;n+=" var "+v+" = formats["+f+"]; var "+y+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+g+" = "+y+" && "+v+".type || 'string'; if ("+y+") { ",e.async&&(n+=" var async"+a+" = "+v+".async; "),n+=" "+v+" = "+v+".validate; } if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" (",w!="ignore"&&(n+=" ("+f+" && !"+v+" ",p&&(n+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),n+=") || "),n+=" ("+v+" && "+g+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?n+=" (async"+a+" ? await "+v+"("+h+") : "+v+"("+h+")) ":n+=" "+v+"("+h+") ",n+=" : "+v+".test("+h+"))))) {"}else{var v=e.formats[i];if(!v){if(w=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(n+=" if (true) { "),n;if(p&&w.indexOf(i)>=0)return d&&(n+=" if (true) { "),n;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var y=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,g=y&&v.type||"string";if(y){var b=v.async===!0;v=v.validate}if(g!=s)return d&&(n+=" if (true) { "),n;if(b){if(!e.async)throw new Error("async format in sync schema");var S="formats"+e.util.getProperty(i)+".validate";n+=" if (!(await "+S+"("+h+"))) { "}else{n+=" if (! ";var S="formats"+e.util.getProperty(i);y&&(S+=".validate"),typeof v=="function"?n+=" "+S+"("+h+") ":n+=" "+S+".test("+h+") ",n+=") { "}}var E=E||[];E.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",m?n+=""+f:n+=""+e.util.toQuotedString(i),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+f+" + '":n+=""+e.util.escapeQuotes(i),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+e.util.toQuotedString(i),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var N=n;return n=E.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+N+"]); ":n+=" validate.errors = ["+N+"]; return false; ":n+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n},VM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e);w.level++;var p="valid"+w.level,v=e.schema.then,y=e.schema.else,g=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),b=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),S=w.baseId;if(g||b){var E;w.createErrors=!1,w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" var "+f+" = errors; var "+m+" = true; ";var N=e.compositeRule;e.compositeRule=w.compositeRule=!0,n+=" "+e.validate(w)+" ",w.baseId=S,w.createErrors=!0,n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.compositeRule=w.compositeRule=N,g?(n+=" if ("+p+") { ",w.schema=e.schema.then,w.schemaPath=e.schemaPath+".then",w.errSchemaPath=e.errSchemaPath+"/then",n+=" "+e.validate(w)+" ",w.baseId=S,n+=" "+m+" = "+p+"; ",g&&b?(E="ifClause"+a,n+=" var "+E+" = 'then'; "):E="'then'",n+=" } ",b&&(n+=" else { ")):n+=" if (!"+p+") { ",b&&(w.schema=e.schema.else,w.schemaPath=e.schemaPath+".else",w.errSchemaPath=e.errSchemaPath+"/else",n+=" "+e.validate(w)+" ",w.baseId=S,n+=" "+m+" = "+p+"; ",g&&b?(E="ifClause"+a,n+=" var "+E+" = 'else'; "):E="'else'",n+=" } "),n+=" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+E+" } ",e.opts.messages!==!1&&(n+=` , message: 'should match "' + `+E+` + '" schema' `),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n},qM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e),p="";w.level++;var v="valid"+w.level,y="i"+a,g=w.dataLevel=e.dataLevel+1,b="data"+g,S=e.baseId;if(n+="var "+f+" = errors;var "+m+";",Array.isArray(i)){var E=e.schema.additionalItems;if(E===!1){n+=" "+m+" = "+h+".length <= "+i.length+"; ";var N=u;u=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var j=j||[];j.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var R=n;n=j.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+R+"]); ":n+=" validate.errors = ["+R+"]; return false; ":n+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u=N,d&&(p+="}",n+=" else { ")}var A=i;if(A){for(var F,T=-1,_=A.length-1;T<_;)if(F=A[T+=1],e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all)){n+=" "+v+" = true; if ("+h+".length > "+T+") { ";var I=h+"["+T+"]";w.schema=F,w.schemaPath=c+"["+T+"]",w.errSchemaPath=u+"/"+T,w.errorPath=e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers,!0),w.dataPathArr[g]=T;var C=e.validate(w);w.baseId=S,e.util.varOccurences(C,b)<2?n+=" "+e.util.varReplace(C,b,I)+" ":n+=" var "+b+" = "+I+"; "+C+" ",n+=" } ",d&&(n+=" if ("+v+") { ",p+="}")}}if(typeof E=="object"&&(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))){w.schema=E,w.schemaPath=e.schemaPath+".additionalItems",w.errSchemaPath=e.errSchemaPath+"/additionalItems",n+=" "+v+" = true; if ("+h+".length > "+i.length+") { for (var "+y+" = "+i.length+"; "+y+" < "+h+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var I=h+"["+y+"]";w.dataPathArr[g]=y;var C=e.validate(w);w.baseId=S,e.util.varOccurences(C,b)<2?n+=" "+e.util.varReplace(C,b,I)+" ":n+=" var "+b+" = "+I+"; "+C+" ",d&&(n+=" if (!"+v+") break; "),n+=" } } ",d&&(n+=" if ("+v+") { ",p+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" for (var "+y+" = 0; "+y+" < "+h+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var I=h+"["+y+"]";w.dataPathArr[g]=y;var C=e.validate(w);w.baseId=S,e.util.varOccurences(C,b)<2?n+=" "+e.util.varReplace(C,b,I)+" ":n+=" var "+b+" = "+I+"; "+C+" ",d&&(n+=" if (!"+v+") break; "),n+=" }"}return d&&(n+=" "+p+" if ("+f+" == errors) {"),n},U0=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,S,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i;var w=r=="maximum",p=w?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[p],y=e.opts.$data&&v&&v.$data,g=w?"<":">",b=w?">":"<",S=void 0;if(!(m||typeof i=="number"||i===void 0))throw new Error(r+" must be number");if(!(y||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(p+" must be number or boolean");if(y){var E=e.util.getData(v.$data,o,e.dataPathArr),N="exclusive"+a,j="exclType"+a,R="exclIsNumber"+a,A="op"+a,F="' + "+A+" + '";n+=" var schemaExcl"+a+" = "+E+"; ",E="schemaExcl"+a,n+=" var "+N+"; var "+j+" = typeof "+E+"; if ("+j+" != 'boolean' && "+j+" != 'undefined' && "+j+" != 'number') { ";var S=p,T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(S||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var _=n;n=T.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+_+"]); ":n+=" validate.errors = ["+_+"]; return false; ":n+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+j+" == 'number' ? ( ("+N+" = "+f+" === undefined || "+E+" "+g+"= "+f+") ? "+h+" "+b+"= "+E+" : "+h+" "+b+" "+f+" ) : ( ("+N+" = "+E+" === true) ? "+h+" "+b+"= "+f+" : "+h+" "+b+" "+f+" ) || "+h+" !== "+h+") { var op"+a+" = "+N+" ? '"+g+"' : '"+g+"='; ",i===void 0&&(S=p,u=e.errSchemaPath+"/"+p,f=E,m=y)}else{var R=typeof v=="number",F=g;if(R&&m){var A="'"+F+"'";n+=" if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" ( "+f+" === undefined || "+v+" "+g+"= "+f+" ? "+h+" "+b+"= "+v+" : "+h+" "+b+" "+f+" ) || "+h+" !== "+h+") { "}else{R&&i===void 0?(N=!0,S=p,u=e.errSchemaPath+"/"+p,f=v,b+="="):(R&&(f=Math[w?"min":"max"](v,i)),v===(R?f:!0)?(N=!0,S=p,u=e.errSchemaPath+"/"+p,b+="="):(N=!1,F+="="));var A="'"+F+"'";n+=" if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+h+" "+b+" "+f+" || "+h+" !== "+h+") { "}}S=S||r;var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(S||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+A+", limit: "+f+", exclusive: "+N+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+F+" ",m?n+="' + "+f:n+=""+f+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var _=n;return n=T.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+_+"]); ":n+=" validate.errors = ["+_+"]; return false; ":n+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n},z0=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,p,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+h+".length "+w+" "+f+") { ";var p=r,v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",r=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+f+" + '":n+=""+i,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=v.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},V0=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,p,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),e.opts.unicode===!1?n+=" "+h+".length ":n+=" ucs2length("+h+") ",n+=" "+w+" "+f+") { ";var p=r,v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",r=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+f+" + '":n+=""+i,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=v.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},q0=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,p,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" Object.keys("+h+").length "+w+" "+f+") { ";var p=r,v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",r=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+f+" + '":n+=""+i,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=v.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},HM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i,!(m||typeof i=="number"))throw new Error(r+" must be number");n+="var division"+a+";if (",m&&(n+=" "+f+" !== undefined && ( typeof "+f+" != 'number' || "),n+=" (division"+a+" = "+h+" / "+f+", ",e.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+a+") - division"+a+") > 1e-"+e.opts.multipleOfPrecision+" ":n+=" division"+a+" !== parseInt(division"+a+") ",n+=" ) ",m&&(n+=" ) "),n+=" ) { ";var w=w||[];w.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+f+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+f:n+=""+f+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var p=n;return n=w.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},BM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="errs__"+a,f=e.util.copy(e);f.level++;var w="valid"+f.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=c,f.errSchemaPath=u,n+=" var "+m+" = errors; ";var p=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.createErrors=!1;var v;f.opts.allErrors&&(v=f.opts.allErrors,f.opts.allErrors=!1),n+=" "+e.validate(f)+" ",f.createErrors=!0,v&&(f.opts.allErrors=v),e.compositeRule=f.compositeRule=p,n+=" if ("+w+") { ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var g=n;n=y.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(n+=" if (false) { ");return n},KM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e),p="";w.level++;var v="valid"+w.level,y=w.baseId,g="prevValid"+a,b="passingSchemas"+a;n+="var "+f+" = errors , "+g+" = false , "+m+" = false , "+b+" = null; ";var S=e.compositeRule;e.compositeRule=w.compositeRule=!0;var E=i;if(E)for(var N,j=-1,R=E.length-1;j<R;)N=E[j+=1],(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))?(w.schema=N,w.schemaPath=c+"["+j+"]",w.errSchemaPath=u+"/"+j,n+=" "+e.validate(w)+" ",w.baseId=y):n+=" var "+v+" = true; ",j&&(n+=" if ("+v+" && "+g+") { "+m+" = false; "+b+" = ["+b+", "+j+"]; } else { ",p+="}"),n+=" if ("+v+") { "+m+" = "+g+" = true; "+b+" = "+j+"; }";return e.compositeRule=w.compositeRule=S,n+=""+p+"if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+b+" } ",e.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n},WM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i;var w=m?"(new RegExp("+f+"))":e.usePattern(i);n+="if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" !"+w+".test("+h+") ) { ";var p=p||[];p.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",m?n+=""+f:n+=""+e.util.toQuotedString(i),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+f+" + '":n+=""+e.util.escapeQuotes(i),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+e.util.toQuotedString(i),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var v=n;return n=p.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},QM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="errs__"+a,f=e.util.copy(e),w="";f.level++;var p="valid"+f.level,v="key"+a,y="idx"+a,g=f.dataLevel=e.dataLevel+1,b="data"+g,S="dataProperties"+a,E=Object.keys(i||{}).filter(P),N=e.schema.patternProperties||{},j=Object.keys(N).filter(P),R=e.schema.additionalProperties,A=E.length||j.length,F=R===!1,T=typeof R=="object"&&Object.keys(R).length,_=e.opts.removeAdditional,I=F||T||_,C=e.opts.ownProperties,z=e.baseId,U=e.schema.required;if(U&&!(e.opts.$data&&U.$data)&&U.length<e.opts.loopRequired)var K=e.util.toHash(U);function P(fs){return fs!=="__proto__"}if(n+="var "+m+" = errors;var "+p+" = true;",C&&(n+=" var "+S+" = undefined;"),I){if(C?n+=" "+S+" = "+S+" || Object.keys("+h+"); for (var "+y+"=0; "+y+"<"+S+".length; "+y+"++) { var "+v+" = "+S+"["+y+"]; ":n+=" for (var "+v+" in "+h+") { ",A){if(n+=" var isAdditional"+a+" = !(false ",E.length)if(E.length>8)n+=" || validate.schema"+c+".hasOwnProperty("+v+") ";else{var D=E;if(D)for(var L,J=-1,Z=D.length-1;J<Z;)L=D[J+=1],n+=" || "+v+" == "+e.util.toQuotedString(L)+" "}if(j.length){var B=j;if(B)for(var oe,ve=-1,ge=B.length-1;ve<ge;)oe=B[ve+=1],n+=" || "+e.usePattern(oe)+".test("+v+") "}n+=" ); if (isAdditional"+a+") { "}if(_=="all")n+=" delete "+h+"["+v+"]; ";else{var re=e.errorPath,ye="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),F)if(_)n+=" delete "+h+"["+v+"]; ";else{n+=" "+p+" = false; ";var ke=u;u=e.errSchemaPath+"/additionalProperties";var me=me||[];me.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+ye+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is an invalid additional property":n+="should NOT have additional properties",n+="' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var ee=n;n=me.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+ee+"]); ":n+=" validate.errors = ["+ee+"]; return false; ":n+=" var err = "+ee+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ke,d&&(n+=" break; ")}else if(T)if(_=="failing"){n+=" var "+m+" = errors; ";var _e=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=R,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Pe=h+"["+v+"]";f.dataPathArr[g]=v;var De=e.validate(f);f.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Pe)+" ":n+=" var "+b+" = "+Pe+"; "+De+" ",n+=" if (!"+p+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+h+"["+v+"]; } ",e.compositeRule=f.compositeRule=_e}else{f.schema=R,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Pe=h+"["+v+"]";f.dataPathArr[g]=v;var De=e.validate(f);f.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Pe)+" ":n+=" var "+b+" = "+Pe+"; "+De+" ",d&&(n+=" if (!"+p+") break; ")}e.errorPath=re}A&&(n+=" } "),n+=" } ",d&&(n+=" if ("+p+") { ",w+="}")}var X=e.opts.useDefaults&&!e.compositeRule;if(E.length){var ce=E;if(ce)for(var L,Y=-1,ze=ce.length-1;Y<ze;){L=ce[Y+=1];var te=i[L];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){var Me=e.util.getProperty(L),Pe=h+Me,Ue=X&&te.default!==void 0;f.schema=te,f.schemaPath=c+Me,f.errSchemaPath=u+"/"+e.util.escapeFragment(L),f.errorPath=e.util.getPath(e.errorPath,L,e.opts.jsonPointers),f.dataPathArr[g]=e.util.toQuotedString(L);var De=e.validate(f);if(f.baseId=z,e.util.varOccurences(De,b)<2){De=e.util.varReplace(De,b,Pe);var Ne=Pe}else{var Ne=b;n+=" var "+b+" = "+Pe+"; "}if(Ue)n+=" "+De+" ";else{if(K&&K[L]){n+=" if ( "+Ne+" === undefined ",C&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(L)+"') "),n+=") { "+p+" = false; ";var re=e.errorPath,ke=u,rt=e.util.escapeQuotes(L);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(re,L,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var me=me||[];me.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+rt+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+rt+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var ee=n;n=me.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+ee+"]); ":n+=" validate.errors = ["+ee+"]; return false; ":n+=" var err = "+ee+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ke,e.errorPath=re,n+=" } else { "}else d?(n+=" if ( "+Ne+" === undefined ",C&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(L)+"') "),n+=") { "+p+" = true; } else { "):(n+=" if ("+Ne+" !== undefined ",C&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(L)+"') "),n+=" ) { ");n+=" "+De+" } "}}d&&(n+=" if ("+p+") { ",w+="}")}}if(j.length){var pt=j;if(pt)for(var oe,Hr=-1,zt=pt.length-1;Hr<zt;){oe=pt[Hr+=1];var te=N[oe];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){f.schema=te,f.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(oe),f.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(oe),C?n+=" "+S+" = "+S+" || Object.keys("+h+"); for (var "+y+"=0; "+y+"<"+S+".length; "+y+"++) { var "+v+" = "+S+"["+y+"]; ":n+=" for (var "+v+" in "+h+") { ",n+=" if ("+e.usePattern(oe)+".test("+v+")) { ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Pe=h+"["+v+"]";f.dataPathArr[g]=v;var De=e.validate(f);f.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Pe)+" ":n+=" var "+b+" = "+Pe+"; "+De+" ",d&&(n+=" if (!"+p+") break; "),n+=" } ",d&&(n+=" else "+p+" = true; "),n+=" } ",d&&(n+=" if ("+p+") { ",w+="}")}}}return d&&(n+=" "+w+" if ("+m+" == errors) {"),n},GM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="errs__"+a,f=e.util.copy(e),w="";f.level++;var p="valid"+f.level;if(n+="var "+m+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=c,f.errSchemaPath=u;var v="key"+a,y="idx"+a,g="i"+a,b="' + "+v+" + '",S=f.dataLevel=e.dataLevel+1,E="data"+S,N="dataProperties"+a,j=e.opts.ownProperties,R=e.baseId;j&&(n+=" var "+N+" = undefined; "),j?n+=" "+N+" = "+N+" || Object.keys("+h+"); for (var "+y+"=0; "+y+"<"+N+".length; "+y+"++) { var "+v+" = "+N+"["+y+"]; ":n+=" for (var "+v+" in "+h+") { ",n+=" var startErrs"+a+" = errors; ";var A=v,F=e.compositeRule;e.compositeRule=f.compositeRule=!0;var T=e.validate(f);f.baseId=R,e.util.varOccurences(T,E)<2?n+=" "+e.util.varReplace(T,E,A)+" ":n+=" var "+E+" = "+A+"; "+T+" ",e.compositeRule=f.compositeRule=F,n+=" if (!"+p+") { for (var "+g+"=startErrs"+a+"; "+g+"<errors; "+g+"++) { vErrors["+g+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(n+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+b+"' } ",e.opts.messages!==!1&&(n+=" , message: 'property name \\'"+b+"\\' is invalid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),d&&(n+=" break; "),n+=" } }"}return d&&(n+=" "+w+" if ("+m+" == errors) {"),n},ZM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f=e.opts.$data&&i&&i.$data;f&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var w="schema"+a;if(!f)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],v=i;if(v)for(var y,g=-1,b=v.length-1;g<b;){y=v[g+=1];var S=e.schema.properties[y];S&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))||(p[p.length]=y)}}else var p=i;if(f||p.length){var E=e.errorPath,N=f||p.length>=e.opts.loopRequired,j=e.opts.ownProperties;if(d)if(n+=" var missing"+a+"; ",N){f||(n+=" var "+w+" = validate.schema"+c+"; ");var R="i"+a,A="schema"+a+"["+R+"]",F="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,A,e.opts.jsonPointers)),n+=" var "+m+" = true; ",f&&(n+=" if (schema"+a+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+a+")) "+m+" = false; else {"),n+=" for (var "+R+" = 0; "+R+" < "+w+".length; "+R+"++) { "+m+" = "+h+"["+w+"["+R+"]] !== undefined ",j&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", "+w+"["+R+"]) "),n+="; if (!"+m+") break; } ",f&&(n+=" } "),n+=" if (!"+m+") { ";var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var _=n;n=T.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+_+"]); ":n+=" validate.errors = ["+_+"]; return false; ":n+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var I=p;if(I)for(var C,R=-1,z=I.length-1;R<z;){C=I[R+=1],R&&(n+=" || ");var U=e.util.getProperty(C),K=h+U;n+=" ( ( "+K+" === undefined ",j&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(C)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?C:U)+") ) "}n+=") { ";var A="missing"+a,F="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,A,!0):E+" + "+A);var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var _=n;n=T.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+_+"]); ":n+=" validate.errors = ["+_+"]; return false; ":n+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(N){f||(n+=" var "+w+" = validate.schema"+c+"; ");var R="i"+a,A="schema"+a+"["+R+"]",F="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,A,e.opts.jsonPointers)),f&&(n+=" if ("+w+" && !Array.isArray("+w+")) { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+w+" !== undefined) { "),n+=" for (var "+R+" = 0; "+R+" < "+w+".length; "+R+"++) { if ("+h+"["+w+"["+R+"]] === undefined ",j&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", "+w+"["+R+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",f&&(n+=" } ")}else{var P=p;if(P)for(var C,D=-1,L=P.length-1;D<L;){C=P[D+=1];var U=e.util.getProperty(C),F=e.util.escapeQuotes(C),K=h+U;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,C,e.opts.jsonPointers)),n+=" if ( "+K+" === undefined ",j&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(C)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=E}else d&&(n+=" if (true) {");return n},YM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f=e.opts.$data&&i&&i.$data,w;if(f?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",w="schema"+a):w=i,(i||f)&&e.opts.uniqueItems!==!1){f&&(n+=" var "+m+"; if ("+w+" === false || "+w+" === undefined) "+m+" = true; else if (typeof "+w+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+h+".length , "+m+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,v=Array.isArray(p);if(!p||p=="object"||p=="array"||v&&(p.indexOf("object")>=0||p.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+h+"[i]; ";var y="checkDataType"+(v?"s":"");n+=" if ("+e.util[y](p,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",f&&(n+=" } "),n+=" if (!"+m+") { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",f?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n},JM={$ref:OM,allOf:IM,anyOf:DM,$comment:MM,const:$M,contains:FM,dependencies:LM,enum:UM,format:zM,if:VM,items:qM,maximum:U0,minimum:U0,maxItems:z0,minItems:z0,maxLength:V0,minLength:V0,maxProperties:q0,minProperties:q0,multipleOf:HM,not:BM,oneOf:KM,pattern:WM,properties:QM,propertyNames:GM,required:ZM,uniqueItems:YM,validate:BE},H0=JM,Zf=ki.toHash,XM=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],n=["number","integer","string","array","object","boolean","null"];return e.all=Zf(r),e.types=Zf(n),e.forEach(function(a){a.rules=a.rules.map(function(o){var i;if(typeof o=="object"){var c=Object.keys(o)[0];i=o[c],o=c,i.forEach(function(d){r.push(d),e.all[d]=!0})}r.push(o);var u=e.all[o]={keyword:o,code:H0[o],implements:i};return u}),e.all.$comment={keyword:"$comment",code:H0.$comment},a.type&&(e.types[a.type]=a)}),e.keywords=Zf(r.concat(s)),e.custom={},e},B0=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],e$=function(t,e){for(var r=0;r<e.length;r++){t=JSON.parse(JSON.stringify(t));var s=e[r].split("/"),n=t,a;for(a=1;a<s.length;a++)n=n[s[a]];for(a=0;a<B0.length;a++){var o=B0[a],i=n[o];i&&(n[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},t$=ig.MissingRef,r$=aC;function aC(t,e,r){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var n=a(t).then(function(){var i=s._addSchema(t,void 0,e);return i.validate||o(i)});return r&&n.then(function(i){r(null,i)},r),n;function a(i){var c=i.$schema;return c&&!s.getSchema(c)?aC.call(s,{$ref:c},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(u){if(u instanceof t$)return c(u);throw u}function c(u){var d=u.missingSchema;if(f(d))throw new Error("Schema "+d+" is loaded but "+u.missingRef+" cannot be resolved");var h=s._loadingSchemas[d];return h||(h=s._loadingSchemas[d]=s._opts.loadSchema(d),h.then(m,m)),h.then(function(w){if(!f(d))return a(w).then(function(){f(d)||s.addSchema(w,d,void 0,e)})}).then(function(){return o(i)});function m(){delete s._loadingSchemas[d]}function f(w){return s._refs[w]||s._schemas[w]}}}}var n$=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h,m="data"+(o||""),f="valid"+a,w="errs__"+a,p=e.opts.$data&&i&&i.$data,v;p?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",v="schema"+a):v=i;var y=this,g="definition"+a,b=y.definition,S="",E,N,j,R,A;if(p&&b.$data){A="keywordValidate"+a;var F=b.validateSchema;n+=" var "+g+" = RULES.custom['"+r+"'].definition; var "+A+" = "+g+".validate;"}else{if(R=e.useCustomRule(y,i,e.schema,e),!R)return;v="validate.schema"+c,A=R.code,E=b.compile,N=b.inline,j=b.macro}var T=A+".errors",_="i"+a,I="ruleErr"+a,C=b.async;if(C&&!e.async)throw new Error("async keyword in sync schema");if(N||j||(n+=""+T+" = null;"),n+="var "+w+" = errors;var "+f+";",p&&b.$data&&(S+="}",n+=" if ("+v+" === undefined) { "+f+" = true; } else { ",F&&(S+="}",n+=" "+f+" = "+g+".validateSchema("+v+"); if ("+f+") { ")),N)b.statements?n+=" "+R.validate+" ":n+=" "+f+" = "+R.validate+"; ";else if(j){var z=e.util.copy(e),S="";z.level++;var U="valid"+z.level;z.schema=R.validate,z.schemaPath="";var K=e.compositeRule;e.compositeRule=z.compositeRule=!0;var P=e.validate(z).replace(/validate\.schema/g,A);e.compositeRule=z.compositeRule=K,n+=" "+P}else{var D=D||[];D.push(n),n="",n+=" "+A+".call( ",e.opts.passContext?n+="this":n+="self",E||b.schema===!1?n+=" , "+m+" ":n+=" , "+v+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var L=o?"data"+(o-1||""):"parentData",J=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+L+" , "+J+" , rootData ) ";var Z=n;n=D.pop(),b.errors===!1?(n+=" "+f+" = ",C&&(n+="await "),n+=""+Z+"; "):C?(T="customErrors"+a,n+=" var "+T+" = null; try { "+f+" = await "+Z+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+T+" = e.errors; else throw e; } "):n+=" "+T+" = null; "+f+" = "+Z+"; "}if(b.modifying&&(n+=" if ("+L+") "+m+" = "+L+"["+J+"];"),n+=""+S,b.valid)d&&(n+=" if (true) { ");else{n+=" if ( ",b.valid===void 0?(n+=" !",j?n+=""+U:n+=""+f):n+=" "+!b.valid+" ",n+=") { ",h=y.keyword;var D=D||[];D.push(n),n="";var D=D||[];D.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var B=n;n=D.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+B+"]); ":n+=" validate.errors = ["+B+"]; return false; ":n+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var oe=n;n=D.pop(),N?b.errors?b.errors!="full"&&(n+=" for (var "+_+"="+w+"; "+_+"<errors; "+_+"++) { var "+I+" = vErrors["+_+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+I+".schemaPath === undefined) { "+I+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+I+".schema = "+v+"; "+I+".data = "+m+"; "),n+=" } "):b.errors===!1?n+=" "+oe+" ":(n+=" if ("+w+" == errors) { "+oe+" } else { for (var "+_+"="+w+"; "+_+"<errors; "+_+"++) { var "+I+" = vErrors["+_+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+I+".schemaPath === undefined) { "+I+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+I+".schema = "+v+"; "+I+".data = "+m+"; "),n+=" } } "):j?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; ")):b.errors===!1?n+=" "+oe+" ":(n+=" if (Array.isArray("+T+")) { if (vErrors === null) vErrors = "+T+"; else vErrors = vErrors.concat("+T+"); errors = vErrors.length; for (var "+_+"="+w+"; "+_+"<errors; "+_+"++) { var "+I+" = vErrors["+_+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; "+I+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(n+=" "+I+".schema = "+v+"; "+I+".data = "+m+"; "),n+=" } } else { "+oe+" } "),n+=" } ",d&&(n+=" else { ")}return n};const s$="http://json-schema.org/draft-07/schema#",a$="http://json-schema.org/draft-07/schema#",o$="Core schema meta-schema",i$={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:[]}},l$=["object","boolean"],c$={$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:"#"}},oC={$schema:s$,$id:a$,title:o$,definitions:i$,type:l$,properties:c$,default:!0};var K0=oC,u$={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:K0.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:K0.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},d$=/^[a-z_$][a-z0-9_$-]*$/i,f$=n$,h$=u$,p$={add:m$,get:v$,remove:g$,validate:cm};function m$(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!d$.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var n=0;n<s.length;n++)o(t,s[n],e);else o(t,s,e);var a=e.metaSchema;a&&(e.$data&&this._opts.$data&&(a={anyOf:[a,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(a,!0))}r.keywords[t]=r.all[t]=!0;function o(i,c,u){for(var d,h=0;h<r.length;h++){var m=r[h];if(m.type==c){d=m;break}}d||(d={type:c,rules:[]},r.push(d));var f={keyword:i,definition:u,custom:!0,code:f$,implements:u.implements};d.rules.push(f),r.custom[i]=f}return this}function v$(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function g$(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var r=0;r<e.length;r++)for(var s=e[r].rules,n=0;n<s.length;n++)if(s[n].keyword==t){s.splice(n,1);break}return this}function cm(t,e){cm.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(h$,!0);if(r(t))return!0;if(cm.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}const y$="http://json-schema.org/draft-07/schema#",x$="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",w$="Meta-schema for $data reference (JSON Schema extension proposal)",b$="object",S$=["$data"],_$={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},E$=!1,C$={$schema:y$,$id:x$,description:w$,type:b$,required:S$,properties:_$,additionalProperties:E$};var iC=fM,La=og,P$=xM,lC=UE,k$=HE,N$=PM,j$=XM,cC=e$,uC=ki,R$=wt;wt.prototype.validate=A$;wt.prototype.compile=O$;wt.prototype.addSchema=I$;wt.prototype.addMetaSchema=D$;wt.prototype.validateSchema=M$;wt.prototype.getSchema=F$;wt.prototype.removeSchema=U$;wt.prototype.addFormat=Q$;wt.prototype.errorsText=W$;wt.prototype._addSchema=z$;wt.prototype._compile=V$;wt.prototype.compileAsync=r$;var Jd=p$;wt.prototype.addKeyword=Jd.add;wt.prototype.getKeyword=Jd.get;wt.prototype.removeKeyword=Jd.remove;wt.prototype.validateKeyword=Jd.validate;var dC=ig;wt.ValidationError=dC.Validation;wt.MissingRefError=dC.MissingRef;wt.$dataMetaSchema=cC;var ad="http://json-schema.org/draft-07/schema",W0=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],T$=["/properties"];function wt(t){if(!(this instanceof wt))return new wt(t);t=this._opts=uC.copy(t)||{},eF(this),this._schemas={},this._refs={},this._fragments={},this._formats=N$(t.format),this._cache=t.cache||new P$,this._loadingSchemas={},this._compilations=[],this.RULES=j$(),this._getId=q$(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=k$),this._metaOpts=X$(this),t.formats&&Y$(this),t.keywords&&J$(this),G$(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Z$(this)}function A$(t,e){var r;if(typeof t=="string"){if(r=this.getSchema(t),!r)throw new Error('no schema with key or ref "'+t+'"')}else{var s=this._addSchema(t);r=s.validate||this._compile(s)}var n=r(e);return r.$async!==!0&&(this.errors=r.errors),n}function O$(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function I$(t,e,r,s){if(Array.isArray(t)){for(var n=0;n<t.length;n++)this.addSchema(t[n],void 0,r,s);return this}var a=this._getId(t);if(a!==void 0&&typeof a!="string")throw new Error("schema id must be string");return e=La.normalizeId(e||a),hC(this,e),this._schemas[e]=this._addSchema(t,r,s,!0),this}function D$(t,e,r){return this.addSchema(t,e,r,!0),this}function M$(t,e){var r=t.$schema;if(r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||$$(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(r,t);if(!s&&e){var n="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(n);else throw new Error(n)}return s}function $$(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(ad)?ad:void 0,t._opts.defaultMeta}function F$(t){var e=fC(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return L$(this,t)}}function L$(t,e){var r=La.schema.call(t,{schema:{}},e);if(r){var s=r.schema,n=r.root,a=r.baseId,o=iC.call(t,s,n,void 0,a);return t._fragments[e]=new lC({ref:e,fragment:!0,schema:s,root:n,baseId:a,validate:o}),o}}function fC(t,e){return e=La.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function U$(t){if(t instanceof RegExp)return Ac(this,this._schemas,t),Ac(this,this._refs,t),this;switch(typeof t){case"undefined":return Ac(this,this._schemas),Ac(this,this._refs),this._cache.clear(),this;case"string":var e=fC(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var r=this._opts.serialize,s=r?r(t):t;this._cache.del(s);var n=this._getId(t);n&&(n=La.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this}function Ac(t,e,r){for(var s in e){var n=e[s];!n.meta&&(!r||r.test(s))&&(t._cache.del(n.cacheKey),delete e[s])}}function z$(t,e,r,s){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var n=this._opts.serialize,a=n?n(t):t,o=this._cache.get(a);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var i=La.normalizeId(this._getId(t));i&&s&&hC(this,i);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=i&&i==La.normalizeId(t.$schema))&&this.validateSchema(t,!0);var d=La.ids.call(this,t),h=new lC({id:i,schema:t,localRefs:d,cacheKey:a,meta:r});return i[0]!="#"&&s&&(this._refs[i]=h),this._cache.put(a,h),c&&u&&this.validateSchema(t,!0),h}function V$(t,e){if(t.compiling)return t.validate=n,n.schema=t.schema,n.errors=null,n.root=e||n,t.schema.$async===!0&&(n.$async=!0),n;t.compiling=!0;var r;t.meta&&(r=this._opts,this._opts=this._metaOpts);var s;try{s=iC.call(this,t.schema,e,t.localRefs)}catch(a){throw delete t.validate,a}finally{t.compiling=!1,t.meta&&(this._opts=r)}return t.validate=s,t.refs=s.refs,t.refVal=s.refVal,t.root=s.root,s;function n(){var a=t.validate,o=a.apply(this,arguments);return n.errors=a.errors,o}}function q$(t){switch(t.schemaId){case"auto":return K$;case"id":return H$;default:return B$}}function H$(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function B$(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function K$(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function W$(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var r=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,n="",a=0;a<t.length;a++){var o=t[a];o&&(n+=s+o.dataPath+" "+o.message+r)}return n.slice(0,-r.length)}function Q$(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function G$(t){var e;if(t._opts.$data&&(e=C$,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=oC;t._opts.$data&&(r=cC(r,T$)),t.addMetaSchema(r,ad,!0),t._refs["http://json-schema.org/schema"]=ad}}function Z$(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var r in e)t.addSchema(e[r],r)}function Y$(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function J$(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function hC(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function X$(t){for(var e=uC.copy(t._opts),r=0;r<W0.length;r++)delete e[W0[r]];return e}function eF(t){var e=t._opts.logger;if(e===!1)t.logger={log:Yf,warn:Yf,error:Yf};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function Yf(){}const tF=um(R$);class rF extends RD{constructor(e,r){var s;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=r==null?void 0:r.capabilities)!==null&&s!==void 0?s:{},this._ajv=new tF}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=TD(this._capabilities,e)}assertCapability(e,r){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:Vd,capabilities:this._capabilities,clientInfo:this._clientInfo}},_E,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!GI.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,s,n,a,o;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break}}async ping(e){return this.request({method:"ping"},Ao,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},AE,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Ao,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Qv,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Zu,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Gu,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},jE,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Hv,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Ao,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Ao,r)}async callTool(e,r=Wd,s){const n=await this.request({method:"tools/call",params:e},r,s),a=this.getToolOutputValidator(e.name);if(a){if(!n.structuredContent&&!n.isError)throw new qs(En.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{if(!a(n.structuredContent))throw new qs(En.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(a.errors)}`)}catch(o){throw o instanceof qs?o:new qs(En.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return n}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const r of e)if(r.outputSchema)try{const s=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const s=await this.request({method:"tools/list",params:e},Gv,r);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Ui(t,e){if(!t)throw new Error(e)}var Q0=3e3,nF=5e3,Jf=5*60*1e3;function sF(t){const{url:e,clientName:r,clientUri:s,callbackUrl:n=typeof window<"u"?To(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:a="mcp:auth",clientConfig:o={},customHeaders:i={},autoRetry:c=!1,autoReconnect:u=Q0,transportType:d="auto",preventAutoAuth:h=!1,onPopupWindow:m}=t,[f,w]=x.useState("discovering"),[p,v]=x.useState([]),[y,g]=x.useState([]),[b,S]=x.useState([]),[E,N]=x.useState([]),[j,R]=x.useState(void 0),[A,F]=x.useState([]),[T,_]=x.useState(void 0),I=x.useRef(null),C=x.useRef(null),z=x.useRef(null),U=x.useRef(!1),K=x.useRef(!0),P=x.useRef(0),D=x.useRef(null),L=x.useRef(f),J=x.useRef(u),Z=x.useRef(null);x.useEffect(()=>{L.current=f,J.current=u},[f,u]);const B=x.useCallback((X,ce,...Y)=>{const ze=Y.length>0?`${ce} ${Y.map(te=>JSON.stringify(te)).join(" ")}`:ce;console[X](`[useMcp] ${ze}`),K.current&&F(te=>[...te.slice(-100),{level:X,message:ze,timestamp:Date.now()}])},[]),oe=x.useCallback(async(X=!1)=>{X||B("info","Disconnecting..."),U.current=!1,D.current&&clearTimeout(D.current),D.current=null;const ce=C.current;if(I.current=null,C.current=null,K.current&&!X&&(w("discovering"),v([]),g([]),S([]),N([]),R(void 0),_(void 0)),ce)try{await ce.close(),X||B("debug","Transport closed")}catch(Y){X||B("warn","Error closing transport:",Y)}},[B]),ve=x.useCallback((X,ce)=>{var Y;if(B("error",X,ce??""),K.current){w("failed"),R(X);const ze=(Y=z.current)==null?void 0:Y.getLastAttemptedAuthUrl();ze&&(_(ze),B("info","Manual authentication URL may be available.",ze))}U.current=!1},[B]),ge=x.useCallback(async()=>{if(U.current){B("debug","Connection attempt already in progress.");return}if(!K.current){B("debug","Connect called after unmount, aborting.");return}U.current=!0,P.current+=1,R(void 0),_(void 0),Z.current=null,w("discovering"),B("info",`Connecting attempt #${P.current} to ${e}...`),z.current||(z.current=new S0(e,{storageKeyPrefix:a,clientName:r,clientUri:s,callbackUrl:n,preventAutoAuth:h,onPopupWindow:m}),B("debug","BrowserOAuthClientProvider initialized in connect.")),I.current||(I.current=new rF({name:o.name||"use-mcp-react-client",version:o.version||"0.1.0"},{capabilities:{}}),B("debug","MCP Client initialized in connect."));const X=async Y=>{B("info",`Attempting connection with ${Y.toUpperCase()} transport...`),L.current!=="authenticating"&&w("connecting");let ze;try{Ui(z.current,"Auth Provider must be initialized"),Ui(I.current,"Client must be initialized"),C.current&&(await C.current.close().catch(Ne=>B("warn",`Error closing previous transport: ${Ne.message}`)),C.current=null);const te={authProvider:z.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...i}}},Me=To(e),Ue=new URL(Me);B("debug",`Creating ${Y.toUpperCase()} transport for URL: ${Ue.toString()}`),B("debug","Transport options:",{authProvider:!!z.current,headers:i,url:Ue.toString()}),Y==="http"?(B("debug","Creating StreamableHTTPClientTransport..."),ze=new ND(Ue,te),B("debug","StreamableHTTPClientTransport created successfully")):(B("debug","Creating SSEClientTransport..."),ze=new CD(Ue,te),B("debug","SSEClientTransport created successfully")),C.current=ze,B("debug",`${Y.toUpperCase()} transport created and assigned to ref.`)}catch(te){return ve(`Failed to create ${Y.toUpperCase()} transport: ${te instanceof Error?te.message:String(te)}`,te instanceof Error?te:void 0),"failed"}ze.onmessage=te=>{var Me,Ue;B("debug",`[Transport] Received: ${JSON.stringify(te)}`),(Ue=(Me=I.current)==null?void 0:Me.handleMessage)==null||Ue.call(Me,te)},ze.onerror=te=>{B("warn",`Transport error event (${Y.toUpperCase()}):`,te),B("debug","Error details:",{message:te.message,stack:te.stack,name:te.name,cause:te.cause}),ve(`Transport error (${Y.toUpperCase()}): ${te.message}`,te)},ze.onclose=()=>{if(!K.current||U.current)return;B("info",`Transport connection closed (${Z.current||"unknown"} type).`);const te=L.current,Me=J.current;if(te==="ready"&&Me){const Ue=typeof Me=="number"?Me:Q0;B("info",`Attempting to reconnect in ${Ue}ms...`),w("connecting"),setTimeout(()=>{K.current&&ge()},Ue)}else te!=="failed"&&te!=="authenticating"&&ve("Connection closed unexpectedly.")};try{B("info",`Connecting client via ${Y.toUpperCase()}...`),B("debug","About to call client.connect() with transport instance"),B("debug",`Transport instance type: ${ze.constructor.name}`),await I.current.connect(ze),B("info",`Client connected via ${Y.toUpperCase()}. Loading tools, resources, and prompts...`),Z.current=Y,w("loading");const te=await I.current.request({method:"tools/list"},Gv);let Me={resources:[],resourceTemplates:[]};try{Me=await I.current.request({method:"resources/list"},Gu)}catch(Ne){B("debug","Server does not support resources/list method",Ne)}let Ue={prompts:[]};try{Ue=await I.current.request({method:"prompts/list"},Zu)}catch(Ne){B("debug","Server does not support prompts/list method",Ne)}if(K.current){v(te.tools),g(Me.resources),S(Array.isArray(Me.resourceTemplates)?Me.resourceTemplates:[]),N(Ue.prompts);const Ne=[`Loaded ${te.tools.length} tools`];return(Me.resources.length>0||Me.resourceTemplates&&Me.resourceTemplates.length>0)&&(Ne.push(`${Me.resources.length} resources`),Array.isArray(Me.resourceTemplates)&&Me.resourceTemplates.length>0&&Ne.push(`${Me.resourceTemplates.length} resource templates`)),Ue.prompts.length>0&&Ne.push(`${Ue.prompts.length} prompts`),B("info",Ne.join(", ")+"."),w("ready"),P.current=0,"success"}else return"failed"}catch(te){B("debug",`Client connect error via ${Y.toUpperCase()}:`,te),B("debug","Connect error details:",{message:te instanceof Error?te.message:String(te),stack:te instanceof Error?te.stack:"N/A",name:te instanceof Error?te.name:"Unknown",cause:te instanceof Error?te.cause:void 0});const Me=te instanceof Error?te:new Error(String(te)),Ue=Me.message,Ne=Ue.includes("404")||Ue.includes("Not Found"),rt=Ue.includes("405")||Ue.includes("Method Not Allowed"),pt=Ue==="Failed to fetch"||Ue==="NetworkError when attempting to fetch resource."||Ue==="Load failed";if(Y==="http"&&(Ne||rt||pt))return B("warn",`HTTP transport failed (${pt?"CORS":Ne?"404":"405"}).`),"fallback";if(Me instanceof Dr||Ue.includes("Unauthorized")||Ue.includes("401")){B("info","Authentication required."),Ui(z.current,"Auth Provider not available for auth flow");const Hr=await z.current.tokens();if(h&&!Hr)return B("info","Authentication required but auto-auth prevented. User action needed."),w("pending_auth"),"auth_redirect";L.current!=="authenticating"&&L.current!=="pending_auth"&&(w("authenticating"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{},Jf));try{const zt=await Pn(z.current,{serverUrl:e});if(!K.current)return"failed";if(zt==="AUTHORIZED")return B("info","Authentication successful via existing token or refresh. Re-attempting connection..."),D.current&&clearTimeout(D.current),U.current=!1,ge(),"failed";if(zt==="REDIRECT")return B("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(zt){return K.current&&(D.current&&clearTimeout(D.current),ve(`Failed to initiate authentication: ${zt instanceof Error?zt.message:String(zt)}`,zt instanceof Error?zt:void 0)),"failed"}}return ve(`Failed to connect via ${Y.toUpperCase()}: ${Ue}`,Me),"failed"}};let ce="failed";if(console.log({transportType:d}),d==="sse")B("debug","Using SSE-only transport mode"),ce=await X("sse");else if(d==="http")B("debug","Using HTTP-only transport mode"),ce=await X("http");else{B("debug","Using auto transport mode (HTTP with SSE fallback)");const Y=await X("http");if(Y==="fallback"&&K.current&&L.current!=="authenticating"){B("info","HTTP failed, attempting SSE fallback...");const ze=await X("sse");ce=ze,ze==="failed"&&K.current}else ce=Y}(ce==="success"||ce==="failed")&&(U.current=!1),B("debug",`Connection sequence finished with status: ${ce}`)},[B,ve,oe,Pn,e,a,r,s,n,o.name,o.version]),re=x.useCallback(async(X,ce)=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot call tool "${X}".`);B("info",`Calling tool: ${X}`,ce);try{const Y=await I.current.request({method:"tools/call",params:{name:X,arguments:ce}},Wd);return B("info",`Tool "${X}" call successful:`,Y),Y}catch(Y){B("error",`Error calling tool "${X}": ${Y instanceof Error?Y.message:String(Y)}`,Y);const ze=Y instanceof Error?Y:new Error(String(Y));if(ze instanceof Dr||ze.message.includes("Unauthorized")||ze.message.includes("401")){B("warn","Tool call unauthorized, attempting re-authentication..."),w("authenticating"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{},Jf);try{Ui(z.current,"Auth Provider not available for tool re-auth");const te=await Pn(z.current,{serverUrl:e});if(!K.current)return;te==="AUTHORIZED"?(B("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),D.current&&clearTimeout(D.current),U.current=!1,ge()):te==="REDIRECT"&&B("info","Redirecting for re-authentication for tool call.")}catch(te){if(!K.current)return;D.current&&clearTimeout(D.current),ve(`Re-authentication failed: ${te instanceof Error?te.message:String(te)}`,te instanceof Error?te:void 0)}}if(L.current!=="authenticating")throw Y;return}},[f,e,B,ve,ge]),ye=x.useCallback(()=>{L.current==="failed"?(B("info","Retry requested..."),ge()):B("warn",`Retry called but state is not 'failed' (state: ${L.current}). Ignoring.`)},[B,ge]),ke=x.useCallback(async()=>{var ce;B("info","Manual authentication requested...");const X=L.current;if(X==="failed")B("info","Attempting to reconnect and authenticate via retry..."),ye();else if(X==="pending_auth"){B("info","Proceeding with authentication from pending state..."),w("authenticating"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{},Jf);try{Ui(z.current,"Auth Provider not available for manual auth");const Y=await Pn(z.current,{serverUrl:e});if(!K.current)return;Y==="AUTHORIZED"?(B("info","Manual authentication successful. Re-attempting connection..."),D.current&&clearTimeout(D.current),U.current=!1,ge()):Y==="REDIRECT"&&B("info","Redirecting for manual authentication. Waiting for callback...")}catch(Y){if(!K.current)return;D.current&&clearTimeout(D.current),ve(`Manual authentication failed: ${Y instanceof Error?Y.message:String(Y)}`,Y instanceof Error?Y:void 0)}}else if(X==="authenticating"){B("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const Y=(ce=z.current)==null?void 0:ce.getLastAttemptedAuthUrl();Y&&!T&&(_(Y),B("info","Manual authentication URL retrieved:",Y))}else B("info",`Client not in a state requiring manual authentication trigger (state: ${X}). If needed, try disconnecting and reconnecting.`)},[B,ye,T,e,ve,ge]),me=x.useCallback(()=>{if(z.current){const X=z.current.clearStorage();B("info",`Cleared ${X} item(s) from localStorage for ${e}.`),_(void 0),oe()}else B("warn","Auth provider not initialized, cannot clear storage.")},[e,B,oe]),ee=x.useCallback(async()=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot list resources.`);B("info","Listing resources...");try{const X=await I.current.request({method:"resources/list"},Gu);K.current&&(g(X.resources),S(Array.isArray(X.resourceTemplates)?X.resourceTemplates:[]),B("info",`Listed ${X.resources.length} resources, ${Array.isArray(X.resourceTemplates)?X.resourceTemplates.length:0} resource templates.`))}catch(X){throw B("error",`Error listing resources: ${X instanceof Error?X.message:String(X)}`,X),X}},[f,B]),_e=x.useCallback(async X=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot read resource "${X}".`);B("info",`Reading resource: ${X}`);try{const ce=await I.current.request({method:"resources/read",params:{uri:X}},Hv);return B("info",`Resource "${X}" read successfully`),ce}catch(ce){throw B("error",`Error reading resource "${X}": ${ce instanceof Error?ce.message:String(ce)}`,ce),ce}},[f,B]),Pe=x.useCallback(async()=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot list prompts.`);B("info","Listing prompts...");try{const X=await I.current.request({method:"prompts/list"},Zu);K.current&&(N(X.prompts),B("info",`Listed ${X.prompts.length} prompts.`))}catch(X){throw B("error",`Error listing prompts: ${X instanceof Error?X.message:String(X)}`,X),X}},[f,B]),De=x.useCallback(async(X,ce)=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot get prompt "${X}".`);B("info",`Getting prompt: ${X}`,ce);try{const Y=await I.current.request({method:"prompts/get",params:{name:X,arguments:ce}},Qv);return B("info",`Prompt "${X}" retrieved successfully`),Y}catch(Y){throw B("error",`Error getting prompt "${X}": ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[f,B]);return x.useEffect(()=>{const X=ce=>{var Y;ce.origin===window.location.origin&&((Y=ce.data)==null?void 0:Y.type)==="mcp_auth_callback"&&(B("info","Received auth callback message.",ce.data),D.current&&clearTimeout(D.current),ce.data.success?(B("info","Authentication successful via popup. Reconnecting client..."),U.current=!1,ge()):ve(`Authentication failed in callback: ${ce.data.error||"Unknown reason."}`))};return window.addEventListener("message",X),B("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",X),B("debug","Auth callback message listener removed."),D.current&&clearTimeout(D.current)}},[B,ve,ge]),x.useEffect(()=>(K.current=!0,B("debug","useMcp mounted, initiating connection."),P.current=0,(!z.current||z.current.serverUrl!==e)&&(z.current=new S0(e,{storageKeyPrefix:a,clientName:r,clientUri:s,callbackUrl:n,preventAutoAuth:h,onPopupWindow:m}),B("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),ge(),()=>{K.current=!1,B("debug","useMcp unmounting, disconnecting."),oe(!0)}),[e,a,n,r,s,o.name,o.version,ge,oe]),x.useEffect(()=>{let X=null;if(f==="failed"&&c&&P.current>0){const ce=typeof c=="number"?c:nF;B("info",`Connection failed, auto-retrying in ${ce}ms...`),X=setTimeout(()=>{K.current&&L.current==="failed"&&ye()},ce)}return()=>{X&&clearTimeout(X)}},[f,c,ye,B]),{state:f,tools:p,resources:y,resourceTemplates:b,prompts:E,error:j,log:A,authUrl:T,callTool:re,listResources:ee,readResource:_e,listPrompts:Pe,getPrompt:De,retry:ye,disconnect:oe,authenticate:ke,clearStorage:me}}function aF({service:t,autoConnect:e=!1,onConnected:r,onError:s}){const{toast:n}=or(),{state:a,tools:o,resources:i,prompts:c,error:u,authUrl:d,callTool:h,readResource:m,listResources:f,getPrompt:w,listPrompts:p,retry:v,disconnect:y,authenticate:g,clearStorage:b}=sF({url:t.url,clientName:"AgentDeck",clientUri:window.location.origin,callbackUrl:`${window.location.origin}/oauth/callback`,storageKeyPrefix:`mcp:auth:${t.id}`,autoRetry:3,autoReconnect:5e3,transportType:"auto",preventAutoAuth:!e}),S=a==="ready",E=a==="connecting"||a==="loading",N=a==="authenticating"||a==="pending_auth",j=a==="failed";return mn.useEffect(()=>{S&&r&&(r(),n({title:"Connected to MCP service",description:`Successfully connected to ${t.name}`}))},[S,r,t.name,n]),mn.useEffect(()=>{j&&u&&s&&(s(u),n({title:"MCP connection failed",description:u,variant:"destructive"}))},[j,u,s,n]),{isConnected:S,isConnecting:E,isAuthenticating:N,hasError:j,error:u,tools:o,resources:i,prompts:c,connect:()=>{v()},disconnect:y,retry:v,authenticate:g,callTool:async(I,C)=>{try{return await h(I,C)}catch(z){const U=z instanceof Error?z.message:"Unknown error";throw n({title:"Tool call failed",description:U,variant:"destructive"}),z}},readResource:async I=>{try{return await m(I)}catch(C){const z=C instanceof Error?C.message:"Unknown error";throw n({title:"Resource read failed",description:z,variant:"destructive"}),C}},listResources:async()=>{try{await f()}catch(I){const C=I instanceof Error?I.message:"Unknown error";throw n({title:"Resource listing failed",description:C,variant:"destructive"}),I}},getPrompt:async(I,C)=>{try{return await w(I,C)}catch(z){const U=z instanceof Error?z.message:"Unknown error";throw n({title:"Prompt retrieval failed",description:U,variant:"destructive"}),z}},listPrompts:async()=>{try{await p()}catch(I){const C=I instanceof Error?I.message:"Unknown error";throw n({title:"Prompt listing failed",description:C,variant:"destructive"}),I}},authUrl:d,clearStorage:b}}function oF(){const[t,e]=x.useState("https://api.githubcopilot.com/mcp"),[r,s]=x.useState("get_me"),[n,a]=x.useState("{}"),[o,i]=x.useState(""),c={id:"test-mcp-service",name:"Test MCP Service",url:t,registeredAt:new Date().toISOString(),updatedAt:new Date().toISOString()},{isConnected:u,isConnecting:d,isAuthenticating:h,hasError:m,error:f,tools:w,resources:p,prompts:v,connect:y,disconnect:g,retry:b,authenticate:S,callTool:E,authUrl:N,clearStorage:j}=aF({service:c,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:T=>{console.error("Test MCP service error:",T)}}),A=d?{status:"connecting",icon:Gy,color:"text-yellow-500"}:h?{status:"authenticating",icon:Ec,color:"text-blue-500"}:u?{status:"connected",icon:lp,color:"text-green-500"}:m?{status:"error",icon:Wy,color:"text-red-500"}:{status:"disconnected",icon:Wy,color:"text-gray-500"},F=async()=>{try{let T={};n.trim()&&(T=JSON.parse(n));const _=await E(r,T);i(JSON.stringify(_,null,2))}catch(T){i(`Error: ${T instanceof Error?T.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(Es,{children:[l.jsxs(_a,{children:[l.jsxs(Ea,{className:"flex items-center gap-2",children:[l.jsx(A.icon,{className:`w-5 h-5 ${A.color}`}),"Connection Status: ",A.status]}),l.jsx(Jc,{children:"Current connection state and available actions"})]}),l.jsxs(Cs,{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(We,{children:"Service URL"}),l.jsx(tt,{value:t,onChange:T=>e(T.target.value),placeholder:"Enter MCP service URL"})]}),l.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&l.jsx(fe,{onClick:y,children:"Connect"}),u&&l.jsx(fe,{onClick:g,variant:"outline",children:"Disconnect"}),m&&l.jsxs(fe,{onClick:b,variant:"outline",children:[l.jsx(Gy,{className:"w-4 h-4 mr-1"}),"Retry"]}),N&&!u&&l.jsxs(fe,{onClick:S,variant:"outline",children:[l.jsx(Ec,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),f&&l.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[l.jsx(b1,{className:"w-4 h-4 text-destructive"}),l.jsx("span",{className:"text-sm text-destructive",children:f})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[l.jsxs(Es,{children:[l.jsx(_a,{children:l.jsxs(Ea,{className:"flex items-center gap-2",children:[l.jsx(Ru,{className:"w-4 h-4"}),"Tools (",w.length,")"]})}),l.jsx(Cs,{children:w.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:[w.slice(0,5).map((T,_)=>l.jsx("div",{className:"text-sm",children:l.jsx(hn,{variant:"outline",className:"text-xs",children:T.name})},_)),w.length>5&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",w.length-5," more tools"]})]})})]}),l.jsxs(Es,{children:[l.jsx(_a,{children:l.jsxs(Ea,{children:["Resources (",p.length,")"]})}),l.jsx(Cs,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${p.length} resources available`:"Connect to see resources"})})]}),l.jsxs(Es,{children:[l.jsx(_a,{children:l.jsxs(Ea,{children:["Prompts (",v.length,")"]})}),l.jsx(Cs,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${v.length} prompts available`:"Connect to see prompts"})})]})]}),u&&l.jsxs(Es,{children:[l.jsxs(_a,{children:[l.jsx(Ea,{children:"Test Tool Call"}),l.jsx(Jc,{children:"Test calling a tool on the connected MCP service"})]}),l.jsxs(Cs,{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(We,{htmlFor:"toolName",children:"Tool Name"}),l.jsx(tt,{id:"toolName",value:r,onChange:T=>s(T.target.value),placeholder:"e.g., get_me"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),l.jsx(tt,{id:"toolArgs",value:n,onChange:T=>a(T.target.value),placeholder:'{"key": "value"}'})]})]}),l.jsxs(fe,{onClick:F,disabled:!u,children:[l.jsx(u2,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),o&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{children:"Result"}),l.jsx(Gn,{value:o,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),N&&l.jsxs(Es,{children:[l.jsxs(_a,{children:[l.jsxs(Ea,{className:"flex items-center gap-2",children:[l.jsx(Ec,{className:"w-4 h-4"}),"OAuth Authentication"]}),l.jsx(Jc,{children:"This service requires OAuth authentication"})]}),l.jsxs(Cs,{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(fe,{onClick:S,variant:"outline",children:[l.jsx(Ec,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),l.jsx(fe,{onClick:j,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function iF(){return l.jsxs(SN,{children:[l.jsx(wc,{path:"/",component:vI}),l.jsx(wc,{path:"/oauth/callback",component:xI}),l.jsx(wc,{path:"/mcp-test",component:oF}),l.jsx(wc,{component:yI})]})}function lF(){return l.jsx(qN,{client:sj,children:l.jsxs(OT,{children:[l.jsx(Q2,{}),l.jsx(iF,{})]})})}gb(document.getElementById("root")).render(l.jsx(x.StrictMode,{children:l.jsx(lF,{})}));
|
|
354
|
+
`&&s++}}return[e,r]}class M0 extends Event{constructor(e,r){var s,n;super(e),this.code=(s=r==null?void 0:r.code)!=null?s:void 0,this.message=(n=r==null?void 0:r.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,s){return s($0(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e($0(this),r)}}function t4(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function $p(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map($p).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${$p(t.cause)}`:t.message:`${t}`}function $0(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var LE=t=>{throw TypeError(t)},Jv=(t,e,r)=>e.has(t)||LE("Cannot "+r),Ve=(t,e,r)=>(Jv(t,e,"read from private field"),r?r.call(t):e.get(t)),jt=(t,e,r)=>e.has(t)?LE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ft=(t,e,r,s)=>(Jv(t,e,"write to private field"),e.set(t,r),r),qn=(t,e,r)=>(Jv(t,e,"access private method"),r),dr,Ca,vo,tu,Ju,ll,Oo,cl,Rs,go,Ho,yo,Gi,Gr,Fp,Lp,Up,F0,zp,Vp,Zi,qp,Hp;class ru extends EventTarget{constructor(e,r){var s,n;super(),jt(this,Gr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,jt(this,dr),jt(this,Ca),jt(this,vo),jt(this,tu),jt(this,Ju),jt(this,ll),jt(this,Oo),jt(this,cl,null),jt(this,Rs),jt(this,go),jt(this,Ho,null),jt(this,yo,null),jt(this,Gi,null),jt(this,Lp,async a=>{var o;Ve(this,go).reset();const{body:i,redirected:c,status:u,headers:d}=a;if(u===204){qn(this,Gr,Zi).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?ft(this,vo,new URL(a.url)):ft(this,vo,void 0),u!==200){qn(this,Gr,Zi).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){qn(this,Gr,Zi).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ve(this,dr)===this.CLOSED)return;ft(this,dr,this.OPEN);const h=new Event("open");if((o=Ve(this,Gi))==null||o.call(this,h),this.dispatchEvent(h),typeof i!="object"||!i||!("getReader"in i)){qn(this,Gr,Zi).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const m=new TextDecoder,f=i.getReader();let w=!0;do{const{done:p,value:y}=await f.read();y&&Ve(this,go).feed(m.decode(y,{stream:!p})),p&&(w=!1,Ve(this,go).reset(),qn(this,Gr,qp).call(this))}while(w)}),jt(this,Up,a=>{ft(this,Rs,void 0),!(a.name==="AbortError"||a.type==="aborted")&&qn(this,Gr,qp).call(this,$p(a))}),jt(this,zp,a=>{typeof a.id=="string"&&ft(this,cl,a.id);const o=new MessageEvent(a.event||"message",{data:a.data,origin:Ve(this,vo)?Ve(this,vo).origin:Ve(this,Ca).origin,lastEventId:a.id||""});Ve(this,yo)&&(!a.event||a.event==="message")&&Ve(this,yo).call(this,o),this.dispatchEvent(o)}),jt(this,Vp,a=>{ft(this,ll,a)}),jt(this,Hp,()=>{ft(this,Oo,void 0),Ve(this,dr)===this.CONNECTING&&qn(this,Gr,Fp).call(this)});try{if(e instanceof URL)ft(this,Ca,e);else if(typeof e=="string")ft(this,Ca,new URL(e,r4()));else throw new Error("Invalid URL")}catch{throw t4("An invalid or illegal string was specified")}ft(this,go,FE({onEvent:Ve(this,zp),onRetry:Ve(this,Vp)})),ft(this,dr,this.CONNECTING),ft(this,ll,3e3),ft(this,Ju,(s=r==null?void 0:r.fetch)!=null?s:globalThis.fetch),ft(this,tu,(n=r==null?void 0:r.withCredentials)!=null?n:!1),qn(this,Gr,Fp).call(this)}get readyState(){return Ve(this,dr)}get url(){return Ve(this,Ca).href}get withCredentials(){return Ve(this,tu)}get onerror(){return Ve(this,Ho)}set onerror(e){ft(this,Ho,e)}get onmessage(){return Ve(this,yo)}set onmessage(e){ft(this,yo,e)}get onopen(){return Ve(this,Gi)}set onopen(e){ft(this,Gi,e)}addEventListener(e,r,s){const n=r;super.addEventListener(e,n,s)}removeEventListener(e,r,s){const n=r;super.removeEventListener(e,n,s)}close(){Ve(this,Oo)&&clearTimeout(Ve(this,Oo)),Ve(this,dr)!==this.CLOSED&&(Ve(this,Rs)&&Ve(this,Rs).abort(),ft(this,dr,this.CLOSED),ft(this,Rs,void 0))}}dr=new WeakMap,Ca=new WeakMap,vo=new WeakMap,tu=new WeakMap,Ju=new WeakMap,ll=new WeakMap,Oo=new WeakMap,cl=new WeakMap,Rs=new WeakMap,go=new WeakMap,Ho=new WeakMap,yo=new WeakMap,Gi=new WeakMap,Gr=new WeakSet,Fp=function(){ft(this,dr,this.CONNECTING),ft(this,Rs,new AbortController),Ve(this,Ju)(Ve(this,Ca),qn(this,Gr,F0).call(this)).then(Ve(this,Lp)).catch(Ve(this,Up))},Lp=new WeakMap,Up=new WeakMap,F0=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ve(this,cl)?{"Last-Event-ID":Ve(this,cl)}:void 0},cache:"no-store",signal:(t=Ve(this,Rs))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},zp=new WeakMap,Vp=new WeakMap,Zi=function(t,e){var r;Ve(this,dr)!==this.CLOSED&&ft(this,dr,this.CLOSED);const s=new M0("error",{code:e,message:t});(r=Ve(this,Ho))==null||r.call(this,s),this.dispatchEvent(s)},qp=function(t,e){var r;if(Ve(this,dr)===this.CLOSED)return;ft(this,dr,this.CONNECTING);const s=new M0("error",{code:e,message:t});(r=Ve(this,Ho))==null||r.call(this,s),this.dispatchEvent(s),ft(this,Oo,setTimeout(Ve(this,Hp),Ve(this,ll)))},Hp=new WeakMap,ru.CONNECTING=0,ru.OPEN=1,ru.CLOSED=2;function r4(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}let Xv;Xv=globalThis.crypto;async function n4(t){return(await Xv).getRandomValues(new Uint8Array(t))}async function s4(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const s=await n4(t);for(let n=0;n<t;n++){const a=s[n]%e.length;r+=e[a]}return r}async function a4(t){return await s4(t)}async function o4(t){const e=await(await Xv).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function i4(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await a4(t),r=await o4(e);return{code_verifier:e,code_challenge:r}}const Ft=V().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Z.custom,message:"URL must be parseable",fatal:!0}),rD}).refine(t=>{const e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),l4=se({resource:V().url(),authorization_servers:he(Ft).optional(),jwks_uri:V().url().optional(),scopes_supported:he(V()).optional(),bearer_methods_supported:he(V()).optional(),resource_signing_alg_values_supported:he(V()).optional(),resource_name:V().optional(),resource_documentation:V().optional(),resource_policy_uri:V().url().optional(),resource_tos_uri:V().url().optional(),tls_client_certificate_bound_access_tokens:It().optional(),authorization_details_types_supported:he(V()).optional(),dpop_signing_alg_values_supported:he(V()).optional(),dpop_bound_access_tokens_required:It().optional()}).passthrough(),UE=se({issuer:V(),authorization_endpoint:Ft,token_endpoint:Ft,registration_endpoint:Ft.optional(),scopes_supported:he(V()).optional(),response_types_supported:he(V()),response_modes_supported:he(V()).optional(),grant_types_supported:he(V()).optional(),token_endpoint_auth_methods_supported:he(V()).optional(),token_endpoint_auth_signing_alg_values_supported:he(V()).optional(),service_documentation:Ft.optional(),revocation_endpoint:Ft.optional(),revocation_endpoint_auth_methods_supported:he(V()).optional(),revocation_endpoint_auth_signing_alg_values_supported:he(V()).optional(),introspection_endpoint:V().optional(),introspection_endpoint_auth_methods_supported:he(V()).optional(),introspection_endpoint_auth_signing_alg_values_supported:he(V()).optional(),code_challenge_methods_supported:he(V()).optional()}).passthrough(),c4=se({issuer:V(),authorization_endpoint:Ft,token_endpoint:Ft,userinfo_endpoint:Ft.optional(),jwks_uri:Ft,registration_endpoint:Ft.optional(),scopes_supported:he(V()).optional(),response_types_supported:he(V()),response_modes_supported:he(V()).optional(),grant_types_supported:he(V()).optional(),acr_values_supported:he(V()).optional(),subject_types_supported:he(V()),id_token_signing_alg_values_supported:he(V()),id_token_encryption_alg_values_supported:he(V()).optional(),id_token_encryption_enc_values_supported:he(V()).optional(),userinfo_signing_alg_values_supported:he(V()).optional(),userinfo_encryption_alg_values_supported:he(V()).optional(),userinfo_encryption_enc_values_supported:he(V()).optional(),request_object_signing_alg_values_supported:he(V()).optional(),request_object_encryption_alg_values_supported:he(V()).optional(),request_object_encryption_enc_values_supported:he(V()).optional(),token_endpoint_auth_methods_supported:he(V()).optional(),token_endpoint_auth_signing_alg_values_supported:he(V()).optional(),display_values_supported:he(V()).optional(),claim_types_supported:he(V()).optional(),claims_supported:he(V()).optional(),service_documentation:V().optional(),claims_locales_supported:he(V()).optional(),ui_locales_supported:he(V()).optional(),claims_parameter_supported:It().optional(),request_parameter_supported:It().optional(),request_uri_parameter_supported:It().optional(),require_request_uri_registration:It().optional(),op_policy_uri:Ft.optional(),op_tos_uri:Ft.optional()}).passthrough(),u4=c4.merge(UE.pick({code_challenge_methods_supported:!0})),zE=se({access_token:V(),id_token:V().optional(),token_type:V(),expires_in:Ut().optional(),scope:V().optional(),refresh_token:V().optional()}).strip(),d4=se({error:V(),error_description:V().optional(),error_uri:V().optional()}),f4=se({redirect_uris:he(Ft),token_endpoint_auth_method:V().optional(),grant_types:he(V()).optional(),response_types:he(V()).optional(),client_name:V().optional(),client_uri:Ft.optional(),logo_uri:Ft.optional(),scope:V().optional(),contacts:he(V()).optional(),tos_uri:Ft.optional(),policy_uri:V().optional(),jwks_uri:Ft.optional(),jwks:eD().optional(),software_id:V().optional(),software_version:V().optional(),software_statement:V().optional()}).strip(),h4=se({client_id:V(),client_secret:V().optional(),client_id_issued_at:Ut().optional(),client_secret_expires_at:Ut().optional()}).strip(),p4=f4.merge(h4);se({error:V(),error_description:V().optional()}).strip();se({token:V(),token_type_hint:V().optional()}).strip();function m4(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function v4({requestedResource:t,configuredResource:e}){const r=typeof t=="string"?new URL(t):new URL(t.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==s.origin||r.pathname.length<s.pathname.length)return!1;const n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return n.startsWith(a)}class Kt extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class Bp extends Kt{}Bp.errorCode="invalid_request";class Xu extends Kt{}Xu.errorCode="invalid_client";class ed extends Kt{}ed.errorCode="invalid_grant";class td extends Kt{}td.errorCode="unauthorized_client";class Kp extends Kt{}Kp.errorCode="unsupported_grant_type";class Wp extends Kt{}Wp.errorCode="invalid_scope";class Qp extends Kt{}Qp.errorCode="access_denied";class gi extends Kt{}gi.errorCode="server_error";class Gp extends Kt{}Gp.errorCode="temporarily_unavailable";class Zp extends Kt{}Zp.errorCode="unsupported_response_type";class Yp extends Kt{}Yp.errorCode="unsupported_token_type";class Jp extends Kt{}Jp.errorCode="invalid_token";class Xp extends Kt{}Xp.errorCode="method_not_allowed";class em extends Kt{}em.errorCode="too_many_requests";class tm extends Kt{}tm.errorCode="invalid_client_metadata";class rm extends Kt{}rm.errorCode="insufficient_scope";const g4={[Bp.errorCode]:Bp,[Xu.errorCode]:Xu,[ed.errorCode]:ed,[td.errorCode]:td,[Kp.errorCode]:Kp,[Wp.errorCode]:Wp,[Qp.errorCode]:Qp,[gi.errorCode]:gi,[Gp.errorCode]:Gp,[Zp.errorCode]:Zp,[Yp.errorCode]:Yp,[Jp.errorCode]:Jp,[Xp.errorCode]:Xp,[em.errorCode]:em,[tm.errorCode]:tm,[rm.errorCode]:rm};class Dr extends Error{constructor(e){super(e??"Unauthorized")}}function VE(t,e){const r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function qE(t,e,r,s){const{client_id:n,client_secret:a}=e;switch(t){case"client_secret_basic":y4(n,a,r);return;case"client_secret_post":x4(n,a,s);return;case"none":w4(n,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function y4(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const s=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${s}`)}function x4(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function w4(t,e){e.set("client_id",t)}async function eg(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const s=d4.parse(JSON.parse(r)),{error:n,error_description:a,error_uri:o}=s,i=g4[n]||gi;return new i(a||"",o)}catch(s){const n=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${r}`;return new gi(n)}}async function Pn(t,e){var r,s;try{return await Gf(t,e)}catch(n){if(n instanceof Xu||n instanceof td)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await Gf(t,e);if(n instanceof ed)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await Gf(t,e);throw n}}async function Gf(t,{serverUrl:e,authorizationCode:r,scope:s,resourceMetadataUrl:n,fetchFn:a}){let o,i;try{o=await S4(e,{resourceMetadataUrl:n},a),o.authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch{}i||(i=e);const c=await b4(e,t,o),u=await k4(i,{fetchFn:a});let d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const p=await T4(i,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:a});await t.saveClientInformation(p),d=p}if(r!==void 0){const p=await t.codeVerifier(),y=await j4(i,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:p,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(y),"AUTHORIZED"}const h=await t.tokens();if(h!=null&&h.refresh_token)try{const p=await R4(i,{metadata:u,clientInformation:d,refreshToken:h.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof Kt)||p instanceof gi))throw p}const m=t.state?await t.state():void 0,{authorizationUrl:f,codeVerifier:w}=await N4(i,{metadata:u,clientInformation:d,state:m,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(w),await t.redirectToAuthorization(f),"REDIRECT"}async function b4(t,e,r){const s=m4(t);if(e.validateResourceURL)return await e.validateResourceURL(s,r==null?void 0:r.resource);if(r){if(!v4({requestedResource:s,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${s} (or origin)`);return new URL(r.resource)}}function nm(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[r,s]=e.split(" ");if(r.toLowerCase()!=="bearer"||!s)return;const a=/resource_metadata="([^"]*)"/.exec(e);if(a)try{return new URL(a[1])}catch{return}}async function S4(t,e,r=fetch){const s=await C4(t,"oauth-protected-resource",r,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return l4.parse(await s.json())}async function tg(t,e,r=fetch){try{return await r(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?tg(t,void 0,r):void 0;throw s}}function _4(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function L0(t,e,r=fetch){return await tg(t,{"MCP-Protocol-Version":e},r)}function E4(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function C4(t,e,r,s){var n,a;const o=new URL(t),i=(n=s==null?void 0:s.protocolVersion)!==null&&n!==void 0?n:qd;let c;if(s!=null&&s.metadataUrl)c=new URL(s.metadataUrl);else{const d=_4(e,o.pathname);c=new URL(d,(a=s==null?void 0:s.metadataServerUrl)!==null&&a!==void 0?a:o),c.search=o.search}let u=await L0(c,i,r);if(!(s!=null&&s.metadataUrl)&&E4(u,o.pathname)){const d=new URL(`/.well-known/${e}`,o);u=await L0(d,i,r)}return u}function P4(t){const e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",s=[];if(!r)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let n=e.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${n}`,e.origin),type:"oidc"}),s.push({url:new URL(`${n}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function k4(t,{fetchFn:e=fetch,protocolVersion:r=qd}={}){var s;const n={"MCP-Protocol-Version":r},a=P4(t);for(const{url:o,type:i}of a){const c=await tg(o,n,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(i==="oauth")return UE.parse(await c.json());{const u=u4.parse(await c.json());if(!(!((s=u.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${o}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function N4(t,{metadata:e,clientInformation:r,redirectUrl:s,scope:n,state:a,resource:o}){const i="code",c="S256";let u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(i))throw new Error(`Incompatible auth server: does not support response type ${i}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);const d=await i4(),h=d.code_verifier,m=d.code_challenge;return u.searchParams.set("response_type",i),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",m),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(s)),a&&u.searchParams.set("state",a),n&&u.searchParams.set("scope",n),n!=null&&n.includes("offline_access")&&u.searchParams.append("prompt","consent"),o&&u.searchParams.set("resource",o.href),{authorizationUrl:u,codeVerifier:h}}async function j4(t,{metadata:e,clientInformation:r,authorizationCode:s,codeVerifier:n,redirectUri:a,resource:o,addClientAuthentication:i,fetchFn:c}){var u;const d="authorization_code",h=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);const m=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),f=new URLSearchParams({grant_type:d,code:s,code_verifier:n,redirect_uri:String(a)});if(i)i(m,f,t,e);else{const p=(u=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],y=VE(r,p);qE(y,r,m,f)}o&&f.set("resource",o.href);const w=await(c??fetch)(h,{method:"POST",headers:m,body:f});if(!w.ok)throw await eg(w);return zE.parse(await w.json())}async function R4(t,{metadata:e,clientInformation:r,refreshToken:s,resource:n,addClientAuthentication:a,fetchFn:o}){var i;const c="refresh_token";let u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);const d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),h=new URLSearchParams({grant_type:c,refresh_token:s});if(a)a(d,h,t,e);else{const f=(i=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&i!==void 0?i:[],w=VE(r,f);qE(w,r,d,h)}n&&h.set("resource",n.href);const m=await(o??fetch)(u,{method:"POST",headers:d,body:h});if(!m.ok)throw await eg(m);return zE.parse({refresh_token:s,...await m.json()})}async function T4(t,{metadata:e,clientMetadata:r,fetchFn:s}){let n;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");n=new URL(e.registration_endpoint)}else n=new URL("/register",t);const a=await(s??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await eg(a);return p4.parse(await a.json())}class A4 extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class O4{constructor(e,r){this._url=e,this._resourceMetadataUrl=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}async _authThenStart(){var e;if(!this._authProvider)throw new Dr("No auth provider");let r;try{r=await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(r!=="AUTHORIZED")throw new Dr;return await this._startOrAuth()}async _commonHeaders(){var e;const r={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(r.Authorization=`Bearer ${s.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,s;const n=(s=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&s!==void 0?s:fetch;return new Promise((a,o)=>{this._eventSource=new ru(this._url.href,{...this._eventSourceInit,fetch:async(i,c)=>{const u=await this._commonHeaders();u.set("Accept","text/event-stream");const d=await n(i,{...c,headers:u});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=nm(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{var c;if(i.code===401&&this._authProvider){this._authThenStart().then(a,o);return}const u=new A4(i.code,i.message,i);o(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{var c;const u=i;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){o(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}a()}),this._eventSource.onmessage=i=>{var c,u;const d=i;let h;try{h=eu.parse(JSON.parse(d.data))}catch(m){(c=this.onerror)===null||c===void 0||c.call(this,m);return}(u=this.onmessage)===null||u===void 0||u.call(this,h)}})}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(e){if(!this._authProvider)throw new Dr("No auth provider");if(await Pn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr("Failed to authorize")}async close(){var e,r,s;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(s=this.onclose)===null||s===void 0||s.call(this)}async send(e){var r,s,n;if(!this._endpoint)throw new Error("Not connected");try{const a=await this._commonHeaders();a.set("content-type","application/json");const o={...this._requestInit,method:"POST",headers:a,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},i=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._endpoint,o);if(!i.ok){if(i.status===401&&this._authProvider){if(this._resourceMetadataUrl=nm(i),await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr;return this.send(e)}const c=await i.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${c}`)}}catch(a){throw(n=this.onerror)===null||n===void 0||n.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}}class I4 extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let n;super({start(a){n=FE({onEvent:o=>{a.enqueue(o)},onError(o){e==="terminate"?a.error(o):typeof e=="function"&&e(o)},onRetry:r,onComment:s})},transform(a){n.feed(a)}})}}const D4={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Zf extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class M4{constructor(e,r){var s;this._url=e,this._resourceMetadataUrl=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._sessionId=r==null?void 0:r.sessionId,this._reconnectionOptions=(s=r==null?void 0:r.reconnectionOptions)!==null&&s!==void 0?s:D4}async _authThenStart(){var e;if(!this._authProvider)throw new Dr("No auth provider");let r;try{r=await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(r!=="AUTHORIZED")throw new Dr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const r={};if(this._authProvider){const n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...s})}async _startOrAuthSse(e){var r,s,n;const{resumptionToken:a}=e;try{const o=await this._commonHeaders();o.set("Accept","text/event-stream"),a&&o.set("last-event-id",a);const i=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:o,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!i.ok){if(i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Zf(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(o){throw(n=this.onerror)===null||n===void 0||n.call(this,o),o}}_getNextReconnectionDelay(e){const r=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(s,e),n)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var s;const n=this._reconnectionOptions.maxRetries;if(n>0&&r>=n){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}const a=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},a)}_handleSseStream(e,r,s){if(!e)return;const{onresumptiontoken:n,replayMessageId:a}=r;let o;(async()=>{var c,u,d,h;try{const m=e.pipeThrough(new TextDecoderStream).pipeThrough(new I4).getReader();for(;;){const{value:f,done:w}=await m.read();if(w)break;if(f.id&&(o=f.id,n==null||n(f.id)),!f.event||f.event==="message")try{const p=eu.parse(JSON.parse(f.data));a!==void 0&&Mp(p)&&(p.id=a),(c=this.onmessage)===null||c===void 0||c.call(this,p)}catch(p){(u=this.onerror)===null||u===void 0||u.call(this,p)}}}catch(m){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${m}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:n,replayMessageId:a},0)}catch(f){(h=this.onerror)===null||h===void 0||h.call(this,new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}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(e){if(!this._authProvider)throw new Dr("No auth provider");if(await Pn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var s,n,a,o;try{const{resumptionToken:i,onresumptiontoken:c}=r||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:_E(e)?e.id:void 0}).catch(y=>{var g;return(g=this.onerror)===null||g===void 0?void 0:g.call(this,y)});return}const u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");const d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},h=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,d),m=h.headers.get("mcp-session-id");if(m&&(this._sessionId=m),!h.ok){if(h.status===401&&this._authProvider){if(this._resourceMetadataUrl=nm(h),await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr;return this.send(e)}const y=await h.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${h.status}): ${y}`)}if(h.status===202){uD(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(y=>{var g;return(g=this.onerror)===null||g===void 0?void 0:g.call(this,y)});return}const w=(Array.isArray(e)?e:[e]).filter(y=>"method"in y&&"id"in y&&y.id!==void 0).length>0,p=h.headers.get("content-type");if(w)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(h.body,{onresumptiontoken:c},!1);else if(p!=null&&p.includes("application/json")){const y=await h.json(),g=Array.isArray(y)?y.map(v=>eu.parse(v)):[eu.parse(y)];for(const v of g)(a=this.onmessage)===null||a===void 0||a.call(this,v)}else throw new Zf(-1,`Unexpected content type: ${p}`)}catch(i){throw(o=this.onerror)===null||o===void 0||o.call(this,i),i}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,s;if(this._sessionId)try{const n=await this._commonHeaders(),a={...this._requestInit,method:"DELETE",headers:n,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},o=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,a);if(!o.ok&&o.status!==405)throw new Zf(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(n){throw(s=this.onerror)===null||s===void 0||s.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}const $4=6e4;class F4{constructor(e){this._options=e,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.setNotificationHandler(Vv,r=>{const s=this._requestHandlerAbortControllers.get(r.params.requestId);s==null||s.abort(r.params.reason)}),this.setNotificationHandler(Hv,r=>{this._onprogress(r)}),this.setRequestHandler(qv,r=>({}))}_setupTimeout(e,r,s,n,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:s,resetTimeoutOnProgress:a,onTimeout:n})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const s=Date.now()-r.startTime;if(r.maxTotalTimeout&&s>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new qs(En.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:s});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,s,n;this._transport=e;const a=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{a==null||a(),this._onclose()};const o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{o==null||o(c),this._onerror(c)};const i=(n=this._transport)===null||n===void 0?void 0:n.onmessage;this._transport.onmessage=(c,u)=>{i==null||i(c,u),Mp(c)||oD(c)?this._onresponse(c):_E(c)?this._onrequest(c,u):aD(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;const r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const s=new qs(En.ConnectionClosed,"Connection closed");for(const n of r.values())n(s)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const s=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){var s,n;const a=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,o=this._transport;if(a===void 0){o==null||o.send({jsonrpc:"2.0",id:e.id,error:{code:En.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);const c={signal:i.signal,sessionId:o==null?void 0:o.sessionId,_meta:(n=e.params)===null||n===void 0?void 0:n._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,h)=>this.request(u,d,{...h,relatedRequestId:e.id}),authInfo:r==null?void 0:r.authInfo,requestId:e.id,requestInfo:r==null?void 0:r.requestInfo};Promise.resolve().then(()=>a(e,c)).then(u=>{if(!i.signal.aborted)return o==null?void 0:o.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var d;if(!i.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:En.InternalError,message:(d=u.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...s}=e.params,n=Number(r),a=this._progressHandlers.get(n);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const o=this._responseHandlers.get(n),i=this._timeoutInfo.get(n);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){o(c);return}a(s)}_onresponse(e){const r=Number(e.id),s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Mp(e))s(e);else{const n=new qs(e.error.code,e.error.message,e.error.data);s(n)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,s){const{relatedRequestId:n,resumptionToken:a,onresumptiontoken:o}=s??{};return new Promise((i,c)=>{var u,d,h,m,f,w;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=s==null?void 0:s.signal)===null||d===void 0||d.throwIfAborted();const p=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),y.params={...e.params,_meta:{...((h=e.params)===null||h===void 0?void 0:h._meta)||{},progressToken:p}});const g=S=>{var E;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(E=this._transport)===null||E===void 0||E.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:n,resumptionToken:a,onresumptiontoken:o}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`))),c(S)};this._responseHandlers.set(p,S=>{var E;if(!(!((E=s==null?void 0:s.signal)===null||E===void 0)&&E.aborted)){if(S instanceof Error)return c(S);try{const N=r.parse(S.result);i(N)}catch(N){c(N)}}}),(m=s==null?void 0:s.signal)===null||m===void 0||m.addEventListener("abort",()=>{var S;g((S=s==null?void 0:s.signal)===null||S===void 0?void 0:S.reason)});const v=(f=s==null?void 0:s.timeout)!==null&&f!==void 0?f:$4,b=()=>g(new qs(En.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(p,v,s==null?void 0:s.maxTotalTimeout,b,(w=s==null?void 0:s.resetTimeoutOnProgress)!==null&&w!==void 0?w:!1),this._transport.send(y,{relatedRequestId:n,resumptionToken:a,onresumptiontoken:o}).catch(S=>{this._cleanupTimeout(p),c(S)})})}async notification(e,r){var s,n;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((n=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&n!==void 0?n:[]).includes(e.method)&&!e.params&&!(r!=null&&r.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(d=>this._onerror(d))});return}const i={...e,jsonrpc:"2.0"};await this._transport.send(i,r)}setRequestHandler(e,r){const s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(n,a)=>Promise.resolve(r(e.parse(n),a)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(r(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function L4(t,e){return Object.entries(e).reduce((r,[s,n])=>(n&&typeof n=="object"?r[s]=r[s]?{...r[s],...n}:n:r[s]=n,r),{...t})}var sm={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(t,e){(function(r,s){s(e)})(EC,function(r){function s(){for(var M=arguments.length,k=Array(M),$=0;$<M;$++)k[$]=arguments[$];if(k.length>1){k[0]=k[0].slice(0,-1);for(var H=k.length-1,q=1;q<H;++q)k[q]=k[q].slice(1,-1);return k[H]=k[H].slice(1),k.join("")}else return k[0]}function n(M){return"(?:"+M+")"}function a(M){return M===void 0?"undefined":M===null?"null":Object.prototype.toString.call(M).split(" ").pop().split("]").shift().toLowerCase()}function o(M){return M.toUpperCase()}function i(M){return M!=null?M instanceof Array?M:typeof M.length!="number"||M.split||M.setInterval||M.call?[M]:Array.prototype.slice.call(M):[]}function c(M,k){var $=M;if(k)for(var H in k)$[H]=k[H];return $}function u(M){var k="[A-Za-z]",$="[0-9]",H=s($,"[A-Fa-f]"),q=n(n("%[EFef]"+H+"%"+H+H+"%"+H+H)+"|"+n("%[89A-Fa-f]"+H+"%"+H+H)+"|"+n("%"+H+H)),xe="[\\:\\/\\?\\#\\[\\]\\@]",we="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Qe=s(xe,we),ot=M?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",bt=M?"[\\uE000-\\uF8FF]":"[]",He=s(k,$,"[\\-\\.\\_\\~]",ot);n(k+s(k,$,"[\\+\\-\\.]")+"*"),n(n(q+"|"+s(He,we,"[\\:]"))+"*");var nt=n(n("25[0-5]")+"|"+n("2[0-4]"+$)+"|"+n("1"+$+$)+"|"+n("0?[1-9]"+$)+"|0?0?"+$),St=n(nt+"\\."+nt+"\\."+nt+"\\."+nt),Re=n(H+"{1,4}"),ut=n(n(Re+"\\:"+Re)+"|"+St),Ct=n(n(Re+"\\:")+"{6}"+ut),dt=n("\\:\\:"+n(Re+"\\:")+"{5}"+ut),gs=n(n(Re)+"?\\:\\:"+n(Re+"\\:")+"{4}"+ut),cn=n(n(n(Re+"\\:")+"{0,1}"+Re)+"?\\:\\:"+n(Re+"\\:")+"{3}"+ut),un=n(n(n(Re+"\\:")+"{0,2}"+Re)+"?\\:\\:"+n(Re+"\\:")+"{2}"+ut),io=n(n(n(Re+"\\:")+"{0,3}"+Re)+"?\\:\\:"+Re+"\\:"+ut),xa=n(n(n(Re+"\\:")+"{0,4}"+Re)+"?\\:\\:"+ut),Rr=n(n(n(Re+"\\:")+"{0,5}"+Re)+"?\\:\\:"+Re),dn=n(n(n(Re+"\\:")+"{0,6}"+Re)+"?\\:\\:"),wa=n([Ct,dt,gs,cn,un,io,xa,Rr,dn].join("|")),Fn=n(n(He+"|"+q)+"+");n("[vV]"+H+"+\\."+s(He,we,"[\\:]")+"+"),n(n(q+"|"+s(He,we))+"*");var Ni=n(q+"|"+s(He,we,"[\\:\\@]"));return n(n(q+"|"+s(He,we,"[\\@]"))+"+"),n(n(Ni+"|"+s("[\\/\\?]",bt))+"*"),{NOT_SCHEME:new RegExp(s("[^]",k,$,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",He,we),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",He,we),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",He,we),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",He,we),"g"),NOT_QUERY:new RegExp(s("[^\\%]",He,we,"[\\:\\@\\/\\?]",bt),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",He,we,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",He,we),"g"),UNRESERVED:new RegExp(He,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",He,Qe),"g"),PCT_ENCODED:new RegExp(q,"g"),IPV4ADDRESS:new RegExp("^("+St+")$"),IPV6ADDRESS:new RegExp("^\\[?("+wa+")"+n(n("\\%25|\\%(?!"+H+"{2})")+"("+Fn+")")+"?\\]?$")}}var d=u(!1),h=u(!0),m=function(){function M(k,$){var H=[],q=!0,xe=!1,we=void 0;try{for(var Qe=k[Symbol.iterator](),ot;!(q=(ot=Qe.next()).done)&&(H.push(ot.value),!($&&H.length===$));q=!0);}catch(bt){xe=!0,we=bt}finally{try{!q&&Qe.return&&Qe.return()}finally{if(xe)throw we}}return H}return function(k,$){if(Array.isArray(k))return k;if(Symbol.iterator in Object(k))return M(k,$);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function(M){if(Array.isArray(M)){for(var k=0,$=Array(M.length);k<M.length;k++)$[k]=M[k];return $}else return Array.from(M)},w=2147483647,p=36,y=1,g=26,v=38,b=700,S=72,E=128,N="-",j=/^xn--/,R=/[^\0-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=p-y,_=Math.floor,I=String.fromCharCode;function C(M){throw new RangeError(F[M])}function z(M,k){for(var $=[],H=M.length;H--;)$[H]=k(M[H]);return $}function U(M,k){var $=M.split("@"),H="";$.length>1&&(H=$[0]+"@",M=$[1]),M=M.replace(A,".");var q=M.split("."),xe=z(q,k).join(".");return H+xe}function K(M){for(var k=[],$=0,H=M.length;$<H;){var q=M.charCodeAt($++);if(q>=55296&&q<=56319&&$<H){var xe=M.charCodeAt($++);(xe&64512)==56320?k.push(((q&1023)<<10)+(xe&1023)+65536):(k.push(q),$--)}else k.push(q)}return k}var P=function(k){return String.fromCodePoint.apply(String,f(k))},D=function(k){return k-48<10?k-22:k-65<26?k-65:k-97<26?k-97:p},L=function(k,$){return k+22+75*(k<26)-(($!=0)<<5)},X=function(k,$,H){var q=0;for(k=H?_(k/b):k>>1,k+=_(k/$);k>T*g>>1;q+=p)k=_(k/T);return _(q+(T+1)*k/(k+v))},G=function(k){var $=[],H=k.length,q=0,xe=E,we=S,Qe=k.lastIndexOf(N);Qe<0&&(Qe=0);for(var ot=0;ot<Qe;++ot)k.charCodeAt(ot)>=128&&C("not-basic"),$.push(k.charCodeAt(ot));for(var bt=Qe>0?Qe+1:0;bt<H;){for(var He=q,nt=1,St=p;;St+=p){bt>=H&&C("invalid-input");var Re=D(k.charCodeAt(bt++));(Re>=p||Re>_((w-q)/nt))&&C("overflow"),q+=Re*nt;var ut=St<=we?y:St>=we+g?g:St-we;if(Re<ut)break;var Ct=p-ut;nt>_(w/Ct)&&C("overflow"),nt*=Ct}var dt=$.length+1;we=X(q-He,dt,He==0),_(q/dt)>w-xe&&C("overflow"),xe+=_(q/dt),q%=dt,$.splice(q++,0,xe)}return String.fromCodePoint.apply(String,$)},B=function(k){var $=[];k=K(k);var H=k.length,q=E,xe=0,we=S,Qe=!0,ot=!1,bt=void 0;try{for(var He=k[Symbol.iterator](),nt;!(Qe=(nt=He.next()).done);Qe=!0){var St=nt.value;St<128&&$.push(I(St))}}catch(ji){ot=!0,bt=ji}finally{try{!Qe&&He.return&&He.return()}finally{if(ot)throw bt}}var Re=$.length,ut=Re;for(Re&&$.push(N);ut<H;){var Ct=w,dt=!0,gs=!1,cn=void 0;try{for(var un=k[Symbol.iterator](),io;!(dt=(io=un.next()).done);dt=!0){var xa=io.value;xa>=q&&xa<Ct&&(Ct=xa)}}catch(ji){gs=!0,cn=ji}finally{try{!dt&&un.return&&un.return()}finally{if(gs)throw cn}}var Rr=ut+1;Ct-q>_((w-xe)/Rr)&&C("overflow"),xe+=(Ct-q)*Rr,q=Ct;var dn=!0,wa=!1,Fn=void 0;try{for(var Ni=k[Symbol.iterator](),pg;!(dn=(pg=Ni.next()).done);dn=!0){var mg=pg.value;if(mg<q&&++xe>w&&C("overflow"),mg==q){for(var ec=xe,tc=p;;tc+=p){var rc=tc<=we?y:tc>=we+g?g:tc-we;if(ec<rc)break;var vg=ec-rc,gg=p-rc;$.push(I(L(rc+vg%gg,0))),ec=_(vg/gg)}$.push(I(L(ec,0))),we=X(xe,Rr,ut==Re),xe=0,++ut}}}catch(ji){wa=!0,Fn=ji}finally{try{!dn&&Ni.return&&Ni.return()}finally{if(wa)throw Fn}}++xe,++q}return $.join("")},oe=function(k){return U(k,function($){return j.test($)?G($.slice(4).toLowerCase()):$})},ve=function(k){return U(k,function($){return R.test($)?"xn--"+B($):$})},ge={version:"2.1.0",ucs2:{decode:K,encode:P},decode:G,encode:B,toASCII:ve,toUnicode:oe},re={};function ye(M){var k=M.charCodeAt(0),$=void 0;return k<16?$="%0"+k.toString(16).toUpperCase():k<128?$="%"+k.toString(16).toUpperCase():k<2048?$="%"+(k>>6|192).toString(16).toUpperCase()+"%"+(k&63|128).toString(16).toUpperCase():$="%"+(k>>12|224).toString(16).toUpperCase()+"%"+(k>>6&63|128).toString(16).toUpperCase()+"%"+(k&63|128).toString(16).toUpperCase(),$}function ke(M){for(var k="",$=0,H=M.length;$<H;){var q=parseInt(M.substr($+1,2),16);if(q<128)k+=String.fromCharCode(q),$+=3;else if(q>=194&&q<224){if(H-$>=6){var xe=parseInt(M.substr($+4,2),16);k+=String.fromCharCode((q&31)<<6|xe&63)}else k+=M.substr($,6);$+=6}else if(q>=224){if(H-$>=9){var we=parseInt(M.substr($+4,2),16),Qe=parseInt(M.substr($+7,2),16);k+=String.fromCharCode((q&15)<<12|(we&63)<<6|Qe&63)}else k+=M.substr($,9);$+=9}else k+=M.substr($,3),$+=3}return k}function me(M,k){function $(H){var q=ke(H);return q.match(k.UNRESERVED)?q:H}return M.scheme&&(M.scheme=String(M.scheme).replace(k.PCT_ENCODED,$).toLowerCase().replace(k.NOT_SCHEME,"")),M.userinfo!==void 0&&(M.userinfo=String(M.userinfo).replace(k.PCT_ENCODED,$).replace(k.NOT_USERINFO,ye).replace(k.PCT_ENCODED,o)),M.host!==void 0&&(M.host=String(M.host).replace(k.PCT_ENCODED,$).toLowerCase().replace(k.NOT_HOST,ye).replace(k.PCT_ENCODED,o)),M.path!==void 0&&(M.path=String(M.path).replace(k.PCT_ENCODED,$).replace(M.scheme?k.NOT_PATH:k.NOT_PATH_NOSCHEME,ye).replace(k.PCT_ENCODED,o)),M.query!==void 0&&(M.query=String(M.query).replace(k.PCT_ENCODED,$).replace(k.NOT_QUERY,ye).replace(k.PCT_ENCODED,o)),M.fragment!==void 0&&(M.fragment=String(M.fragment).replace(k.PCT_ENCODED,$).replace(k.NOT_FRAGMENT,ye).replace(k.PCT_ENCODED,o)),M}function ee(M){return M.replace(/^0*(.*)/,"$1")||"0"}function _e(M,k){var $=M.match(k.IPV4ADDRESS)||[],H=m($,2),q=H[1];return q?q.split(".").map(ee).join("."):M}function Pe(M,k){var $=M.match(k.IPV6ADDRESS)||[],H=m($,3),q=H[1],xe=H[2];if(q){for(var we=q.toLowerCase().split("::").reverse(),Qe=m(we,2),ot=Qe[0],bt=Qe[1],He=bt?bt.split(":").map(ee):[],nt=ot.split(":").map(ee),St=k.IPV4ADDRESS.test(nt[nt.length-1]),Re=St?7:8,ut=nt.length-Re,Ct=Array(Re),dt=0;dt<Re;++dt)Ct[dt]=He[dt]||nt[ut+dt]||"";St&&(Ct[Re-1]=_e(Ct[Re-1],k));var gs=Ct.reduce(function(Rr,dn,wa){if(!dn||dn==="0"){var Fn=Rr[Rr.length-1];Fn&&Fn.index+Fn.length===wa?Fn.length++:Rr.push({index:wa,length:1})}return Rr},[]),cn=gs.sort(function(Rr,dn){return dn.length-Rr.length})[0],un=void 0;if(cn&&cn.length>1){var io=Ct.slice(0,cn.index),xa=Ct.slice(cn.index+cn.length);un=io.join(":")+"::"+xa.join(":")}else un=Ct.join(":");return xe&&(un+="%"+xe),un}else return M}var De=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,J="".match(/(){0}/)[1]===void 0;function ce(M){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$={},H=k.iri!==!1?h:d;k.reference==="suffix"&&(M=(k.scheme?k.scheme+":":"")+"//"+M);var q=M.match(De);if(q){J?($.scheme=q[1],$.userinfo=q[3],$.host=q[4],$.port=parseInt(q[5],10),$.path=q[6]||"",$.query=q[7],$.fragment=q[8],isNaN($.port)&&($.port=q[5])):($.scheme=q[1]||void 0,$.userinfo=M.indexOf("@")!==-1?q[3]:void 0,$.host=M.indexOf("//")!==-1?q[4]:void 0,$.port=parseInt(q[5],10),$.path=q[6]||"",$.query=M.indexOf("?")!==-1?q[7]:void 0,$.fragment=M.indexOf("#")!==-1?q[8]:void 0,isNaN($.port)&&($.port=M.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?q[4]:void 0)),$.host&&($.host=Pe(_e($.host,H),H)),$.scheme===void 0&&$.userinfo===void 0&&$.host===void 0&&$.port===void 0&&!$.path&&$.query===void 0?$.reference="same-document":$.scheme===void 0?$.reference="relative":$.fragment===void 0?$.reference="absolute":$.reference="uri",k.reference&&k.reference!=="suffix"&&k.reference!==$.reference&&($.error=$.error||"URI is not a "+k.reference+" reference.");var xe=re[(k.scheme||$.scheme||"").toLowerCase()];if(!k.unicodeSupport&&(!xe||!xe.unicodeSupport)){if($.host&&(k.domainHost||xe&&xe.domainHost))try{$.host=ge.toASCII($.host.replace(H.PCT_ENCODED,ke).toLowerCase())}catch(we){$.error=$.error||"Host's domain name can not be converted to ASCII via punycode: "+we}me($,d)}else me($,H);xe&&xe.parse&&xe.parse($,k)}else $.error=$.error||"URI can not be parsed.";return $}function Y(M,k){var $=k.iri!==!1?h:d,H=[];return M.userinfo!==void 0&&(H.push(M.userinfo),H.push("@")),M.host!==void 0&&H.push(Pe(_e(String(M.host),$),$).replace($.IPV6ADDRESS,function(q,xe,we){return"["+xe+(we?"%25"+we:"")+"]"})),(typeof M.port=="number"||typeof M.port=="string")&&(H.push(":"),H.push(String(M.port))),H.length?H.join(""):void 0}var ze=/^\.\.?\//,te=/^\/\.(\/|$)/,Me=/^\/\.\.(\/|$)/,Ue=/^\/?(?:.|\n)*?(?=\/|$)/;function Ne(M){for(var k=[];M.length;)if(M.match(ze))M=M.replace(ze,"");else if(M.match(te))M=M.replace(te,"/");else if(M.match(Me))M=M.replace(Me,"/"),k.pop();else if(M==="."||M==="..")M="";else{var $=M.match(Ue);if($){var H=$[0];M=M.slice(H.length),k.push(H)}else throw new Error("Unexpected dot segment condition")}return k.join("")}function rt(M){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=k.iri?h:d,H=[],q=re[(k.scheme||M.scheme||"").toLowerCase()];if(q&&q.serialize&&q.serialize(M,k),M.host&&!$.IPV6ADDRESS.test(M.host)){if(k.domainHost||q&&q.domainHost)try{M.host=k.iri?ge.toUnicode(M.host):ge.toASCII(M.host.replace($.PCT_ENCODED,ke).toLowerCase())}catch(Qe){M.error=M.error||"Host's domain name can not be converted to "+(k.iri?"Unicode":"ASCII")+" via punycode: "+Qe}}me(M,$),k.reference!=="suffix"&&M.scheme&&(H.push(M.scheme),H.push(":"));var xe=Y(M,k);if(xe!==void 0&&(k.reference!=="suffix"&&H.push("//"),H.push(xe),M.path&&M.path.charAt(0)!=="/"&&H.push("/")),M.path!==void 0){var we=M.path;!k.absolutePath&&(!q||!q.absolutePath)&&(we=Ne(we)),xe===void 0&&(we=we.replace(/^\/\//,"/%2F")),H.push(we)}return M.query!==void 0&&(H.push("?"),H.push(M.query)),M.fragment!==void 0&&(H.push("#"),H.push(M.fragment)),H.join("")}function pt(M,k){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},H=arguments[3],q={};return H||(M=ce(rt(M,$),$),k=ce(rt(k,$),$)),$=$||{},!$.tolerant&&k.scheme?(q.scheme=k.scheme,q.userinfo=k.userinfo,q.host=k.host,q.port=k.port,q.path=Ne(k.path||""),q.query=k.query):(k.userinfo!==void 0||k.host!==void 0||k.port!==void 0?(q.userinfo=k.userinfo,q.host=k.host,q.port=k.port,q.path=Ne(k.path||""),q.query=k.query):(k.path?(k.path.charAt(0)==="/"?q.path=Ne(k.path):((M.userinfo!==void 0||M.host!==void 0||M.port!==void 0)&&!M.path?q.path="/"+k.path:M.path?q.path=M.path.slice(0,M.path.lastIndexOf("/")+1)+k.path:q.path=k.path,q.path=Ne(q.path)),q.query=k.query):(q.path=M.path,k.query!==void 0?q.query=k.query:q.query=M.query),q.userinfo=M.userinfo,q.host=M.host,q.port=M.port),q.scheme=M.scheme),q.fragment=k.fragment,q}function Hr(M,k,$){var H=c({scheme:"null"},$);return rt(pt(ce(M,H),ce(k,H),H,!0),H)}function zt(M,k){return typeof M=="string"?M=rt(ce(M,k),k):a(M)==="object"&&(M=ce(rt(M,k),k)),M}function hs(M,k,$){return typeof M=="string"?M=rt(ce(M,$),$):a(M)==="object"&&(M=rt(M,$)),typeof k=="string"?k=rt(ce(k,$),$):a(k)==="object"&&(k=rt(k,$)),M===k}function oo(M,k){return M&&M.toString().replace(!k||!k.iri?d.ESCAPE:h.ESCAPE,ye)}function Yt(M,k){return M&&M.toString().replace(!k||!k.iri?d.PCT_ENCODED:h.PCT_ENCODED,ke)}var Br={scheme:"http",domainHost:!0,parse:function(k,$){return k.host||(k.error=k.error||"HTTP URIs must have a host."),k},serialize:function(k,$){var H=String(k.scheme).toLowerCase()==="https";return(k.port===(H?443:80)||k.port==="")&&(k.port=void 0),k.path||(k.path="/"),k}},ps={scheme:"https",domainHost:Br.domainHost,parse:Br.parse,serialize:Br.serialize};function jr(M){return typeof M.secure=="boolean"?M.secure:String(M.scheme).toLowerCase()==="wss"}var Dn={scheme:"ws",domainHost:!0,parse:function(k,$){var H=k;return H.secure=jr(H),H.resourceName=(H.path||"/")+(H.query?"?"+H.query:""),H.path=void 0,H.query=void 0,H},serialize:function(k,$){if((k.port===(jr(k)?443:80)||k.port==="")&&(k.port=void 0),typeof k.secure=="boolean"&&(k.scheme=k.secure?"wss":"ws",k.secure=void 0),k.resourceName){var H=k.resourceName.split("?"),q=m(H,2),xe=q[0],we=q[1];k.path=xe&&xe!=="/"?xe:void 0,k.query=we,k.resourceName=void 0}return k.fragment=void 0,k}},ms={scheme:"wss",domainHost:Dn.domainHost,parse:Dn.parse,serialize:Dn.serialize},ya={},vs="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ne="[0-9A-Fa-f]",Et=n(n("%[EFef]"+ne+"%"+ne+ne+"%"+ne+ne)+"|"+n("%[89A-Fa-f]"+ne+"%"+ne+ne)+"|"+n("%"+ne+ne)),Mn="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",$n="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Yl=s($n,'[\\"\\\\]'),Jl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Xl=new RegExp(vs,"g"),le=new RegExp(Et,"g"),je=new RegExp(s("[^]",Mn,"[\\.]",'[\\"]',Yl),"g"),at=new RegExp(s("[^]",vs,Jl),"g"),Dt=at;function Nt(M){var k=ke(M);return k.match(Xl)?k:M}var dg={scheme:"mailto",parse:function(k,$){var H=k,q=H.to=H.path?H.path.split(","):[];if(H.path=void 0,H.query){for(var xe=!1,we={},Qe=H.query.split("&"),ot=0,bt=Qe.length;ot<bt;++ot){var He=Qe[ot].split("=");switch(He[0]){case"to":for(var nt=He[1].split(","),St=0,Re=nt.length;St<Re;++St)q.push(nt[St]);break;case"subject":H.subject=Yt(He[1],$);break;case"body":H.body=Yt(He[1],$);break;default:xe=!0,we[Yt(He[0],$)]=Yt(He[1],$);break}}xe&&(H.headers=we)}H.query=void 0;for(var ut=0,Ct=q.length;ut<Ct;++ut){var dt=q[ut].split("@");if(dt[0]=Yt(dt[0]),$.unicodeSupport)dt[1]=Yt(dt[1],$).toLowerCase();else try{dt[1]=ge.toASCII(Yt(dt[1],$).toLowerCase())}catch(gs){H.error=H.error||"Email address's domain name can not be converted to ASCII via punycode: "+gs}q[ut]=dt.join("@")}return H},serialize:function(k,$){var H=k,q=i(k.to);if(q){for(var xe=0,we=q.length;xe<we;++xe){var Qe=String(q[xe]),ot=Qe.lastIndexOf("@"),bt=Qe.slice(0,ot).replace(le,Nt).replace(le,o).replace(je,ye),He=Qe.slice(ot+1);try{He=$.iri?ge.toUnicode(He):ge.toASCII(Yt(He,$).toLowerCase())}catch(ut){H.error=H.error||"Email address's domain name can not be converted to "+($.iri?"Unicode":"ASCII")+" via punycode: "+ut}q[xe]=bt+"@"+He}H.path=q.join(",")}var nt=k.headers=k.headers||{};k.subject&&(nt.subject=k.subject),k.body&&(nt.body=k.body);var St=[];for(var Re in nt)nt[Re]!==ya[Re]&&St.push(Re.replace(le,Nt).replace(le,o).replace(at,ye)+"="+nt[Re].replace(le,Nt).replace(le,o).replace(Dt,ye));return St.length&&(H.query=St.join("&")),H}},xC=/^([^\:]+)\:(.*)/,fg={scheme:"urn",parse:function(k,$){var H=k.path&&k.path.match(xC),q=k;if(H){var xe=$.scheme||q.scheme||"urn",we=H[1].toLowerCase(),Qe=H[2],ot=xe+":"+($.nid||we),bt=re[ot];q.nid=we,q.nss=Qe,q.path=void 0,bt&&(q=bt.parse(q,$))}else q.error=q.error||"URN can not be parsed.";return q},serialize:function(k,$){var H=$.scheme||k.scheme||"urn",q=k.nid,xe=H+":"+($.nid||q),we=re[xe];we&&(k=we.serialize(k,$));var Qe=k,ot=k.nss;return Qe.path=(q||$.nid)+":"+ot,Qe}},wC=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,hg={scheme:"urn:uuid",parse:function(k,$){var H=k;return H.uuid=H.nss,H.nss=void 0,!$.tolerant&&(!H.uuid||!H.uuid.match(wC))&&(H.error=H.error||"UUID is not valid."),H},serialize:function(k,$){var H=k;return H.nss=(k.uuid||"").toLowerCase(),H}};re[Br.scheme]=Br,re[ps.scheme]=ps,re[Dn.scheme]=Dn,re[ms.scheme]=ms,re[dg.scheme]=dg,re[fg.scheme]=fg,re[hg.scheme]=hg,r.SCHEMES=re,r.pctEncChar=ye,r.pctDecChars=ke,r.parse=ce,r.removeDotSegments=Ne,r.serialize=rt,r.resolveComponents=pt,r.resolve=Hr,r.normalize=zt,r.equal=hs,r.escapeComponent=oo,r.unescapeComponent=Yt,Object.defineProperty(r,"__esModule",{value:!0})})})(sm,sm.exports);var U4=sm.exports,rg=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var s,n,a;if(Array.isArray(e)){if(s=e.length,s!=r.length)return!1;for(n=s;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(a=Object.keys(e),s=a.length,s!==Object.keys(r).length)return!1;for(n=s;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[n]))return!1;for(n=s;n--!==0;){var o=a[n];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r},z4=function(e){for(var r=0,s=e.length,n=0,a;n<s;)r++,a=e.charCodeAt(n++),a>=55296&&a<=56319&&n<s&&(a=e.charCodeAt(n),(a&64512)==56320&&n++);return r},ki={copy:V4,checkDataType:am,checkDataTypes:q4,coerceToTypes:H4,toHash:ng,getProperty:sg,escapeQuotes:ag,equal:rg,ucs2length:z4,varOccurences:W4,varReplace:Q4,schemaHasRules:G4,schemaHasRulesExcept:Z4,schemaUnknownRules:Y4,toQuotedString:om,getPathExpr:J4,getPath:X4,getData:rM,unescapeFragment:nM,unescapeJsonPointer:ig,escapeFragment:sM,escapeJsonPointer:og};function V4(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function am(t,e,r,s){var n=s?" !== ":" === ",a=s?" || ":" && ",o=s?"!":"",i=s?"":"!";switch(t){case"null":return e+n+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+a+"typeof "+e+n+'"object"'+a+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+n+'"number"'+a+i+"("+e+" % 1)"+a+e+n+e+(r?a+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+n+'"'+t+'"'+(r?a+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+n+'"'+t+'"'}}function q4(t,e,r){switch(t.length){case 1:return am(t[0],e,r,!0);default:var s="",n=ng(t);n.array&&n.object&&(s=n.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer;for(var a in n)s+=(s?" && ":"")+am(a,e,r,!0);return s}}var U0=ng(["string","number","integer","boolean","null"]);function H4(t,e){if(Array.isArray(e)){for(var r=[],s=0;s<e.length;s++){var n=e[s];(U0[n]||t==="array"&&n==="array")&&(r[r.length]=n)}if(r.length)return r}else{if(U0[e])return[e];if(t==="array"&&e==="array")return["array"]}}function ng(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var B4=/^[a-z$_][a-z$_0-9]*$/i,K4=/'|\\/g;function sg(t){return typeof t=="number"?"["+t+"]":B4.test(t)?"."+t:"['"+ag(t)+"']"}function ag(t){return t.replace(K4,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function W4(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function Q4(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function G4(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function Z4(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var s in t)if(s!=r&&e[s])return!0}function Y4(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function om(t){return"'"+ag(t)+"'"}function J4(t,e,r,s){var n=r?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return HE(t,n)}function X4(t,e,r){var s=om(r?"/"+og(e):sg(e));return HE(t,s)}var eM=/^\/(?:[^~]|~0|~1)*$/,tM=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function rM(t,e,r){var s,n,a,o;if(t==="")return"rootData";if(t[0]=="/"){if(!eM.test(t))throw new Error("Invalid JSON-pointer: "+t);n=t,a="rootData"}else{if(o=t.match(tM),!o)throw new Error("Invalid JSON-pointer: "+t);if(s=+o[1],n=o[2],n=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return r[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(a="data"+(e-s||""),!n)return a}for(var i=a,c=n.split("/"),u=0;u<c.length;u++){var d=c[u];d&&(a+=sg(ig(d)),i+=" && "+a)}return i}function HE(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function nM(t){return ig(decodeURIComponent(t))}function sM(t){return encodeURIComponent(og(t))}function og(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ig(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var aM=ki,BE=oM;function oM(t){aM.copy(t,this)}var KE={exports:{}},Hs=KE.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var s=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};nu(e,s,n,t,"",t)};Hs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Hs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Hs.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Hs.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 nu(t,e,r,s,n,a,o,i,c,u){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,n,a,o,i,c,u);for(var d in s){var h=s[d];if(Array.isArray(h)){if(d in Hs.arrayKeywords)for(var m=0;m<h.length;m++)nu(t,e,r,h[m],n+"/"+d+"/"+m,a,n,d,s,m)}else if(d in Hs.propsKeywords){if(h&&typeof h=="object")for(var f in h)nu(t,e,r,h[f],n+"/"+d+"/"+iM(f),a,n,d,s,f)}else(d in Hs.keywords||t.allKeys&&!(d in Hs.skipKeywords))&&nu(t,e,r,h,n+"/"+d,a,n,d,s)}r(s,n,a,o,i,c,u)}}function iM(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var lM=KE.exports,Zl=U4,z0=rg,Gd=ki,rd=BE,cM=lM,lg=ga;ga.normalizeId=ra;ga.fullPath=nd;ga.url=sd;ga.ids=pM;ga.inlineRef=im;ga.schema=Zd;function ga(t,e,r){var s=this._refs[r];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return ga.call(this,t,e,s);if(s=s||this._schemas[r],s instanceof rd)return im(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var n=Zd.call(this,e,r),a,o,i;return n&&(a=n.schema,e=n.root,i=n.baseId),a instanceof rd?o=a.validate||t.call(this,a.schema,e,void 0,i):a!==void 0&&(o=im(a,this._opts.inlineRefs)?a:t.call(this,a,e,void 0,i)),o}function Zd(t,e){var r=Zl.parse(e),s=QE(r),n=nd(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==n){var a=ra(s),o=this._refs[a];if(typeof o=="string")return uM.call(this,t,o,r);if(o instanceof rd)o.validate||this._compile(o),t=o;else if(o=this._schemas[a],o instanceof rd){if(o.validate||this._compile(o),a==ra(e))return{schema:o,root:t,baseId:n};t=o}else return;if(!t.schema)return;n=nd(this._getId(t.schema))}return WE.call(this,r,n,t.schema,t)}function uM(t,e,r){var s=Zd.call(this,t,e);if(s){var n=s.schema,a=s.baseId;t=s.root;var o=this._getId(n);return o&&(a=sd(a,o)),WE.call(this,r,a,n,t)}}var dM=Gd.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function WE(t,e,r,s){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var n=t.fragment.split("/"),a=1;a<n.length;a++){var o=n[a];if(o){if(o=Gd.unescapeFragment(o),r=r[o],r===void 0)break;var i;if(!dM[o]&&(i=this._getId(r),i&&(e=sd(e,i)),r.$ref)){var c=sd(e,r.$ref),u=Zd.call(this,s,c);u&&(r=u.schema,s=u.root,e=u.baseId)}}}if(r!==void 0&&r!==s.schema)return{schema:r,root:s,baseId:e}}}var fM=Gd.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function im(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return lm(t);if(e)return cm(t)<=e}function lm(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!lm(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!lm(e)))return!1;return!0}function cm(t){var e=0,r;if(Array.isArray(t)){for(var s=0;s<t.length;s++)if(r=t[s],typeof r=="object"&&(e+=cm(r)),e==1/0)return 1/0}else for(var n in t){if(n=="$ref")return 1/0;if(fM[n])e++;else if(r=t[n],typeof r=="object"&&(e+=cm(r)+1),e==1/0)return 1/0}return e}function nd(t,e){e!==!1&&(t=ra(t));var r=Zl.parse(t);return QE(r)}function QE(t){return Zl.serialize(t).split("#")[0]+"#"}var hM=/#\/?$/;function ra(t){return t?t.replace(hM,""):""}function sd(t,e){return e=ra(e),Zl.resolve(t,e)}function pM(t){var e=ra(this._getId(t)),r={"":e},s={"":nd(e,!1)},n={},a=this;return cM(t,{allKeys:!0},function(o,i,c,u,d,h,m){if(i!==""){var f=a._getId(o),w=r[u],p=s[u]+"/"+d;if(m!==void 0&&(p+="/"+(typeof m=="number"?m:Gd.escapeFragment(m))),typeof f=="string"){f=w=ra(w?Zl.resolve(w,f):f);var y=a._refs[f];if(typeof y=="string"&&(y=a._refs[y]),y&&y.schema){if(!z0(o,y.schema))throw new Error('id "'+f+'" resolves to more than one schema')}else if(f!=ra(p))if(f[0]=="#"){if(n[f]&&!z0(o,n[f]))throw new Error('id "'+f+'" resolves to more than one schema');n[f]=o}else a._refs[f]=p}r[i]=w,s[i]=p}}),n}var Yf=lg,cg={Validation:V0(mM),MissingRef:V0(ug)};function mM(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}ug.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function ug(t,e,r){this.message=r||ug.message(t,e),this.missingRef=Yf.url(t,e),this.missingSchema=Yf.normalizeId(Yf.fullPath(this.missingRef))}function V0(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var GE=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(a){return function(o){return function(i,c){var u={key:i,value:o[i]},d={key:c,value:o[c]};return a(u,d)}}}(e.cmp),n=[];return function a(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,c;if(Array.isArray(o)){for(c="[",i=0;i<o.length;i++)i&&(c+=","),c+=a(o[i])||"null";return c+"]"}if(o===null)return"null";if(n.indexOf(o)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=n.push(o)-1,d=Object.keys(o).sort(s&&s(o));for(c="",i=0;i<d.length;i++){var h=d[i],m=a(o[h]);m&&(c&&(c+=","),c+=JSON.stringify(h)+":"+m)}return n.splice(u,1),"{"+c+"}"}}(t)},ZE=function(e,r,s){var n="",a=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(n+=" var validate = ",a&&(e.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(n+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var r="false schema",d=e.level,h=e.dataLevel,m=e.schema[r],f=e.schemaPath+e.util.getProperty(r),w=e.errSchemaPath+"/"+r,E=!e.opts.allErrors,R,p="data"+(h||""),S="valid"+d;if(e.schema===!1){e.isTop?E=!0:n+=" var "+S+" = false; ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(R||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var g=n;n=y.pop(),!e.compositeRule&&E?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?a?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+S+" = true; ";return e.isTop&&(n+=" }; return validate; "),n}if(e.isTop){var v=e.isTop,d=e.level=0,h=e.dataLevel=0,p="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var b="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var d=e.level,h=e.dataLevel,p="data"+(h||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),a&&!e.async)throw new Error("async schema in sync schema");n+=" var errs_"+d+" = errors;"}var S="valid"+d,E=!e.opts.allErrors,N="",j="",R,A=e.schema.type,F=Array.isArray(A);if(A&&e.opts.nullable&&e.schema.nullable===!0&&(F?A.indexOf("null")==-1&&(A=A.concat("null")):A!="null"&&(A=[A,"null"],F=!0)),F&&A.length==1&&(A=A[0],F=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(n+=" "+e.RULES.all.$comment.code(e,"$comment")),A){if(e.opts.coerceTypes)var T=e.util.coerceToTypes(e.opts.coerceTypes,A);var _=e.RULES.types[A];if(T||F||_===!0||_&&!te(_)){var f=e.schemaPath+".type",w=e.errSchemaPath+"/type",f=e.schemaPath+".type",w=e.errSchemaPath+"/type",I=F?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[I](A,p,e.opts.strictNumbers,!0)+") { ",T){var C="dataType"+d,z="coerced"+d;n+=" var "+C+" = typeof "+p+"; var "+z+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+C+" == 'object' && Array.isArray("+p+") && "+p+".length == 1) { "+p+" = "+p+"[0]; "+C+" = typeof "+p+"; if ("+e.util.checkDataType(e.schema.type,p,e.opts.strictNumbers)+") "+z+" = "+p+"; } "),n+=" if ("+z+" !== undefined) ; ";var U=T;if(U)for(var K,P=-1,D=U.length-1;P<D;)K=U[P+=1],K=="string"?n+=" else if ("+C+" == 'number' || "+C+" == 'boolean') "+z+" = '' + "+p+"; else if ("+p+" === null) "+z+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+C+" == 'boolean' || "+p+" === null || ("+C+" == 'string' && "+p+" && "+p+" == +"+p+" ",K=="integer"&&(n+=" && !("+p+" % 1)"),n+=")) "+z+" = +"+p+"; "):K=="boolean"?n+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+z+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+z+" = true; ":K=="null"?n+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+z+" = null; ":e.opts.coerceTypes=="array"&&K=="array"&&(n+=" else if ("+C+" == 'string' || "+C+" == 'number' || "+C+" == 'boolean' || "+p+" == null) "+z+" = ["+p+"]; ");n+=" else { ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(R||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",F?n+=""+A.join(","):n+=""+A,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",F?n+=""+A.join(","):n+=""+A,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var g=n;n=y.pop(),!e.compositeRule&&E?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } if ("+z+" !== undefined) { ";var L=h?"data"+(h-1||""):"parentData",X=h?e.dataPathArr[h]:"parentDataProperty";n+=" "+p+" = "+z+"; ",h||(n+="if ("+L+" !== undefined)"),n+=" "+L+"["+X+"] = "+z+"; } "}else{var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(R||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",F?n+=""+A.join(","):n+=""+A,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",F?n+=""+A.join(","):n+=""+A,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var g=n;n=y.pop(),!e.compositeRule&&E?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}n+=" } "}}if(e.schema.$ref&&!o)n+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",E&&(n+=" } if (errors === ",v?n+="0":n+="errs_"+d,n+=") { ",j+="}");else{var G=e.RULES;if(G){for(var _,B=-1,oe=G.length-1;B<oe;)if(_=G[B+=1],te(_)){if(_.type&&(n+=" if ("+e.util.checkDataType(_.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(_.type=="object"&&e.schema.properties){var m=e.schema.properties,ve=Object.keys(m),ge=ve;if(ge)for(var re,ye=-1,ke=ge.length-1;ye<ke;){re=ge[ye+=1];var me=m[re];if(me.default!==void 0){var ee=p+e.util.getProperty(re);if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+ee;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else n+=" if ("+ee+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+ee+" === null || "+ee+" === '' "),n+=" ) "+ee+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(me.default)+" ":n+=" "+JSON.stringify(me.default)+" ",n+="; "}}}else if(_.type=="array"&&Array.isArray(e.schema.items)){var _e=e.schema.items;if(_e){for(var me,P=-1,Pe=_e.length-1;P<Pe;)if(me=_e[P+=1],me.default!==void 0){var ee=p+"["+P+"]";if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+ee;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else n+=" if ("+ee+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+ee+" === null || "+ee+" === '' "),n+=" ) "+ee+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(me.default)+" ":n+=" "+JSON.stringify(me.default)+" ",n+="; "}}}}var De=_.rules;if(De){for(var J,ce=-1,Y=De.length-1;ce<Y;)if(J=De[ce+=1],Me(J)){var ze=J.code(e,J.keyword,_.type);ze&&(n+=" "+ze+" ",E&&(N+="}"))}}if(E&&(n+=" "+N+" ",N=""),_.type&&(n+=" } ",A&&A===_.type&&!T)){n+=" else { ";var f=e.schemaPath+".type",w=e.errSchemaPath+"/type",y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(R||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",F?n+=""+A.join(","):n+=""+A,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",F?n+=""+A.join(","):n+=""+A,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var g=n;n=y.pop(),!e.compositeRule&&E?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } "}E&&(n+=" if (errors === ",v?n+="0":n+="errs_"+d,n+=") { ",j+="}")}}}E&&(n+=" "+j+" "),v?(a?(n+=" if (errors === 0) return data; ",n+=" else throw new ValidationError(vErrors); "):(n+=" validate.errors = vErrors; ",n+=" return errors === 0; "),n+=" }; return validate;"):n+=" var "+S+" = errors === errs_"+d+";";function te(Ne){for(var rt=Ne.rules,pt=0;pt<rt.length;pt++)if(Me(rt[pt]))return!0}function Me(Ne){return e.schema[Ne.keyword]!==void 0||Ne.implements&&Ue(Ne)}function Ue(Ne){for(var rt=Ne.implements,pt=0;pt<rt.length;pt++)if(e.schema[rt[pt]]!==void 0)return!0}return n},Tc=lg,ad=ki,YE=cg,vM=GE,q0=ZE,gM=ad.ucs2length,yM=rg,xM=YE.Validation,wM=um;function um(t,e,r,s){var n=this,a=this._opts,o=[void 0],i={},c=[],u={},d=[],h={},m=[];e=e||{schema:t,refVal:o,refs:i};var f=bM.call(this,t,e,s),w=this._compilations[f.index];if(f.compiling)return w.callValidate=b;var p=this._formats,y=this.RULES;try{var g=S(t,e,r,s);w.validate=g;var v=w.callValidate;return v&&(v.schema=g.schema,v.errors=null,v.refs=g.refs,v.refVal=g.refVal,v.root=g.root,v.$async=g.$async,a.sourceCode&&(v.source=g.source)),g}finally{SM.call(this,t,e,s)}function b(){var I=w.validate,C=I.apply(this,arguments);return b.errors=I.errors,C}function S(I,C,z,U){var K=!C||C&&C.schema==I;if(C.schema!=e.schema)return um.call(n,I,C,z,U);var P=I.$async===!0,D=q0({isTop:!0,schema:I,isRoot:K,baseId:U,root:C,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:YE.MissingRef,RULES:y,validate:q0,util:ad,resolve:Tc,resolveRef:E,usePattern:F,useDefault:T,useCustomRule:_,opts:a,formats:p,logger:n.logger,self:n});D=Ac(o,CM)+Ac(c,_M)+Ac(d,EM)+Ac(m,PM)+D,a.processCode&&(D=a.processCode(D,I));var L;try{var X=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",D);L=X(n,y,p,e,o,d,m,yM,gM,xM),o[0]=L}catch(G){throw n.logger.error("Error compiling schema, function code:",D),G}return L.schema=I,L.errors=null,L.refs=i,L.refVal=o,L.root=K?L:C,P&&(L.$async=!0),a.sourceCode===!0&&(L.source={code:D,patterns:c,defaults:d}),L}function E(I,C,z){C=Tc.url(I,C);var U=i[C],K,P;if(U!==void 0)return K=o[U],P="refVal["+U+"]",A(K,P);if(!z&&e.refs){var D=e.refs[C];if(D!==void 0)return K=e.refVal[D],P=N(C,K),A(K,P)}P=N(C);var L=Tc.call(n,S,e,C);if(L===void 0){var X=r&&r[C];X&&(L=Tc.inlineRef(X,a.inlineRefs)?X:um.call(n,X,e,r,I))}if(L===void 0)j(C);else return R(C,L),A(L,P)}function N(I,C){var z=o.length;return o[z]=C,i[I]=z,"refVal"+z}function j(I){delete i[I]}function R(I,C){var z=i[I];o[z]=C}function A(I,C){return typeof I=="object"||typeof I=="boolean"?{code:C,schema:I,inline:!0}:{code:C,$async:I&&!!I.$async}}function F(I){var C=u[I];return C===void 0&&(C=u[I]=c.length,c[C]=I),"pattern"+C}function T(I){switch(typeof I){case"boolean":case"number":return""+I;case"string":return ad.toQuotedString(I);case"object":if(I===null)return"null";var C=vM(I),z=h[C];return z===void 0&&(z=h[C]=d.length,d[z]=I),"default"+z}}function _(I,C,z,U){if(n._opts.validateSchema!==!1){var K=I.definition.dependencies;if(K&&!K.every(function(ge){return Object.prototype.hasOwnProperty.call(z,ge)}))throw new Error("parent schema must have all required keywords: "+K.join(","));var P=I.definition.validateSchema;if(P){var D=P(C);if(!D){var L="keyword schema is invalid: "+n.errorsText(P.errors);if(n._opts.validateSchema=="log")n.logger.error(L);else throw new Error(L)}}}var X=I.definition.compile,G=I.definition.inline,B=I.definition.macro,oe;if(X)oe=X.call(n,C,z,U);else if(B)oe=B.call(n,C,z,U),a.validateSchema!==!1&&n.validateSchema(oe,!0);else if(G)oe=G.call(n,U,I.keyword,C,z);else if(oe=I.definition.validate,!oe)return;if(oe===void 0)throw new Error('custom keyword "'+I.keyword+'"failed to compile');var ve=m.length;return m[ve]=oe,{code:"customRule"+ve,validate:oe}}}function bM(t,e,r){var s=JE.call(this,t,e,r);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:t,root:e,baseId:r},{index:s,compiling:!1})}function SM(t,e,r){var s=JE.call(this,t,e,r);s>=0&&this._compilations.splice(s,1)}function JE(t,e,r){for(var s=0;s<this._compilations.length;s++){var n=this._compilations[s];if(n.schema==t&&n.root==e&&n.baseId==r)return s}return-1}function _M(t,e){return"var pattern"+t+" = new RegExp("+ad.toQuotedString(e[t])+");"}function EM(t){return"var default"+t+" = defaults["+t+"];"}function CM(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function PM(t){return"var customRule"+t+" = customRules["+t+"];"}function Ac(t,e){if(!t.length)return"";for(var r="",s=0;s<t.length;s++)r+=e(s,t);return r}var XE={exports:{}},Yd=XE.exports=function(){this._cache={}};Yd.prototype.put=function(e,r){this._cache[e]=r};Yd.prototype.get=function(e){return this._cache[e]};Yd.prototype.del=function(e){delete this._cache[e]};Yd.prototype.clear=function(){this._cache={}};var kM=XE.exports,NM=ki,jM=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,RM=[0,31,28,31,30,31,30,31,31,30,31,30,31],TM=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,eC=/^(?=.{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,AM=/^(?:[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,OM=/^(?:[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,tC=/^(?:(?:[^\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,rC=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,nC=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,sC=/^(?:\/(?:[^~/]|~0|~1)*)*$/,aC=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,oC=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,IM=Jd;function Jd(t){return t=t=="full"?"full":"fast",NM.copy(Jd[t])}Jd.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\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,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":tC,url:rC,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,hostname:eC,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:cC,uuid:nC,"json-pointer":sC,"json-pointer-uri-fragment":aC,"relative-json-pointer":oC};Jd.full={date:iC,time:lC,"date-time":$M,uri:LM,"uri-reference":OM,"uri-template":tC,url:rC,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:eC,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:cC,uuid:nC,"json-pointer":sC,"json-pointer-uri-fragment":aC,"relative-json-pointer":oC};function DM(t){return t%4===0&&(t%100!==0||t%400===0)}function iC(t){var e=t.match(jM);if(!e)return!1;var r=+e[1],s=+e[2],n=+e[3];return s>=1&&s<=12&&n>=1&&n<=(s==2&&DM(r)?29:RM[s])}function lC(t,e){var r=t.match(TM);if(!r)return!1;var s=r[1],n=r[2],a=r[3],o=r[5];return(s<=23&&n<=59&&a<=59||s==23&&n==59&&a==60)&&(!e||o)}var MM=/t|\s/i;function $M(t){var e=t.split(MM);return e.length==2&&iC(e[0])&&lC(e[1],!0)}var FM=/\/|:/;function LM(t){return FM.test(t)&&AM.test(t)}var UM=/[^\\]\\Z/;function cC(t){if(UM.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var zM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(o||""),h="valid"+a,m,f;if(i=="#"||i=="#/")e.isRoot?(m=e.async,f="validate"):(m=e.root.schema.$async===!0,f="root.refVal[0]");else{var w=e.resolveRef(e.baseId,i,e.isRoot);if(w===void 0){var p=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(p);var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),u&&(n+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,p)}else if(w.inline){var v=e.util.copy(e);v.level++;var b="valid"+v.level;v.schema=w.schema,v.schemaPath="",v.errSchemaPath=i;var S=e.validate(v).replace(/validate\.schema/g,w.code);n+=" "+S+" ",u&&(n+=" if ("+b+") { ")}else m=w.$async===!0||e.async&&w.$async!==!1,f=w.code}if(f){var y=y||[];y.push(n),n="",e.opts.passContext?n+=" "+f+".call(this, ":n+=" "+f+"( ",n+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var E=o?"data"+(o-1||""):"parentData",N=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+E+" , "+N+", rootData) ";var j=n;if(n=y.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+h+"; "),n+=" try { await "+j+"; ",u&&(n+=" "+h+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(n+=" "+h+" = false; "),n+=" } ",u&&(n+=" if ("+h+") { ")}else n+=" if (!"+j+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n},VM=function(e,r,s){var n=" ",a=e.schema[r],o=e.schemaPath+e.util.getProperty(r),i=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u=e.util.copy(e),d="";u.level++;var h="valid"+u.level,m=u.baseId,f=!0,w=a;if(w)for(var p,y=-1,g=w.length-1;y<g;)p=w[y+=1],(e.opts.strictKeywords?typeof p=="object"&&Object.keys(p).length>0||p===!1:e.util.schemaHasRules(p,e.RULES.all))&&(f=!1,u.schema=p,u.schemaPath=o+"["+y+"]",u.errSchemaPath=i+"/"+y,n+=" "+e.validate(u)+" ",u.baseId=m,c&&(n+=" if ("+h+") { ",d+="}"));return c&&(f?n+=" if (true) { ":n+=" "+d.slice(0,-1)+" "),n},qM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e),p="";w.level++;var y="valid"+w.level,g=i.every(function(R){return e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:e.util.schemaHasRules(R,e.RULES.all)});if(g){var v=w.baseId;n+=" var "+f+" = errors; var "+m+" = false; ";var b=e.compositeRule;e.compositeRule=w.compositeRule=!0;var S=i;if(S)for(var E,N=-1,j=S.length-1;N<j;)E=S[N+=1],w.schema=E,w.schemaPath=c+"["+N+"]",w.errSchemaPath=u+"/"+N,n+=" "+e.validate(w)+" ",w.baseId=v,n+=" "+m+" = "+m+" || "+y+"; if (!"+m+") { ",p+="}";e.compositeRule=w.compositeRule=b,n+=" "+p+" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else d&&(n+=" if (true) { ");return n},HM=function(e,r,s){var n=" ",a=e.schema[r],o=e.errSchemaPath+"/"+r;e.opts.allErrors;var i=e.util.toQuotedString(a);return e.opts.$comment===!0?n+=" console.log("+i+");":typeof e.opts.$comment=="function"&&(n+=" self._opts.$comment("+i+", "+e.util.toQuotedString(o)+", validate.root.schema);"),n},BM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f=e.opts.$data&&i&&i.$data;f&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; "),f||(n+=" var schema"+a+" = validate.schema"+c+";"),n+="var "+m+" = equal("+h+", schema"+a+"); if (!"+m+") { ";var w=w||[];w.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+a+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var p=n;return n=w.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n},KM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e),p="";w.level++;var y="valid"+w.level,g="i"+a,v=w.dataLevel=e.dataLevel+1,b="data"+v,S=e.baseId,E=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(n+="var "+f+" = errors;var "+m+";",E){var N=e.compositeRule;e.compositeRule=w.compositeRule=!0,w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" var "+y+" = false; for (var "+g+" = 0; "+g+" < "+h+".length; "+g+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var j=h+"["+g+"]";w.dataPathArr[v]=g;var R=e.validate(w);w.baseId=S,e.util.varOccurences(R,b)<2?n+=" "+e.util.varReplace(R,b,j)+" ":n+=" var "+b+" = "+j+"; "+R+" ",n+=" if ("+y+") break; } ",e.compositeRule=w.compositeRule=N,n+=" "+p+" if (!"+y+") {"}else n+=" if ("+h+".length == 0) {";var A=A||[];A.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var F=n;return n=A.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+F+"]); ":n+=" validate.errors = ["+F+"]; return false; ":n+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",E&&(n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n},WM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="errs__"+a,f=e.util.copy(e),w="";f.level++;var p="valid"+f.level,y={},g={},v=e.opts.ownProperties;for(N in i)if(N!="__proto__"){var b=i[N],S=Array.isArray(b)?g:y;S[N]=b}n+="var "+m+" = errors;";var E=e.errorPath;n+="var missing"+a+";";for(var N in g)if(S=g[N],S.length){if(n+=" if ( "+h+e.util.getProperty(N)+" !== undefined ",v&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(N)+"') "),d){n+=" && ( ";var j=S;if(j)for(var R,A=-1,F=j.length-1;A<F;){R=j[A+=1],A&&(n+=" || ");var T=e.util.getProperty(R),_=h+T;n+=" ( ( "+_+" === undefined ",v&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(R)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?R:T)+") ) "}n+=")) { ";var I="missing"+a,C="' + "+I+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,I,!0):E+" + "+I);var z=z||[];z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(N)+"', missingProperty: '"+C+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",S.length==1?n+="property "+e.util.escapeQuotes(S[0]):n+="properties "+e.util.escapeQuotes(S.join(", ")),n+=" when property "+e.util.escapeQuotes(N)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var U=n;n=z.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+U+"]); ":n+=" validate.errors = ["+U+"]; return false; ":n+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=S;if(K)for(var R,P=-1,D=K.length-1;P<D;){R=K[P+=1];var T=e.util.getProperty(R),C=e.util.escapeQuotes(R),_=h+T;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,R,e.opts.jsonPointers)),n+=" if ( "+_+" === undefined ",v&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(R)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(N)+"', missingProperty: '"+C+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",S.length==1?n+="property "+e.util.escapeQuotes(S[0]):n+="properties "+e.util.escapeQuotes(S.join(", ")),n+=" when property "+e.util.escapeQuotes(N)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",d&&(w+="}",n+=" else { ")}e.errorPath=E;var L=f.baseId;for(var N in y){var b=y[N];(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(n+=" "+p+" = true; if ( "+h+e.util.getProperty(N)+" !== undefined ",v&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(N)+"') "),n+=") { ",f.schema=b,f.schemaPath=c+e.util.getProperty(N),f.errSchemaPath=u+"/"+e.util.escapeFragment(N),n+=" "+e.validate(f)+" ",f.baseId=L,n+=" } ",d&&(n+=" if ("+p+") { ",w+="}"))}return d&&(n+=" "+w+" if ("+m+" == errors) {"),n},QM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f=e.opts.$data&&i&&i.$data;f&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var w="i"+a,p="schema"+a;f||(n+=" var "+p+" = validate.schema"+c+";"),n+="var "+m+";",f&&(n+=" if (schema"+a+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+a+")) "+m+" = false; else {"),n+=""+m+" = false;for (var "+w+"=0; "+w+"<"+p+".length; "+w+"++) if (equal("+h+", "+p+"["+w+"])) { "+m+" = true; break; }",f&&(n+=" } "),n+=" if (!"+m+") { ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+a+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n},GM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||"");if(e.opts.format===!1)return d&&(n+=" if (true) { "),n;var m=e.opts.$data&&i&&i.$data,f;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i;var w=e.opts.unknownFormats,p=Array.isArray(w);if(m){var y="format"+a,g="isObject"+a,v="formatType"+a;n+=" var "+y+" = formats["+f+"]; var "+g+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+v+" = "+g+" && "+y+".type || 'string'; if ("+g+") { ",e.async&&(n+=" var async"+a+" = "+y+".async; "),n+=" "+y+" = "+y+".validate; } if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" (",w!="ignore"&&(n+=" ("+f+" && !"+y+" ",p&&(n+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),n+=") || "),n+=" ("+y+" && "+v+" == '"+s+"' && !(typeof "+y+" == 'function' ? ",e.async?n+=" (async"+a+" ? await "+y+"("+h+") : "+y+"("+h+")) ":n+=" "+y+"("+h+") ",n+=" : "+y+".test("+h+"))))) {"}else{var y=e.formats[i];if(!y){if(w=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(n+=" if (true) { "),n;if(p&&w.indexOf(i)>=0)return d&&(n+=" if (true) { "),n;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var g=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,v=g&&y.type||"string";if(g){var b=y.async===!0;y=y.validate}if(v!=s)return d&&(n+=" if (true) { "),n;if(b){if(!e.async)throw new Error("async format in sync schema");var S="formats"+e.util.getProperty(i)+".validate";n+=" if (!(await "+S+"("+h+"))) { "}else{n+=" if (! ";var S="formats"+e.util.getProperty(i);g&&(S+=".validate"),typeof y=="function"?n+=" "+S+"("+h+") ":n+=" "+S+".test("+h+") ",n+=") { "}}var E=E||[];E.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",m?n+=""+f:n+=""+e.util.toQuotedString(i),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+f+" + '":n+=""+e.util.escapeQuotes(i),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+e.util.toQuotedString(i),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var N=n;return n=E.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+N+"]); ":n+=" validate.errors = ["+N+"]; return false; ":n+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n},ZM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e);w.level++;var p="valid"+w.level,y=e.schema.then,g=e.schema.else,v=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),b=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),S=w.baseId;if(v||b){var E;w.createErrors=!1,w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" var "+f+" = errors; var "+m+" = true; ";var N=e.compositeRule;e.compositeRule=w.compositeRule=!0,n+=" "+e.validate(w)+" ",w.baseId=S,w.createErrors=!0,n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.compositeRule=w.compositeRule=N,v?(n+=" if ("+p+") { ",w.schema=e.schema.then,w.schemaPath=e.schemaPath+".then",w.errSchemaPath=e.errSchemaPath+"/then",n+=" "+e.validate(w)+" ",w.baseId=S,n+=" "+m+" = "+p+"; ",v&&b?(E="ifClause"+a,n+=" var "+E+" = 'then'; "):E="'then'",n+=" } ",b&&(n+=" else { ")):n+=" if (!"+p+") { ",b&&(w.schema=e.schema.else,w.schemaPath=e.schemaPath+".else",w.errSchemaPath=e.errSchemaPath+"/else",n+=" "+e.validate(w)+" ",w.baseId=S,n+=" "+m+" = "+p+"; ",v&&b?(E="ifClause"+a,n+=" var "+E+" = 'else'; "):E="'else'",n+=" } "),n+=" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+E+" } ",e.opts.messages!==!1&&(n+=` , message: 'should match "' + `+E+` + '" schema' `),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n},YM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e),p="";w.level++;var y="valid"+w.level,g="i"+a,v=w.dataLevel=e.dataLevel+1,b="data"+v,S=e.baseId;if(n+="var "+f+" = errors;var "+m+";",Array.isArray(i)){var E=e.schema.additionalItems;if(E===!1){n+=" "+m+" = "+h+".length <= "+i.length+"; ";var N=u;u=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var j=j||[];j.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var R=n;n=j.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+R+"]); ":n+=" validate.errors = ["+R+"]; return false; ":n+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u=N,d&&(p+="}",n+=" else { ")}var A=i;if(A){for(var F,T=-1,_=A.length-1;T<_;)if(F=A[T+=1],e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all)){n+=" "+y+" = true; if ("+h+".length > "+T+") { ";var I=h+"["+T+"]";w.schema=F,w.schemaPath=c+"["+T+"]",w.errSchemaPath=u+"/"+T,w.errorPath=e.util.getPathExpr(e.errorPath,T,e.opts.jsonPointers,!0),w.dataPathArr[v]=T;var C=e.validate(w);w.baseId=S,e.util.varOccurences(C,b)<2?n+=" "+e.util.varReplace(C,b,I)+" ":n+=" var "+b+" = "+I+"; "+C+" ",n+=" } ",d&&(n+=" if ("+y+") { ",p+="}")}}if(typeof E=="object"&&(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))){w.schema=E,w.schemaPath=e.schemaPath+".additionalItems",w.errSchemaPath=e.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+h+".length > "+i.length+") { for (var "+g+" = "+i.length+"; "+g+" < "+h+".length; "+g+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var I=h+"["+g+"]";w.dataPathArr[v]=g;var C=e.validate(w);w.baseId=S,e.util.varOccurences(C,b)<2?n+=" "+e.util.varReplace(C,b,I)+" ":n+=" var "+b+" = "+I+"; "+C+" ",d&&(n+=" if (!"+y+") break; "),n+=" } } ",d&&(n+=" if ("+y+") { ",p+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" for (var "+g+" = 0; "+g+" < "+h+".length; "+g+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var I=h+"["+g+"]";w.dataPathArr[v]=g;var C=e.validate(w);w.baseId=S,e.util.varOccurences(C,b)<2?n+=" "+e.util.varReplace(C,b,I)+" ":n+=" var "+b+" = "+I+"; "+C+" ",d&&(n+=" if (!"+y+") break; "),n+=" }"}return d&&(n+=" "+p+" if ("+f+" == errors) {"),n},H0=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,S,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i;var w=r=="maximum",p=w?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[p],g=e.opts.$data&&y&&y.$data,v=w?"<":">",b=w?">":"<",S=void 0;if(!(m||typeof i=="number"||i===void 0))throw new Error(r+" must be number");if(!(g||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(p+" must be number or boolean");if(g){var E=e.util.getData(y.$data,o,e.dataPathArr),N="exclusive"+a,j="exclType"+a,R="exclIsNumber"+a,A="op"+a,F="' + "+A+" + '";n+=" var schemaExcl"+a+" = "+E+"; ",E="schemaExcl"+a,n+=" var "+N+"; var "+j+" = typeof "+E+"; if ("+j+" != 'boolean' && "+j+" != 'undefined' && "+j+" != 'number') { ";var S=p,T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(S||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var _=n;n=T.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+_+"]); ":n+=" validate.errors = ["+_+"]; return false; ":n+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+j+" == 'number' ? ( ("+N+" = "+f+" === undefined || "+E+" "+v+"= "+f+") ? "+h+" "+b+"= "+E+" : "+h+" "+b+" "+f+" ) : ( ("+N+" = "+E+" === true) ? "+h+" "+b+"= "+f+" : "+h+" "+b+" "+f+" ) || "+h+" !== "+h+") { var op"+a+" = "+N+" ? '"+v+"' : '"+v+"='; ",i===void 0&&(S=p,u=e.errSchemaPath+"/"+p,f=E,m=g)}else{var R=typeof y=="number",F=v;if(R&&m){var A="'"+F+"'";n+=" if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" ( "+f+" === undefined || "+y+" "+v+"= "+f+" ? "+h+" "+b+"= "+y+" : "+h+" "+b+" "+f+" ) || "+h+" !== "+h+") { "}else{R&&i===void 0?(N=!0,S=p,u=e.errSchemaPath+"/"+p,f=y,b+="="):(R&&(f=Math[w?"min":"max"](y,i)),y===(R?f:!0)?(N=!0,S=p,u=e.errSchemaPath+"/"+p,b+="="):(N=!1,F+="="));var A="'"+F+"'";n+=" if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+h+" "+b+" "+f+" || "+h+" !== "+h+") { "}}S=S||r;var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(S||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+A+", limit: "+f+", exclusive: "+N+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+F+" ",m?n+="' + "+f:n+=""+f+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var _=n;return n=T.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+_+"]); ":n+=" validate.errors = ["+_+"]; return false; ":n+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n},B0=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,p,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+h+".length "+w+" "+f+") { ";var p=r,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",r=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+f+" + '":n+=""+i,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},K0=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,p,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),e.opts.unicode===!1?n+=" "+h+".length ":n+=" ucs2length("+h+") ",n+=" "+w+" "+f+") { ";var p=r,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",r=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+f+" + '":n+=""+i,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},W0=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,p,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" Object.keys("+h+").length "+w+" "+f+") { ";var p=r,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",r=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+f+" + '":n+=""+i,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},JM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i,!(m||typeof i=="number"))throw new Error(r+" must be number");n+="var division"+a+";if (",m&&(n+=" "+f+" !== undefined && ( typeof "+f+" != 'number' || "),n+=" (division"+a+" = "+h+" / "+f+", ",e.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+a+") - division"+a+") > 1e-"+e.opts.multipleOfPrecision+" ":n+=" division"+a+" !== parseInt(division"+a+") ",n+=" ) ",m&&(n+=" ) "),n+=" ) { ";var w=w||[];w.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+f+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+f:n+=""+f+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var p=n;return n=w.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},XM=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="errs__"+a,f=e.util.copy(e);f.level++;var w="valid"+f.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=c,f.errSchemaPath=u,n+=" var "+m+" = errors; ";var p=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.createErrors=!1;var y;f.opts.allErrors&&(y=f.opts.allErrors,f.opts.allErrors=!1),n+=" "+e.validate(f)+" ",f.createErrors=!0,y&&(f.opts.allErrors=y),e.compositeRule=f.compositeRule=p,n+=" if ("+w+") { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var v=n;n=g.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(n+=" if (false) { ");return n},e$=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f="errs__"+a,w=e.util.copy(e),p="";w.level++;var y="valid"+w.level,g=w.baseId,v="prevValid"+a,b="passingSchemas"+a;n+="var "+f+" = errors , "+v+" = false , "+m+" = false , "+b+" = null; ";var S=e.compositeRule;e.compositeRule=w.compositeRule=!0;var E=i;if(E)for(var N,j=-1,R=E.length-1;j<R;)N=E[j+=1],(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))?(w.schema=N,w.schemaPath=c+"["+j+"]",w.errSchemaPath=u+"/"+j,n+=" "+e.validate(w)+" ",w.baseId=g):n+=" var "+y+" = true; ",j&&(n+=" if ("+y+" && "+v+") { "+m+" = false; "+b+" = ["+b+", "+j+"]; } else { ",p+="}"),n+=" if ("+y+") { "+m+" = "+v+" = true; "+b+" = "+j+"; }";return e.compositeRule=w.compositeRule=S,n+=""+p+"if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+b+" } ",e.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n},t$=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m=e.opts.$data&&i&&i.$data,f;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+a):f=i;var w=m?"(new RegExp("+f+"))":e.usePattern(i);n+="if ( ",m&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" !"+w+".test("+h+") ) { ";var p=p||[];p.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",m?n+=""+f:n+=""+e.util.toQuotedString(i),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+f+" + '":n+=""+e.util.escapeQuotes(i),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+e.util.toQuotedString(i),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=p.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n},r$=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="errs__"+a,f=e.util.copy(e),w="";f.level++;var p="valid"+f.level,y="key"+a,g="idx"+a,v=f.dataLevel=e.dataLevel+1,b="data"+v,S="dataProperties"+a,E=Object.keys(i||{}).filter(P),N=e.schema.patternProperties||{},j=Object.keys(N).filter(P),R=e.schema.additionalProperties,A=E.length||j.length,F=R===!1,T=typeof R=="object"&&Object.keys(R).length,_=e.opts.removeAdditional,I=F||T||_,C=e.opts.ownProperties,z=e.baseId,U=e.schema.required;if(U&&!(e.opts.$data&&U.$data)&&U.length<e.opts.loopRequired)var K=e.util.toHash(U);function P(hs){return hs!=="__proto__"}if(n+="var "+m+" = errors;var "+p+" = true;",C&&(n+=" var "+S+" = undefined;"),I){if(C?n+=" "+S+" = "+S+" || Object.keys("+h+"); for (var "+g+"=0; "+g+"<"+S+".length; "+g+"++) { var "+y+" = "+S+"["+g+"]; ":n+=" for (var "+y+" in "+h+") { ",A){if(n+=" var isAdditional"+a+" = !(false ",E.length)if(E.length>8)n+=" || validate.schema"+c+".hasOwnProperty("+y+") ";else{var D=E;if(D)for(var L,X=-1,G=D.length-1;X<G;)L=D[X+=1],n+=" || "+y+" == "+e.util.toQuotedString(L)+" "}if(j.length){var B=j;if(B)for(var oe,ve=-1,ge=B.length-1;ve<ge;)oe=B[ve+=1],n+=" || "+e.usePattern(oe)+".test("+y+") "}n+=" ); if (isAdditional"+a+") { "}if(_=="all")n+=" delete "+h+"["+y+"]; ";else{var re=e.errorPath,ye="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),F)if(_)n+=" delete "+h+"["+y+"]; ";else{n+=" "+p+" = false; ";var ke=u;u=e.errSchemaPath+"/additionalProperties";var me=me||[];me.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+ye+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is an invalid additional property":n+="should NOT have additional properties",n+="' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var ee=n;n=me.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+ee+"]); ":n+=" validate.errors = ["+ee+"]; return false; ":n+=" var err = "+ee+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ke,d&&(n+=" break; ")}else if(T)if(_=="failing"){n+=" var "+m+" = errors; ";var _e=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=R,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Pe=h+"["+y+"]";f.dataPathArr[v]=y;var De=e.validate(f);f.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Pe)+" ":n+=" var "+b+" = "+Pe+"; "+De+" ",n+=" if (!"+p+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+h+"["+y+"]; } ",e.compositeRule=f.compositeRule=_e}else{f.schema=R,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Pe=h+"["+y+"]";f.dataPathArr[v]=y;var De=e.validate(f);f.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Pe)+" ":n+=" var "+b+" = "+Pe+"; "+De+" ",d&&(n+=" if (!"+p+") break; ")}e.errorPath=re}A&&(n+=" } "),n+=" } ",d&&(n+=" if ("+p+") { ",w+="}")}var J=e.opts.useDefaults&&!e.compositeRule;if(E.length){var ce=E;if(ce)for(var L,Y=-1,ze=ce.length-1;Y<ze;){L=ce[Y+=1];var te=i[L];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){var Me=e.util.getProperty(L),Pe=h+Me,Ue=J&&te.default!==void 0;f.schema=te,f.schemaPath=c+Me,f.errSchemaPath=u+"/"+e.util.escapeFragment(L),f.errorPath=e.util.getPath(e.errorPath,L,e.opts.jsonPointers),f.dataPathArr[v]=e.util.toQuotedString(L);var De=e.validate(f);if(f.baseId=z,e.util.varOccurences(De,b)<2){De=e.util.varReplace(De,b,Pe);var Ne=Pe}else{var Ne=b;n+=" var "+b+" = "+Pe+"; "}if(Ue)n+=" "+De+" ";else{if(K&&K[L]){n+=" if ( "+Ne+" === undefined ",C&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(L)+"') "),n+=") { "+p+" = false; ";var re=e.errorPath,ke=u,rt=e.util.escapeQuotes(L);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(re,L,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var me=me||[];me.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+rt+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+rt+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var ee=n;n=me.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+ee+"]); ":n+=" validate.errors = ["+ee+"]; return false; ":n+=" var err = "+ee+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ke,e.errorPath=re,n+=" } else { "}else d?(n+=" if ( "+Ne+" === undefined ",C&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(L)+"') "),n+=") { "+p+" = true; } else { "):(n+=" if ("+Ne+" !== undefined ",C&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(L)+"') "),n+=" ) { ");n+=" "+De+" } "}}d&&(n+=" if ("+p+") { ",w+="}")}}if(j.length){var pt=j;if(pt)for(var oe,Hr=-1,zt=pt.length-1;Hr<zt;){oe=pt[Hr+=1];var te=N[oe];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){f.schema=te,f.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(oe),f.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(oe),C?n+=" "+S+" = "+S+" || Object.keys("+h+"); for (var "+g+"=0; "+g+"<"+S+".length; "+g+"++) { var "+y+" = "+S+"["+g+"]; ":n+=" for (var "+y+" in "+h+") { ",n+=" if ("+e.usePattern(oe)+".test("+y+")) { ",f.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Pe=h+"["+y+"]";f.dataPathArr[v]=y;var De=e.validate(f);f.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Pe)+" ":n+=" var "+b+" = "+Pe+"; "+De+" ",d&&(n+=" if (!"+p+") break; "),n+=" } ",d&&(n+=" else "+p+" = true; "),n+=" } ",d&&(n+=" if ("+p+") { ",w+="}")}}}return d&&(n+=" "+w+" if ("+m+" == errors) {"),n},n$=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="errs__"+a,f=e.util.copy(e),w="";f.level++;var p="valid"+f.level;if(n+="var "+m+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=c,f.errSchemaPath=u;var y="key"+a,g="idx"+a,v="i"+a,b="' + "+y+" + '",S=f.dataLevel=e.dataLevel+1,E="data"+S,N="dataProperties"+a,j=e.opts.ownProperties,R=e.baseId;j&&(n+=" var "+N+" = undefined; "),j?n+=" "+N+" = "+N+" || Object.keys("+h+"); for (var "+g+"=0; "+g+"<"+N+".length; "+g+"++) { var "+y+" = "+N+"["+g+"]; ":n+=" for (var "+y+" in "+h+") { ",n+=" var startErrs"+a+" = errors; ";var A=y,F=e.compositeRule;e.compositeRule=f.compositeRule=!0;var T=e.validate(f);f.baseId=R,e.util.varOccurences(T,E)<2?n+=" "+e.util.varReplace(T,E,A)+" ":n+=" var "+E+" = "+A+"; "+T+" ",e.compositeRule=f.compositeRule=F,n+=" if (!"+p+") { for (var "+v+"=startErrs"+a+"; "+v+"<errors; "+v+"++) { vErrors["+v+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(n+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+b+"' } ",e.opts.messages!==!1&&(n+=" , message: 'property name \\'"+b+"\\' is invalid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),d&&(n+=" break; "),n+=" } }"}return d&&(n+=" "+w+" if ("+m+" == errors) {"),n},s$=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f=e.opts.$data&&i&&i.$data;f&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var w="schema"+a;if(!f)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],y=i;if(y)for(var g,v=-1,b=y.length-1;v<b;){g=y[v+=1];var S=e.schema.properties[g];S&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))||(p[p.length]=g)}}else var p=i;if(f||p.length){var E=e.errorPath,N=f||p.length>=e.opts.loopRequired,j=e.opts.ownProperties;if(d)if(n+=" var missing"+a+"; ",N){f||(n+=" var "+w+" = validate.schema"+c+"; ");var R="i"+a,A="schema"+a+"["+R+"]",F="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,A,e.opts.jsonPointers)),n+=" var "+m+" = true; ",f&&(n+=" if (schema"+a+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+a+")) "+m+" = false; else {"),n+=" for (var "+R+" = 0; "+R+" < "+w+".length; "+R+"++) { "+m+" = "+h+"["+w+"["+R+"]] !== undefined ",j&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", "+w+"["+R+"]) "),n+="; if (!"+m+") break; } ",f&&(n+=" } "),n+=" if (!"+m+") { ";var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var _=n;n=T.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+_+"]); ":n+=" validate.errors = ["+_+"]; return false; ":n+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var I=p;if(I)for(var C,R=-1,z=I.length-1;R<z;){C=I[R+=1],R&&(n+=" || ");var U=e.util.getProperty(C),K=h+U;n+=" ( ( "+K+" === undefined ",j&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(C)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?C:U)+") ) "}n+=") { ";var A="missing"+a,F="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,A,!0):E+" + "+A);var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var _=n;n=T.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+_+"]); ":n+=" validate.errors = ["+_+"]; return false; ":n+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(N){f||(n+=" var "+w+" = validate.schema"+c+"; ");var R="i"+a,A="schema"+a+"["+R+"]",F="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,A,e.opts.jsonPointers)),f&&(n+=" if ("+w+" && !Array.isArray("+w+")) { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+w+" !== undefined) { "),n+=" for (var "+R+" = 0; "+R+" < "+w+".length; "+R+"++) { if ("+h+"["+w+"["+R+"]] === undefined ",j&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", "+w+"["+R+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",f&&(n+=" } ")}else{var P=p;if(P)for(var C,D=-1,L=P.length-1;D<L;){C=P[D+=1];var U=e.util.getProperty(C),F=e.util.escapeQuotes(C),K=h+U;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,C,e.opts.jsonPointers)),n+=" if ( "+K+" === undefined ",j&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(C)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+F+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=E}else d&&(n+=" if (true) {");return n},a$=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h="data"+(o||""),m="valid"+a,f=e.opts.$data&&i&&i.$data,w;if(f?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",w="schema"+a):w=i,(i||f)&&e.opts.uniqueItems!==!1){f&&(n+=" var "+m+"; if ("+w+" === false || "+w+" === undefined) "+m+" = true; else if (typeof "+w+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+h+".length , "+m+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,y=Array.isArray(p);if(!p||p=="object"||p=="array"||y&&(p.indexOf("object")>=0||p.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+h+"[i]; ";var g="checkDataType"+(y?"s":"");n+=" if ("+e.util[g](p,"item",e.opts.strictNumbers,!0)+") continue; ",y&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",f&&(n+=" } "),n+=" if (!"+m+") { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",f?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var b=n;n=v.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n},o$={$ref:zM,allOf:VM,anyOf:qM,$comment:HM,const:BM,contains:KM,dependencies:WM,enum:QM,format:GM,if:ZM,items:YM,maximum:H0,minimum:H0,maxItems:B0,minItems:B0,maxLength:K0,minLength:K0,maxProperties:W0,minProperties:W0,multipleOf:JM,not:XM,oneOf:e$,pattern:t$,properties:r$,propertyNames:n$,required:s$,uniqueItems:a$,validate:ZE},Q0=o$,Jf=ki.toHash,i$=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],n=["number","integer","string","array","object","boolean","null"];return e.all=Jf(r),e.types=Jf(n),e.forEach(function(a){a.rules=a.rules.map(function(o){var i;if(typeof o=="object"){var c=Object.keys(o)[0];i=o[c],o=c,i.forEach(function(d){r.push(d),e.all[d]=!0})}r.push(o);var u=e.all[o]={keyword:o,code:Q0[o],implements:i};return u}),e.all.$comment={keyword:"$comment",code:Q0.$comment},a.type&&(e.types[a.type]=a)}),e.keywords=Jf(r.concat(s)),e.custom={},e},G0=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],l$=function(t,e){for(var r=0;r<e.length;r++){t=JSON.parse(JSON.stringify(t));var s=e[r].split("/"),n=t,a;for(a=1;a<s.length;a++)n=n[s[a]];for(a=0;a<G0.length;a++){var o=G0[a],i=n[o];i&&(n[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},c$=cg.MissingRef,u$=uC;function uC(t,e,r){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var n=a(t).then(function(){var i=s._addSchema(t,void 0,e);return i.validate||o(i)});return r&&n.then(function(i){r(null,i)},r),n;function a(i){var c=i.$schema;return c&&!s.getSchema(c)?uC.call(s,{$ref:c},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(u){if(u instanceof c$)return c(u);throw u}function c(u){var d=u.missingSchema;if(f(d))throw new Error("Schema "+d+" is loaded but "+u.missingRef+" cannot be resolved");var h=s._loadingSchemas[d];return h||(h=s._loadingSchemas[d]=s._opts.loadSchema(d),h.then(m,m)),h.then(function(w){if(!f(d))return a(w).then(function(){f(d)||s.addSchema(w,d,void 0,e)})}).then(function(){return o(i)});function m(){delete s._loadingSchemas[d]}function f(w){return s._refs[w]||s._schemas[w]}}}}var d$=function(e,r,s){var n=" ",a=e.level,o=e.dataLevel,i=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,h,m="data"+(o||""),f="valid"+a,w="errs__"+a,p=e.opts.$data&&i&&i.$data,y;p?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+a):y=i;var g=this,v="definition"+a,b=g.definition,S="",E,N,j,R,A;if(p&&b.$data){A="keywordValidate"+a;var F=b.validateSchema;n+=" var "+v+" = RULES.custom['"+r+"'].definition; var "+A+" = "+v+".validate;"}else{if(R=e.useCustomRule(g,i,e.schema,e),!R)return;y="validate.schema"+c,A=R.code,E=b.compile,N=b.inline,j=b.macro}var T=A+".errors",_="i"+a,I="ruleErr"+a,C=b.async;if(C&&!e.async)throw new Error("async keyword in sync schema");if(N||j||(n+=""+T+" = null;"),n+="var "+w+" = errors;var "+f+";",p&&b.$data&&(S+="}",n+=" if ("+y+" === undefined) { "+f+" = true; } else { ",F&&(S+="}",n+=" "+f+" = "+v+".validateSchema("+y+"); if ("+f+") { ")),N)b.statements?n+=" "+R.validate+" ":n+=" "+f+" = "+R.validate+"; ";else if(j){var z=e.util.copy(e),S="";z.level++;var U="valid"+z.level;z.schema=R.validate,z.schemaPath="";var K=e.compositeRule;e.compositeRule=z.compositeRule=!0;var P=e.validate(z).replace(/validate\.schema/g,A);e.compositeRule=z.compositeRule=K,n+=" "+P}else{var D=D||[];D.push(n),n="",n+=" "+A+".call( ",e.opts.passContext?n+="this":n+="self",E||b.schema===!1?n+=" , "+m+" ":n+=" , "+y+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var L=o?"data"+(o-1||""):"parentData",X=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+L+" , "+X+" , rootData ) ";var G=n;n=D.pop(),b.errors===!1?(n+=" "+f+" = ",C&&(n+="await "),n+=""+G+"; "):C?(T="customErrors"+a,n+=" var "+T+" = null; try { "+f+" = await "+G+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+T+" = e.errors; else throw e; } "):n+=" "+T+" = null; "+f+" = "+G+"; "}if(b.modifying&&(n+=" if ("+L+") "+m+" = "+L+"["+X+"];"),n+=""+S,b.valid)d&&(n+=" if (true) { ");else{n+=" if ( ",b.valid===void 0?(n+=" !",j?n+=""+U:n+=""+f):n+=" "+!b.valid+" ",n+=") { ",h=g.keyword;var D=D||[];D.push(n),n="";var D=D||[];D.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+g.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+g.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var B=n;n=D.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+B+"]); ":n+=" validate.errors = ["+B+"]; return false; ":n+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var oe=n;n=D.pop(),N?b.errors?b.errors!="full"&&(n+=" for (var "+_+"="+w+"; "+_+"<errors; "+_+"++) { var "+I+" = vErrors["+_+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+I+".schemaPath === undefined) { "+I+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+I+".schema = "+y+"; "+I+".data = "+m+"; "),n+=" } "):b.errors===!1?n+=" "+oe+" ":(n+=" if ("+w+" == errors) { "+oe+" } else { for (var "+_+"="+w+"; "+_+"<errors; "+_+"++) { var "+I+" = vErrors["+_+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+I+".schemaPath === undefined) { "+I+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+I+".schema = "+y+"; "+I+".data = "+m+"; "),n+=" } } "):j?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+g.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+g.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; ")):b.errors===!1?n+=" "+oe+" ":(n+=" if (Array.isArray("+T+")) { if (vErrors === null) vErrors = "+T+"; else vErrors = vErrors.concat("+T+"); errors = vErrors.length; for (var "+_+"="+w+"; "+_+"<errors; "+_+"++) { var "+I+" = vErrors["+_+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; "+I+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(n+=" "+I+".schema = "+y+"; "+I+".data = "+m+"; "),n+=" } } else { "+oe+" } "),n+=" } ",d&&(n+=" else { ")}return n};const f$="http://json-schema.org/draft-07/schema#",h$="http://json-schema.org/draft-07/schema#",p$="Core schema meta-schema",m$={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:[]}},v$=["object","boolean"],g$={$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:"#"}},dC={$schema:f$,$id:h$,title:p$,definitions:m$,type:v$,properties:g$,default:!0};var Z0=dC,y$={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Z0.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Z0.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},x$=/^[a-z_$][a-z0-9_$-]*$/i,w$=d$,b$=y$,S$={add:_$,get:E$,remove:C$,validate:dm};function _$(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!x$.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var n=0;n<s.length;n++)o(t,s[n],e);else o(t,s,e);var a=e.metaSchema;a&&(e.$data&&this._opts.$data&&(a={anyOf:[a,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(a,!0))}r.keywords[t]=r.all[t]=!0;function o(i,c,u){for(var d,h=0;h<r.length;h++){var m=r[h];if(m.type==c){d=m;break}}d||(d={type:c,rules:[]},r.push(d));var f={keyword:i,definition:u,custom:!0,code:w$,implements:u.implements};d.rules.push(f),r.custom[i]=f}return this}function E$(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function C$(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var r=0;r<e.length;r++)for(var s=e[r].rules,n=0;n<s.length;n++)if(s[n].keyword==t){s.splice(n,1);break}return this}function dm(t,e){dm.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(b$,!0);if(r(t))return!0;if(dm.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}const P$="http://json-schema.org/draft-07/schema#",k$="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",N$="Meta-schema for $data reference (JSON Schema extension proposal)",j$="object",R$=["$data"],T$={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},A$=!1,O$={$schema:P$,$id:k$,description:N$,type:j$,required:R$,properties:T$,additionalProperties:A$};var fC=wM,La=lg,I$=kM,hC=BE,D$=GE,M$=IM,$$=i$,pC=l$,mC=ki,F$=wt;wt.prototype.validate=U$;wt.prototype.compile=z$;wt.prototype.addSchema=V$;wt.prototype.addMetaSchema=q$;wt.prototype.validateSchema=H$;wt.prototype.getSchema=K$;wt.prototype.removeSchema=Q$;wt.prototype.addFormat=rF;wt.prototype.errorsText=tF;wt.prototype._addSchema=G$;wt.prototype._compile=Z$;wt.prototype.compileAsync=u$;var Xd=S$;wt.prototype.addKeyword=Xd.add;wt.prototype.getKeyword=Xd.get;wt.prototype.removeKeyword=Xd.remove;wt.prototype.validateKeyword=Xd.validate;var vC=cg;wt.ValidationError=vC.Validation;wt.MissingRefError=vC.MissingRef;wt.$dataMetaSchema=pC;var od="http://json-schema.org/draft-07/schema",Y0=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],L$=["/properties"];function wt(t){if(!(this instanceof wt))return new wt(t);t=this._opts=mC.copy(t)||{},lF(this),this._schemas={},this._refs={},this._fragments={},this._formats=M$(t.format),this._cache=t.cache||new I$,this._loadingSchemas={},this._compilations=[],this.RULES=$$(),this._getId=Y$(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=D$),this._metaOpts=iF(this),t.formats&&aF(this),t.keywords&&oF(this),nF(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),sF(this)}function U$(t,e){var r;if(typeof t=="string"){if(r=this.getSchema(t),!r)throw new Error('no schema with key or ref "'+t+'"')}else{var s=this._addSchema(t);r=s.validate||this._compile(s)}var n=r(e);return r.$async!==!0&&(this.errors=r.errors),n}function z$(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function V$(t,e,r,s){if(Array.isArray(t)){for(var n=0;n<t.length;n++)this.addSchema(t[n],void 0,r,s);return this}var a=this._getId(t);if(a!==void 0&&typeof a!="string")throw new Error("schema id must be string");return e=La.normalizeId(e||a),yC(this,e),this._schemas[e]=this._addSchema(t,r,s,!0),this}function q$(t,e,r){return this.addSchema(t,e,r,!0),this}function H$(t,e){var r=t.$schema;if(r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||B$(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(r,t);if(!s&&e){var n="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(n);else throw new Error(n)}return s}function B$(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(od)?od:void 0,t._opts.defaultMeta}function K$(t){var e=gC(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return W$(this,t)}}function W$(t,e){var r=La.schema.call(t,{schema:{}},e);if(r){var s=r.schema,n=r.root,a=r.baseId,o=fC.call(t,s,n,void 0,a);return t._fragments[e]=new hC({ref:e,fragment:!0,schema:s,root:n,baseId:a,validate:o}),o}}function gC(t,e){return e=La.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Q$(t){if(t instanceof RegExp)return Oc(this,this._schemas,t),Oc(this,this._refs,t),this;switch(typeof t){case"undefined":return Oc(this,this._schemas),Oc(this,this._refs),this._cache.clear(),this;case"string":var e=gC(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var r=this._opts.serialize,s=r?r(t):t;this._cache.del(s);var n=this._getId(t);n&&(n=La.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this}function Oc(t,e,r){for(var s in e){var n=e[s];!n.meta&&(!r||r.test(s))&&(t._cache.del(n.cacheKey),delete e[s])}}function G$(t,e,r,s){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var n=this._opts.serialize,a=n?n(t):t,o=this._cache.get(a);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var i=La.normalizeId(this._getId(t));i&&s&&yC(this,i);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=i&&i==La.normalizeId(t.$schema))&&this.validateSchema(t,!0);var d=La.ids.call(this,t),h=new hC({id:i,schema:t,localRefs:d,cacheKey:a,meta:r});return i[0]!="#"&&s&&(this._refs[i]=h),this._cache.put(a,h),c&&u&&this.validateSchema(t,!0),h}function Z$(t,e){if(t.compiling)return t.validate=n,n.schema=t.schema,n.errors=null,n.root=e||n,t.schema.$async===!0&&(n.$async=!0),n;t.compiling=!0;var r;t.meta&&(r=this._opts,this._opts=this._metaOpts);var s;try{s=fC.call(this,t.schema,e,t.localRefs)}catch(a){throw delete t.validate,a}finally{t.compiling=!1,t.meta&&(this._opts=r)}return t.validate=s,t.refs=s.refs,t.refVal=s.refVal,t.root=s.root,s;function n(){var a=t.validate,o=a.apply(this,arguments);return n.errors=a.errors,o}}function Y$(t){switch(t.schemaId){case"auto":return eF;case"id":return J$;default:return X$}}function J$(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function X$(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function eF(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function tF(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var r=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,n="",a=0;a<t.length;a++){var o=t[a];o&&(n+=s+o.dataPath+" "+o.message+r)}return n.slice(0,-r.length)}function rF(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function nF(t){var e;if(t._opts.$data&&(e=O$,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=dC;t._opts.$data&&(r=pC(r,L$)),t.addMetaSchema(r,od,!0),t._refs["http://json-schema.org/schema"]=od}}function sF(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var r in e)t.addSchema(e[r],r)}function aF(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function oF(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function yC(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function iF(t){for(var e=mC.copy(t._opts),r=0;r<Y0.length;r++)delete e[Y0[r]];return e}function lF(t){var e=t._opts.logger;if(e===!1)t.logger={log:Xf,warn:Xf,error:Xf};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function Xf(){}const cF=fm(F$);class uF extends F4{constructor(e,r){var s;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=r==null?void 0:r.capabilities)!==null&&s!==void 0?s:{},this._ajv=new cF}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=L4(this._capabilities,e)}assertCapability(e,r){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:qd,capabilities:this._capabilities,clientInfo:this._clientInfo}},NE,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!nD.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,s,n,a,o;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break}}async ping(e){return this.request({method:"ping"},Ao,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},$E,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Ao,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Zv,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Yu,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Zu,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},IE,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Kv,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Ao,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Ao,r)}async callTool(e,r=Qd,s){const n=await this.request({method:"tools/call",params:e},r,s),a=this.getToolOutputValidator(e.name);if(a){if(!n.structuredContent&&!n.isError)throw new qs(En.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{if(!a(n.structuredContent))throw new qs(En.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(a.errors)}`)}catch(o){throw o instanceof qs?o:new qs(En.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return n}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const r of e)if(r.outputSchema)try{const s=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const s=await this.request({method:"tools/list",params:e},Yv,r);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Ui(t,e){if(!t)throw new Error(e)}var J0=3e3,dF=5e3,eh=5*60*1e3;function fF(t){const{url:e,clientName:r,clientUri:s,callbackUrl:n=typeof window<"u"?To(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:a="mcp:auth",clientConfig:o={},customHeaders:i={},autoRetry:c=!1,autoReconnect:u=J0,transportType:d="auto",preventAutoAuth:h=!1,onPopupWindow:m}=t,[f,w]=x.useState("discovering"),[p,y]=x.useState([]),[g,v]=x.useState([]),[b,S]=x.useState([]),[E,N]=x.useState([]),[j,R]=x.useState(void 0),[A,F]=x.useState([]),[T,_]=x.useState(void 0),I=x.useRef(null),C=x.useRef(null),z=x.useRef(null),U=x.useRef(!1),K=x.useRef(!0),P=x.useRef(0),D=x.useRef(null),L=x.useRef(f),X=x.useRef(u),G=x.useRef(null);x.useEffect(()=>{L.current=f,X.current=u},[f,u]);const B=x.useCallback((J,ce,...Y)=>{const ze=Y.length>0?`${ce} ${Y.map(te=>JSON.stringify(te)).join(" ")}`:ce;console[J](`[useMcp] ${ze}`),K.current&&F(te=>[...te.slice(-100),{level:J,message:ze,timestamp:Date.now()}])},[]),oe=x.useCallback(async(J=!1)=>{J||B("info","Disconnecting..."),U.current=!1,D.current&&clearTimeout(D.current),D.current=null;const ce=C.current;if(I.current=null,C.current=null,K.current&&!J&&(w("discovering"),y([]),v([]),S([]),N([]),R(void 0),_(void 0)),ce)try{await ce.close(),J||B("debug","Transport closed")}catch(Y){J||B("warn","Error closing transport:",Y)}},[B]),ve=x.useCallback((J,ce)=>{var Y;if(B("error",J,ce??""),K.current){w("failed"),R(J);const ze=(Y=z.current)==null?void 0:Y.getLastAttemptedAuthUrl();ze&&(_(ze),B("info","Manual authentication URL may be available.",ze))}U.current=!1},[B]),ge=x.useCallback(async()=>{if(U.current){B("debug","Connection attempt already in progress.");return}if(!K.current){B("debug","Connect called after unmount, aborting.");return}U.current=!0,P.current+=1,R(void 0),_(void 0),G.current=null,w("discovering"),B("info",`Connecting attempt #${P.current} to ${e}...`),z.current||(z.current=new P0(e,{storageKeyPrefix:a,clientName:r,clientUri:s,callbackUrl:n,preventAutoAuth:h,onPopupWindow:m}),B("debug","BrowserOAuthClientProvider initialized in connect.")),I.current||(I.current=new uF({name:o.name||"use-mcp-react-client",version:o.version||"0.1.0"},{capabilities:{}}),B("debug","MCP Client initialized in connect."));const J=async Y=>{B("info",`Attempting connection with ${Y.toUpperCase()} transport...`),L.current!=="authenticating"&&w("connecting");let ze;try{Ui(z.current,"Auth Provider must be initialized"),Ui(I.current,"Client must be initialized"),C.current&&(await C.current.close().catch(Ne=>B("warn",`Error closing previous transport: ${Ne.message}`)),C.current=null);const te={authProvider:z.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...i}}},Me=To(e),Ue=new URL(Me);B("debug",`Creating ${Y.toUpperCase()} transport for URL: ${Ue.toString()}`),B("debug","Transport options:",{authProvider:!!z.current,headers:i,url:Ue.toString()}),Y==="http"?(B("debug","Creating StreamableHTTPClientTransport..."),ze=new M4(Ue,te),B("debug","StreamableHTTPClientTransport created successfully")):(B("debug","Creating SSEClientTransport..."),ze=new O4(Ue,te),B("debug","SSEClientTransport created successfully")),C.current=ze,B("debug",`${Y.toUpperCase()} transport created and assigned to ref.`)}catch(te){return ve(`Failed to create ${Y.toUpperCase()} transport: ${te instanceof Error?te.message:String(te)}`,te instanceof Error?te:void 0),"failed"}ze.onmessage=te=>{var Me,Ue;B("debug",`[Transport] Received: ${JSON.stringify(te)}`),(Ue=(Me=I.current)==null?void 0:Me.handleMessage)==null||Ue.call(Me,te)},ze.onerror=te=>{B("warn",`Transport error event (${Y.toUpperCase()}):`,te),B("debug","Error details:",{message:te.message,stack:te.stack,name:te.name,cause:te.cause}),ve(`Transport error (${Y.toUpperCase()}): ${te.message}`,te)},ze.onclose=()=>{if(!K.current||U.current)return;B("info",`Transport connection closed (${G.current||"unknown"} type).`);const te=L.current,Me=X.current;if(te==="ready"&&Me){const Ue=typeof Me=="number"?Me:J0;B("info",`Attempting to reconnect in ${Ue}ms...`),w("connecting"),setTimeout(()=>{K.current&&ge()},Ue)}else te!=="failed"&&te!=="authenticating"&&ve("Connection closed unexpectedly.")};try{B("info",`Connecting client via ${Y.toUpperCase()}...`),B("debug","About to call client.connect() with transport instance"),B("debug",`Transport instance type: ${ze.constructor.name}`),await I.current.connect(ze),B("info",`Client connected via ${Y.toUpperCase()}. Loading tools, resources, and prompts...`),G.current=Y,w("loading");const te=await I.current.request({method:"tools/list"},Yv);let Me={resources:[],resourceTemplates:[]};try{Me=await I.current.request({method:"resources/list"},Zu)}catch(Ne){B("debug","Server does not support resources/list method",Ne)}let Ue={prompts:[]};try{Ue=await I.current.request({method:"prompts/list"},Yu)}catch(Ne){B("debug","Server does not support prompts/list method",Ne)}if(K.current){y(te.tools),v(Me.resources),S(Array.isArray(Me.resourceTemplates)?Me.resourceTemplates:[]),N(Ue.prompts);const Ne=[`Loaded ${te.tools.length} tools`];return(Me.resources.length>0||Me.resourceTemplates&&Me.resourceTemplates.length>0)&&(Ne.push(`${Me.resources.length} resources`),Array.isArray(Me.resourceTemplates)&&Me.resourceTemplates.length>0&&Ne.push(`${Me.resourceTemplates.length} resource templates`)),Ue.prompts.length>0&&Ne.push(`${Ue.prompts.length} prompts`),B("info",Ne.join(", ")+"."),w("ready"),P.current=0,"success"}else return"failed"}catch(te){B("debug",`Client connect error via ${Y.toUpperCase()}:`,te),B("debug","Connect error details:",{message:te instanceof Error?te.message:String(te),stack:te instanceof Error?te.stack:"N/A",name:te instanceof Error?te.name:"Unknown",cause:te instanceof Error?te.cause:void 0});const Me=te instanceof Error?te:new Error(String(te)),Ue=Me.message,Ne=Ue.includes("404")||Ue.includes("Not Found"),rt=Ue.includes("405")||Ue.includes("Method Not Allowed"),pt=Ue==="Failed to fetch"||Ue==="NetworkError when attempting to fetch resource."||Ue==="Load failed";if(Y==="http"&&(Ne||rt||pt))return B("warn",`HTTP transport failed (${pt?"CORS":Ne?"404":"405"}).`),"fallback";if(Me instanceof Dr||Ue.includes("Unauthorized")||Ue.includes("401")){B("info","Authentication required."),Ui(z.current,"Auth Provider not available for auth flow");const Hr=await z.current.tokens();if(h&&!Hr)return B("info","Authentication required but auto-auth prevented. User action needed."),w("pending_auth"),"auth_redirect";L.current!=="authenticating"&&L.current!=="pending_auth"&&(w("authenticating"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{},eh));try{const zt=await Pn(z.current,{serverUrl:e});if(!K.current)return"failed";if(zt==="AUTHORIZED")return B("info","Authentication successful via existing token or refresh. Re-attempting connection..."),D.current&&clearTimeout(D.current),U.current=!1,ge(),"failed";if(zt==="REDIRECT")return B("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(zt){return K.current&&(D.current&&clearTimeout(D.current),ve(`Failed to initiate authentication: ${zt instanceof Error?zt.message:String(zt)}`,zt instanceof Error?zt:void 0)),"failed"}}return ve(`Failed to connect via ${Y.toUpperCase()}: ${Ue}`,Me),"failed"}};let ce="failed";if(console.log({transportType:d}),d==="sse")B("debug","Using SSE-only transport mode"),ce=await J("sse");else if(d==="http")B("debug","Using HTTP-only transport mode"),ce=await J("http");else{B("debug","Using auto transport mode (HTTP with SSE fallback)");const Y=await J("http");if(Y==="fallback"&&K.current&&L.current!=="authenticating"){B("info","HTTP failed, attempting SSE fallback...");const ze=await J("sse");ce=ze,ze==="failed"&&K.current}else ce=Y}(ce==="success"||ce==="failed")&&(U.current=!1),B("debug",`Connection sequence finished with status: ${ce}`)},[B,ve,oe,Pn,e,a,r,s,n,o.name,o.version]),re=x.useCallback(async(J,ce)=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot call tool "${J}".`);B("info",`Calling tool: ${J}`,ce);try{const Y=await I.current.request({method:"tools/call",params:{name:J,arguments:ce}},Qd);return B("info",`Tool "${J}" call successful:`,Y),Y}catch(Y){B("error",`Error calling tool "${J}": ${Y instanceof Error?Y.message:String(Y)}`,Y);const ze=Y instanceof Error?Y:new Error(String(Y));if(ze instanceof Dr||ze.message.includes("Unauthorized")||ze.message.includes("401")){B("warn","Tool call unauthorized, attempting re-authentication..."),w("authenticating"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{},eh);try{Ui(z.current,"Auth Provider not available for tool re-auth");const te=await Pn(z.current,{serverUrl:e});if(!K.current)return;te==="AUTHORIZED"?(B("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),D.current&&clearTimeout(D.current),U.current=!1,ge()):te==="REDIRECT"&&B("info","Redirecting for re-authentication for tool call.")}catch(te){if(!K.current)return;D.current&&clearTimeout(D.current),ve(`Re-authentication failed: ${te instanceof Error?te.message:String(te)}`,te instanceof Error?te:void 0)}}if(L.current!=="authenticating")throw Y;return}},[f,e,B,ve,ge]),ye=x.useCallback(()=>{L.current==="failed"?(B("info","Retry requested..."),ge()):B("warn",`Retry called but state is not 'failed' (state: ${L.current}). Ignoring.`)},[B,ge]),ke=x.useCallback(async()=>{var ce;B("info","Manual authentication requested...");const J=L.current;if(J==="failed")B("info","Attempting to reconnect and authenticate via retry..."),ye();else if(J==="pending_auth"){B("info","Proceeding with authentication from pending state..."),w("authenticating"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{},eh);try{Ui(z.current,"Auth Provider not available for manual auth");const Y=await Pn(z.current,{serverUrl:e});if(!K.current)return;Y==="AUTHORIZED"?(B("info","Manual authentication successful. Re-attempting connection..."),D.current&&clearTimeout(D.current),U.current=!1,ge()):Y==="REDIRECT"&&B("info","Redirecting for manual authentication. Waiting for callback...")}catch(Y){if(!K.current)return;D.current&&clearTimeout(D.current),ve(`Manual authentication failed: ${Y instanceof Error?Y.message:String(Y)}`,Y instanceof Error?Y:void 0)}}else if(J==="authenticating"){B("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const Y=(ce=z.current)==null?void 0:ce.getLastAttemptedAuthUrl();Y&&!T&&(_(Y),B("info","Manual authentication URL retrieved:",Y))}else B("info",`Client not in a state requiring manual authentication trigger (state: ${J}). If needed, try disconnecting and reconnecting.`)},[B,ye,T,e,ve,ge]),me=x.useCallback(()=>{if(z.current){const J=z.current.clearStorage();B("info",`Cleared ${J} item(s) from localStorage for ${e}.`),_(void 0),oe()}else B("warn","Auth provider not initialized, cannot clear storage.")},[e,B,oe]),ee=x.useCallback(async()=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot list resources.`);B("info","Listing resources...");try{const J=await I.current.request({method:"resources/list"},Zu);K.current&&(v(J.resources),S(Array.isArray(J.resourceTemplates)?J.resourceTemplates:[]),B("info",`Listed ${J.resources.length} resources, ${Array.isArray(J.resourceTemplates)?J.resourceTemplates.length:0} resource templates.`))}catch(J){throw B("error",`Error listing resources: ${J instanceof Error?J.message:String(J)}`,J),J}},[f,B]),_e=x.useCallback(async J=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot read resource "${J}".`);B("info",`Reading resource: ${J}`);try{const ce=await I.current.request({method:"resources/read",params:{uri:J}},Kv);return B("info",`Resource "${J}" read successfully`),ce}catch(ce){throw B("error",`Error reading resource "${J}": ${ce instanceof Error?ce.message:String(ce)}`,ce),ce}},[f,B]),Pe=x.useCallback(async()=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot list prompts.`);B("info","Listing prompts...");try{const J=await I.current.request({method:"prompts/list"},Yu);K.current&&(N(J.prompts),B("info",`Listed ${J.prompts.length} prompts.`))}catch(J){throw B("error",`Error listing prompts: ${J instanceof Error?J.message:String(J)}`,J),J}},[f,B]),De=x.useCallback(async(J,ce)=>{if(L.current!=="ready"||!I.current)throw new Error(`MCP client is not ready (current state: ${f}). Cannot get prompt "${J}".`);B("info",`Getting prompt: ${J}`,ce);try{const Y=await I.current.request({method:"prompts/get",params:{name:J,arguments:ce}},Zv);return B("info",`Prompt "${J}" retrieved successfully`),Y}catch(Y){throw B("error",`Error getting prompt "${J}": ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[f,B]);return x.useEffect(()=>{const J=ce=>{var Y;ce.origin===window.location.origin&&((Y=ce.data)==null?void 0:Y.type)==="mcp_auth_callback"&&(B("info","Received auth callback message.",ce.data),D.current&&clearTimeout(D.current),ce.data.success?(B("info","Authentication successful via popup. Reconnecting client..."),U.current=!1,ge()):ve(`Authentication failed in callback: ${ce.data.error||"Unknown reason."}`))};return window.addEventListener("message",J),B("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",J),B("debug","Auth callback message listener removed."),D.current&&clearTimeout(D.current)}},[B,ve,ge]),x.useEffect(()=>(K.current=!0,B("debug","useMcp mounted, initiating connection."),P.current=0,(!z.current||z.current.serverUrl!==e)&&(z.current=new P0(e,{storageKeyPrefix:a,clientName:r,clientUri:s,callbackUrl:n,preventAutoAuth:h,onPopupWindow:m}),B("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),ge(),()=>{K.current=!1,B("debug","useMcp unmounting, disconnecting."),oe(!0)}),[e,a,n,r,s,o.name,o.version,ge,oe]),x.useEffect(()=>{let J=null;if(f==="failed"&&c&&P.current>0){const ce=typeof c=="number"?c:dF;B("info",`Connection failed, auto-retrying in ${ce}ms...`),J=setTimeout(()=>{K.current&&L.current==="failed"&&ye()},ce)}return()=>{J&&clearTimeout(J)}},[f,c,ye,B]),{state:f,tools:p,resources:g,resourceTemplates:b,prompts:E,error:j,log:A,authUrl:T,callTool:re,listResources:ee,readResource:_e,listPrompts:Pe,getPrompt:De,retry:ye,disconnect:oe,authenticate:ke,clearStorage:me}}function hF({service:t,autoConnect:e=!1,onConnected:r,onError:s}){const{toast:n}=or(),{state:a,tools:o,resources:i,prompts:c,error:u,authUrl:d,callTool:h,readResource:m,listResources:f,getPrompt:w,listPrompts:p,retry:y,disconnect:g,authenticate:v,clearStorage:b}=fF({url:t.url,clientName:"AgentDeck",clientUri:window.location.origin,callbackUrl:`${window.location.origin}/oauth/callback`,storageKeyPrefix:`mcp:auth:${t.id}`,autoRetry:3,autoReconnect:5e3,transportType:"auto",preventAutoAuth:!e}),S=a==="ready",E=a==="connecting"||a==="loading",N=a==="authenticating"||a==="pending_auth",j=a==="failed";return mn.useEffect(()=>{S&&r&&(r(),n({title:"Connected to MCP service",description:`Successfully connected to ${t.name}`}))},[S,r,t.name,n]),mn.useEffect(()=>{j&&u&&s&&(s(u),n({title:"MCP connection failed",description:u,variant:"destructive"}))},[j,u,s,n]),{isConnected:S,isConnecting:E,isAuthenticating:N,hasError:j,error:u,tools:o,resources:i,prompts:c,connect:()=>{y()},disconnect:g,retry:y,authenticate:v,callTool:async(I,C)=>{try{return await h(I,C)}catch(z){const U=z instanceof Error?z.message:"Unknown error";throw n({title:"Tool call failed",description:U,variant:"destructive"}),z}},readResource:async I=>{try{return await m(I)}catch(C){const z=C instanceof Error?C.message:"Unknown error";throw n({title:"Resource read failed",description:z,variant:"destructive"}),C}},listResources:async()=>{try{await f()}catch(I){const C=I instanceof Error?I.message:"Unknown error";throw n({title:"Resource listing failed",description:C,variant:"destructive"}),I}},getPrompt:async(I,C)=>{try{return await w(I,C)}catch(z){const U=z instanceof Error?z.message:"Unknown error";throw n({title:"Prompt retrieval failed",description:U,variant:"destructive"}),z}},listPrompts:async()=>{try{await p()}catch(I){const C=I instanceof Error?I.message:"Unknown error";throw n({title:"Prompt listing failed",description:C,variant:"destructive"}),I}},authUrl:d,clearStorage:b}}function pF(){const[t,e]=x.useState("https://api.githubcopilot.com/mcp"),[r,s]=x.useState("get_me"),[n,a]=x.useState("{}"),[o,i]=x.useState(""),c={id:"test-mcp-service",name:"Test MCP Service",url:t,registeredAt:new Date().toISOString(),updatedAt:new Date().toISOString()},{isConnected:u,isConnecting:d,isAuthenticating:h,hasError:m,error:f,tools:w,resources:p,prompts:y,connect:g,disconnect:v,retry:b,authenticate:S,callTool:E,authUrl:N,clearStorage:j}=hF({service:c,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:T=>{console.error("Test MCP service error:",T)}}),A=d?{status:"connecting",icon:Yy,color:"text-yellow-500"}:h?{status:"authenticating",icon:Cc,color:"text-blue-500"}:u?{status:"connected",icon:up,color:"text-green-500"}:m?{status:"error",icon:Gy,color:"text-red-500"}:{status:"disconnected",icon:Gy,color:"text-gray-500"},F=async()=>{try{let T={};n.trim()&&(T=JSON.parse(n));const _=await E(r,T);i(JSON.stringify(_,null,2))}catch(T){i(`Error: ${T instanceof Error?T.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(Cs,{children:[l.jsxs(_a,{children:[l.jsxs(Ea,{className:"flex items-center gap-2",children:[l.jsx(A.icon,{className:`w-5 h-5 ${A.color}`}),"Connection Status: ",A.status]}),l.jsx(Xc,{children:"Current connection state and available actions"})]}),l.jsxs(Ps,{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(We,{children:"Service URL"}),l.jsx(tt,{value:t,onChange:T=>e(T.target.value),placeholder:"Enter MCP service URL"})]}),l.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&l.jsx(fe,{onClick:g,children:"Connect"}),u&&l.jsx(fe,{onClick:v,variant:"outline",children:"Disconnect"}),m&&l.jsxs(fe,{onClick:b,variant:"outline",children:[l.jsx(Yy,{className:"w-4 h-4 mr-1"}),"Retry"]}),N&&!u&&l.jsxs(fe,{onClick:S,variant:"outline",children:[l.jsx(Cc,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),f&&l.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[l.jsx(C1,{className:"w-4 h-4 text-destructive"}),l.jsx("span",{className:"text-sm text-destructive",children:f})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[l.jsxs(Cs,{children:[l.jsx(_a,{children:l.jsxs(Ea,{className:"flex items-center gap-2",children:[l.jsx(Tu,{className:"w-4 h-4"}),"Tools (",w.length,")"]})}),l.jsx(Ps,{children:w.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:[w.slice(0,5).map((T,_)=>l.jsx("div",{className:"text-sm",children:l.jsx(hn,{variant:"outline",className:"text-xs",children:T.name})},_)),w.length>5&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",w.length-5," more tools"]})]})})]}),l.jsxs(Cs,{children:[l.jsx(_a,{children:l.jsxs(Ea,{children:["Resources (",p.length,")"]})}),l.jsx(Ps,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${p.length} resources available`:"Connect to see resources"})})]}),l.jsxs(Cs,{children:[l.jsx(_a,{children:l.jsxs(Ea,{children:["Prompts (",y.length,")"]})}),l.jsx(Ps,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${y.length} prompts available`:"Connect to see prompts"})})]})]}),u&&l.jsxs(Cs,{children:[l.jsxs(_a,{children:[l.jsx(Ea,{children:"Test Tool Call"}),l.jsx(Xc,{children:"Test calling a tool on the connected MCP service"})]}),l.jsxs(Ps,{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(We,{htmlFor:"toolName",children:"Tool Name"}),l.jsx(tt,{id:"toolName",value:r,onChange:T=>s(T.target.value),placeholder:"e.g., get_me"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),l.jsx(tt,{id:"toolArgs",value:n,onChange:T=>a(T.target.value),placeholder:'{"key": "value"}'})]})]}),l.jsxs(fe,{onClick:F,disabled:!u,children:[l.jsx(m2,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),o&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(We,{children:"Result"}),l.jsx(Gn,{value:o,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),N&&l.jsxs(Cs,{children:[l.jsxs(_a,{children:[l.jsxs(Ea,{className:"flex items-center gap-2",children:[l.jsx(Cc,{className:"w-4 h-4"}),"OAuth Authentication"]}),l.jsx(Xc,{children:"This service requires OAuth authentication"})]}),l.jsxs(Ps,{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(fe,{onClick:S,variant:"outline",children:[l.jsx(Cc,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),l.jsx(fe,{onClick:j,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function mF(){return l.jsxs(kN,{children:[l.jsx(bc,{path:"/",component:EI}),l.jsx(bc,{path:"/oauth/callback",component:kI}),l.jsx(bc,{path:"/mcp-test",component:pF}),l.jsx(bc,{component:PI})]})}function vF(){return l.jsx(QN,{client:cj,children:l.jsxs(FT,{children:[l.jsx(X2,{}),l.jsx(mF,{})]})})}bb(document.getElementById("root")).render(l.jsx(x.StrictMode,{children:l.jsx(vF,{})}));
|