@agent-deck/backend 1.1.2 → 1.1.4
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/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +5 -8
- package/dist/lib/paths.js.map +1 -1
- package/dist/mcp-server.d.ts +8 -2
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +100 -23
- package/dist/mcp-server.js.map +1 -1
- package/dist/models/database.d.ts +4 -1
- package/dist/models/database.d.ts.map +1 -1
- package/dist/models/database.js +40 -19
- package/dist/models/database.js.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -1
- package/dist/server/index.js.map +1 -1
- package/package.json +4 -4
- package/static-ui/assets/{index-D1IuraRt.js → index-BMpKtwqp.js} +56 -51
- package/static-ui/index.html +1 -1
|
@@ -34,10 +34,10 @@ var mC=Object.defineProperty;var yg=t=>{throw TypeError(t)};var vC=(t,e,r)=>e in
|
|
|
34
34
|
`+af+t}var of=!1;function lf(t,e){if(!t||of)return"";of=!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{of=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Vi(t):""}function KC(t){switch(t.tag){case 5:return Vi(t.type);case 16:return Vi("Lazy");case 13:return Vi("Suspense");case 19:return Vi("SuspenseList");case 0:case 2:case 15:return t=lf(t.type,!1),t;case 11:return t=lf(t.type.render,!1),t;case 1:return t=lf(t.type,!0),t;default:return""}}function ih(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 bo:return"Fragment";case wo:return"Portal";case sh:return"Profiler";case _m:return"StrictMode";case ah:return"Suspense";case oh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case _x:return(t.displayName||"Context")+".Consumer";case Sx:return(t._context.displayName||"Context")+".Provider";case Em:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Cm:return e=t.displayName||null,e!==null?e:ih(t.type)||"Memo";case _s:e=t._payload,t=t._init;try{return ih(t(e))}catch{}}return null}function WC(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 ih(e);case 8:return e===_m?"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 Cx(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function QC(t){var e=Cx(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=QC(t))}function Px(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),s="";return t&&(s=Cx(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 lh(t,e){var r=e.checked;return xt({},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 kx(t,e){e=e.checked,e!=null&&Sm(t,"checked",e,!1)}function ch(t,e){kx(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")?uh(t,e.type,r):e.hasOwnProperty("defaultValue")&&uh(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 uh(t,e,r){(e!=="number"||su(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var qi=Array.isArray;function Do(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 dh(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(G(91));return xt({},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(G(92));if(qi(r)){if(1<r.length)throw Error(G(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:na(r)}}function Nx(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 jx(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 fh(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?jx(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var ic,Rx=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 Ji={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},GC=["Webkit","ms","Moz","O"];Object.keys(Ji).forEach(function(t){GC.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ji[e]=Ji[t]})});function Tx(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Ji.hasOwnProperty(t)&&Ji[t]?(""+e).trim():e+"px"}function Ax(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var s=r.indexOf("--")===0,n=Tx(r,e[r],s);r==="float"&&(r="cssFloat"),s?t.setProperty(r,n):t[r]=n}}var ZC=xt({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 hh(t,e){if(e){if(ZC[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(G(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(G(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(G(61))}if(e.style!=null&&typeof e.style!="object")throw Error(G(62))}}function ph(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 mh=null;function Pm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var vh=null,$o=null,Mo=null;function jg(t){if(t=Ll(t)){if(typeof vh!="function")throw Error(G(280));var e=t.stateNode;e&&(e=fd(e),vh(t.stateNode,t.type,e))}}function Ox(t){$o?Mo?Mo.push(t):Mo=[t]:$o=t}function Ix(){if($o){var t=$o,e=Mo;if(Mo=$o=null,jg(t),e)for(t=0;t<e.length;t++)jg(e[t])}}function Dx(t,e){return t(e)}function $x(){}var cf=!1;function Mx(t,e,r){if(cf)return t(e,r);cf=!0;try{return Dx(t,e,r)}finally{cf=!1,($o!==null||Mo!==null)&&($x(),Ix())}}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(G(231,e,typeof r));return r}var gh=!1;if(rs)try{var Ai={};Object.defineProperty(Ai,"passive",{get:function(){gh=!0}}),window.addEventListener("test",Ai,Ai),window.removeEventListener("test",Ai,Ai)}catch{gh=!1}function YC(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 Xi=!1,au=null,ou=!1,yh=null,JC={onError:function(t){Xi=!0,au=t}};function XC(t,e,r,s,n,a,o,i,c){Xi=!1,au=null,YC.apply(JC,arguments)}function eP(t,e,r,s,n,a,o,i,c){if(XC.apply(this,arguments),Xi){if(Xi){var u=au;Xi=!1,au=null}else throw Error(G(198));ou||(ou=!0,yh=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 Fx(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(G(188))}function tP(t){var e=t.alternate;if(!e){if(e=no(t),e===null)throw Error(G(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(G(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(G(189))}}if(r.alternate!==s)throw Error(G(190))}if(r.tag!==3)throw Error(G(188));return r.stateNode.current===r?t:e}function Lx(t){return t=tP(t),t!==null?Ux(t):null}function Ux(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Ux(t);if(e!==null)return e;t=t.sibling}return null}var zx=Cr.unstable_scheduleCallback,Tg=Cr.unstable_cancelCallback,rP=Cr.unstable_shouldYield,nP=Cr.unstable_requestPaint,Ct=Cr.unstable_now,sP=Cr.unstable_getCurrentPriorityLevel,km=Cr.unstable_ImmediatePriority,Vx=Cr.unstable_UserBlockingPriority,iu=Cr.unstable_NormalPriority,aP=Cr.unstable_LowPriority,qx=Cr.unstable_IdlePriority,ld=null,kn=null;function oP(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:cP,iP=Math.log,lP=Math.LN2;function cP(t){return t>>>=0,t===0?32:31-(iP(t)/lP|0)|0}var lc=64,cc=4194304;function Hi(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=Hi(i):(a&=o,a!==0&&(s=Hi(a)))}else o=r&~n,o!==0?s=Hi(o):a!==0&&(s=Hi(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 uP(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 dP(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]=uP(i,e)):c<=e&&(t.expiredLanes|=i),a&=~i}}function xh(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Hx(){var t=lc;return lc<<=1,!(lc&4194240)&&(lc=64),t}function uf(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 fP(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 Nm(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 tt=0;function Bx(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Kx,jm,Wx,Qx,Gx,wh=!1,uc=[],Bs=null,Ks=null,Ws=null,hl=new Map,pl=new Map,Ns=[],hP="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 Oi(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&&jm(e)),t):(t.eventSystemFlags|=s,e=t.targetContainers,n!==null&&e.indexOf(n)===-1&&e.push(n),t)}function pP(t,e,r,s,n){switch(e){case"focusin":return Bs=Oi(Bs,t,e,r,s,n),!0;case"dragenter":return Ks=Oi(Ks,t,e,r,s,n),!0;case"mouseover":return Ws=Oi(Ws,t,e,r,s,n),!0;case"pointerover":var a=n.pointerId;return hl.set(a,Oi(hl.get(a)||null,t,e,r,s,n)),!0;case"gotpointercapture":return a=n.pointerId,pl.set(a,Oi(pl.get(a)||null,t,e,r,s,n)),!0}return!1}function Zx(t){var e=Pa(t.target);if(e!==null){var r=no(e);if(r!==null){if(e=r.tag,e===13){if(e=Fx(r),e!==null){t.blockedOn=e,Gx(t.priority,function(){Wx(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 $c(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=bh(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var s=new r.constructor(r.type,r);mh=s,r.target.dispatchEvent(s),mh=null}else return e=Ll(r),e!==null&&jm(e),t.blockedOn=r,!1;e.shift()}return!0}function Og(t,e,r){$c(t)&&r.delete(e)}function mP(){wh=!1,Bs!==null&&$c(Bs)&&(Bs=null),Ks!==null&&$c(Ks)&&(Ks=null),Ws!==null&&$c(Ws)&&(Ws=null),hl.forEach(Og),pl.forEach(Og)}function Ii(t,e){t.blockedOn===e&&(t.blockedOn=null,wh||(wh=!0,Cr.unstable_scheduleCallback(Cr.unstable_NormalPriority,mP)))}function ml(t){function e(n){return Ii(n,t)}if(0<uc.length){Ii(uc[0],t);for(var r=1;r<uc.length;r++){var s=uc[r];s.blockedOn===t&&(s.blockedOn=null)}}for(Bs!==null&&Ii(Bs,t),Ks!==null&&Ii(Ks,t),Ws!==null&&Ii(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);)Zx(r),r.blockedOn===null&&Ns.shift()}var Fo=us.ReactCurrentBatchConfig,cu=!0;function vP(t,e,r,s){var n=tt,a=Fo.transition;Fo.transition=null;try{tt=1,Rm(t,e,r,s)}finally{tt=n,Fo.transition=a}}function gP(t,e,r,s){var n=tt,a=Fo.transition;Fo.transition=null;try{tt=4,Rm(t,e,r,s)}finally{tt=n,Fo.transition=a}}function Rm(t,e,r,s){if(cu){var n=bh(t,e,r,s);if(n===null)wf(t,e,s,uu,r),Ag(t,s);else if(pP(n,t,e,r,s))s.stopPropagation();else if(Ag(t,s),e&4&&-1<hP.indexOf(t)){for(;n!==null;){var a=Ll(n);if(a!==null&&Kx(a),a=bh(t,e,r,s),a===null&&wf(t,e,s,uu,r),a===n)break;n=a}n!==null&&s.stopPropagation()}else wf(t,e,s,null,r)}}var uu=null;function bh(t,e,r,s){if(uu=null,t=Pm(s),t=Pa(t),t!==null)if(e=no(t),e===null)t=null;else if(r=e.tag,r===13){if(t=Fx(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 Yx(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(sP()){case km:return 1;case Vx:return 4;case iu:case aP:return 16;case qx:return 536870912;default:return 16}default:return 16}}var Us=null,Tm=null,Mc=null;function Jx(){if(Mc)return Mc;var t,e=Tm,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 Mc=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 kr(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 xt(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 wi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Am=kr(wi),Fl=xt({},wi,{view:0,detail:0}),yP=kr(Fl),df,ff,Di,cd=xt({},Fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Om,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!==Di&&(Di&&t.type==="mousemove"?(df=t.screenX-Di.screenX,ff=t.screenY-Di.screenY):ff=df=0,Di=t),df)},movementY:function(t){return"movementY"in t?t.movementY:ff}}),Dg=kr(cd),xP=xt({},cd,{dataTransfer:0}),wP=kr(xP),bP=xt({},Fl,{relatedTarget:0}),hf=kr(bP),SP=xt({},wi,{animationName:0,elapsedTime:0,pseudoElement:0}),_P=kr(SP),EP=xt({},wi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),CP=kr(EP),PP=xt({},wi,{data:0}),$g=kr(PP),kP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},NP={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"},jP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RP(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=jP[t])?!!e[t]:!1}function Om(){return RP}var TP=xt({},Fl,{key:function(t){if(t.key){var e=kP[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"?NP[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Om,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}}),AP=kr(TP),OP=xt({},cd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mg=kr(OP),IP=xt({},Fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Om}),DP=kr(IP),$P=xt({},wi,{propertyName:0,elapsedTime:0,pseudoElement:0}),MP=kr($P),FP=xt({},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}),LP=kr(FP),UP=[9,13,27,32],Im=rs&&"CompositionEvent"in window,el=null;rs&&"documentMode"in document&&(el=document.documentMode);var zP=rs&&"TextEvent"in window&&!el,Xx=rs&&(!Im||el&&8<el&&11>=el),Fg=" ",Lg=!1;function ew(t,e){switch(t){case"keyup":return UP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tw(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var So=!1;function VP(t,e){switch(t){case"compositionend":return tw(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 qP(t,e){if(So)return t==="compositionend"||!Im&&ew(t,e)?(t=Jx(),Mc=Tm=Us=null,So=!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 Xx&&e.locale!=="ko"?null:e.data;default:return null}}var HP={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"?!!HP[t.type]:e==="textarea"}function rw(t,e,r,s){Ox(s),e=du(e,"onChange"),0<e.length&&(r=new Am("onChange","change",null,r,s),t.push({event:r,listeners:e}))}var tl=null,vl=null;function BP(t){hw(t,0)}function ud(t){var e=Co(t);if(Px(e))return t}function KP(t,e){if(t==="change")return e}var nw=!1;if(rs){var pf;if(rs){var mf="oninput"in document;if(!mf){var zg=document.createElement("div");zg.setAttribute("oninput","return;"),mf=typeof zg.oninput=="function"}pf=mf}else pf=!1;nw=pf&&(!document.documentMode||9<document.documentMode)}function Vg(){tl&&(tl.detachEvent("onpropertychange",sw),vl=tl=null)}function sw(t){if(t.propertyName==="value"&&ud(vl)){var e=[];rw(e,vl,t,Pm(t)),Mx(BP,e)}}function WP(t,e,r){t==="focusin"?(Vg(),tl=e,vl=r,tl.attachEvent("onpropertychange",sw)):t==="focusout"&&Vg()}function QP(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ud(vl)}function GP(t,e){if(t==="click")return ud(e)}function ZP(t,e){if(t==="input"||t==="change")return ud(e)}function YP(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var sn=typeof Object.is=="function"?Object.is:YP;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(!nh.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 aw(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?aw(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function ow(){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 Dm(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 JP(t){var e=ow(),r=t.focusedElem,s=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&aw(r.ownerDocument.documentElement,r)){if(s!==null&&Dm(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 XP=rs&&"documentMode"in document&&11>=document.documentMode,_o=null,Sh=null,rl=null,_h=!1;function Bg(t,e,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;_h||_o==null||_o!==su(s)||(s=_o,"selectionStart"in s&&Dm(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}),rl&&gl(rl,s)||(rl=s,s=du(Sh,"onSelect"),0<s.length&&(e=new Am("onSelect","select",null,e,r),t.push({event:e,listeners:s}),e.target=_o)))}function fc(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var Eo={animationend:fc("Animation","AnimationEnd"),animationiteration:fc("Animation","AnimationIteration"),animationstart:fc("Animation","AnimationStart"),transitionend:fc("Transition","TransitionEnd")},vf={},iw={};rs&&(iw=document.createElement("div").style,"AnimationEvent"in window||(delete Eo.animationend.animation,delete Eo.animationiteration.animation,delete Eo.animationstart.animation),"TransitionEvent"in window||delete Eo.transitionend.transition);function dd(t){if(vf[t])return vf[t];if(!Eo[t])return t;var e=Eo[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in iw)return vf[t]=e[r];return t}var lw=dd("animationend"),cw=dd("animationiteration"),uw=dd("animationstart"),dw=dd("transitionend"),fw=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){fw.set(t,e),ro(e,[t])}for(var gf=0;gf<Kg.length;gf++){var yf=Kg[gf],ek=yf.toLowerCase(),tk=yf[0].toUpperCase()+yf.slice(1);la(ek,"on"+tk)}la(lw,"onAnimationEnd");la(cw,"onAnimationIteration");la(uw,"onAnimationStart");la("dblclick","onDoubleClick");la("focusin","onFocus");la("focusout","onBlur");la(dw,"onTransitionEnd");ai("onMouseEnter",["mouseout","mouseover"]);ai("onMouseLeave",["mouseout","mouseover"]);ai("onPointerEnter",["pointerout","pointerover"]);ai("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 Bi="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(" "),rk=new Set("cancel close invalid load scroll toggle".split(" ").concat(Bi));function Wg(t,e,r){var s=t.type||"unknown-event";t.currentTarget=r,eP(s,e,void 0,t),t.currentTarget=null}function hw(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=yh,ou=!1,yh=null,t}function ct(t,e){var r=e[Nh];r===void 0&&(r=e[Nh]=new Set);var s=t+"__bubble";r.has(s)||(pw(e,t,2,!1),r.add(s))}function xf(t,e,r){var s=0;e&&(s|=4),pw(r,t,s,e)}var hc="_reactListening"+Math.random().toString(36).slice(2);function yl(t){if(!t[hc]){t[hc]=!0,bx.forEach(function(r){r!=="selectionchange"&&(rk.has(r)||xf(r,!1,t),xf(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[hc]||(e[hc]=!0,xf("selectionchange",!1,e))}}function pw(t,e,r,s){switch(Yx(e)){case 1:var n=vP;break;case 4:n=gP;break;default:n=Rm}r=n.bind(null,e,r,t),n=void 0,!gh||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 wf(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}Mx(function(){var u=a,d=Pm(r),f=[];e:{var m=fw.get(t);if(m!==void 0){var h=Am,w=t;switch(t){case"keypress":if(Fc(r)===0)break e;case"keydown":case"keyup":h=AP;break;case"focusin":w="focus",h=hf;break;case"focusout":w="blur",h=hf;break;case"beforeblur":case"afterblur":h=hf;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":h=Dg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=wP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=DP;break;case lw:case cw:case uw:h=_P;break;case dw:h=MP;break;case"scroll":h=yP;break;case"wheel":h=LP;break;case"copy":case"cut":case"paste":h=CP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Mg}var p=(e&4)!==0,g=!p&&t==="scroll",y=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,y!==null&&(S=fl(v,y),S!=null&&p.push(xl(v,S,b)))),g)break;v=v.return}0<p.length&&(m=new h(m,w,null,r,d),f.push({event:m,listeners:p}))}}if(!(e&7)){e:{if(m=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",m&&r!==mh&&(w=r.relatedTarget||r.fromElement)&&(Pa(w)||w[ns]))break e;if((h||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,h?(w=r.relatedTarget||r.toElement,h=u,w=w?Pa(w):null,w!==null&&(g=no(w),w!==g||w.tag!==5&&w.tag!==6)&&(w=null)):(h=null,w=u),h!==w)){if(p=Dg,S="onMouseLeave",y="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(p=Mg,S="onPointerLeave",y="onPointerEnter",v="pointer"),g=h==null?m:Co(h),b=w==null?m:Co(w),m=new p(S,v+"leave",h,r,d),m.target=g,m.relatedTarget=b,S=null,Pa(d)===u&&(p=new p(y,v+"enter",w,r,d),p.target=b,p.relatedTarget=g,S=p),g=S,h&&w)t:{for(p=h,y=w,v=0,b=p;b;b=lo(b))v++;for(b=0,S=y;S;S=lo(S))b++;for(;0<v-b;)p=lo(p),v--;for(;0<b-v;)y=lo(y),b--;for(;v--;){if(p===y||y!==null&&p===y.alternate)break t;p=lo(p),y=lo(y)}p=null}else p=null;h!==null&&Qg(f,m,h,p,!1),w!==null&&g!==null&&Qg(f,g,w,p,!0)}}e:{if(m=u?Co(u):window,h=m.nodeName&&m.nodeName.toLowerCase(),h==="select"||h==="input"&&m.type==="file")var E=KP;else if(Ug(m))if(nw)E=ZP;else{E=QP;var k=WP}else(h=m.nodeName)&&h.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(E=GP);if(E&&(E=E(t,u))){rw(f,E,r,d);break e}k&&k(t,m,u),t==="focusout"&&(k=m._wrapperState)&&k.controlled&&m.type==="number"&&uh(m,"number",m.value)}switch(k=u?Co(u):window,t){case"focusin":(Ug(k)||k.contentEditable==="true")&&(_o=k,Sh=u,rl=null);break;case"focusout":rl=Sh=_o=null;break;case"mousedown":_h=!0;break;case"contextmenu":case"mouseup":case"dragend":_h=!1,Bg(f,r,d);break;case"selectionchange":if(XP)break;case"keydown":case"keyup":Bg(f,r,d)}var N;if(Im)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else So?ew(t,r)&&(T="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(T="onCompositionStart");T&&(Xx&&r.locale!=="ko"&&(So||T!=="onCompositionStart"?T==="onCompositionEnd"&&So&&(N=Jx()):(Us=d,Tm="value"in Us?Us.value:Us.textContent,So=!0)),k=du(u,T),0<k.length&&(T=new $g(T,t,null,r,d),f.push({event:T,listeners:k}),N?T.data=N:(N=tw(r),N!==null&&(T.data=N)))),(N=zP?VP(t,r):qP(t,r))&&(u=du(u,"onBeforeInput"),0<u.length&&(d=new $g("onBeforeInput","beforeinput",null,r,d),f.push({event:d,listeners:u}),d.data=N))}hw(f,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 nk=/\r\n?/g,sk=/\u0000|\uFFFD/g;function Gg(t){return(typeof t=="string"?t:""+t).replace(nk,`
|
|
38
|
-
`).replace(sk,"")}function pc(t,e,r){if(e=Gg(e),Gg(t)!==e&&r)throw Error(G(425))}function fu(){}var Eh=null,Ch=null;function Ph(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 kh=typeof setTimeout=="function"?setTimeout:void 0,ak=typeof clearTimeout=="function"?clearTimeout:void 0,Zg=typeof Promise=="function"?Promise:void 0,ok=typeof queueMicrotask=="function"?queueMicrotask:typeof Zg<"u"?function(t){return Zg.resolve(null).then(t).catch(ik)}:kh;function ik(t){setTimeout(function(){throw t})}function bf(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 bi=Math.random().toString(36).slice(2),xn="__reactFiber$"+bi,wl="__reactProps$"+bi,ns="__reactContainer$"+bi,Nh="__reactEvents$"+bi,lk="__reactListeners$"+bi,ck="__reactHandles$"+bi;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=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[ns],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Co(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(G(33))}function fd(t){return t[wl]||null}var jh=[],Po=-1;function ca(t){return{current:t}}function dt(t){0>Po||(t.current=jh[Po],jh[Po]=null,Po--)}function ot(t,e){Po++,jh[Po]=t.current,t.current=e}var sa={},Zt=ca(sa),hr=ca(!1),Ua=sa;function oi(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 pr(t){return t=t.childContextTypes,t!=null}function hu(){dt(hr),dt(Zt)}function Jg(t,e,r){if(Zt.current!==sa)throw Error(G(168));ot(Zt,e),ot(hr,r)}function mw(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(G(108,WC(t)||"Unknown",n));return xt({},r,s)}function pu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||sa,Ua=Zt.current,ot(Zt,t),ot(hr,hr.current),!0}function Xg(t,e,r){var s=t.stateNode;if(!s)throw Error(G(169));r?(t=mw(t,e,Ua),s.__reactInternalMemoizedMergedChildContext=t,dt(hr),dt(Zt),ot(Zt,t)):dt(hr),ot(hr,r)}var Bn=null,hd=!1,Sf=!1;function vw(t){Bn===null?Bn=[t]:Bn.push(t)}function uk(t){hd=!0,vw(t)}function ua(){if(!Sf&&Bn!==null){Sf=!0;var t=0,e=tt;try{var r=Bn;for(tt=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)),zx(km,ua),n}finally{tt=e,Sf=!1}}return null}var ko=[],No=0,mu=null,vu=0,Ar=[],Or=0,za=null,Zn=1,Yn="";function ba(t,e){ko[No++]=vu,ko[No++]=mu,mu=t,vu=e}function gw(t,e,r){Ar[Or++]=Zn,Ar[Or++]=Yn,Ar[Or++]=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 $m(t){t.return!==null&&(ba(t,1),gw(t,1,0))}function Mm(t){for(;t===mu;)mu=ko[--No],ko[No]=null,vu=ko[--No],ko[No]=null;for(;t===za;)za=Ar[--Or],Ar[Or]=null,Yn=Ar[--Or],Ar[Or]=null,Zn=Ar[--Or],Ar[Or]=null}var _r=null,Sr=null,mt=!1,tn=null;function yw(t,e){var r=$r(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,_r=t,Sr=Qs(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,_r=t,Sr=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=$r(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,_r=t,Sr=null,!0):!1;default:return!1}}function Rh(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Th(t){if(mt){var e=Sr;if(e){var r=e;if(!ey(t,e)){if(Rh(t))throw Error(G(418));e=Qs(r.nextSibling);var s=_r;e&&ey(t,e)?yw(s,r):(t.flags=t.flags&-4097|2,mt=!1,_r=t)}}else{if(Rh(t))throw Error(G(418));t.flags=t.flags&-4097|2,mt=!1,_r=t}}}function ty(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;_r=t}function mc(t){if(t!==_r)return!1;if(!mt)return ty(t),mt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Ph(t.type,t.memoizedProps)),e&&(e=Sr)){if(Rh(t))throw xw(),Error(G(418));for(;e;)yw(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(G(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Sr=Qs(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Sr=null}}else Sr=_r?Qs(t.stateNode.nextSibling):null;return!0}function xw(){for(var t=Sr;t;)t=Qs(t.nextSibling)}function ii(){Sr=_r=null,mt=!1}function Fm(t){tn===null?tn=[t]:tn.push(t)}var dk=us.ReactCurrentBatchConfig;function $i(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(G(309));var s=r.stateNode}if(!s)throw Error(G(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(G(284));if(!r._owner)throw Error(G(290,t))}return t}function vc(t,e){throw t=Object.prototype.toString.call(e),Error(G(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function ry(t){var e=t._init;return e(t._payload)}function ww(t){function e(y,v){if(t){var b=y.deletions;b===null?(y.deletions=[v],y.flags|=16):b.push(v)}}function r(y,v){if(!t)return null;for(;v!==null;)e(y,v),v=v.sibling;return null}function s(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function n(y,v){return y=Js(y,v),y.index=0,y.sibling=null,y}function a(y,v,b){return y.index=b,t?(b=y.alternate,b!==null?(b=b.index,b<v?(y.flags|=2,v):b):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function i(y,v,b,S){return v===null||v.tag!==6?(v=jf(b,y.mode,S),v.return=y,v):(v=n(v,b),v.return=y,v)}function c(y,v,b,S){var E=b.type;return E===bo?d(y,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=$i(y,v,b),S.return=y,S):(S=Bc(b.type,b.key,b.props,null,y.mode,S),S.ref=$i(y,v,b),S.return=y,S)}function u(y,v,b,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=Rf(b,y.mode,S),v.return=y,v):(v=n(v,b.children||[]),v.return=y,v)}function d(y,v,b,S,E){return v===null||v.tag!==7?(v=Fa(b,y.mode,S,E),v.return=y,v):(v=n(v,b),v.return=y,v)}function f(y,v,b){if(typeof v=="string"&&v!==""||typeof v=="number")return v=jf(""+v,y.mode,b),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ac:return b=Bc(v.type,v.key,v.props,null,y.mode,b),b.ref=$i(y,null,v),b.return=y,b;case wo:return v=Rf(v,y.mode,b),v.return=y,v;case _s:var S=v._init;return f(y,S(v._payload),b)}if(qi(v)||Ti(v))return v=Fa(v,y.mode,b,null),v.return=y,v;vc(y,v)}return null}function m(y,v,b,S){var E=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return E!==null?null:i(y,v,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ac:return b.key===E?c(y,v,b,S):null;case wo:return b.key===E?u(y,v,b,S):null;case _s:return E=b._init,m(y,v,E(b._payload),S)}if(qi(b)||Ti(b))return E!==null?null:d(y,v,b,S,null);vc(y,b)}return null}function h(y,v,b,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(b)||null,i(v,y,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ac:return y=y.get(S.key===null?b:S.key)||null,c(v,y,S,E);case wo:return y=y.get(S.key===null?b:S.key)||null,u(v,y,S,E);case _s:var k=S._init;return h(y,v,b,k(S._payload),E)}if(qi(S)||Ti(S))return y=y.get(b)||null,d(v,y,S,E,null);vc(v,S)}return null}function w(y,v,b,S){for(var E=null,k=null,N=v,T=v=0,D=null;N!==null&&T<b.length;T++){N.index>T?(D=N,N=null):D=N.sibling;var U=m(y,N,b[T],S);if(U===null){N===null&&(N=D);break}t&&N&&U.alternate===null&&e(y,N),v=a(U,v,T),k===null?E=U:k.sibling=U,k=U,N=D}if(T===b.length)return r(y,N),mt&&ba(y,T),E;if(N===null){for(;T<b.length;T++)N=f(y,b[T],S),N!==null&&(v=a(N,v,T),k===null?E=N:k.sibling=N,k=N);return mt&&ba(y,T),E}for(N=s(y,N);T<b.length;T++)D=h(N,y,T,b[T],S),D!==null&&(t&&D.alternate!==null&&N.delete(D.key===null?T:D.key),v=a(D,v,T),k===null?E=D:k.sibling=D,k=D);return t&&N.forEach(function(R){return e(y,R)}),mt&&ba(y,T),E}function p(y,v,b,S){var E=Ti(b);if(typeof E!="function")throw Error(G(150));if(b=E.call(b),b==null)throw Error(G(151));for(var k=E=null,N=v,T=v=0,D=null,U=b.next();N!==null&&!U.done;T++,U=b.next()){N.index>T?(D=N,N=null):D=N.sibling;var R=m(y,N,U.value,S);if(R===null){N===null&&(N=D);break}t&&N&&R.alternate===null&&e(y,N),v=a(R,v,T),k===null?E=R:k.sibling=R,k=R,N=D}if(U.done)return r(y,N),mt&&ba(y,T),E;if(N===null){for(;!U.done;T++,U=b.next())U=f(y,U.value,S),U!==null&&(v=a(U,v,T),k===null?E=U:k.sibling=U,k=U);return mt&&ba(y,T),E}for(N=s(y,N);!U.done;T++,U=b.next())U=h(N,y,T,U.value,S),U!==null&&(t&&U.alternate!==null&&N.delete(U.key===null?T:U.key),v=a(U,v,T),k===null?E=U:k.sibling=U,k=U);return t&&N.forEach(function(A){return e(y,A)}),mt&&ba(y,T),E}function g(y,v,b,S){if(typeof b=="object"&&b!==null&&b.type===bo&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case ac:e:{for(var E=b.key,k=v;k!==null;){if(k.key===E){if(E=b.type,E===bo){if(k.tag===7){r(y,k.sibling),v=n(k,b.props.children),v.return=y,y=v;break e}}else if(k.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===_s&&ry(E)===k.type){r(y,k.sibling),v=n(k,b.props),v.ref=$i(y,k,b),v.return=y,y=v;break e}r(y,k);break}else e(y,k);k=k.sibling}b.type===bo?(v=Fa(b.props.children,y.mode,S,b.key),v.return=y,y=v):(S=Bc(b.type,b.key,b.props,null,y.mode,S),S.ref=$i(y,v,b),S.return=y,y=S)}return o(y);case wo:e:{for(k=b.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){r(y,v.sibling),v=n(v,b.children||[]),v.return=y,y=v;break e}else{r(y,v);break}else e(y,v);v=v.sibling}v=Rf(b,y.mode,S),v.return=y,y=v}return o(y);case _s:return k=b._init,g(y,v,k(b._payload),S)}if(qi(b))return w(y,v,b,S);if(Ti(b))return p(y,v,b,S);vc(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(r(y,v.sibling),v=n(v,b),v.return=y,y=v):(r(y,v),v=jf(b,y.mode,S),v.return=y,y=v),o(y)):r(y,v)}return g}var li=ww(!0),bw=ww(!1),gu=ca(null),yu=null,jo=null,Lm=null;function Um(){Lm=jo=yu=null}function zm(t){var e=gu.current;dt(gu),t._currentValue=e}function Ah(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 Lo(t,e){yu=t,Lm=jo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(fr=!0),t.firstContext=null)}function Fr(t){var e=t._currentValue;if(Lm!==t)if(t={context:t,memoizedValue:e,next:null},jo===null){if(yu===null)throw Error(G(308));jo=t,yu.dependencies={lanes:0,firstContext:t}}else jo=jo.next=t;return e}var ka=null;function Vm(t){ka===null?ka=[t]:ka.push(t)}function Sw(t,e,r,s){var n=e.interleaved;return n===null?(r.next=r,Vm(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 Es=!1;function qm(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _w(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,Ye&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,Vm(s)):(e.next=n.next,n.next=e),s.interleaved=e,ss(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,Nm(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 f=n.baseState;o=0,d=u=c=null,i=a;do{var m=i.lane,h=i.eventTime;if((s&m)===m){d!==null&&(d=d.next={eventTime:h,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var w=t,p=i;switch(m=e,h=r,p.tag){case 1:if(w=p.payload,typeof w=="function"){f=w.call(h,f,m);break e}f=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=p.payload,m=typeof w=="function"?w.call(h,f,m):w,m==null)break e;f=xt({},f,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 h={eventTime:h,lane:m,tag:i.tag,payload:i.payload,callback:i.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,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=f),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=f}}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(G(191,n));n.call(s)}}}var Ul={},Nn=ca(Ul),bl=ca(Ul),Sl=ca(Ul);function Na(t){if(t===Ul)throw Error(G(174));return t}function Hm(t,e){switch(ot(Sl,e),ot(bl,t),ot(Nn,Ul),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:fh(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=fh(e,t)}dt(Nn),ot(Nn,e)}function ci(){dt(Nn),dt(bl),dt(Sl)}function Ew(t){Na(Sl.current);var e=Na(Nn.current),r=fh(e,t.type);e!==r&&(ot(bl,t),ot(Nn,r))}function Bm(t){bl.current===t&&(dt(Nn),dt(bl))}var gt=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 _f=[];function Km(){for(var t=0;t<_f.length;t++)_f[t]._workInProgressVersionPrimary=null;_f.length=0}var Uc=us.ReactCurrentDispatcher,Ef=us.ReactCurrentBatchConfig,Va=0,yt=null,Tt=null,Mt=null,bu=!1,nl=!1,_l=0,fk=0;function Wt(){throw Error(G(321))}function Wm(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 Qm(t,e,r,s,n,a){if(Va=a,yt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Uc.current=t===null||t.memoizedState===null?vk:gk,t=r(s,n),nl){a=0;do{if(nl=!1,_l=0,25<=a)throw Error(G(301));a+=1,Mt=Tt=null,e.updateQueue=null,Uc.current=yk,t=r(s,n)}while(nl)}if(Uc.current=Su,e=Tt!==null&&Tt.next!==null,Va=0,Mt=Tt=yt=null,bu=!1,e)throw Error(G(300));return t}function Gm(){var t=_l!==0;return _l=0,t}function pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?yt.memoizedState=Mt=t:Mt=Mt.next=t,Mt}function Lr(){if(Tt===null){var t=yt.alternate;t=t!==null?t.memoizedState:null}else t=Tt.next;var e=Mt===null?yt.memoizedState:Mt.next;if(e!==null)Mt=e,Tt=t;else{if(t===null)throw Error(G(310));Tt=t,t={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},Mt===null?yt.memoizedState=Mt=t:Mt=Mt.next=t}return Mt}function El(t,e){return typeof e=="function"?e(t):e}function Cf(t){var e=Lr(),r=e.queue;if(r===null)throw Error(G(311));r.lastRenderedReducer=t;var s=Tt,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 f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(i=c=f,o=s):c=c.next=f,yt.lanes|=d,qa|=d}u=u.next}while(u!==null&&u!==a);c===null?o=s:c.next=i,sn(s,e.memoizedState)||(fr=!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,yt.lanes|=a,qa|=a,n=n.next;while(n!==t)}else n===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function Pf(t){var e=Lr(),r=e.queue;if(r===null)throw Error(G(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)||(fr=!0),e.memoizedState=a,e.baseQueue===null&&(e.baseState=a),r.lastRenderedState=a}return[a,s]}function Cw(){}function Pw(t,e){var r=yt,s=Lr(),n=e(),a=!sn(s.memoizedState,n);if(a&&(s.memoizedState=n,fr=!0),s=s.queue,Zm(jw.bind(null,r,s,t),[t]),s.getSnapshot!==e||a||Mt!==null&&Mt.memoizedState.tag&1){if(r.flags|=2048,Cl(9,Nw.bind(null,r,s,n,e),void 0,null),Lt===null)throw Error(G(349));Va&30||kw(r,e,n)}return n}function kw(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=yt.updateQueue,e===null?(e={lastEffect:null,stores:null},yt.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function Nw(t,e,r,s){e.value=r,e.getSnapshot=s,Rw(e)&&Tw(t)}function jw(t,e,r){return r(function(){Rw(e)&&Tw(t)})}function Rw(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!sn(t,r)}catch{return!0}}function Tw(t){var e=ss(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=mk.bind(null,yt,t),[e.memoizedState,t]}function Cl(t,e,r,s){return t={tag:t,create:e,destroy:r,deps:s,next:null},e=yt.updateQueue,e===null?(e={lastEffect:null,stores:null},yt.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 Aw(){return Lr().memoizedState}function zc(t,e,r,s){var n=pn();yt.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(Tt!==null){var o=Tt.memoizedState;if(a=o.destroy,s!==null&&Wm(s,o.deps)){n.memoizedState=Cl(e,r,a,s);return}}yt.flags|=t,n.memoizedState=Cl(1|e,r,a,s)}function oy(t,e){return zc(8390656,8,t,e)}function Zm(t,e){return pd(2048,8,t,e)}function Ow(t,e){return pd(4,2,t,e)}function Iw(t,e){return pd(4,4,t,e)}function Dw(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 $w(t,e,r){return r=r!=null?r.concat([t]):null,pd(4,4,Dw.bind(null,e,t),r)}function Ym(){}function Mw(t,e){var r=Lr();e=e===void 0?null:e;var s=r.memoizedState;return s!==null&&e!==null&&Wm(e,s[1])?s[0]:(r.memoizedState=[t,e],t)}function Fw(t,e){var r=Lr();e=e===void 0?null:e;var s=r.memoizedState;return s!==null&&e!==null&&Wm(e,s[1])?s[0]:(t=t(),r.memoizedState=[t,e],t)}function Lw(t,e,r){return Va&21?(sn(r,e)||(r=Hx(),yt.lanes|=r,qa|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,fr=!0),t.memoizedState=r)}function hk(t,e){var r=tt;tt=r!==0&&4>r?r:4,t(!0);var s=Ef.transition;Ef.transition={};try{t(!1),e()}finally{tt=r,Ef.transition=s}}function Uw(){return Lr().memoizedState}function pk(t,e,r){var s=Ys(t);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},zw(t))Vw(e,r);else if(r=Sw(t,e,r,s),r!==null){var n=rr();nn(r,t,s,n),qw(r,e,s)}}function mk(t,e,r){var s=Ys(t),n={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(zw(t))Vw(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,Vm(e)):(n.next=c.next,c.next=n),e.interleaved=n;return}}catch{}finally{}r=Sw(t,e,n,s),r!==null&&(n=rr(),nn(r,t,s,n),qw(r,e,s))}}function zw(t){var e=t.alternate;return t===yt||e!==null&&e===yt}function Vw(t,e){nl=bu=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function qw(t,e,r){if(r&4194240){var s=e.lanes;s&=t.pendingLanes,r|=s,e.lanes=r,Nm(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},vk={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,Dw.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=pk.bind(null,yt,t),[s.memoizedState,t]},useRef:function(t){var e=pn();return t={current:t},e.memoizedState=t},useState:ay,useDebugValue:Ym,useDeferredValue:function(t){return pn().memoizedState=t},useTransition:function(){var t=ay(!1),e=t[0];return t=hk.bind(null,t[1]),pn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var s=yt,n=pn();if(mt){if(r===void 0)throw Error(G(407));r=r()}else{if(r=e(),Lt===null)throw Error(G(349));Va&30||kw(s,e,r)}n.memoizedState=r;var a={value:r,getSnapshot:e};return n.queue=a,oy(jw.bind(null,s,a,t),[t]),s.flags|=2048,Cl(9,Nw.bind(null,s,a,r,e),void 0,null),r},useId:function(){var t=pn(),e=Lt.identifierPrefix;if(mt){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=fk++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},gk={readContext:Fr,useCallback:Mw,useContext:Fr,useEffect:Zm,useImperativeHandle:$w,useInsertionEffect:Ow,useLayoutEffect:Iw,useMemo:Fw,useReducer:Cf,useRef:Aw,useState:function(){return Cf(El)},useDebugValue:Ym,useDeferredValue:function(t){var e=Lr();return Lw(e,Tt.memoizedState,t)},useTransition:function(){var t=Cf(El)[0],e=Lr().memoizedState;return[t,e]},useMutableSource:Cw,useSyncExternalStore:Pw,useId:Uw,unstable_isNewReconciler:!1},yk={readContext:Fr,useCallback:Mw,useContext:Fr,useEffect:Zm,useImperativeHandle:$w,useInsertionEffect:Ow,useLayoutEffect:Iw,useMemo:Fw,useReducer:Pf,useRef:Aw,useState:function(){return Pf(El)},useDebugValue:Ym,useDeferredValue:function(t){var e=Lr();return Tt===null?e.memoizedState=t:Lw(e,Tt.memoizedState,t)},useTransition:function(){var t=Pf(El)[0],e=Lr().memoizedState;return[t,e]},useMutableSource:Cw,useSyncExternalStore:Pw,useId:Uw,unstable_isNewReconciler:!1};function Zr(t,e){if(t&&t.defaultProps){e=xt({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function Oh(t,e,r,s){e=t.memoizedState,r=r(s,e),r=r==null?e:xt({},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=Xn(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=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),Lc(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),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 Hw(t,e,r){var s=!1,n=sa,a=e.contextType;return typeof a=="object"&&a!==null?a=Fr(a):(n=pr(e)?Ua:Zt.current,s=e.contextTypes,a=(s=s!=null)?oi(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 Ih(t,e,r,s){var n=t.stateNode;n.props=r,n.state=t.memoizedState,n.refs={},qm(t);var a=e.contextType;typeof a=="object"&&a!==null?n.context=Fr(a):(a=pr(e)?Ua:Zt.current,n.context=oi(t,a)),n.state=t.memoizedState,a=e.getDerivedStateFromProps,typeof a=="function"&&(Oh(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 ui(t,e){try{var r="",s=e;do r+=KC(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{of=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Vi(t):""}function KC(t){switch(t.tag){case 5:return Vi(t.type);case 16:return Vi("Lazy");case 13:return Vi("Suspense");case 19:return Vi("SuspenseList");case 0:case 2:case 15:return t=lf(t.type,!1),t;case 11:return t=lf(t.type.render,!1),t;case 1:return t=lf(t.type,!0),t;default:return""}}function ih(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 bo:return"Fragment";case wo:return"Portal";case sh:return"Profiler";case _m:return"StrictMode";case ah:return"Suspense";case oh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case _x:return(t.displayName||"Context")+".Consumer";case Sx:return(t._context.displayName||"Context")+".Provider";case Em:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Cm:return e=t.displayName||null,e!==null?e:ih(t.type)||"Memo";case _s:e=t._payload,t=t._init;try{return ih(t(e))}catch{}}return null}function WC(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 ih(e);case 8:return e===_m?"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 Cx(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function QC(t){var e=Cx(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=QC(t))}function Px(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),s="";return t&&(s=Cx(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 lh(t,e){var r=e.checked;return xt({},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 kx(t,e){e=e.checked,e!=null&&Sm(t,"checked",e,!1)}function ch(t,e){kx(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")?uh(t,e.type,r):e.hasOwnProperty("defaultValue")&&uh(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 uh(t,e,r){(e!=="number"||su(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var qi=Array.isArray;function Do(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 dh(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(G(91));return xt({},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(G(92));if(qi(r)){if(1<r.length)throw Error(G(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:na(r)}}function Nx(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 jx(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 fh(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?jx(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var ic,Rx=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 Ji={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},GC=["Webkit","ms","Moz","O"];Object.keys(Ji).forEach(function(t){GC.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ji[e]=Ji[t]})});function Tx(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Ji.hasOwnProperty(t)&&Ji[t]?(""+e).trim():e+"px"}function Ax(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var s=r.indexOf("--")===0,n=Tx(r,e[r],s);r==="float"&&(r="cssFloat"),s?t.setProperty(r,n):t[r]=n}}var ZC=xt({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 hh(t,e){if(e){if(ZC[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(G(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(G(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(G(61))}if(e.style!=null&&typeof e.style!="object")throw Error(G(62))}}function ph(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 mh=null;function Pm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var vh=null,$o=null,Mo=null;function jg(t){if(t=Ll(t)){if(typeof vh!="function")throw Error(G(280));var e=t.stateNode;e&&(e=fd(e),vh(t.stateNode,t.type,e))}}function Ox(t){$o?Mo?Mo.push(t):Mo=[t]:$o=t}function Ix(){if($o){var t=$o,e=Mo;if(Mo=$o=null,jg(t),e)for(t=0;t<e.length;t++)jg(e[t])}}function Dx(t,e){return t(e)}function $x(){}var cf=!1;function Mx(t,e,r){if(cf)return t(e,r);cf=!0;try{return Dx(t,e,r)}finally{cf=!1,($o!==null||Mo!==null)&&($x(),Ix())}}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(G(231,e,typeof r));return r}var gh=!1;if(rs)try{var Ai={};Object.defineProperty(Ai,"passive",{get:function(){gh=!0}}),window.addEventListener("test",Ai,Ai),window.removeEventListener("test",Ai,Ai)}catch{gh=!1}function YC(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 Xi=!1,au=null,ou=!1,yh=null,JC={onError:function(t){Xi=!0,au=t}};function XC(t,e,r,s,n,a,o,i,c){Xi=!1,au=null,YC.apply(JC,arguments)}function eP(t,e,r,s,n,a,o,i,c){if(XC.apply(this,arguments),Xi){if(Xi){var u=au;Xi=!1,au=null}else throw Error(G(198));ou||(ou=!0,yh=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 Fx(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(G(188))}function tP(t){var e=t.alternate;if(!e){if(e=no(t),e===null)throw Error(G(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(G(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(G(189))}}if(r.alternate!==s)throw Error(G(190))}if(r.tag!==3)throw Error(G(188));return r.stateNode.current===r?t:e}function Lx(t){return t=tP(t),t!==null?Ux(t):null}function Ux(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Ux(t);if(e!==null)return e;t=t.sibling}return null}var zx=Cr.unstable_scheduleCallback,Tg=Cr.unstable_cancelCallback,rP=Cr.unstable_shouldYield,nP=Cr.unstable_requestPaint,Ct=Cr.unstable_now,sP=Cr.unstable_getCurrentPriorityLevel,km=Cr.unstable_ImmediatePriority,Vx=Cr.unstable_UserBlockingPriority,iu=Cr.unstable_NormalPriority,aP=Cr.unstable_LowPriority,qx=Cr.unstable_IdlePriority,ld=null,kn=null;function oP(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:cP,iP=Math.log,lP=Math.LN2;function cP(t){return t>>>=0,t===0?32:31-(iP(t)/lP|0)|0}var lc=64,cc=4194304;function Hi(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=Hi(i):(a&=o,a!==0&&(s=Hi(a)))}else o=r&~n,o!==0?s=Hi(o):a!==0&&(s=Hi(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 uP(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 dP(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]=uP(i,e)):c<=e&&(t.expiredLanes|=i),a&=~i}}function xh(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Hx(){var t=lc;return lc<<=1,!(lc&4194240)&&(lc=64),t}function uf(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 fP(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 Nm(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 rt=0;function Bx(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Kx,jm,Wx,Qx,Gx,wh=!1,uc=[],Bs=null,Ks=null,Ws=null,hl=new Map,pl=new Map,Ns=[],hP="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 Oi(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&&jm(e)),t):(t.eventSystemFlags|=s,e=t.targetContainers,n!==null&&e.indexOf(n)===-1&&e.push(n),t)}function pP(t,e,r,s,n){switch(e){case"focusin":return Bs=Oi(Bs,t,e,r,s,n),!0;case"dragenter":return Ks=Oi(Ks,t,e,r,s,n),!0;case"mouseover":return Ws=Oi(Ws,t,e,r,s,n),!0;case"pointerover":var a=n.pointerId;return hl.set(a,Oi(hl.get(a)||null,t,e,r,s,n)),!0;case"gotpointercapture":return a=n.pointerId,pl.set(a,Oi(pl.get(a)||null,t,e,r,s,n)),!0}return!1}function Zx(t){var e=Pa(t.target);if(e!==null){var r=no(e);if(r!==null){if(e=r.tag,e===13){if(e=Fx(r),e!==null){t.blockedOn=e,Gx(t.priority,function(){Wx(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 $c(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=bh(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var s=new r.constructor(r.type,r);mh=s,r.target.dispatchEvent(s),mh=null}else return e=Ll(r),e!==null&&jm(e),t.blockedOn=r,!1;e.shift()}return!0}function Og(t,e,r){$c(t)&&r.delete(e)}function mP(){wh=!1,Bs!==null&&$c(Bs)&&(Bs=null),Ks!==null&&$c(Ks)&&(Ks=null),Ws!==null&&$c(Ws)&&(Ws=null),hl.forEach(Og),pl.forEach(Og)}function Ii(t,e){t.blockedOn===e&&(t.blockedOn=null,wh||(wh=!0,Cr.unstable_scheduleCallback(Cr.unstable_NormalPriority,mP)))}function ml(t){function e(n){return Ii(n,t)}if(0<uc.length){Ii(uc[0],t);for(var r=1;r<uc.length;r++){var s=uc[r];s.blockedOn===t&&(s.blockedOn=null)}}for(Bs!==null&&Ii(Bs,t),Ks!==null&&Ii(Ks,t),Ws!==null&&Ii(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);)Zx(r),r.blockedOn===null&&Ns.shift()}var Fo=us.ReactCurrentBatchConfig,cu=!0;function vP(t,e,r,s){var n=rt,a=Fo.transition;Fo.transition=null;try{rt=1,Rm(t,e,r,s)}finally{rt=n,Fo.transition=a}}function gP(t,e,r,s){var n=rt,a=Fo.transition;Fo.transition=null;try{rt=4,Rm(t,e,r,s)}finally{rt=n,Fo.transition=a}}function Rm(t,e,r,s){if(cu){var n=bh(t,e,r,s);if(n===null)wf(t,e,s,uu,r),Ag(t,s);else if(pP(n,t,e,r,s))s.stopPropagation();else if(Ag(t,s),e&4&&-1<hP.indexOf(t)){for(;n!==null;){var a=Ll(n);if(a!==null&&Kx(a),a=bh(t,e,r,s),a===null&&wf(t,e,s,uu,r),a===n)break;n=a}n!==null&&s.stopPropagation()}else wf(t,e,s,null,r)}}var uu=null;function bh(t,e,r,s){if(uu=null,t=Pm(s),t=Pa(t),t!==null)if(e=no(t),e===null)t=null;else if(r=e.tag,r===13){if(t=Fx(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 Yx(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(sP()){case km:return 1;case Vx:return 4;case iu:case aP:return 16;case qx:return 536870912;default:return 16}default:return 16}}var Us=null,Tm=null,Mc=null;function Jx(){if(Mc)return Mc;var t,e=Tm,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 Mc=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 kr(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 xt(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 wi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Am=kr(wi),Fl=xt({},wi,{view:0,detail:0}),yP=kr(Fl),df,ff,Di,cd=xt({},Fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Om,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!==Di&&(Di&&t.type==="mousemove"?(df=t.screenX-Di.screenX,ff=t.screenY-Di.screenY):ff=df=0,Di=t),df)},movementY:function(t){return"movementY"in t?t.movementY:ff}}),Dg=kr(cd),xP=xt({},cd,{dataTransfer:0}),wP=kr(xP),bP=xt({},Fl,{relatedTarget:0}),hf=kr(bP),SP=xt({},wi,{animationName:0,elapsedTime:0,pseudoElement:0}),_P=kr(SP),EP=xt({},wi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),CP=kr(EP),PP=xt({},wi,{data:0}),$g=kr(PP),kP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},NP={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"},jP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RP(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=jP[t])?!!e[t]:!1}function Om(){return RP}var TP=xt({},Fl,{key:function(t){if(t.key){var e=kP[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"?NP[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Om,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}}),AP=kr(TP),OP=xt({},cd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mg=kr(OP),IP=xt({},Fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Om}),DP=kr(IP),$P=xt({},wi,{propertyName:0,elapsedTime:0,pseudoElement:0}),MP=kr($P),FP=xt({},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}),LP=kr(FP),UP=[9,13,27,32],Im=rs&&"CompositionEvent"in window,el=null;rs&&"documentMode"in document&&(el=document.documentMode);var zP=rs&&"TextEvent"in window&&!el,Xx=rs&&(!Im||el&&8<el&&11>=el),Fg=" ",Lg=!1;function ew(t,e){switch(t){case"keyup":return UP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tw(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var So=!1;function VP(t,e){switch(t){case"compositionend":return tw(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 qP(t,e){if(So)return t==="compositionend"||!Im&&ew(t,e)?(t=Jx(),Mc=Tm=Us=null,So=!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 Xx&&e.locale!=="ko"?null:e.data;default:return null}}var HP={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"?!!HP[t.type]:e==="textarea"}function rw(t,e,r,s){Ox(s),e=du(e,"onChange"),0<e.length&&(r=new Am("onChange","change",null,r,s),t.push({event:r,listeners:e}))}var tl=null,vl=null;function BP(t){hw(t,0)}function ud(t){var e=Co(t);if(Px(e))return t}function KP(t,e){if(t==="change")return e}var nw=!1;if(rs){var pf;if(rs){var mf="oninput"in document;if(!mf){var zg=document.createElement("div");zg.setAttribute("oninput","return;"),mf=typeof zg.oninput=="function"}pf=mf}else pf=!1;nw=pf&&(!document.documentMode||9<document.documentMode)}function Vg(){tl&&(tl.detachEvent("onpropertychange",sw),vl=tl=null)}function sw(t){if(t.propertyName==="value"&&ud(vl)){var e=[];rw(e,vl,t,Pm(t)),Mx(BP,e)}}function WP(t,e,r){t==="focusin"?(Vg(),tl=e,vl=r,tl.attachEvent("onpropertychange",sw)):t==="focusout"&&Vg()}function QP(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ud(vl)}function GP(t,e){if(t==="click")return ud(e)}function ZP(t,e){if(t==="input"||t==="change")return ud(e)}function YP(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var sn=typeof Object.is=="function"?Object.is:YP;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(!nh.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 aw(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?aw(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function ow(){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 Dm(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 JP(t){var e=ow(),r=t.focusedElem,s=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&aw(r.ownerDocument.documentElement,r)){if(s!==null&&Dm(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 XP=rs&&"documentMode"in document&&11>=document.documentMode,_o=null,Sh=null,rl=null,_h=!1;function Bg(t,e,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;_h||_o==null||_o!==su(s)||(s=_o,"selectionStart"in s&&Dm(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}),rl&&gl(rl,s)||(rl=s,s=du(Sh,"onSelect"),0<s.length&&(e=new Am("onSelect","select",null,e,r),t.push({event:e,listeners:s}),e.target=_o)))}function fc(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var Eo={animationend:fc("Animation","AnimationEnd"),animationiteration:fc("Animation","AnimationIteration"),animationstart:fc("Animation","AnimationStart"),transitionend:fc("Transition","TransitionEnd")},vf={},iw={};rs&&(iw=document.createElement("div").style,"AnimationEvent"in window||(delete Eo.animationend.animation,delete Eo.animationiteration.animation,delete Eo.animationstart.animation),"TransitionEvent"in window||delete Eo.transitionend.transition);function dd(t){if(vf[t])return vf[t];if(!Eo[t])return t;var e=Eo[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in iw)return vf[t]=e[r];return t}var lw=dd("animationend"),cw=dd("animationiteration"),uw=dd("animationstart"),dw=dd("transitionend"),fw=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){fw.set(t,e),ro(e,[t])}for(var gf=0;gf<Kg.length;gf++){var yf=Kg[gf],ek=yf.toLowerCase(),tk=yf[0].toUpperCase()+yf.slice(1);la(ek,"on"+tk)}la(lw,"onAnimationEnd");la(cw,"onAnimationIteration");la(uw,"onAnimationStart");la("dblclick","onDoubleClick");la("focusin","onFocus");la("focusout","onBlur");la(dw,"onTransitionEnd");ai("onMouseEnter",["mouseout","mouseover"]);ai("onMouseLeave",["mouseout","mouseover"]);ai("onPointerEnter",["pointerout","pointerover"]);ai("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 Bi="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(" "),rk=new Set("cancel close invalid load scroll toggle".split(" ").concat(Bi));function Wg(t,e,r){var s=t.type||"unknown-event";t.currentTarget=r,eP(s,e,void 0,t),t.currentTarget=null}function hw(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=yh,ou=!1,yh=null,t}function ct(t,e){var r=e[Nh];r===void 0&&(r=e[Nh]=new Set);var s=t+"__bubble";r.has(s)||(pw(e,t,2,!1),r.add(s))}function xf(t,e,r){var s=0;e&&(s|=4),pw(r,t,s,e)}var hc="_reactListening"+Math.random().toString(36).slice(2);function yl(t){if(!t[hc]){t[hc]=!0,bx.forEach(function(r){r!=="selectionchange"&&(rk.has(r)||xf(r,!1,t),xf(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[hc]||(e[hc]=!0,xf("selectionchange",!1,e))}}function pw(t,e,r,s){switch(Yx(e)){case 1:var n=vP;break;case 4:n=gP;break;default:n=Rm}r=n.bind(null,e,r,t),n=void 0,!gh||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 wf(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}Mx(function(){var u=a,d=Pm(r),f=[];e:{var m=fw.get(t);if(m!==void 0){var h=Am,w=t;switch(t){case"keypress":if(Fc(r)===0)break e;case"keydown":case"keyup":h=AP;break;case"focusin":w="focus",h=hf;break;case"focusout":w="blur",h=hf;break;case"beforeblur":case"afterblur":h=hf;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":h=Dg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=wP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=DP;break;case lw:case cw:case uw:h=_P;break;case dw:h=MP;break;case"scroll":h=yP;break;case"wheel":h=LP;break;case"copy":case"cut":case"paste":h=CP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Mg}var p=(e&4)!==0,g=!p&&t==="scroll",y=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,y!==null&&(S=fl(v,y),S!=null&&p.push(xl(v,S,b)))),g)break;v=v.return}0<p.length&&(m=new h(m,w,null,r,d),f.push({event:m,listeners:p}))}}if(!(e&7)){e:{if(m=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",m&&r!==mh&&(w=r.relatedTarget||r.fromElement)&&(Pa(w)||w[ns]))break e;if((h||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,h?(w=r.relatedTarget||r.toElement,h=u,w=w?Pa(w):null,w!==null&&(g=no(w),w!==g||w.tag!==5&&w.tag!==6)&&(w=null)):(h=null,w=u),h!==w)){if(p=Dg,S="onMouseLeave",y="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(p=Mg,S="onPointerLeave",y="onPointerEnter",v="pointer"),g=h==null?m:Co(h),b=w==null?m:Co(w),m=new p(S,v+"leave",h,r,d),m.target=g,m.relatedTarget=b,S=null,Pa(d)===u&&(p=new p(y,v+"enter",w,r,d),p.target=b,p.relatedTarget=g,S=p),g=S,h&&w)t:{for(p=h,y=w,v=0,b=p;b;b=lo(b))v++;for(b=0,S=y;S;S=lo(S))b++;for(;0<v-b;)p=lo(p),v--;for(;0<b-v;)y=lo(y),b--;for(;v--;){if(p===y||y!==null&&p===y.alternate)break t;p=lo(p),y=lo(y)}p=null}else p=null;h!==null&&Qg(f,m,h,p,!1),w!==null&&g!==null&&Qg(f,g,w,p,!0)}}e:{if(m=u?Co(u):window,h=m.nodeName&&m.nodeName.toLowerCase(),h==="select"||h==="input"&&m.type==="file")var E=KP;else if(Ug(m))if(nw)E=ZP;else{E=QP;var k=WP}else(h=m.nodeName)&&h.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(E=GP);if(E&&(E=E(t,u))){rw(f,E,r,d);break e}k&&k(t,m,u),t==="focusout"&&(k=m._wrapperState)&&k.controlled&&m.type==="number"&&uh(m,"number",m.value)}switch(k=u?Co(u):window,t){case"focusin":(Ug(k)||k.contentEditable==="true")&&(_o=k,Sh=u,rl=null);break;case"focusout":rl=Sh=_o=null;break;case"mousedown":_h=!0;break;case"contextmenu":case"mouseup":case"dragend":_h=!1,Bg(f,r,d);break;case"selectionchange":if(XP)break;case"keydown":case"keyup":Bg(f,r,d)}var N;if(Im)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else So?ew(t,r)&&(T="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(T="onCompositionStart");T&&(Xx&&r.locale!=="ko"&&(So||T!=="onCompositionStart"?T==="onCompositionEnd"&&So&&(N=Jx()):(Us=d,Tm="value"in Us?Us.value:Us.textContent,So=!0)),k=du(u,T),0<k.length&&(T=new $g(T,t,null,r,d),f.push({event:T,listeners:k}),N?T.data=N:(N=tw(r),N!==null&&(T.data=N)))),(N=zP?VP(t,r):qP(t,r))&&(u=du(u,"onBeforeInput"),0<u.length&&(d=new $g("onBeforeInput","beforeinput",null,r,d),f.push({event:d,listeners:u}),d.data=N))}hw(f,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 nk=/\r\n?/g,sk=/\u0000|\uFFFD/g;function Gg(t){return(typeof t=="string"?t:""+t).replace(nk,`
|
|
38
|
+
`).replace(sk,"")}function pc(t,e,r){if(e=Gg(e),Gg(t)!==e&&r)throw Error(G(425))}function fu(){}var Eh=null,Ch=null;function Ph(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 kh=typeof setTimeout=="function"?setTimeout:void 0,ak=typeof clearTimeout=="function"?clearTimeout:void 0,Zg=typeof Promise=="function"?Promise:void 0,ok=typeof queueMicrotask=="function"?queueMicrotask:typeof Zg<"u"?function(t){return Zg.resolve(null).then(t).catch(ik)}:kh;function ik(t){setTimeout(function(){throw t})}function bf(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 bi=Math.random().toString(36).slice(2),xn="__reactFiber$"+bi,wl="__reactProps$"+bi,ns="__reactContainer$"+bi,Nh="__reactEvents$"+bi,lk="__reactListeners$"+bi,ck="__reactHandles$"+bi;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=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[ns],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Co(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(G(33))}function fd(t){return t[wl]||null}var jh=[],Po=-1;function ca(t){return{current:t}}function dt(t){0>Po||(t.current=jh[Po],jh[Po]=null,Po--)}function ot(t,e){Po++,jh[Po]=t.current,t.current=e}var sa={},Zt=ca(sa),hr=ca(!1),Ua=sa;function oi(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 pr(t){return t=t.childContextTypes,t!=null}function hu(){dt(hr),dt(Zt)}function Jg(t,e,r){if(Zt.current!==sa)throw Error(G(168));ot(Zt,e),ot(hr,r)}function mw(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(G(108,WC(t)||"Unknown",n));return xt({},r,s)}function pu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||sa,Ua=Zt.current,ot(Zt,t),ot(hr,hr.current),!0}function Xg(t,e,r){var s=t.stateNode;if(!s)throw Error(G(169));r?(t=mw(t,e,Ua),s.__reactInternalMemoizedMergedChildContext=t,dt(hr),dt(Zt),ot(Zt,t)):dt(hr),ot(hr,r)}var Bn=null,hd=!1,Sf=!1;function vw(t){Bn===null?Bn=[t]:Bn.push(t)}function uk(t){hd=!0,vw(t)}function ua(){if(!Sf&&Bn!==null){Sf=!0;var t=0,e=rt;try{var r=Bn;for(rt=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)),zx(km,ua),n}finally{rt=e,Sf=!1}}return null}var ko=[],No=0,mu=null,vu=0,Ar=[],Or=0,za=null,Zn=1,Yn="";function ba(t,e){ko[No++]=vu,ko[No++]=mu,mu=t,vu=e}function gw(t,e,r){Ar[Or++]=Zn,Ar[Or++]=Yn,Ar[Or++]=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 $m(t){t.return!==null&&(ba(t,1),gw(t,1,0))}function Mm(t){for(;t===mu;)mu=ko[--No],ko[No]=null,vu=ko[--No],ko[No]=null;for(;t===za;)za=Ar[--Or],Ar[Or]=null,Yn=Ar[--Or],Ar[Or]=null,Zn=Ar[--Or],Ar[Or]=null}var _r=null,Sr=null,mt=!1,tn=null;function yw(t,e){var r=$r(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,_r=t,Sr=Qs(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,_r=t,Sr=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=$r(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,_r=t,Sr=null,!0):!1;default:return!1}}function Rh(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Th(t){if(mt){var e=Sr;if(e){var r=e;if(!ey(t,e)){if(Rh(t))throw Error(G(418));e=Qs(r.nextSibling);var s=_r;e&&ey(t,e)?yw(s,r):(t.flags=t.flags&-4097|2,mt=!1,_r=t)}}else{if(Rh(t))throw Error(G(418));t.flags=t.flags&-4097|2,mt=!1,_r=t}}}function ty(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;_r=t}function mc(t){if(t!==_r)return!1;if(!mt)return ty(t),mt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Ph(t.type,t.memoizedProps)),e&&(e=Sr)){if(Rh(t))throw xw(),Error(G(418));for(;e;)yw(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(G(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Sr=Qs(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Sr=null}}else Sr=_r?Qs(t.stateNode.nextSibling):null;return!0}function xw(){for(var t=Sr;t;)t=Qs(t.nextSibling)}function ii(){Sr=_r=null,mt=!1}function Fm(t){tn===null?tn=[t]:tn.push(t)}var dk=us.ReactCurrentBatchConfig;function $i(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(G(309));var s=r.stateNode}if(!s)throw Error(G(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(G(284));if(!r._owner)throw Error(G(290,t))}return t}function vc(t,e){throw t=Object.prototype.toString.call(e),Error(G(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function ry(t){var e=t._init;return e(t._payload)}function ww(t){function e(y,v){if(t){var b=y.deletions;b===null?(y.deletions=[v],y.flags|=16):b.push(v)}}function r(y,v){if(!t)return null;for(;v!==null;)e(y,v),v=v.sibling;return null}function s(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function n(y,v){return y=Js(y,v),y.index=0,y.sibling=null,y}function a(y,v,b){return y.index=b,t?(b=y.alternate,b!==null?(b=b.index,b<v?(y.flags|=2,v):b):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function i(y,v,b,S){return v===null||v.tag!==6?(v=jf(b,y.mode,S),v.return=y,v):(v=n(v,b),v.return=y,v)}function c(y,v,b,S){var E=b.type;return E===bo?d(y,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=$i(y,v,b),S.return=y,S):(S=Bc(b.type,b.key,b.props,null,y.mode,S),S.ref=$i(y,v,b),S.return=y,S)}function u(y,v,b,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=Rf(b,y.mode,S),v.return=y,v):(v=n(v,b.children||[]),v.return=y,v)}function d(y,v,b,S,E){return v===null||v.tag!==7?(v=Fa(b,y.mode,S,E),v.return=y,v):(v=n(v,b),v.return=y,v)}function f(y,v,b){if(typeof v=="string"&&v!==""||typeof v=="number")return v=jf(""+v,y.mode,b),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ac:return b=Bc(v.type,v.key,v.props,null,y.mode,b),b.ref=$i(y,null,v),b.return=y,b;case wo:return v=Rf(v,y.mode,b),v.return=y,v;case _s:var S=v._init;return f(y,S(v._payload),b)}if(qi(v)||Ti(v))return v=Fa(v,y.mode,b,null),v.return=y,v;vc(y,v)}return null}function m(y,v,b,S){var E=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return E!==null?null:i(y,v,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ac:return b.key===E?c(y,v,b,S):null;case wo:return b.key===E?u(y,v,b,S):null;case _s:return E=b._init,m(y,v,E(b._payload),S)}if(qi(b)||Ti(b))return E!==null?null:d(y,v,b,S,null);vc(y,b)}return null}function h(y,v,b,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(b)||null,i(v,y,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ac:return y=y.get(S.key===null?b:S.key)||null,c(v,y,S,E);case wo:return y=y.get(S.key===null?b:S.key)||null,u(v,y,S,E);case _s:var k=S._init;return h(y,v,b,k(S._payload),E)}if(qi(S)||Ti(S))return y=y.get(b)||null,d(v,y,S,E,null);vc(v,S)}return null}function w(y,v,b,S){for(var E=null,k=null,N=v,T=v=0,D=null;N!==null&&T<b.length;T++){N.index>T?(D=N,N=null):D=N.sibling;var U=m(y,N,b[T],S);if(U===null){N===null&&(N=D);break}t&&N&&U.alternate===null&&e(y,N),v=a(U,v,T),k===null?E=U:k.sibling=U,k=U,N=D}if(T===b.length)return r(y,N),mt&&ba(y,T),E;if(N===null){for(;T<b.length;T++)N=f(y,b[T],S),N!==null&&(v=a(N,v,T),k===null?E=N:k.sibling=N,k=N);return mt&&ba(y,T),E}for(N=s(y,N);T<b.length;T++)D=h(N,y,T,b[T],S),D!==null&&(t&&D.alternate!==null&&N.delete(D.key===null?T:D.key),v=a(D,v,T),k===null?E=D:k.sibling=D,k=D);return t&&N.forEach(function(R){return e(y,R)}),mt&&ba(y,T),E}function p(y,v,b,S){var E=Ti(b);if(typeof E!="function")throw Error(G(150));if(b=E.call(b),b==null)throw Error(G(151));for(var k=E=null,N=v,T=v=0,D=null,U=b.next();N!==null&&!U.done;T++,U=b.next()){N.index>T?(D=N,N=null):D=N.sibling;var R=m(y,N,U.value,S);if(R===null){N===null&&(N=D);break}t&&N&&R.alternate===null&&e(y,N),v=a(R,v,T),k===null?E=R:k.sibling=R,k=R,N=D}if(U.done)return r(y,N),mt&&ba(y,T),E;if(N===null){for(;!U.done;T++,U=b.next())U=f(y,U.value,S),U!==null&&(v=a(U,v,T),k===null?E=U:k.sibling=U,k=U);return mt&&ba(y,T),E}for(N=s(y,N);!U.done;T++,U=b.next())U=h(N,y,T,U.value,S),U!==null&&(t&&U.alternate!==null&&N.delete(U.key===null?T:U.key),v=a(U,v,T),k===null?E=U:k.sibling=U,k=U);return t&&N.forEach(function(A){return e(y,A)}),mt&&ba(y,T),E}function g(y,v,b,S){if(typeof b=="object"&&b!==null&&b.type===bo&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case ac:e:{for(var E=b.key,k=v;k!==null;){if(k.key===E){if(E=b.type,E===bo){if(k.tag===7){r(y,k.sibling),v=n(k,b.props.children),v.return=y,y=v;break e}}else if(k.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===_s&&ry(E)===k.type){r(y,k.sibling),v=n(k,b.props),v.ref=$i(y,k,b),v.return=y,y=v;break e}r(y,k);break}else e(y,k);k=k.sibling}b.type===bo?(v=Fa(b.props.children,y.mode,S,b.key),v.return=y,y=v):(S=Bc(b.type,b.key,b.props,null,y.mode,S),S.ref=$i(y,v,b),S.return=y,y=S)}return o(y);case wo:e:{for(k=b.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){r(y,v.sibling),v=n(v,b.children||[]),v.return=y,y=v;break e}else{r(y,v);break}else e(y,v);v=v.sibling}v=Rf(b,y.mode,S),v.return=y,y=v}return o(y);case _s:return k=b._init,g(y,v,k(b._payload),S)}if(qi(b))return w(y,v,b,S);if(Ti(b))return p(y,v,b,S);vc(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(r(y,v.sibling),v=n(v,b),v.return=y,y=v):(r(y,v),v=jf(b,y.mode,S),v.return=y,y=v),o(y)):r(y,v)}return g}var li=ww(!0),bw=ww(!1),gu=ca(null),yu=null,jo=null,Lm=null;function Um(){Lm=jo=yu=null}function zm(t){var e=gu.current;dt(gu),t._currentValue=e}function Ah(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 Lo(t,e){yu=t,Lm=jo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(fr=!0),t.firstContext=null)}function Fr(t){var e=t._currentValue;if(Lm!==t)if(t={context:t,memoizedValue:e,next:null},jo===null){if(yu===null)throw Error(G(308));jo=t,yu.dependencies={lanes:0,firstContext:t}}else jo=jo.next=t;return e}var ka=null;function Vm(t){ka===null?ka=[t]:ka.push(t)}function Sw(t,e,r,s){var n=e.interleaved;return n===null?(r.next=r,Vm(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 Es=!1;function qm(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _w(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,Ye&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,Vm(s)):(e.next=n.next,n.next=e),s.interleaved=e,ss(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,Nm(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 f=n.baseState;o=0,d=u=c=null,i=a;do{var m=i.lane,h=i.eventTime;if((s&m)===m){d!==null&&(d=d.next={eventTime:h,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var w=t,p=i;switch(m=e,h=r,p.tag){case 1:if(w=p.payload,typeof w=="function"){f=w.call(h,f,m);break e}f=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=p.payload,m=typeof w=="function"?w.call(h,f,m):w,m==null)break e;f=xt({},f,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 h={eventTime:h,lane:m,tag:i.tag,payload:i.payload,callback:i.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,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=f),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=f}}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(G(191,n));n.call(s)}}}var Ul={},Nn=ca(Ul),bl=ca(Ul),Sl=ca(Ul);function Na(t){if(t===Ul)throw Error(G(174));return t}function Hm(t,e){switch(ot(Sl,e),ot(bl,t),ot(Nn,Ul),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:fh(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=fh(e,t)}dt(Nn),ot(Nn,e)}function ci(){dt(Nn),dt(bl),dt(Sl)}function Ew(t){Na(Sl.current);var e=Na(Nn.current),r=fh(e,t.type);e!==r&&(ot(bl,t),ot(Nn,r))}function Bm(t){bl.current===t&&(dt(Nn),dt(bl))}var gt=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 _f=[];function Km(){for(var t=0;t<_f.length;t++)_f[t]._workInProgressVersionPrimary=null;_f.length=0}var Uc=us.ReactCurrentDispatcher,Ef=us.ReactCurrentBatchConfig,Va=0,yt=null,Tt=null,Mt=null,bu=!1,nl=!1,_l=0,fk=0;function Wt(){throw Error(G(321))}function Wm(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 Qm(t,e,r,s,n,a){if(Va=a,yt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Uc.current=t===null||t.memoizedState===null?vk:gk,t=r(s,n),nl){a=0;do{if(nl=!1,_l=0,25<=a)throw Error(G(301));a+=1,Mt=Tt=null,e.updateQueue=null,Uc.current=yk,t=r(s,n)}while(nl)}if(Uc.current=Su,e=Tt!==null&&Tt.next!==null,Va=0,Mt=Tt=yt=null,bu=!1,e)throw Error(G(300));return t}function Gm(){var t=_l!==0;return _l=0,t}function pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?yt.memoizedState=Mt=t:Mt=Mt.next=t,Mt}function Lr(){if(Tt===null){var t=yt.alternate;t=t!==null?t.memoizedState:null}else t=Tt.next;var e=Mt===null?yt.memoizedState:Mt.next;if(e!==null)Mt=e,Tt=t;else{if(t===null)throw Error(G(310));Tt=t,t={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},Mt===null?yt.memoizedState=Mt=t:Mt=Mt.next=t}return Mt}function El(t,e){return typeof e=="function"?e(t):e}function Cf(t){var e=Lr(),r=e.queue;if(r===null)throw Error(G(311));r.lastRenderedReducer=t;var s=Tt,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 f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(i=c=f,o=s):c=c.next=f,yt.lanes|=d,qa|=d}u=u.next}while(u!==null&&u!==a);c===null?o=s:c.next=i,sn(s,e.memoizedState)||(fr=!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,yt.lanes|=a,qa|=a,n=n.next;while(n!==t)}else n===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function Pf(t){var e=Lr(),r=e.queue;if(r===null)throw Error(G(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)||(fr=!0),e.memoizedState=a,e.baseQueue===null&&(e.baseState=a),r.lastRenderedState=a}return[a,s]}function Cw(){}function Pw(t,e){var r=yt,s=Lr(),n=e(),a=!sn(s.memoizedState,n);if(a&&(s.memoizedState=n,fr=!0),s=s.queue,Zm(jw.bind(null,r,s,t),[t]),s.getSnapshot!==e||a||Mt!==null&&Mt.memoizedState.tag&1){if(r.flags|=2048,Cl(9,Nw.bind(null,r,s,n,e),void 0,null),Lt===null)throw Error(G(349));Va&30||kw(r,e,n)}return n}function kw(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=yt.updateQueue,e===null?(e={lastEffect:null,stores:null},yt.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function Nw(t,e,r,s){e.value=r,e.getSnapshot=s,Rw(e)&&Tw(t)}function jw(t,e,r){return r(function(){Rw(e)&&Tw(t)})}function Rw(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!sn(t,r)}catch{return!0}}function Tw(t){var e=ss(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=mk.bind(null,yt,t),[e.memoizedState,t]}function Cl(t,e,r,s){return t={tag:t,create:e,destroy:r,deps:s,next:null},e=yt.updateQueue,e===null?(e={lastEffect:null,stores:null},yt.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 Aw(){return Lr().memoizedState}function zc(t,e,r,s){var n=pn();yt.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(Tt!==null){var o=Tt.memoizedState;if(a=o.destroy,s!==null&&Wm(s,o.deps)){n.memoizedState=Cl(e,r,a,s);return}}yt.flags|=t,n.memoizedState=Cl(1|e,r,a,s)}function oy(t,e){return zc(8390656,8,t,e)}function Zm(t,e){return pd(2048,8,t,e)}function Ow(t,e){return pd(4,2,t,e)}function Iw(t,e){return pd(4,4,t,e)}function Dw(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 $w(t,e,r){return r=r!=null?r.concat([t]):null,pd(4,4,Dw.bind(null,e,t),r)}function Ym(){}function Mw(t,e){var r=Lr();e=e===void 0?null:e;var s=r.memoizedState;return s!==null&&e!==null&&Wm(e,s[1])?s[0]:(r.memoizedState=[t,e],t)}function Fw(t,e){var r=Lr();e=e===void 0?null:e;var s=r.memoizedState;return s!==null&&e!==null&&Wm(e,s[1])?s[0]:(t=t(),r.memoizedState=[t,e],t)}function Lw(t,e,r){return Va&21?(sn(r,e)||(r=Hx(),yt.lanes|=r,qa|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,fr=!0),t.memoizedState=r)}function hk(t,e){var r=rt;rt=r!==0&&4>r?r:4,t(!0);var s=Ef.transition;Ef.transition={};try{t(!1),e()}finally{rt=r,Ef.transition=s}}function Uw(){return Lr().memoizedState}function pk(t,e,r){var s=Ys(t);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},zw(t))Vw(e,r);else if(r=Sw(t,e,r,s),r!==null){var n=rr();nn(r,t,s,n),qw(r,e,s)}}function mk(t,e,r){var s=Ys(t),n={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(zw(t))Vw(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,Vm(e)):(n.next=c.next,c.next=n),e.interleaved=n;return}}catch{}finally{}r=Sw(t,e,n,s),r!==null&&(n=rr(),nn(r,t,s,n),qw(r,e,s))}}function zw(t){var e=t.alternate;return t===yt||e!==null&&e===yt}function Vw(t,e){nl=bu=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function qw(t,e,r){if(r&4194240){var s=e.lanes;s&=t.pendingLanes,r|=s,e.lanes=r,Nm(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},vk={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,Dw.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=pk.bind(null,yt,t),[s.memoizedState,t]},useRef:function(t){var e=pn();return t={current:t},e.memoizedState=t},useState:ay,useDebugValue:Ym,useDeferredValue:function(t){return pn().memoizedState=t},useTransition:function(){var t=ay(!1),e=t[0];return t=hk.bind(null,t[1]),pn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var s=yt,n=pn();if(mt){if(r===void 0)throw Error(G(407));r=r()}else{if(r=e(),Lt===null)throw Error(G(349));Va&30||kw(s,e,r)}n.memoizedState=r;var a={value:r,getSnapshot:e};return n.queue=a,oy(jw.bind(null,s,a,t),[t]),s.flags|=2048,Cl(9,Nw.bind(null,s,a,r,e),void 0,null),r},useId:function(){var t=pn(),e=Lt.identifierPrefix;if(mt){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=fk++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},gk={readContext:Fr,useCallback:Mw,useContext:Fr,useEffect:Zm,useImperativeHandle:$w,useInsertionEffect:Ow,useLayoutEffect:Iw,useMemo:Fw,useReducer:Cf,useRef:Aw,useState:function(){return Cf(El)},useDebugValue:Ym,useDeferredValue:function(t){var e=Lr();return Lw(e,Tt.memoizedState,t)},useTransition:function(){var t=Cf(El)[0],e=Lr().memoizedState;return[t,e]},useMutableSource:Cw,useSyncExternalStore:Pw,useId:Uw,unstable_isNewReconciler:!1},yk={readContext:Fr,useCallback:Mw,useContext:Fr,useEffect:Zm,useImperativeHandle:$w,useInsertionEffect:Ow,useLayoutEffect:Iw,useMemo:Fw,useReducer:Pf,useRef:Aw,useState:function(){return Pf(El)},useDebugValue:Ym,useDeferredValue:function(t){var e=Lr();return Tt===null?e.memoizedState=t:Lw(e,Tt.memoizedState,t)},useTransition:function(){var t=Pf(El)[0],e=Lr().memoizedState;return[t,e]},useMutableSource:Cw,useSyncExternalStore:Pw,useId:Uw,unstable_isNewReconciler:!1};function Zr(t,e){if(t&&t.defaultProps){e=xt({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function Oh(t,e,r,s){e=t.memoizedState,r=r(s,e),r=r==null?e:xt({},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=Xn(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=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),Lc(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),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 Hw(t,e,r){var s=!1,n=sa,a=e.contextType;return typeof a=="object"&&a!==null?a=Fr(a):(n=pr(e)?Ua:Zt.current,s=e.contextTypes,a=(s=s!=null)?oi(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 Ih(t,e,r,s){var n=t.stateNode;n.props=r,n.state=t.memoizedState,n.refs={},qm(t);var a=e.contextType;typeof a=="object"&&a!==null?n.context=Fr(a):(a=pr(e)?Ua:Zt.current,n.context=oi(t,a)),n.state=t.memoizedState,a=e.getDerivedStateFromProps,typeof a=="function"&&(Oh(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 ui(t,e){try{var r="",s=e;do r+=KC(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 kf(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Dh(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var xk=typeof WeakMap=="function"?WeakMap:Map;function Bw(t,e,r){r=Xn(-1,r),r.tag=3,r.payload={element:null};var s=e.value;return r.callback=function(){Eu||(Eu=!0,Bh=s),Dh(t,e)},r}function Kw(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(){Dh(t,e)}}var a=t.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(r.callback=function(){Dh(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 xk;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=Ok.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=Xn(-1,1),e.tag=2,Gs(r,e,1))),r.lanes|=1),t)}var wk=us.ReactCurrentOwner,fr=!1;function er(t,e,r,s){e.child=t===null?bw(e,null,r,s):li(e,t.child,r,s)}function fy(t,e,r,s,n){r=r.render;var a=e.ref;return Lo(e,n),s=Qm(t,e,r,s,a,n),r=Gm(),t!==null&&!fr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n,as(t,e,n)):(mt&&r&&$m(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"&&!av(a)&&a.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=a,Ww(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 as(t,e,n)}return e.flags|=1,t=Js(a,s),t.ref=e.ref,t.return=e,e.child=t}function Ww(t,e,r,s,n){if(t!==null){var a=t.memoizedProps;if(gl(a,s)&&t.ref===e.ref)if(fr=!1,e.pendingProps=s=a,(t.lanes&n)!==0)t.flags&131072&&(fr=!0);else return e.lanes=t.lanes,as(t,e,n)}return $h(t,e,r,s,n)}function Qw(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},ot(To,wr),wr|=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,ot(To,wr),wr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=a!==null?a.baseLanes:r,ot(To,wr),wr|=s}else a!==null?(s=a.baseLanes|r,e.memoizedState=null):s=r,ot(To,wr),wr|=s;return er(t,e,n,r),e.child}function Gw(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function $h(t,e,r,s,n){var a=pr(r)?Ua:Zt.current;return a=oi(e,a),Lo(e,n),r=Qm(t,e,r,s,a,n),s=Gm(),t!==null&&!fr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n,as(t,e,n)):(mt&&s&&$m(e),e.flags|=1,er(t,e,r,n),e.child)}function py(t,e,r,s,n){if(pr(r)){var a=!0;pu(e)}else a=!1;if(Lo(e,n),e.stateNode===null)Vc(t,e),Hw(e,r,s),Ih(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=pr(r)?Ua:Zt.current,u=oi(e,u));var d=r.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||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||hr.current||Es?(typeof d=="function"&&(Oh(e,r,d,s),c=e.memoizedState),(i=Es||iy(e,r,i,s,m,c,u))?(f||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,_w(t,e),i=e.memoizedProps,u=e.type===e.elementType?i:Zr(e.type,i),o.props=u,f=e.pendingProps,m=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=Fr(c):(c=pr(r)?Ua:Zt.current,c=oi(e,c));var h=r.getDerivedStateFromProps;(d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==f||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!==f||m!==w||hr.current||Es?(typeof h=="function"&&(Oh(e,r,h,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 Mh(t,e,r,s,a,n)}function Mh(t,e,r,s,n,a){Gw(t,e);var o=(e.flags&128)!==0;if(!s&&!o)return n&&Xg(e,r,!1),as(t,e,a);s=e.stateNode,wk.current=e;var i=o&&typeof r.getDerivedStateFromError!="function"?null:s.render();return e.flags|=1,t!==null&&o?(e.child=li(e,t.child,null,a),e.child=li(e,null,i,a)):er(t,e,i,a),e.memoizedState=s.state,n&&Xg(e,r,!0),e.child}function Zw(t){var e=t.stateNode;e.pendingContext?Jg(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Jg(t,e.context,!1),Hm(t,e.containerInfo)}function my(t,e,r,s,n){return ii(),Fm(n),e.flags|=256,er(t,e,r,s),e.child}var Fh={dehydrated:null,treeContext:null,retryLane:0};function Lh(t){return{baseLanes:t,cachePool:null,transitions:null}}function Yw(t,e,r){var s=e.pendingProps,n=gt.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),ot(gt,n&1),t===null)return Th(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=Lh(r),e.memoizedState=Fh,t):Jm(e,o));if(n=t.memoizedState,n!==null&&(i=n.dehydrated,i!==null))return bk(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?Lh(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=t.childLanes&~r,e.memoizedState=Fh,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 Jm(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&&Fm(s),li(e,t.child,null,r),t=Jm(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function bk(t,e,r,s,n,a,o){if(r)return e.flags&256?(e.flags&=-257,s=kf(Error(G(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&&li(e,t.child,null,o),e.child.memoizedState=Lh(o),e.memoizedState=Fh,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(G(419)),s=kf(a,s,void 0),gc(t,e,o,s)}if(i=(o&t.childLanes)!==0,fr||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 sv(),s=kf(Error(G(421))),gc(t,e,o,s)}return n.data==="$?"?(e.flags|=128,e.child=t.child,e=Ik.bind(null,t),n._reactRetry=e,null):(t=a.treeContext,Sr=Qs(n.nextSibling),_r=e,mt=!0,tn=null,t!==null&&(Ar[Or++]=Zn,Ar[Or++]=Yn,Ar[Or++]=za,Zn=t.id,Yn=t.overflow,za=e),e=Jm(e,s.children),e.flags|=4096,e)}function vy(t,e,r){t.lanes|=e;var s=t.alternate;s!==null&&(s.lanes|=e),Ah(t.return,e,r)}function Nf(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 Jw(t,e,r){var s=e.pendingProps,n=s.revealOrder,a=s.tail;if(er(t,e,s.children,r),s=gt.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(ot(gt,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),Nf(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}Nf(e,!0,r,null,a);break;case"together":Nf(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 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(G(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 Sk(t,e,r){switch(e.tag){case 3:Zw(e),ii();break;case 5:Ew(e);break;case 1:pr(e.type)&&pu(e);break;case 4:Hm(e,e.stateNode.containerInfo);break;case 10:var s=e.type._context,n=e.memoizedProps.value;ot(gu,s._currentValue),s._currentValue=n;break;case 13:if(s=e.memoizedState,s!==null)return s.dehydrated!==null?(ot(gt,gt.current&1),e.flags|=128,null):r&e.child.childLanes?Yw(t,e,r):(ot(gt,gt.current&1),t=as(t,e,r),t!==null?t.sibling:null);ot(gt,gt.current&1);break;case 19:if(s=(r&e.childLanes)!==0,t.flags&128){if(s)return Jw(t,e,r);e.flags|=128}if(n=e.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),ot(gt,gt.current),s)break;return null;case 22:case 23:return e.lanes=0,Qw(t,e,r)}return as(t,e,r)}var Xw,Uh,eb,tb;Xw=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}};Uh=function(){};eb=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=lh(t,n),s=lh(t,s),a=[];break;case"select":n=xt({},n,{value:void 0}),s=xt({},s,{value:void 0}),a=[];break;case"textarea":n=dh(t,n),s=dh(t,s),a=[];break;default:typeof n.onClick!="function"&&typeof s.onClick=="function"&&(t.onclick=fu)}hh(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"&&ct("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)}};tb=function(t,e,r,s){r!==s&&(e.flags|=4)};function Mi(t,e){if(!mt)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 _k(t,e,r){var s=e.pendingProps;switch(Mm(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 pr(e.type)&&hu(),Qt(e),null;case 3:return s=e.stateNode,ci(),dt(hr),dt(Zt),Km(),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&&(Qh(tn),tn=null))),Uh(t,e),Qt(e),null;case 5:Bm(e);var n=Na(Sl.current);if(r=e.type,t!==null&&e.stateNode!=null)eb(t,e,r,s,n),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!s){if(e.stateNode===null)throw Error(G(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":ct("cancel",s),ct("close",s);break;case"iframe":case"object":case"embed":ct("load",s);break;case"video":case"audio":for(n=0;n<Bi.length;n++)ct(Bi[n],s);break;case"source":ct("error",s);break;case"img":case"image":case"link":ct("error",s),ct("load",s);break;case"details":ct("toggle",s);break;case"input":Cg(s,a),ct("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!a.multiple},ct("invalid",s);break;case"textarea":kg(s,a),ct("invalid",s)}hh(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"&&ct("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=jx(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,Xw(t,e,!1,!1),e.stateNode=t;e:{switch(o=ph(r,s),r){case"dialog":ct("cancel",t),ct("close",t),n=s;break;case"iframe":case"object":case"embed":ct("load",t),n=s;break;case"video":case"audio":for(n=0;n<Bi.length;n++)ct(Bi[n],t);n=s;break;case"source":ct("error",t),n=s;break;case"img":case"image":case"link":ct("error",t),ct("load",t),n=s;break;case"details":ct("toggle",t),n=s;break;case"input":Cg(t,s),n=lh(t,s),ct("invalid",t);break;case"option":n=s;break;case"select":t._wrapperState={wasMultiple:!!s.multiple},n=xt({},s,{value:void 0}),ct("invalid",t);break;case"textarea":kg(t,s),n=dh(t,s),ct("invalid",t);break;default:n=s}hh(r,n),i=n;for(a in i)if(i.hasOwnProperty(a)){var c=i[a];a==="style"?Ax(t,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Rx(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"&&ct("scroll",t):c!=null&&Sm(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?Do(t,!!s.multiple,a,!1):s.defaultValue!=null&&Do(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)tb(t,e,t.memoizedProps,s);else{if(typeof s!="string"&&e.stateNode===null)throw Error(G(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=_r,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(dt(gt),s=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(mt&&Sr!==null&&e.mode&1&&!(e.flags&128))xw(),ii(),e.flags|=98560,a=!1;else if(a=mc(e),s!==null&&s.dehydrated!==null){if(t===null){if(!a)throw Error(G(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(G(317));a[xn]=e}else ii(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Qt(e),a=!1}else tn!==null&&(Qh(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||gt.current&1?It===0&&(It=3):sv())),e.updateQueue!==null&&(e.flags|=4),Qt(e),null);case 4:return ci(),Uh(t,e),t===null&&yl(e.stateNode.containerInfo),Qt(e),null;case 10:return zm(e.type._context),Qt(e),null;case 17:return pr(e.type)&&hu(),Qt(e),null;case 19:if(dt(gt),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(It!==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 ot(gt,gt.current&1|2),e.child}t=t.sibling}a.tail!==null&&Ct()>di&&(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&&!mt)return Qt(e),null}else 2*Ct()-a.renderingStartTime>di&&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=Ct(),e.sibling=null,r=gt.current,ot(gt,s?r&1|2:r&1),e):(Qt(e),null);case 22:case 23:return nv(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?wr&1073741824&&(Qt(e),e.subtreeFlags&6&&(e.flags|=8192)):Qt(e),null;case 24:return null;case 25:return null}throw Error(G(156,e.tag))}function Ek(t,e){switch(Mm(e),e.tag){case 1:return pr(e.type)&&hu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ci(),dt(hr),dt(Zt),Km(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Bm(e),null;case 13:if(dt(gt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(G(340));ii()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return dt(gt),null;case 4:return ci(),null;case 10:return zm(e.type._context),null;case 22:case 23:return nv(),null;case 24:return null;default:return null}}var yc=!1,Gt=!1,Ck=typeof WeakSet=="function"?WeakSet:Set,le=null;function Ro(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){bt(t,e,s)}else r.current=null}function zh(t,e,r){try{r()}catch(s){bt(t,e,s)}}var gy=!1;function Pk(t,e){if(Eh=cu,t=ow(),Dm(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,f=t,m=null;t:for(;;){for(var h;f!==r||n!==0&&f.nodeType!==3||(i=o+n),f!==a||s!==0&&f.nodeType!==3||(c=o+s),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)m=f,f=h;for(;;){if(f===t)break t;if(m===r&&++u===n&&(i=o),m===a&&++d===s&&(c=o),(h=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=h}r=i===-1||c===-1?null:{start:i,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Ch={focusedElem:t,selectionRange:r},cu=!1,le=e;le!==null;)if(e=le,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,le=t;else for(;le!==null;){e=le;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,g=w.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?p:Zr(e.type,p),g);y.__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(G(163))}}catch(S){bt(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,le=t;break}le=e.return}return w=gy,gy=!1,w}function sl(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&&zh(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 Vh(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 rb(t){var e=t.alternate;e!==null&&(t.alternate=null,rb(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[Nh],delete e[lk],delete e[ck])),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 nb(t){return t.tag===5||t.tag===3||t.tag===4}function yy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||nb(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 qh(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(qh(t,e,r),t=t.sibling;t!==null;)qh(t,e,r),t=t.sibling}function Hh(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(Hh(t,e,r),t=t.sibling;t!==null;)Hh(t,e,r),t=t.sibling}var Vt=null,en=!1;function ys(t,e,r){for(r=r.child;r!==null;)sb(t,e,r),r=r.sibling}function sb(t,e,r){if(kn&&typeof kn.onCommitFiberUnmount=="function")try{kn.onCommitFiberUnmount(ld,r)}catch{}switch(r.tag){case 5:Gt||Ro(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?bf(t.parentNode,r):t.nodeType===1&&bf(t,r),ml(t)):bf(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)&&zh(r,e,o),n=n.next}while(n!==s)}ys(t,e,r);break;case 1:if(!Gt&&(Ro(r,e),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(i){bt(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 Ck),e.forEach(function(s){var n=Dk.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(G(160));sb(a,o,n),Vt=null,en=!1;var c=n.alternate;c!==null&&(c.return=null),n.return=null}catch(u){bt(n,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)ab(e,t),e=e.sibling}function ab(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{sl(3,t,t.return),vd(3,t)}catch(p){bt(t,t.return,p)}try{sl(5,t,t.return)}catch(p){bt(t,t.return,p)}}break;case 1:Kr(e,t),fn(t),s&512&&r!==null&&Ro(r,r.return);break;case 5:if(Kr(e,t),fn(t),s&512&&r!==null&&Ro(r,r.return),t.flags&32){var n=t.stateNode;try{dl(n,"")}catch(p){bt(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&&kx(n,a),ph(i,o);var u=ph(i,a);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?Ax(n,f):d==="dangerouslySetInnerHTML"?Rx(n,f):d==="children"?dl(n,f):Sm(n,d,f,u)}switch(i){case"input":ch(n,a);break;case"textarea":Nx(n,a);break;case"select":var m=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!a.multiple;var h=a.value;h!=null?Do(n,!!a.multiple,h,!1):m!==!!a.multiple&&(a.defaultValue!=null?Do(n,!!a.multiple,a.defaultValue,!0):Do(n,!!a.multiple,a.multiple?[]:"",!1))}n[wl]=a}catch(p){bt(t,t.return,p)}}break;case 6:if(Kr(e,t),fn(t),s&4){if(t.stateNode===null)throw Error(G(162));n=t.stateNode,a=t.memoizedProps;try{n.nodeValue=a}catch(p){bt(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){bt(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||(tv=Ct())),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(le=t,d=t.child;d!==null;){for(f=le=d;le!==null;){switch(m=le,h=m.child,m.tag){case 0:case 11:case 14:case 15:sl(4,m,m.return);break;case 1:Ro(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){bt(s,r,p)}}break;case 5:Ro(m,m.return);break;case 22:if(m.memoizedState!==null){by(f);continue}}h!==null?(h.return=m,le=h):by(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{n=f.stateNode,u?(a=n.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(i=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,i.style.display=Tx("display",o))}catch(p){bt(t,t.return,p)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(p){bt(t,t.return,p)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.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(nb(r)){var s=r;break e}r=r.return}throw Error(G(160))}switch(s.tag){case 5:var n=s.stateNode;s.flags&32&&(dl(n,""),s.flags&=-33);var a=yy(t);Hh(t,a,n);break;case 3:case 4:var o=s.stateNode.containerInfo,i=yy(t);qh(t,i,o);break;default:throw Error(G(161))}}catch(c){bt(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function kk(t,e,r){le=t,ob(t)}function ob(t,e,r){for(var s=(t.mode&1)!==0;le!==null;){var n=le,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(le=n;le!==null;)o=le,c=o.child,o.tag===22&&o.memoizedState!==null?Sy(n):c!==null?(c.return=o,le=c):Sy(n);for(;a!==null;)le=a,ob(a),a=a.sibling;le=n,yc=i,Gt=u}wy(t)}else n.subtreeFlags&8772&&a!==null?(a.return=n,le=a):wy(t)}}function wy(t){for(;le!==null;){var e=le;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 f=d.dehydrated;f!==null&&ml(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(G(163))}Gt||e.flags&512&&Vh(e)}catch(m){bt(e,e.return,m)}}if(e===t){le=null;break}if(r=e.sibling,r!==null){r.return=e.return,le=r;break}le=e.return}}function by(t){for(;le!==null;){var e=le;if(e===t){le=null;break}var r=e.sibling;if(r!==null){r.return=e.return,le=r;break}le=e.return}}function Sy(t){for(;le!==null;){var e=le;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{vd(4,e)}catch(c){bt(e,r,c)}break;case 1:var s=e.stateNode;if(typeof s.componentDidMount=="function"){var n=e.return;try{s.componentDidMount()}catch(c){bt(e,n,c)}}var a=e.return;try{Vh(e)}catch(c){bt(e,a,c)}break;case 5:var o=e.return;try{Vh(e)}catch(c){bt(e,o,c)}}}catch(c){bt(e,e.return,c)}if(e===t){le=null;break}var i=e.sibling;if(i!==null){i.return=e.return,le=i;break}le=e.return}}var Nk=Math.ceil,_u=us.ReactCurrentDispatcher,Xm=us.ReactCurrentOwner,Mr=us.ReactCurrentBatchConfig,Ye=0,Lt=null,jt=null,qt=0,wr=0,To=ca(0),It=0,Pl=null,qa=0,gd=0,ev=0,al=null,dr=null,tv=0,di=1/0,Hn=null,Eu=!1,Bh=null,Zs=null,xc=!1,zs=null,Cu=0,ol=0,Kh=null,qc=-1,Hc=0;function rr(){return Ye&6?Ct():qc!==-1?qc:qc=Ct()}function Ys(t){return t.mode&1?Ye&2&&qt!==0?qt&-qt:dk.transition!==null?(Hc===0&&(Hc=Hx()),Hc):(t=tt,t!==0||(t=window.event,t=t===void 0?16:Yx(t.type)),t):1}function nn(t,e,r,s){if(50<ol)throw ol=0,Kh=null,Error(G(185));Ml(t,r,s),(!(Ye&2)||t!==Lt)&&(t===Lt&&(!(Ye&2)&&(gd|=r),It===4&&js(t,qt)),mr(t,s),r===1&&Ye===0&&!(e.mode&1)&&(di=Ct()+500,hd&&ua()))}function mr(t,e){var r=t.callbackNode;dP(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?uk(_y.bind(null,t)):vw(_y.bind(null,t)),ok(function(){!(Ye&6)&&ua()}),r=null;else{switch(Bx(s)){case 1:r=km;break;case 4:r=Vx;break;case 16:r=iu;break;case 536870912:r=qx;break;default:r=iu}r=pb(r,ib.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function ib(t,e){if(qc=-1,Hc=0,Ye&6)throw Error(G(327));var r=t.callbackNode;if(Uo()&&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=Ye;Ye|=2;var a=cb();(Lt!==t||qt!==e)&&(Hn=null,di=Ct()+500,Ma(t,e));do try{Tk();break}catch(i){lb(t,i)}while(!0);Um(),_u.current=a,Ye=n,jt!==null?e=0:(Lt=null,qt=0,e=It)}if(e!==0){if(e===2&&(n=xh(t),n!==0&&(s=n,e=Wh(t,n))),e===1)throw r=Pl,Ma(t,0),js(t,s),mr(t,Ct()),r;if(e===6)js(t,s);else{if(n=t.current.alternate,!(s&30)&&!jk(n)&&(e=Pu(t,s),e===2&&(a=xh(t),a!==0&&(s=a,e=Wh(t,a))),e===1))throw r=Pl,Ma(t,0),js(t,s),mr(t,Ct()),r;switch(t.finishedWork=n,t.finishedLanes=s,e){case 0:case 1:throw Error(G(345));case 2:Sa(t,dr,Hn);break;case 3:if(js(t,s),(s&130023424)===s&&(e=tv+500-Ct(),10<e)){if(lu(t,0)!==0)break;if(n=t.suspendedLanes,(n&s)!==s){rr(),t.pingedLanes|=t.suspendedLanes&n;break}t.timeoutHandle=kh(Sa.bind(null,t,dr,Hn),e);break}Sa(t,dr,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=Ct()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Nk(s/1960))-s,10<s){t.timeoutHandle=kh(Sa.bind(null,t,dr,Hn),s);break}Sa(t,dr,Hn);break;case 5:Sa(t,dr,Hn);break;default:throw Error(G(329))}}}return mr(t,Ct()),t.callbackNode===r?ib.bind(null,t):null}function Wh(t,e){var r=al;return t.current.memoizedState.isDehydrated&&(Ma(t,e).flags|=256),t=Pu(t,e),t!==2&&(e=dr,dr=r,e!==null&&Qh(e)),t}function Qh(t){dr===null?dr=t:dr.push.apply(dr,t)}function jk(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&=~ev,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(Ye&6)throw Error(G(327));Uo();var e=lu(t,0);if(!(e&1))return mr(t,Ct()),null;var r=Pu(t,e);if(t.tag!==0&&r===2){var s=xh(t);s!==0&&(e=s,r=Wh(t,s))}if(r===1)throw r=Pl,Ma(t,0),js(t,e),mr(t,Ct()),r;if(r===6)throw Error(G(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Sa(t,dr,Hn),mr(t,Ct()),null}function rv(t,e){var r=Ye;Ye|=1;try{return t(e)}finally{Ye=r,Ye===0&&(di=Ct()+500,hd&&ua())}}function Ha(t){zs!==null&&zs.tag===0&&!(Ye&6)&&Uo();var e=Ye;Ye|=1;var r=Mr.transition,s=tt;try{if(Mr.transition=null,tt=1,t)return t()}finally{tt=s,Mr.transition=r,Ye=e,!(Ye&6)&&ua()}}function nv(){wr=To.current,dt(To)}function Ma(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,ak(r)),jt!==null)for(r=jt.return;r!==null;){var s=r;switch(Mm(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&hu();break;case 3:ci(),dt(hr),dt(Zt),Km();break;case 5:Bm(s);break;case 4:ci();break;case 13:dt(gt);break;case 19:dt(gt);break;case 10:zm(s.type._context);break;case 22:case 23:nv()}r=r.return}if(Lt=t,jt=t=Js(t.current,null),qt=wr=e,It=0,Pl=null,ev=gd=qa=0,dr=al=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 lb(t,e){do{var r=jt;try{if(Um(),Uc.current=Su,bu){for(var s=yt.memoizedState;s!==null;){var n=s.queue;n!==null&&(n.pending=null),s=s.next}bu=!1}if(Va=0,Mt=Tt=yt=null,nl=!1,_l=0,Xm.current=null,r===null||r.return===null){It=1,Pl=e,jt=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,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===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 h=uy(o);if(h!==null){h.flags&=-257,dy(h,o,i,a,e),h.mode&1&&cy(a,u,e),e=h,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),sv();break e}c=Error(G(426))}}else if(mt&&i.mode&1){var g=uy(o);if(g!==null){!(g.flags&65536)&&(g.flags|=256),dy(g,o,i,a,e),Fm(ui(c,i));break e}}a=c=ui(c,i),It!==4&&(It=2),al===null?al=[a]:al.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,e&=-e,a.lanes|=e;var y=Bw(a,c,e);ny(a,y);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=Kw(a,i,e);ny(a,S);break e}}a=a.return}while(a!==null)}db(r)}catch(E){e=E,jt===r&&r!==null&&(jt=r=r.return);continue}break}while(!0)}function cb(){var t=_u.current;return _u.current=Su,t===null?Su:t}function sv(){(It===0||It===3||It===2)&&(It=4),Lt===null||!(qa&268435455)&&!(gd&268435455)||js(Lt,qt)}function Pu(t,e){var r=Ye;Ye|=2;var s=cb();(Lt!==t||qt!==e)&&(Hn=null,Ma(t,e));do try{Rk();break}catch(n){lb(t,n)}while(!0);if(Um(),Ye=r,_u.current=s,jt!==null)throw Error(G(261));return Lt=null,qt=0,It}function Rk(){for(;jt!==null;)ub(jt)}function Tk(){for(;jt!==null&&!rP();)ub(jt)}function ub(t){var e=hb(t.alternate,t,wr);t.memoizedProps=t.pendingProps,e===null?db(t):jt=e,Xm.current=null}function db(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=Ek(r,e),r!==null){r.flags&=32767,jt=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{It=6,jt=null;return}}else if(r=_k(r,e,wr),r!==null){jt=r;return}if(e=e.sibling,e!==null){jt=e;return}jt=e=t}while(e!==null);It===0&&(It=5)}function Sa(t,e,r){var s=tt,n=Mr.transition;try{Mr.transition=null,tt=1,Ak(t,e,r,s)}finally{Mr.transition=n,tt=s}return null}function Ak(t,e,r,s){do Uo();while(zs!==null);if(Ye&6)throw Error(G(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(G(177));t.callbackNode=null,t.callbackPriority=0;var a=r.lanes|r.childLanes;if(fP(t,a),t===Lt&&(jt=Lt=null,qt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||xc||(xc=!0,pb(iu,function(){return Uo(),null})),a=(r.flags&15990)!==0,r.subtreeFlags&15990||a){a=Mr.transition,Mr.transition=null;var o=tt;tt=1;var i=Ye;Ye|=4,Xm.current=null,Pk(t,r),ab(r,t),JP(Ch),cu=!!Eh,Ch=Eh=null,t.current=r,kk(r),nP(),Ye=i,tt=o,Mr.transition=a}else t.current=r;if(xc&&(xc=!1,zs=t,Cu=n),a=t.pendingLanes,a===0&&(Zs=null),oP(r.stateNode),mr(t,Ct()),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=Bh,Bh=null,t;return Cu&1&&t.tag!==0&&Uo(),a=t.pendingLanes,a&1?t===Kh?ol++:(ol=0,Kh=t):ol=0,ua(),null}function Uo(){if(zs!==null){var t=Bx(Cu),e=Mr.transition,r=tt;try{if(Mr.transition=null,tt=16>t?16:t,zs===null)var s=!1;else{if(t=zs,zs=null,Cu=0,Ye&6)throw Error(G(331));var n=Ye;for(Ye|=4,le=t.current;le!==null;){var a=le,o=a.child;if(le.flags&16){var i=a.deletions;if(i!==null){for(var c=0;c<i.length;c++){var u=i[c];for(le=u;le!==null;){var d=le;switch(d.tag){case 0:case 11:case 15:sl(8,d,a)}var f=d.child;if(f!==null)f.return=d,le=f;else for(;le!==null;){d=le;var m=d.sibling,h=d.return;if(rb(d),d===u){le=null;break}if(m!==null){m.return=h,le=m;break}le=h}}}var w=a.alternate;if(w!==null){var p=w.child;if(p!==null){w.child=null;do{var g=p.sibling;p.sibling=null,p=g}while(p!==null)}}le=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,le=o;else e:for(;le!==null;){if(a=le,a.flags&2048)switch(a.tag){case 0:case 11:case 15:sl(9,a,a.return)}var y=a.sibling;if(y!==null){y.return=a.return,le=y;break e}le=a.return}}var v=t.current;for(le=v;le!==null;){o=le;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,le=b;else e:for(o=v;le!==null;){if(i=le,i.flags&2048)try{switch(i.tag){case 0:case 11:case 15:vd(9,i)}}catch(E){bt(i,i.return,E)}if(i===o){le=null;break e}var S=i.sibling;if(S!==null){S.return=i.return,le=S;break e}le=i.return}}if(Ye=n,ua(),kn&&typeof kn.onPostCommitFiberRoot=="function")try{kn.onPostCommitFiberRoot(ld,t)}catch{}s=!0}return s}finally{tt=r,Mr.transition=e}}return!1}function Ey(t,e,r){e=ui(r,e),e=Bw(t,e,1),t=Gs(t,e,1),e=rr(),t!==null&&(Ml(t,1,e),mr(t,e))}function bt(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=ui(r,t),t=Kw(e,t,1),e=Gs(e,t,1),t=rr(),e!==null&&(Ml(e,1,t),mr(e,t));break}}e=e.return}}function Ok(t,e,r){var s=t.pingCache;s!==null&&s.delete(e),e=rr(),t.pingedLanes|=t.suspendedLanes&r,Lt===t&&(qt&r)===r&&(It===4||It===3&&(qt&130023424)===qt&&500>Ct()-tv?Ma(t,0):ev|=r),mr(t,e)}function fb(t,e){e===0&&(t.mode&1?(e=cc,cc<<=1,!(cc&130023424)&&(cc=4194304)):e=1);var r=rr();t=ss(t,e),t!==null&&(Ml(t,e,r),mr(t,r))}function Ik(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),fb(t,r)}function Dk(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(G(314))}s!==null&&s.delete(e),fb(t,r)}var hb;hb=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||hr.current)fr=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return fr=!1,Sk(t,e,r);fr=!!(t.flags&131072)}else fr=!1,mt&&e.flags&1048576&&gw(e,vu,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;Vc(t,e),t=e.pendingProps;var n=oi(e,Zt.current);Lo(e,r),n=Qm(null,e,s,t,n,r);var a=Gm();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,pr(s)?(a=!0,pu(e)):a=!1,e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,qm(e),n.updater=md,e.stateNode=n,n._reactInternals=e,Ih(e,s,t,r),e=Mh(null,e,s,!0,a,r)):(e.tag=0,mt&&a&&$m(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=Mk(s),t=Zr(s,t),n){case 0:e=$h(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(G(306,s,""))}return e;case 0:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),$h(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(Zw(e),t===null)throw Error(G(387));s=e.pendingProps,a=e.memoizedState,n=a.element,_w(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=ui(Error(G(423)),e),e=my(t,e,s,r,n);break e}else if(s!==n){n=ui(Error(G(424)),e),e=my(t,e,s,r,n);break e}else for(Sr=Qs(e.stateNode.containerInfo.firstChild),_r=e,mt=!0,tn=null,r=bw(e,null,s,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ii(),s===n){e=as(t,e,r);break e}er(t,e,s,r)}e=e.child}return e;case 5:return Ew(e),t===null&&Th(e),s=e.type,n=e.pendingProps,a=t!==null?t.memoizedProps:null,o=n.children,Ph(s,n)?o=null:a!==null&&Ph(s,a)&&(e.flags|=32),Gw(t,e),er(t,e,o,r),e.child;case 6:return t===null&&Th(e),null;case 13:return Yw(t,e,r);case 4:return Hm(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=li(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,ot(gu,s._currentValue),s._currentValue=o,a!==null)if(sn(a.value,o)){if(a.children===n.children&&!hr.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),Ah(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(G(341));o.lanes|=r,i=o.alternate,i!==null&&(i.lanes|=r),Ah(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,Lo(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 Ww(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,pr(s)?(t=!0,pu(e)):t=!1,Lo(e,r),Hw(e,s,n),Ih(e,s,n,r),Mh(null,e,s,!0,t,r);case 19:return Jw(t,e,r);case 22:return Qw(t,e,r)}throw Error(G(156,e.tag))};function pb(t,e){return zx(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 $r(t,e,r,s){return new $k(t,e,r,s)}function av(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Mk(t){if(typeof t=="function")return av(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Em)return 11;if(t===Cm)return 14}return 2}function Js(t,e){var r=t.alternate;return r===null?(r=$r(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")av(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case bo:return Fa(r.children,n,a,e);case _m:o=8,n|=8;break;case sh:return t=$r(12,r,e,n|2),t.elementType=sh,t.lanes=a,t;case ah:return t=$r(13,r,e,n),t.elementType=ah,t.lanes=a,t;case oh:return t=$r(19,r,e,n),t.elementType=oh,t.lanes=a,t;case Ex:return yd(r,n,a,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Sx:o=10;break e;case _x:o=9;break e;case Em:o=11;break e;case Cm:o=14;break e;case _s:o=16,s=null;break e}throw Error(G(130,t==null?t:typeof t,""))}return e=$r(o,r,e,n),e.elementType=t,e.type=s,e.lanes=a,e}function Fa(t,e,r,s){return t=$r(7,t,s,e),t.lanes=r,t}function yd(t,e,r,s){return t=$r(22,t,s,e),t.elementType=Ex,t.lanes=r,t.stateNode={isHidden:!1},t}function jf(t,e,r){return t=$r(6,t,null,e),t.lanes=r,t}function Rf(t,e,r){return e=$r(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Fk(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=uf(0),this.expirationTimes=uf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uf(0),this.identifierPrefix=s,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function ov(t,e,r,s,n,a,o,i,c){return t=new Fk(t,e,r,i,c),e===1?(e=1,a===!0&&(e|=8)):e=0,a=$r(3,null,null,e),t.current=a,a.stateNode=t,a.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},qm(a),t}function Lk(t,e,r){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:wo,key:s==null?null:""+s,children:t,containerInfo:e,implementation:r}}function mb(t){if(!t)return sa;t=t._reactInternals;e:{if(no(t)!==t||t.tag!==1)throw Error(G(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(pr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(G(171))}if(t.tag===1){var r=t.type;if(pr(r))return mw(t,r,e)}return e}function vb(t,e,r,s,n,a,o,i,c){return t=ov(r,s,!0,t,n,a,o,i,c),t.context=mb(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),mr(t,s),t}function xd(t,e,r,s){var n=e.current,a=rr(),o=Ys(n);return r=mb(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),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 iv(t,e){Cy(t,e),(t=t.alternate)&&Cy(t,e)}function Uk(){return null}var gb=typeof reportError=="function"?reportError:function(t){console.error(t)};function lv(t){this._internalRoot=t}wd.prototype.render=lv.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(G(409));xd(t,e,null,null)};wd.prototype.unmount=lv.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[ns]=null}};function wd(t){this._internalRoot=t}wd.prototype.unstable_scheduleHydration=function(t){if(t){var e=Qx();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&&Zx(t)}};function cv(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 zk(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=vb(e,s,t,0,null,!1,!1,"",Py);return t._reactRootContainer=o,t[ns]=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=ov(t,0,!1,null,null,!1,!1,"",Py);return t._reactRootContainer=c,t[ns]=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=zk(r,e,t,n,s);return ku(o)}Kx=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=Hi(e.pendingLanes);r!==0&&(Nm(e,r|1),mr(e,Ct()),!(Ye&6)&&(di=Ct()+500,ua()))}break;case 13:Ha(function(){var s=ss(t,1);if(s!==null){var n=rr();nn(s,t,1,n)}}),iv(t,1)}};jm=function(t){if(t.tag===13){var e=ss(t,134217728);if(e!==null){var r=rr();nn(e,t,134217728,r)}iv(t,134217728)}};Wx=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)}iv(t,e)}};Qx=function(){return tt};Gx=function(t,e){var r=tt;try{return tt=t,e()}finally{tt=r}};vh=function(t,e,r){switch(e){case"input":if(ch(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(G(90));Px(s),ch(s,n)}}}break;case"textarea":Nx(t,r);break;case"select":e=r.value,e!=null&&Do(t,!!r.multiple,e,!1)}};Dx=rv;$x=Ha;var Vk={usingClientEntryPoint:!1,Events:[Ll,Co,fd,Ox,Ix,rv]},Fi={findFiberByHostInstance:Pa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},qk={bundleType:Fi.bundleType,version:Fi.version,rendererPackageName:Fi.rendererPackageName,rendererConfig:Fi.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=Lx(t),t===null?null:t.stateNode},findFiberByHostInstance:Fi.findFiberByHostInstance||Uk,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(qk),kn=wc}catch{}}Pr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Vk;Pr.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cv(e))throw Error(G(200));return Lk(t,e,null,r)};Pr.createRoot=function(t,e){if(!cv(t))throw Error(G(299));var r=!1,s="",n=gb;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onRecoverableError!==void 0&&(n=e.onRecoverableError)),e=ov(t,1,!1,null,null,r,!1,s,n),t[ns]=e.current,yl(t.nodeType===8?t.parentNode:t),new lv(e)};Pr.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(G(188)):(t=Object.keys(t).join(","),Error(G(268,t)));return t=Lx(e),t=t===null?null:t.stateNode,t};Pr.flushSync=function(t){return Ha(t)};Pr.hydrate=function(t,e,r){if(!bd(e))throw Error(G(200));return Sd(null,t,e,!0,r)};Pr.hydrateRoot=function(t,e,r){if(!cv(t))throw Error(G(405));var s=r!=null&&r.hydratedSources||null,n=!1,a="",o=gb;if(r!=null&&(r.unstable_strictMode===!0&&(n=!0),r.identifierPrefix!==void 0&&(a=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),e=vb(e,null,t,1,r??null,n,!1,a,o),t[ns]=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)};Pr.render=function(t,e,r){if(!bd(e))throw Error(G(200));return Sd(null,t,e,!1,r)};Pr.unmountComponentAtNode=function(t){if(!bd(t))throw Error(G(40));return t._reactRootContainer?(Ha(function(){Sd(null,null,t,!1,function(){t._reactRootContainer=null,t[ns]=null})}),!0):!1};Pr.unstable_batchedUpdates=rv;Pr.unstable_renderSubtreeIntoContainer=function(t,e,r,s){if(!bd(r))throw Error(G(200));if(t==null||t._reactInternals===void 0)throw Error(G(38));return Sd(t,e,r,!1,s)};Pr.version="18.3.1-next-f1338f8080-20240426";function yb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yb)}catch(t){console.error(t)}}yb(),yx.exports=Pr;var so=yx.exports;const Hk=pm(so);var xb,ky=so;xb=ky.createRoot,ky.hydrateRoot;function Bk(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 wb={exports:{}},bb={};/**
|
|
40
|
+
`+a.stack}return{value:t,source:e,stack:n,digest:null}}function kf(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Dh(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var xk=typeof WeakMap=="function"?WeakMap:Map;function Bw(t,e,r){r=Xn(-1,r),r.tag=3,r.payload={element:null};var s=e.value;return r.callback=function(){Eu||(Eu=!0,Bh=s),Dh(t,e)},r}function Kw(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(){Dh(t,e)}}var a=t.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(r.callback=function(){Dh(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 xk;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=Ok.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=Xn(-1,1),e.tag=2,Gs(r,e,1))),r.lanes|=1),t)}var wk=us.ReactCurrentOwner,fr=!1;function er(t,e,r,s){e.child=t===null?bw(e,null,r,s):li(e,t.child,r,s)}function fy(t,e,r,s,n){r=r.render;var a=e.ref;return Lo(e,n),s=Qm(t,e,r,s,a,n),r=Gm(),t!==null&&!fr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n,as(t,e,n)):(mt&&r&&$m(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"&&!av(a)&&a.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=a,Ww(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 as(t,e,n)}return e.flags|=1,t=Js(a,s),t.ref=e.ref,t.return=e,e.child=t}function Ww(t,e,r,s,n){if(t!==null){var a=t.memoizedProps;if(gl(a,s)&&t.ref===e.ref)if(fr=!1,e.pendingProps=s=a,(t.lanes&n)!==0)t.flags&131072&&(fr=!0);else return e.lanes=t.lanes,as(t,e,n)}return $h(t,e,r,s,n)}function Qw(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},ot(To,wr),wr|=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,ot(To,wr),wr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=a!==null?a.baseLanes:r,ot(To,wr),wr|=s}else a!==null?(s=a.baseLanes|r,e.memoizedState=null):s=r,ot(To,wr),wr|=s;return er(t,e,n,r),e.child}function Gw(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function $h(t,e,r,s,n){var a=pr(r)?Ua:Zt.current;return a=oi(e,a),Lo(e,n),r=Qm(t,e,r,s,a,n),s=Gm(),t!==null&&!fr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n,as(t,e,n)):(mt&&s&&$m(e),e.flags|=1,er(t,e,r,n),e.child)}function py(t,e,r,s,n){if(pr(r)){var a=!0;pu(e)}else a=!1;if(Lo(e,n),e.stateNode===null)Vc(t,e),Hw(e,r,s),Ih(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=pr(r)?Ua:Zt.current,u=oi(e,u));var d=r.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||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||hr.current||Es?(typeof d=="function"&&(Oh(e,r,d,s),c=e.memoizedState),(i=Es||iy(e,r,i,s,m,c,u))?(f||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,_w(t,e),i=e.memoizedProps,u=e.type===e.elementType?i:Zr(e.type,i),o.props=u,f=e.pendingProps,m=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=Fr(c):(c=pr(r)?Ua:Zt.current,c=oi(e,c));var h=r.getDerivedStateFromProps;(d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==f||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!==f||m!==w||hr.current||Es?(typeof h=="function"&&(Oh(e,r,h,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 Mh(t,e,r,s,a,n)}function Mh(t,e,r,s,n,a){Gw(t,e);var o=(e.flags&128)!==0;if(!s&&!o)return n&&Xg(e,r,!1),as(t,e,a);s=e.stateNode,wk.current=e;var i=o&&typeof r.getDerivedStateFromError!="function"?null:s.render();return e.flags|=1,t!==null&&o?(e.child=li(e,t.child,null,a),e.child=li(e,null,i,a)):er(t,e,i,a),e.memoizedState=s.state,n&&Xg(e,r,!0),e.child}function Zw(t){var e=t.stateNode;e.pendingContext?Jg(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Jg(t,e.context,!1),Hm(t,e.containerInfo)}function my(t,e,r,s,n){return ii(),Fm(n),e.flags|=256,er(t,e,r,s),e.child}var Fh={dehydrated:null,treeContext:null,retryLane:0};function Lh(t){return{baseLanes:t,cachePool:null,transitions:null}}function Yw(t,e,r){var s=e.pendingProps,n=gt.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),ot(gt,n&1),t===null)return Th(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=Lh(r),e.memoizedState=Fh,t):Jm(e,o));if(n=t.memoizedState,n!==null&&(i=n.dehydrated,i!==null))return bk(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?Lh(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=t.childLanes&~r,e.memoizedState=Fh,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 Jm(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&&Fm(s),li(e,t.child,null,r),t=Jm(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function bk(t,e,r,s,n,a,o){if(r)return e.flags&256?(e.flags&=-257,s=kf(Error(G(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&&li(e,t.child,null,o),e.child.memoizedState=Lh(o),e.memoizedState=Fh,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(G(419)),s=kf(a,s,void 0),gc(t,e,o,s)}if(i=(o&t.childLanes)!==0,fr||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 sv(),s=kf(Error(G(421))),gc(t,e,o,s)}return n.data==="$?"?(e.flags|=128,e.child=t.child,e=Ik.bind(null,t),n._reactRetry=e,null):(t=a.treeContext,Sr=Qs(n.nextSibling),_r=e,mt=!0,tn=null,t!==null&&(Ar[Or++]=Zn,Ar[Or++]=Yn,Ar[Or++]=za,Zn=t.id,Yn=t.overflow,za=e),e=Jm(e,s.children),e.flags|=4096,e)}function vy(t,e,r){t.lanes|=e;var s=t.alternate;s!==null&&(s.lanes|=e),Ah(t.return,e,r)}function Nf(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 Jw(t,e,r){var s=e.pendingProps,n=s.revealOrder,a=s.tail;if(er(t,e,s.children,r),s=gt.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(ot(gt,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),Nf(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}Nf(e,!0,r,null,a);break;case"together":Nf(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 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(G(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 Sk(t,e,r){switch(e.tag){case 3:Zw(e),ii();break;case 5:Ew(e);break;case 1:pr(e.type)&&pu(e);break;case 4:Hm(e,e.stateNode.containerInfo);break;case 10:var s=e.type._context,n=e.memoizedProps.value;ot(gu,s._currentValue),s._currentValue=n;break;case 13:if(s=e.memoizedState,s!==null)return s.dehydrated!==null?(ot(gt,gt.current&1),e.flags|=128,null):r&e.child.childLanes?Yw(t,e,r):(ot(gt,gt.current&1),t=as(t,e,r),t!==null?t.sibling:null);ot(gt,gt.current&1);break;case 19:if(s=(r&e.childLanes)!==0,t.flags&128){if(s)return Jw(t,e,r);e.flags|=128}if(n=e.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),ot(gt,gt.current),s)break;return null;case 22:case 23:return e.lanes=0,Qw(t,e,r)}return as(t,e,r)}var Xw,Uh,eb,tb;Xw=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}};Uh=function(){};eb=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=lh(t,n),s=lh(t,s),a=[];break;case"select":n=xt({},n,{value:void 0}),s=xt({},s,{value:void 0}),a=[];break;case"textarea":n=dh(t,n),s=dh(t,s),a=[];break;default:typeof n.onClick!="function"&&typeof s.onClick=="function"&&(t.onclick=fu)}hh(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"&&ct("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)}};tb=function(t,e,r,s){r!==s&&(e.flags|=4)};function Mi(t,e){if(!mt)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 _k(t,e,r){var s=e.pendingProps;switch(Mm(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 pr(e.type)&&hu(),Qt(e),null;case 3:return s=e.stateNode,ci(),dt(hr),dt(Zt),Km(),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&&(Qh(tn),tn=null))),Uh(t,e),Qt(e),null;case 5:Bm(e);var n=Na(Sl.current);if(r=e.type,t!==null&&e.stateNode!=null)eb(t,e,r,s,n),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!s){if(e.stateNode===null)throw Error(G(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":ct("cancel",s),ct("close",s);break;case"iframe":case"object":case"embed":ct("load",s);break;case"video":case"audio":for(n=0;n<Bi.length;n++)ct(Bi[n],s);break;case"source":ct("error",s);break;case"img":case"image":case"link":ct("error",s),ct("load",s);break;case"details":ct("toggle",s);break;case"input":Cg(s,a),ct("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!a.multiple},ct("invalid",s);break;case"textarea":kg(s,a),ct("invalid",s)}hh(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"&&ct("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=jx(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,Xw(t,e,!1,!1),e.stateNode=t;e:{switch(o=ph(r,s),r){case"dialog":ct("cancel",t),ct("close",t),n=s;break;case"iframe":case"object":case"embed":ct("load",t),n=s;break;case"video":case"audio":for(n=0;n<Bi.length;n++)ct(Bi[n],t);n=s;break;case"source":ct("error",t),n=s;break;case"img":case"image":case"link":ct("error",t),ct("load",t),n=s;break;case"details":ct("toggle",t),n=s;break;case"input":Cg(t,s),n=lh(t,s),ct("invalid",t);break;case"option":n=s;break;case"select":t._wrapperState={wasMultiple:!!s.multiple},n=xt({},s,{value:void 0}),ct("invalid",t);break;case"textarea":kg(t,s),n=dh(t,s),ct("invalid",t);break;default:n=s}hh(r,n),i=n;for(a in i)if(i.hasOwnProperty(a)){var c=i[a];a==="style"?Ax(t,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Rx(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"&&ct("scroll",t):c!=null&&Sm(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?Do(t,!!s.multiple,a,!1):s.defaultValue!=null&&Do(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)tb(t,e,t.memoizedProps,s);else{if(typeof s!="string"&&e.stateNode===null)throw Error(G(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=_r,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(dt(gt),s=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(mt&&Sr!==null&&e.mode&1&&!(e.flags&128))xw(),ii(),e.flags|=98560,a=!1;else if(a=mc(e),s!==null&&s.dehydrated!==null){if(t===null){if(!a)throw Error(G(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(G(317));a[xn]=e}else ii(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Qt(e),a=!1}else tn!==null&&(Qh(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||gt.current&1?It===0&&(It=3):sv())),e.updateQueue!==null&&(e.flags|=4),Qt(e),null);case 4:return ci(),Uh(t,e),t===null&&yl(e.stateNode.containerInfo),Qt(e),null;case 10:return zm(e.type._context),Qt(e),null;case 17:return pr(e.type)&&hu(),Qt(e),null;case 19:if(dt(gt),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(It!==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 ot(gt,gt.current&1|2),e.child}t=t.sibling}a.tail!==null&&Ct()>di&&(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&&!mt)return Qt(e),null}else 2*Ct()-a.renderingStartTime>di&&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=Ct(),e.sibling=null,r=gt.current,ot(gt,s?r&1|2:r&1),e):(Qt(e),null);case 22:case 23:return nv(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?wr&1073741824&&(Qt(e),e.subtreeFlags&6&&(e.flags|=8192)):Qt(e),null;case 24:return null;case 25:return null}throw Error(G(156,e.tag))}function Ek(t,e){switch(Mm(e),e.tag){case 1:return pr(e.type)&&hu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ci(),dt(hr),dt(Zt),Km(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Bm(e),null;case 13:if(dt(gt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(G(340));ii()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return dt(gt),null;case 4:return ci(),null;case 10:return zm(e.type._context),null;case 22:case 23:return nv(),null;case 24:return null;default:return null}}var yc=!1,Gt=!1,Ck=typeof WeakSet=="function"?WeakSet:Set,le=null;function Ro(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){bt(t,e,s)}else r.current=null}function zh(t,e,r){try{r()}catch(s){bt(t,e,s)}}var gy=!1;function Pk(t,e){if(Eh=cu,t=ow(),Dm(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,f=t,m=null;t:for(;;){for(var h;f!==r||n!==0&&f.nodeType!==3||(i=o+n),f!==a||s!==0&&f.nodeType!==3||(c=o+s),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)m=f,f=h;for(;;){if(f===t)break t;if(m===r&&++u===n&&(i=o),m===a&&++d===s&&(c=o),(h=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=h}r=i===-1||c===-1?null:{start:i,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Ch={focusedElem:t,selectionRange:r},cu=!1,le=e;le!==null;)if(e=le,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,le=t;else for(;le!==null;){e=le;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,g=w.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?p:Zr(e.type,p),g);y.__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(G(163))}}catch(S){bt(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,le=t;break}le=e.return}return w=gy,gy=!1,w}function sl(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&&zh(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 Vh(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 rb(t){var e=t.alternate;e!==null&&(t.alternate=null,rb(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[Nh],delete e[lk],delete e[ck])),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 nb(t){return t.tag===5||t.tag===3||t.tag===4}function yy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||nb(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 qh(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(qh(t,e,r),t=t.sibling;t!==null;)qh(t,e,r),t=t.sibling}function Hh(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(Hh(t,e,r),t=t.sibling;t!==null;)Hh(t,e,r),t=t.sibling}var Vt=null,en=!1;function ys(t,e,r){for(r=r.child;r!==null;)sb(t,e,r),r=r.sibling}function sb(t,e,r){if(kn&&typeof kn.onCommitFiberUnmount=="function")try{kn.onCommitFiberUnmount(ld,r)}catch{}switch(r.tag){case 5:Gt||Ro(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?bf(t.parentNode,r):t.nodeType===1&&bf(t,r),ml(t)):bf(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)&&zh(r,e,o),n=n.next}while(n!==s)}ys(t,e,r);break;case 1:if(!Gt&&(Ro(r,e),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(i){bt(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 Ck),e.forEach(function(s){var n=Dk.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(G(160));sb(a,o,n),Vt=null,en=!1;var c=n.alternate;c!==null&&(c.return=null),n.return=null}catch(u){bt(n,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)ab(e,t),e=e.sibling}function ab(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{sl(3,t,t.return),vd(3,t)}catch(p){bt(t,t.return,p)}try{sl(5,t,t.return)}catch(p){bt(t,t.return,p)}}break;case 1:Kr(e,t),fn(t),s&512&&r!==null&&Ro(r,r.return);break;case 5:if(Kr(e,t),fn(t),s&512&&r!==null&&Ro(r,r.return),t.flags&32){var n=t.stateNode;try{dl(n,"")}catch(p){bt(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&&kx(n,a),ph(i,o);var u=ph(i,a);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?Ax(n,f):d==="dangerouslySetInnerHTML"?Rx(n,f):d==="children"?dl(n,f):Sm(n,d,f,u)}switch(i){case"input":ch(n,a);break;case"textarea":Nx(n,a);break;case"select":var m=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!a.multiple;var h=a.value;h!=null?Do(n,!!a.multiple,h,!1):m!==!!a.multiple&&(a.defaultValue!=null?Do(n,!!a.multiple,a.defaultValue,!0):Do(n,!!a.multiple,a.multiple?[]:"",!1))}n[wl]=a}catch(p){bt(t,t.return,p)}}break;case 6:if(Kr(e,t),fn(t),s&4){if(t.stateNode===null)throw Error(G(162));n=t.stateNode,a=t.memoizedProps;try{n.nodeValue=a}catch(p){bt(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){bt(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||(tv=Ct())),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(le=t,d=t.child;d!==null;){for(f=le=d;le!==null;){switch(m=le,h=m.child,m.tag){case 0:case 11:case 14:case 15:sl(4,m,m.return);break;case 1:Ro(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){bt(s,r,p)}}break;case 5:Ro(m,m.return);break;case 22:if(m.memoizedState!==null){by(f);continue}}h!==null?(h.return=m,le=h):by(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{n=f.stateNode,u?(a=n.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(i=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,i.style.display=Tx("display",o))}catch(p){bt(t,t.return,p)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(p){bt(t,t.return,p)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.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(nb(r)){var s=r;break e}r=r.return}throw Error(G(160))}switch(s.tag){case 5:var n=s.stateNode;s.flags&32&&(dl(n,""),s.flags&=-33);var a=yy(t);Hh(t,a,n);break;case 3:case 4:var o=s.stateNode.containerInfo,i=yy(t);qh(t,i,o);break;default:throw Error(G(161))}}catch(c){bt(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function kk(t,e,r){le=t,ob(t)}function ob(t,e,r){for(var s=(t.mode&1)!==0;le!==null;){var n=le,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(le=n;le!==null;)o=le,c=o.child,o.tag===22&&o.memoizedState!==null?Sy(n):c!==null?(c.return=o,le=c):Sy(n);for(;a!==null;)le=a,ob(a),a=a.sibling;le=n,yc=i,Gt=u}wy(t)}else n.subtreeFlags&8772&&a!==null?(a.return=n,le=a):wy(t)}}function wy(t){for(;le!==null;){var e=le;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 f=d.dehydrated;f!==null&&ml(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(G(163))}Gt||e.flags&512&&Vh(e)}catch(m){bt(e,e.return,m)}}if(e===t){le=null;break}if(r=e.sibling,r!==null){r.return=e.return,le=r;break}le=e.return}}function by(t){for(;le!==null;){var e=le;if(e===t){le=null;break}var r=e.sibling;if(r!==null){r.return=e.return,le=r;break}le=e.return}}function Sy(t){for(;le!==null;){var e=le;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{vd(4,e)}catch(c){bt(e,r,c)}break;case 1:var s=e.stateNode;if(typeof s.componentDidMount=="function"){var n=e.return;try{s.componentDidMount()}catch(c){bt(e,n,c)}}var a=e.return;try{Vh(e)}catch(c){bt(e,a,c)}break;case 5:var o=e.return;try{Vh(e)}catch(c){bt(e,o,c)}}}catch(c){bt(e,e.return,c)}if(e===t){le=null;break}var i=e.sibling;if(i!==null){i.return=e.return,le=i;break}le=e.return}}var Nk=Math.ceil,_u=us.ReactCurrentDispatcher,Xm=us.ReactCurrentOwner,Mr=us.ReactCurrentBatchConfig,Ye=0,Lt=null,jt=null,qt=0,wr=0,To=ca(0),It=0,Pl=null,qa=0,gd=0,ev=0,al=null,dr=null,tv=0,di=1/0,Hn=null,Eu=!1,Bh=null,Zs=null,xc=!1,zs=null,Cu=0,ol=0,Kh=null,qc=-1,Hc=0;function rr(){return Ye&6?Ct():qc!==-1?qc:qc=Ct()}function Ys(t){return t.mode&1?Ye&2&&qt!==0?qt&-qt:dk.transition!==null?(Hc===0&&(Hc=Hx()),Hc):(t=rt,t!==0||(t=window.event,t=t===void 0?16:Yx(t.type)),t):1}function nn(t,e,r,s){if(50<ol)throw ol=0,Kh=null,Error(G(185));Ml(t,r,s),(!(Ye&2)||t!==Lt)&&(t===Lt&&(!(Ye&2)&&(gd|=r),It===4&&js(t,qt)),mr(t,s),r===1&&Ye===0&&!(e.mode&1)&&(di=Ct()+500,hd&&ua()))}function mr(t,e){var r=t.callbackNode;dP(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?uk(_y.bind(null,t)):vw(_y.bind(null,t)),ok(function(){!(Ye&6)&&ua()}),r=null;else{switch(Bx(s)){case 1:r=km;break;case 4:r=Vx;break;case 16:r=iu;break;case 536870912:r=qx;break;default:r=iu}r=pb(r,ib.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function ib(t,e){if(qc=-1,Hc=0,Ye&6)throw Error(G(327));var r=t.callbackNode;if(Uo()&&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=Ye;Ye|=2;var a=cb();(Lt!==t||qt!==e)&&(Hn=null,di=Ct()+500,Ma(t,e));do try{Tk();break}catch(i){lb(t,i)}while(!0);Um(),_u.current=a,Ye=n,jt!==null?e=0:(Lt=null,qt=0,e=It)}if(e!==0){if(e===2&&(n=xh(t),n!==0&&(s=n,e=Wh(t,n))),e===1)throw r=Pl,Ma(t,0),js(t,s),mr(t,Ct()),r;if(e===6)js(t,s);else{if(n=t.current.alternate,!(s&30)&&!jk(n)&&(e=Pu(t,s),e===2&&(a=xh(t),a!==0&&(s=a,e=Wh(t,a))),e===1))throw r=Pl,Ma(t,0),js(t,s),mr(t,Ct()),r;switch(t.finishedWork=n,t.finishedLanes=s,e){case 0:case 1:throw Error(G(345));case 2:Sa(t,dr,Hn);break;case 3:if(js(t,s),(s&130023424)===s&&(e=tv+500-Ct(),10<e)){if(lu(t,0)!==0)break;if(n=t.suspendedLanes,(n&s)!==s){rr(),t.pingedLanes|=t.suspendedLanes&n;break}t.timeoutHandle=kh(Sa.bind(null,t,dr,Hn),e);break}Sa(t,dr,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=Ct()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Nk(s/1960))-s,10<s){t.timeoutHandle=kh(Sa.bind(null,t,dr,Hn),s);break}Sa(t,dr,Hn);break;case 5:Sa(t,dr,Hn);break;default:throw Error(G(329))}}}return mr(t,Ct()),t.callbackNode===r?ib.bind(null,t):null}function Wh(t,e){var r=al;return t.current.memoizedState.isDehydrated&&(Ma(t,e).flags|=256),t=Pu(t,e),t!==2&&(e=dr,dr=r,e!==null&&Qh(e)),t}function Qh(t){dr===null?dr=t:dr.push.apply(dr,t)}function jk(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&=~ev,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(Ye&6)throw Error(G(327));Uo();var e=lu(t,0);if(!(e&1))return mr(t,Ct()),null;var r=Pu(t,e);if(t.tag!==0&&r===2){var s=xh(t);s!==0&&(e=s,r=Wh(t,s))}if(r===1)throw r=Pl,Ma(t,0),js(t,e),mr(t,Ct()),r;if(r===6)throw Error(G(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Sa(t,dr,Hn),mr(t,Ct()),null}function rv(t,e){var r=Ye;Ye|=1;try{return t(e)}finally{Ye=r,Ye===0&&(di=Ct()+500,hd&&ua())}}function Ha(t){zs!==null&&zs.tag===0&&!(Ye&6)&&Uo();var e=Ye;Ye|=1;var r=Mr.transition,s=rt;try{if(Mr.transition=null,rt=1,t)return t()}finally{rt=s,Mr.transition=r,Ye=e,!(Ye&6)&&ua()}}function nv(){wr=To.current,dt(To)}function Ma(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,ak(r)),jt!==null)for(r=jt.return;r!==null;){var s=r;switch(Mm(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&hu();break;case 3:ci(),dt(hr),dt(Zt),Km();break;case 5:Bm(s);break;case 4:ci();break;case 13:dt(gt);break;case 19:dt(gt);break;case 10:zm(s.type._context);break;case 22:case 23:nv()}r=r.return}if(Lt=t,jt=t=Js(t.current,null),qt=wr=e,It=0,Pl=null,ev=gd=qa=0,dr=al=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 lb(t,e){do{var r=jt;try{if(Um(),Uc.current=Su,bu){for(var s=yt.memoizedState;s!==null;){var n=s.queue;n!==null&&(n.pending=null),s=s.next}bu=!1}if(Va=0,Mt=Tt=yt=null,nl=!1,_l=0,Xm.current=null,r===null||r.return===null){It=1,Pl=e,jt=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,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===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 h=uy(o);if(h!==null){h.flags&=-257,dy(h,o,i,a,e),h.mode&1&&cy(a,u,e),e=h,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),sv();break e}c=Error(G(426))}}else if(mt&&i.mode&1){var g=uy(o);if(g!==null){!(g.flags&65536)&&(g.flags|=256),dy(g,o,i,a,e),Fm(ui(c,i));break e}}a=c=ui(c,i),It!==4&&(It=2),al===null?al=[a]:al.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,e&=-e,a.lanes|=e;var y=Bw(a,c,e);ny(a,y);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=Kw(a,i,e);ny(a,S);break e}}a=a.return}while(a!==null)}db(r)}catch(E){e=E,jt===r&&r!==null&&(jt=r=r.return);continue}break}while(!0)}function cb(){var t=_u.current;return _u.current=Su,t===null?Su:t}function sv(){(It===0||It===3||It===2)&&(It=4),Lt===null||!(qa&268435455)&&!(gd&268435455)||js(Lt,qt)}function Pu(t,e){var r=Ye;Ye|=2;var s=cb();(Lt!==t||qt!==e)&&(Hn=null,Ma(t,e));do try{Rk();break}catch(n){lb(t,n)}while(!0);if(Um(),Ye=r,_u.current=s,jt!==null)throw Error(G(261));return Lt=null,qt=0,It}function Rk(){for(;jt!==null;)ub(jt)}function Tk(){for(;jt!==null&&!rP();)ub(jt)}function ub(t){var e=hb(t.alternate,t,wr);t.memoizedProps=t.pendingProps,e===null?db(t):jt=e,Xm.current=null}function db(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=Ek(r,e),r!==null){r.flags&=32767,jt=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{It=6,jt=null;return}}else if(r=_k(r,e,wr),r!==null){jt=r;return}if(e=e.sibling,e!==null){jt=e;return}jt=e=t}while(e!==null);It===0&&(It=5)}function Sa(t,e,r){var s=rt,n=Mr.transition;try{Mr.transition=null,rt=1,Ak(t,e,r,s)}finally{Mr.transition=n,rt=s}return null}function Ak(t,e,r,s){do Uo();while(zs!==null);if(Ye&6)throw Error(G(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(G(177));t.callbackNode=null,t.callbackPriority=0;var a=r.lanes|r.childLanes;if(fP(t,a),t===Lt&&(jt=Lt=null,qt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||xc||(xc=!0,pb(iu,function(){return Uo(),null})),a=(r.flags&15990)!==0,r.subtreeFlags&15990||a){a=Mr.transition,Mr.transition=null;var o=rt;rt=1;var i=Ye;Ye|=4,Xm.current=null,Pk(t,r),ab(r,t),JP(Ch),cu=!!Eh,Ch=Eh=null,t.current=r,kk(r),nP(),Ye=i,rt=o,Mr.transition=a}else t.current=r;if(xc&&(xc=!1,zs=t,Cu=n),a=t.pendingLanes,a===0&&(Zs=null),oP(r.stateNode),mr(t,Ct()),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=Bh,Bh=null,t;return Cu&1&&t.tag!==0&&Uo(),a=t.pendingLanes,a&1?t===Kh?ol++:(ol=0,Kh=t):ol=0,ua(),null}function Uo(){if(zs!==null){var t=Bx(Cu),e=Mr.transition,r=rt;try{if(Mr.transition=null,rt=16>t?16:t,zs===null)var s=!1;else{if(t=zs,zs=null,Cu=0,Ye&6)throw Error(G(331));var n=Ye;for(Ye|=4,le=t.current;le!==null;){var a=le,o=a.child;if(le.flags&16){var i=a.deletions;if(i!==null){for(var c=0;c<i.length;c++){var u=i[c];for(le=u;le!==null;){var d=le;switch(d.tag){case 0:case 11:case 15:sl(8,d,a)}var f=d.child;if(f!==null)f.return=d,le=f;else for(;le!==null;){d=le;var m=d.sibling,h=d.return;if(rb(d),d===u){le=null;break}if(m!==null){m.return=h,le=m;break}le=h}}}var w=a.alternate;if(w!==null){var p=w.child;if(p!==null){w.child=null;do{var g=p.sibling;p.sibling=null,p=g}while(p!==null)}}le=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,le=o;else e:for(;le!==null;){if(a=le,a.flags&2048)switch(a.tag){case 0:case 11:case 15:sl(9,a,a.return)}var y=a.sibling;if(y!==null){y.return=a.return,le=y;break e}le=a.return}}var v=t.current;for(le=v;le!==null;){o=le;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,le=b;else e:for(o=v;le!==null;){if(i=le,i.flags&2048)try{switch(i.tag){case 0:case 11:case 15:vd(9,i)}}catch(E){bt(i,i.return,E)}if(i===o){le=null;break e}var S=i.sibling;if(S!==null){S.return=i.return,le=S;break e}le=i.return}}if(Ye=n,ua(),kn&&typeof kn.onPostCommitFiberRoot=="function")try{kn.onPostCommitFiberRoot(ld,t)}catch{}s=!0}return s}finally{rt=r,Mr.transition=e}}return!1}function Ey(t,e,r){e=ui(r,e),e=Bw(t,e,1),t=Gs(t,e,1),e=rr(),t!==null&&(Ml(t,1,e),mr(t,e))}function bt(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=ui(r,t),t=Kw(e,t,1),e=Gs(e,t,1),t=rr(),e!==null&&(Ml(e,1,t),mr(e,t));break}}e=e.return}}function Ok(t,e,r){var s=t.pingCache;s!==null&&s.delete(e),e=rr(),t.pingedLanes|=t.suspendedLanes&r,Lt===t&&(qt&r)===r&&(It===4||It===3&&(qt&130023424)===qt&&500>Ct()-tv?Ma(t,0):ev|=r),mr(t,e)}function fb(t,e){e===0&&(t.mode&1?(e=cc,cc<<=1,!(cc&130023424)&&(cc=4194304)):e=1);var r=rr();t=ss(t,e),t!==null&&(Ml(t,e,r),mr(t,r))}function Ik(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),fb(t,r)}function Dk(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(G(314))}s!==null&&s.delete(e),fb(t,r)}var hb;hb=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||hr.current)fr=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return fr=!1,Sk(t,e,r);fr=!!(t.flags&131072)}else fr=!1,mt&&e.flags&1048576&&gw(e,vu,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;Vc(t,e),t=e.pendingProps;var n=oi(e,Zt.current);Lo(e,r),n=Qm(null,e,s,t,n,r);var a=Gm();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,pr(s)?(a=!0,pu(e)):a=!1,e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,qm(e),n.updater=md,e.stateNode=n,n._reactInternals=e,Ih(e,s,t,r),e=Mh(null,e,s,!0,a,r)):(e.tag=0,mt&&a&&$m(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=Mk(s),t=Zr(s,t),n){case 0:e=$h(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(G(306,s,""))}return e;case 0:return s=e.type,n=e.pendingProps,n=e.elementType===s?n:Zr(s,n),$h(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(Zw(e),t===null)throw Error(G(387));s=e.pendingProps,a=e.memoizedState,n=a.element,_w(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=ui(Error(G(423)),e),e=my(t,e,s,r,n);break e}else if(s!==n){n=ui(Error(G(424)),e),e=my(t,e,s,r,n);break e}else for(Sr=Qs(e.stateNode.containerInfo.firstChild),_r=e,mt=!0,tn=null,r=bw(e,null,s,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ii(),s===n){e=as(t,e,r);break e}er(t,e,s,r)}e=e.child}return e;case 5:return Ew(e),t===null&&Th(e),s=e.type,n=e.pendingProps,a=t!==null?t.memoizedProps:null,o=n.children,Ph(s,n)?o=null:a!==null&&Ph(s,a)&&(e.flags|=32),Gw(t,e),er(t,e,o,r),e.child;case 6:return t===null&&Th(e),null;case 13:return Yw(t,e,r);case 4:return Hm(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=li(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,ot(gu,s._currentValue),s._currentValue=o,a!==null)if(sn(a.value,o)){if(a.children===n.children&&!hr.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),Ah(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(G(341));o.lanes|=r,i=o.alternate,i!==null&&(i.lanes|=r),Ah(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,Lo(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 Ww(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,pr(s)?(t=!0,pu(e)):t=!1,Lo(e,r),Hw(e,s,n),Ih(e,s,n,r),Mh(null,e,s,!0,t,r);case 19:return Jw(t,e,r);case 22:return Qw(t,e,r)}throw Error(G(156,e.tag))};function pb(t,e){return zx(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 $r(t,e,r,s){return new $k(t,e,r,s)}function av(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Mk(t){if(typeof t=="function")return av(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Em)return 11;if(t===Cm)return 14}return 2}function Js(t,e){var r=t.alternate;return r===null?(r=$r(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")av(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case bo:return Fa(r.children,n,a,e);case _m:o=8,n|=8;break;case sh:return t=$r(12,r,e,n|2),t.elementType=sh,t.lanes=a,t;case ah:return t=$r(13,r,e,n),t.elementType=ah,t.lanes=a,t;case oh:return t=$r(19,r,e,n),t.elementType=oh,t.lanes=a,t;case Ex:return yd(r,n,a,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Sx:o=10;break e;case _x:o=9;break e;case Em:o=11;break e;case Cm:o=14;break e;case _s:o=16,s=null;break e}throw Error(G(130,t==null?t:typeof t,""))}return e=$r(o,r,e,n),e.elementType=t,e.type=s,e.lanes=a,e}function Fa(t,e,r,s){return t=$r(7,t,s,e),t.lanes=r,t}function yd(t,e,r,s){return t=$r(22,t,s,e),t.elementType=Ex,t.lanes=r,t.stateNode={isHidden:!1},t}function jf(t,e,r){return t=$r(6,t,null,e),t.lanes=r,t}function Rf(t,e,r){return e=$r(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Fk(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=uf(0),this.expirationTimes=uf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uf(0),this.identifierPrefix=s,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function ov(t,e,r,s,n,a,o,i,c){return t=new Fk(t,e,r,i,c),e===1?(e=1,a===!0&&(e|=8)):e=0,a=$r(3,null,null,e),t.current=a,a.stateNode=t,a.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},qm(a),t}function Lk(t,e,r){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:wo,key:s==null?null:""+s,children:t,containerInfo:e,implementation:r}}function mb(t){if(!t)return sa;t=t._reactInternals;e:{if(no(t)!==t||t.tag!==1)throw Error(G(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(pr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(G(171))}if(t.tag===1){var r=t.type;if(pr(r))return mw(t,r,e)}return e}function vb(t,e,r,s,n,a,o,i,c){return t=ov(r,s,!0,t,n,a,o,i,c),t.context=mb(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),mr(t,s),t}function xd(t,e,r,s){var n=e.current,a=rr(),o=Ys(n);return r=mb(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),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 iv(t,e){Cy(t,e),(t=t.alternate)&&Cy(t,e)}function Uk(){return null}var gb=typeof reportError=="function"?reportError:function(t){console.error(t)};function lv(t){this._internalRoot=t}wd.prototype.render=lv.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(G(409));xd(t,e,null,null)};wd.prototype.unmount=lv.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[ns]=null}};function wd(t){this._internalRoot=t}wd.prototype.unstable_scheduleHydration=function(t){if(t){var e=Qx();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&&Zx(t)}};function cv(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 zk(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=vb(e,s,t,0,null,!1,!1,"",Py);return t._reactRootContainer=o,t[ns]=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=ov(t,0,!1,null,null,!1,!1,"",Py);return t._reactRootContainer=c,t[ns]=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=zk(r,e,t,n,s);return ku(o)}Kx=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=Hi(e.pendingLanes);r!==0&&(Nm(e,r|1),mr(e,Ct()),!(Ye&6)&&(di=Ct()+500,ua()))}break;case 13:Ha(function(){var s=ss(t,1);if(s!==null){var n=rr();nn(s,t,1,n)}}),iv(t,1)}};jm=function(t){if(t.tag===13){var e=ss(t,134217728);if(e!==null){var r=rr();nn(e,t,134217728,r)}iv(t,134217728)}};Wx=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)}iv(t,e)}};Qx=function(){return rt};Gx=function(t,e){var r=rt;try{return rt=t,e()}finally{rt=r}};vh=function(t,e,r){switch(e){case"input":if(ch(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(G(90));Px(s),ch(s,n)}}}break;case"textarea":Nx(t,r);break;case"select":e=r.value,e!=null&&Do(t,!!r.multiple,e,!1)}};Dx=rv;$x=Ha;var Vk={usingClientEntryPoint:!1,Events:[Ll,Co,fd,Ox,Ix,rv]},Fi={findFiberByHostInstance:Pa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},qk={bundleType:Fi.bundleType,version:Fi.version,rendererPackageName:Fi.rendererPackageName,rendererConfig:Fi.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=Lx(t),t===null?null:t.stateNode},findFiberByHostInstance:Fi.findFiberByHostInstance||Uk,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(qk),kn=wc}catch{}}Pr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Vk;Pr.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cv(e))throw Error(G(200));return Lk(t,e,null,r)};Pr.createRoot=function(t,e){if(!cv(t))throw Error(G(299));var r=!1,s="",n=gb;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onRecoverableError!==void 0&&(n=e.onRecoverableError)),e=ov(t,1,!1,null,null,r,!1,s,n),t[ns]=e.current,yl(t.nodeType===8?t.parentNode:t),new lv(e)};Pr.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(G(188)):(t=Object.keys(t).join(","),Error(G(268,t)));return t=Lx(e),t=t===null?null:t.stateNode,t};Pr.flushSync=function(t){return Ha(t)};Pr.hydrate=function(t,e,r){if(!bd(e))throw Error(G(200));return Sd(null,t,e,!0,r)};Pr.hydrateRoot=function(t,e,r){if(!cv(t))throw Error(G(405));var s=r!=null&&r.hydratedSources||null,n=!1,a="",o=gb;if(r!=null&&(r.unstable_strictMode===!0&&(n=!0),r.identifierPrefix!==void 0&&(a=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),e=vb(e,null,t,1,r??null,n,!1,a,o),t[ns]=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)};Pr.render=function(t,e,r){if(!bd(e))throw Error(G(200));return Sd(null,t,e,!1,r)};Pr.unmountComponentAtNode=function(t){if(!bd(t))throw Error(G(40));return t._reactRootContainer?(Ha(function(){Sd(null,null,t,!1,function(){t._reactRootContainer=null,t[ns]=null})}),!0):!1};Pr.unstable_batchedUpdates=rv;Pr.unstable_renderSubtreeIntoContainer=function(t,e,r,s){if(!bd(r))throw Error(G(200));if(t==null||t._reactInternals===void 0)throw Error(G(38));return Sd(t,e,r,!1,s)};Pr.version="18.3.1-next-f1338f8080-20240426";function yb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yb)}catch(t){console.error(t)}}yb(),yx.exports=Pr;var so=yx.exports;const Hk=pm(so);var xb,ky=so;xb=ky.createRoot,ky.hydrateRoot;function Bk(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 wb={exports:{}},bb={};/**
|
|
41
41
|
* @license React
|
|
42
42
|
* use-sync-external-store-shim.production.js
|
|
43
43
|
*
|
|
@@ -45,12 +45,12 @@ 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 fi=x;function Kk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Wk=typeof Object.is=="function"?Object.is:Kk,Qk=fi.useState,Gk=fi.useEffect,Zk=fi.useLayoutEffect,Yk=fi.useDebugValue;function Jk(t,e){var r=e(),s=Qk({inst:{value:r,getSnapshot:e}}),n=s[0].inst,a=s[1];return Zk(function(){n.value=r,n.getSnapshot=e,Tf(n)&&a({inst:n})},[t,r,e]),Gk(function(){return Tf(n)&&a({inst:n}),t(function(){Tf(n)&&a({inst:n})})},[t]),Yk(r),r}function Tf(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Wk(t,r)}catch{return!0}}function Xk(t,e){return e()}var eN=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Xk:Jk;bb.useSyncExternalStore=fi.useSyncExternalStore!==void 0?fi.useSyncExternalStore:eN;wb.exports=bb;var tN=wb.exports;const rN=xm.useInsertionEffect,nN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sN=nN?x.useLayoutEffect:x.useEffect,aN=rN||sN,Sb=t=>{const e=x.useRef([t,(...r)=>e[0](...r)]).current;return aN(()=>{e[0]=t}),e[1]},oN="popstate",uv="pushState",dv="replaceState",iN="hashchange",Ny=[oN,uv,dv,iN],lN=t=>{for(const e of Ny)addEventListener(e,t);return()=>{for(const e of Ny)removeEventListener(e,t)}},_b=(t,e)=>tN.useSyncExternalStore(lN,t,e),cN=()=>location.search,uN=({ssrSearch:t=""}={})=>_b(cN,()=>t),jy=()=>location.pathname,dN=({ssrPath:t}={})=>_b(jy,t?()=>t:jy),fN=(t,{replace:e=!1,state:r=null}={})=>history[e?dv:uv](r,"",t),hN=(t={})=>[dN(t),fN],Ry=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Ry]>"u"){for(const t of[uv,dv]){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 pN=(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())?"~"+e:e.slice(t.length)||"/",Eb=(t="")=>t==="/"?"":t,mN=(t,e)=>t[0]==="~"?t.slice(1):Eb(e)+t,vN=(t="",e)=>pN(Ty(Eb(t)),Ty(e)),Ty=t=>{try{return decodeURI(t)}catch{return t}},Cb={hook:hN,searchHook:uN,parser:Bk,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:t=>t},Pb=x.createContext(Cb),zl=()=>x.useContext(Pb),kb={},Nb=x.createContext(kb),gN=()=>x.useContext(Nb),_d=t=>{const[e,r]=t.hook(t);return[vN(t.base,e),Sb((s,n)=>r(mN(s,t.base),n))]},yN=()=>_d(zl()),jb=(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((f,m)=>[f,c[m]])):o.groups;let d={...c};return u&&Object.assign(d,u),d})(),...s?[i]:[]]:[!1,null]},xN=({children:t,...e})=>{var d,f;const r=zl(),s=e.hook?Cb: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??((f=e.hook)==null?void 0:f.hrefs);let i=x.useRef({}),c=i.current,u=c;for(let m in s){const h=m==="base"?s[m]+(e[m]||""):e[m]||s[m];c===u&&h!==u[m]&&(i.current=u={...u}),u[m]=h,(h!==s[m]||h!==n[m])&&(n=u)}return x.createElement(Pb.Provider,{value:n,children:t})},Ay=({children:t,component:e},r)=>e?x.createElement(e,{params:r}):typeof t=="function"?t(r):t,wN=t=>{let e=x.useRef(kb);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??jb(n.parser,t,a,e),u=wN({...gN(),...i});if(!o)return null;const d=c?x.createElement(xN,{base:c},Ay(s,u)):Ay(s,u);return x.createElement(Nb.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:f,state:m,...h}=t,w=Sb(g=>{g.ctrlKey||g.metaKey||g.altKey||g.shiftKey||g.button!==0||(i==null||i(g),g.defaultPrevented||(g.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",{...h,onClick:w,href:p,className:d!=null&&d.call?d(s===o):d,children:u,ref:e})});const Rb=t=>Array.isArray(t)?t.flatMap(e=>Rb(e&&e.type===x.Fragment?e.props.children:e)):[t],bN=({children:t,location:e})=>{const r=zl(),[s]=_d(r);for(const n of Rb(t)){let a=0;if(x.isValidElement(n)&&(a=jb(r.parser,n.props.path,e||s,n.props.nest))[0])return x.cloneElement(n,{match:a})}return null};var Si=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 SN(t,e){return typeof t=="function"?t(e):t}function Gh(t){return typeof t=="number"&&t>=0&&t!==1/0}function Tb(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Xs(t,e){return typeof t=="function"?t(e):t}function Tr(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!==fv(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 fv(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ka)(t)}function Ka(t){return JSON.stringify(t,(e,r)=>Zh(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 Ab(t,e){if(t===e)return t;const r=Dy(t)&&Dy(e);if(r||Zh(t)&&Zh(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 f=r?d:a[d];(!r&&c.has(f)||r)&&t[f]===void 0&&e[f]===void 0?(i[f]=void 0,u++):(i[f]=Ab(t[f],e[f]),i[f]===t[f]&&t[f]!==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 Zh(t){if(!$y(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!$y(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function $y(t){return Object.prototype.toString.call(t)==="[object Object]"}function _N(t){return new Promise(e=>{setTimeout(e,t)})}function Yh(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?Ab(t,e):e}function EN(t,e,r=0){const s=[...t,e];return r&&s.length>r?s.slice(1):s}function CN(t,e,r=0){const s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var hv=Symbol();function Ob(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===hv?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Ib(t,e){return typeof t=="function"?t(...e):!!t}var ja,Ts,Ko,Y0,PN=(Y0=class extends Si{constructor(){super();be(this,ja);be(this,Ts);be(this,Ko);oe(this,Ko,e=>{if(!Ba&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){I(this,Ts)||this.setEventListener(I(this,Ko))}onUnsubscribe(){var e;this.hasListeners()||((e=I(this,Ts))==null||e.call(this),oe(this,Ts,void 0))}setEventListener(e){var r;oe(this,Ko,e),(r=I(this,Ts))==null||r.call(this),oe(this,Ts,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){I(this,ja)!==e&&(oe(this,ja,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof I(this,ja)=="boolean"?I(this,ja):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ja=new WeakMap,Ts=new WeakMap,Ko=new WeakMap,Y0),pv=new PN,Wo,As,Qo,J0,kN=(J0=class extends Si{constructor(){super();be(this,Wo,!0);be(this,As);be(this,Qo);oe(this,Qo,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(){I(this,As)||this.setEventListener(I(this,Qo))}onUnsubscribe(){var e;this.hasListeners()||((e=I(this,As))==null||e.call(this),oe(this,As,void 0))}setEventListener(e){var r;oe(this,Qo,e),(r=I(this,As))==null||r.call(this),oe(this,As,e(this.setOnline.bind(this)))}setOnline(e){I(this,Wo)!==e&&(oe(this,Wo,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return I(this,Wo)}},Wo=new WeakMap,As=new WeakMap,Qo=new WeakMap,J0),ju=new kN;function Jh(){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 NN(t){return Math.min(1e3*2**t,3e4)}function Db(t){return(t??"online")==="online"?ju.isOnline():!0}var $b=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Mb(t){let e=!1,r=0,s;const n=Jh(),a=()=>n.status!=="pending",o=p=>{var g;a()||(m(new $b(p)),(g=t.abort)==null||g.call(t))},i=()=>{e=!0},c=()=>{e=!1},u=()=>pv.isFocused()&&(t.networkMode==="always"||ju.isOnline())&&t.canRun(),d=()=>Db(t.networkMode)&&t.canRun(),f=p=>{a()||(s==null||s(),n.resolve(p))},m=p=>{a()||(s==null||s(),n.reject(p))},h=()=>new Promise(p=>{var g;s=y=>{(a()||u())&&p(y)},(g=t.onPause)==null||g.call(t)}).then(()=>{var p;s=void 0,a()||(p=t.onContinue)==null||p.call(t)}),w=()=>{if(a())return;let p;const g=r===0?t.initialPromise:void 0;try{p=g??t.fn()}catch(y){p=Promise.reject(y)}Promise.resolve(p).then(f).catch(y=>{var k;if(a())return;const v=t.retry??(Ba?0:3),b=t.retryDelay??NN,S=typeof b=="function"?b(r,y):b,E=v===!0||typeof v=="number"&&r<v||typeof v=="function"&&v(r,y);if(e||!E){m(y);return}r++,(k=t.onFail)==null||k.call(t,r,y),_N(S).then(()=>u()?void 0:h()).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():h().then(w),n)}}var jN=t=>setTimeout(t,0);function RN(){let t=[],e=0,r=i=>{i()},s=i=>{i()},n=jN;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 At=RN(),Ra,X0,Fb=(X0=class{constructor(){be(this,Ra)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gh(this.gcTime)&&oe(this,Ra,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ba?1/0:5*60*1e3))}clearGcTimeout(){I(this,Ra)&&(clearTimeout(I(this,Ra)),oe(this,Ra,void 0))}},Ra=new WeakMap,X0),Go,Zo,Rr,Ta,$t,Al,Aa,Jr,zn,ex,TN=(ex=class extends Fb{constructor(e){super();be(this,Jr);be(this,Go);be(this,Zo);be(this,Rr);be(this,Ta);be(this,$t);be(this,Al);be(this,Aa);oe(this,Aa,!1),oe(this,Al,e.defaultOptions),this.setOptions(e.options),this.observers=[],oe(this,Ta,e.client),oe(this,Rr,I(this,Ta).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,oe(this,Go,AN(this.options)),this.state=e.state??I(this,Go),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=I(this,$t))==null?void 0:e.promise}setOptions(e){this.options={...I(this,Al),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&I(this,Rr).remove(this)}setData(e,r){const s=Yh(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=I(this,$t))==null?void 0:s.promise;return(n=I(this,$t))==null||n.cancel(e),r?r.then(tr).catch(tr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(I(this,Go))}isActive(){return this.observers.some(e=>Tr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===hv||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:!Tb(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=I(this,$t))==null||r.continue()}onOnline(){var r;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=I(this,$t))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),I(this,Rr).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(I(this,$t)&&(I(this,Aa)?I(this,$t).cancel({revert:!0}):I(this,$t).cancelRetry()),this.scheduleGc()),I(this,Rr).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,f,m,h,w,p,g,y,v,b;if(this.state.fetchStatus!=="idle"&&((c=I(this,$t))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(I(this,$t))return I(this,$t).continueRetry(),I(this,$t).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:()=>(oe(this,Aa,!0),s.signal)})},a=()=>{const S=Ob(this.options,r),k=(()=>{const N={client:I(this,Ta),queryKey:this.queryKey,meta:this.meta};return n(N),N})();return oe(this,Aa,!1),this.options.persister?this.options.persister(S,k,this):S(k)},i=(()=>{const S={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:I(this,Ta),state:this.state,fetchFn:a};return n(S),S})();(u=this.options.behavior)==null||u.onFetch(i,this),oe(this,Zo,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:(f=i.fetchOptions)==null?void 0:f.meta}),oe(this,$t,Mb({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 I(this,$t).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(h=(m=I(this,Rr).config).onSuccess)==null||h.call(m,S,this),(p=(w=I(this,Rr).config).onSettled)==null||p.call(w,S,this.state.error,this),S}catch(S){if(S instanceof $b){if(S.silent)return I(this,$t).promise;if(S.revert){if(this.setState({...I(this,Zo),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=(g=I(this,Rr).config).onError)==null||y.call(g,S,this),(b=(v=I(this,Rr).config).onSettled)==null||b.call(v,this.state.data,S,this),S}finally{this.scheduleGc()}}},Go=new WeakMap,Zo=new WeakMap,Rr=new WeakMap,Ta=new WeakMap,$t=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,...Lb(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 oe(this,Zo,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),At.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),I(this,Rr).notify({query:this,type:"updated",action:e})})},ex);function Lb(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Db(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function AN(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,tx,ON=(tx=class extends Si{constructor(e={}){super();be(this,vn);this.config=e,oe(this,vn,new Map)}build(e,r,s){const n=r.queryKey,a=r.queryHash??fv(n,r);let o=this.get(a);return o||(o=new TN({client:e,queryKey:n,queryHash:a,options:e.defaultQueryOptions(r),state:s,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){I(this,vn).has(e.queryHash)||(I(this,vn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=I(this,vn).get(e.queryHash);r&&(e.destroy(),r===e&&I(this,vn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){At.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return I(this,vn).get(e)}getAll(){return[...I(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){At.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){At.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){At.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vn=new WeakMap,tx),gn,Jt,Oa,yn,bs,rx,IN=(rx=class extends Fb{constructor(e){super();be(this,yn);be(this,gn);be(this,Jt);be(this,Oa);this.mutationId=e.mutationId,oe(this,Jt,e.mutationCache),oe(this,gn,[]),this.state=e.state||Ub(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){I(this,gn).includes(e)||(I(this,gn).push(e),this.clearGcTimeout(),I(this,Jt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){oe(this,gn,I(this,gn).filter(r=>r!==e)),this.scheduleGc(),I(this,Jt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){I(this,gn).length||(this.state.status==="pending"?this.scheduleGc():I(this,Jt).remove(this))}continue(){var e;return((e=I(this,Oa))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,i,c,u,d,f,m,h,w,p,g,y,v,b,S,E,k,N,T;const r=()=>{Le(this,yn,bs).call(this,{type:"continue"})};oe(this,Oa,Mb({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(D,U)=>{Le(this,yn,bs).call(this,{type:"failed",failureCount:D,error:U})},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:()=>I(this,Jt).canRun(this)}));const s=this.state.status==="pending",n=!I(this,Oa).canStart();try{if(s)r();else{Le(this,yn,bs).call(this,{type:"pending",variables:e,isPaused:n}),await((o=(a=I(this,Jt).config).onMutate)==null?void 0:o.call(a,e,this));const U=await((c=(i=this.options).onMutate)==null?void 0:c.call(i,e));U!==this.state.context&&Le(this,yn,bs).call(this,{type:"pending",context:U,variables:e,isPaused:n})}const D=await I(this,Oa).start();return await((d=(u=I(this,Jt).config).onSuccess)==null?void 0:d.call(u,D,e,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,D,e,this.state.context)),await((w=(h=I(this,Jt).config).onSettled)==null?void 0:w.call(h,D,null,this.state.variables,this.state.context,this)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,D,null,e,this.state.context)),Le(this,yn,bs).call(this,{type:"success",data:D}),D}catch(D){try{throw await((v=(y=I(this,Jt).config).onError)==null?void 0:v.call(y,D,e,this.state.context,this)),await((S=(b=this.options).onError)==null?void 0:S.call(b,D,e,this.state.context)),await((k=(E=I(this,Jt).config).onSettled)==null?void 0:k.call(E,void 0,D,this.state.variables,this.state.context,this)),await((T=(N=this.options).onSettled)==null?void 0:T.call(N,void 0,D,e,this.state.context)),D}finally{Le(this,yn,bs).call(this,{type:"error",error:D})}}finally{I(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),At.batch(()=>{I(this,gn).forEach(s=>{s.onMutationUpdate(e)}),I(this,Jt).notify({mutation:this,type:"updated",action:e})})},rx);function Ub(){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,nx,DN=(nx=class extends Si{constructor(e={}){super();be(this,Kn);be(this,Xr);be(this,Ol);this.config=e,oe(this,Kn,new Set),oe(this,Xr,new Map),oe(this,Ol,0)}build(e,r,s){const n=new IN({mutationCache:this,mutationId:++nc(this,Ol)._,options:e.defaultMutationOptions(r),state:s});return this.add(n),n}add(e){I(this,Kn).add(e);const r=Sc(e);if(typeof r=="string"){const s=I(this,Xr).get(r);s?s.push(e):I(this,Xr).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(I(this,Kn).delete(e)){const r=Sc(e);if(typeof r=="string"){const s=I(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&&I(this,Xr).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Sc(e);if(typeof r=="string"){const s=I(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=I(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(){At.batch(()=>{I(this,Kn).forEach(e=>{this.notify({type:"removed",mutation:e})}),I(this,Kn).clear(),I(this,Xr).clear()})}getAll(){return Array.from(I(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){At.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return At.batch(()=>Promise.all(e.map(r=>r.continue().catch(tr))))}},Kn=new WeakMap,Xr=new WeakMap,Ol=new WeakMap,nx);function Sc(t){var e;return(e=t.options.scope)==null?void 0:e.id}function My(t){return{onFetch:(e,r)=>{var d,f,m,h,w;const s=e.options,n=(m=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,a=((h=e.state.data)==null?void 0:h.pages)||[],o=((w=e.state.data)==null?void 0:w.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const g=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?p=!0:e.signal.addEventListener("abort",()=>{p=!0}),e.signal)})},y=Ob(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 N=(()=>{const R={client:e.client,queryKey:e.queryKey,pageParam:S,direction:E?"backward":"forward",meta:e.options.meta};return g(R),R})(),T=await y(N),{maxPages:D}=e.options,U=E?CN:EN;return{pages:U(b.pages,T,D),pageParams:U(b.pageParams,S,D)}};if(n&&a.length){const b=n==="backward",S=b?$N:Fy,E={pages:a,pageParams:o},k=S(s,E);i=await v(E,k,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,g;return(g=(p=e.options).persister)==null?void 0:g.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 $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 wt,Os,Is,Yo,Jo,Ds,Xo,ei,sx,MN=(sx=class{constructor(t={}){be(this,wt);be(this,Os);be(this,Is);be(this,Yo);be(this,Jo);be(this,Ds);be(this,Xo);be(this,ei);oe(this,wt,t.queryCache||new ON),oe(this,Os,t.mutationCache||new DN),oe(this,Is,t.defaultOptions||{}),oe(this,Yo,new Map),oe(this,Jo,new Map),oe(this,Ds,0)}mount(){nc(this,Ds)._++,I(this,Ds)===1&&(oe(this,Xo,pv.subscribe(async t=>{t&&(await this.resumePausedMutations(),I(this,wt).onFocus())})),oe(this,ei,ju.subscribe(async t=>{t&&(await this.resumePausedMutations(),I(this,wt).onOnline())})))}unmount(){var t,e;nc(this,Ds)._--,I(this,Ds)===0&&((t=I(this,Xo))==null||t.call(this),oe(this,Xo,void 0),(e=I(this,ei))==null||e.call(this),oe(this,ei,void 0))}isFetching(t){return I(this,wt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return I(this,Os).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=I(this,wt).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=I(this,wt).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 I(this,wt).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=I(this,wt).get(s.queryHash),a=n==null?void 0:n.state.data,o=SN(e,a);if(o!==void 0)return I(this,wt).build(this,s).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return At.batch(()=>I(this,wt).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=I(this,wt).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=I(this,wt);At.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=I(this,wt);return At.batch(()=>(r.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},s=At.batch(()=>I(this,wt).findAll(t).map(n=>n.cancel(r)));return Promise.all(s).then(tr).catch(tr)}invalidateQueries(t,e={}){return At.batch(()=>(I(this,wt).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=At.batch(()=>I(this,wt).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=I(this,wt).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=My(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(tr).catch(tr)}ensureInfiniteQueryData(t){return t.behavior=My(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return ju.isOnline()?I(this,Os).resumePausedMutations():Promise.resolve()}getQueryCache(){return I(this,wt)}getMutationCache(){return I(this,Os)}getDefaultOptions(){return I(this,Is)}setDefaultOptions(t){oe(this,Is,t)}setQueryDefaults(t,e){I(this,Yo).set(Ka(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...I(this,Yo).values()],r={};return e.forEach(s=>{kl(t,s.queryKey)&&Object.assign(r,s.defaultOptions)}),r}setMutationDefaults(t,e){I(this,Jo).set(Ka(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...I(this,Jo).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={...I(this,Is).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=fv(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===hv&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...I(this,Is).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){I(this,wt).clear(),I(this,Os).clear()}},wt=new WeakMap,Os=new WeakMap,Is=new WeakMap,Yo=new WeakMap,Jo=new WeakMap,Ds=new WeakMap,Xo=new WeakMap,ei=new WeakMap,sx),ir,We,Il,Xt,Ia,ti,Wn,$s,Dl,ri,ni,Da,$a,Ms,si,et,Ki,Xh,ep,tp,rp,np,sp,ap,zb,ax,FN=(ax=class extends Si{constructor(e,r){super();be(this,et);be(this,ir);be(this,We);be(this,Il);be(this,Xt);be(this,Ia);be(this,ti);be(this,Wn);be(this,$s);be(this,Dl);be(this,ri);be(this,ni);be(this,Da);be(this,$a);be(this,Ms);be(this,si,new Set);this.options=r,oe(this,ir,e),oe(this,$s,null),oe(this,Wn,Jh()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(I(this,We).addObserver(this),Ly(I(this,We),this.options)?Le(this,et,Ki).call(this):this.updateResult(),Le(this,et,rp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return op(I(this,We),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return op(I(this,We),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,et,np).call(this),Le(this,et,sp).call(this),I(this,We).removeObserver(this)}setOptions(e){const r=this.options,s=I(this,We);if(this.options=I(this,ir).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tr(this.options.enabled,I(this,We))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,et,ap).call(this),I(this,We).setOptions(this.options),r._defaulted&&!Nu(this.options,r)&&I(this,ir).getQueryCache().notify({type:"observerOptionsUpdated",query:I(this,We),observer:this});const n=this.hasListeners();n&&Uy(I(this,We),s,this.options,r)&&Le(this,et,Ki).call(this),this.updateResult(),n&&(I(this,We)!==s||Tr(this.options.enabled,I(this,We))!==Tr(r.enabled,I(this,We))||Xs(this.options.staleTime,I(this,We))!==Xs(r.staleTime,I(this,We)))&&Le(this,et,Xh).call(this);const a=Le(this,et,ep).call(this);n&&(I(this,We)!==s||Tr(this.options.enabled,I(this,We))!==Tr(r.enabled,I(this,We))||a!==I(this,Ms))&&Le(this,et,tp).call(this,a)}getOptimisticResult(e){const r=I(this,ir).getQueryCache().build(I(this,ir),e),s=this.createResult(r,e);return UN(this,s)&&(oe(this,Xt,s),oe(this,ti,this.options),oe(this,Ia,I(this,We).state)),s}getCurrentResult(){return I(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&&I(this,Wn).status==="pending"&&I(this,Wn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,n))})}trackProp(e){I(this,si).add(e)}getCurrentQuery(){return I(this,We)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=I(this,ir).defaultQueryOptions(e),s=I(this,ir).getQueryCache().build(I(this,ir),r);return s.fetch().then(()=>this.createResult(s,r))}fetch(e){return Le(this,et,Ki).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),I(this,Xt)))}createResult(e,r){var D;const s=I(this,We),n=this.options,a=I(this,Xt),o=I(this,Ia),i=I(this,ti),u=e!==s?e.state:I(this,Il),{state:d}=e;let f={...d},m=!1,h;if(r._optimisticResults){const U=this.hasListeners(),R=!U&&Ly(e,r),A=U&&Uy(e,s,r,n);(R||A)&&(f={...f,...Lb(d.data,e.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:w,errorUpdatedAt:p,status:g}=f;h=f.data;let y=!1;if(r.placeholderData!==void 0&&h===void 0&&g==="pending"){let U;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(U=a.data,y=!0):U=typeof r.placeholderData=="function"?r.placeholderData((D=I(this,ni))==null?void 0:D.state.data,I(this,ni)):r.placeholderData,U!==void 0&&(g="success",h=Yh(a==null?void 0:a.data,U,r),m=!0)}if(r.select&&h!==void 0&&!y)if(a&&h===(o==null?void 0:o.data)&&r.select===I(this,Dl))h=I(this,ri);else try{oe(this,Dl,r.select),h=r.select(h),h=Yh(a==null?void 0:a.data,h,r),oe(this,ri,h),oe(this,$s,null)}catch(U){oe(this,$s,U)}I(this,$s)&&(w=I(this,$s),h=I(this,ri),p=Date.now(),g="error");const v=f.fetchStatus==="fetching",b=g==="pending",S=g==="error",E=b&&v,k=h!==void 0,T={status:g,fetchStatus:f.fetchStatus,isPending:b,isSuccess:g==="success",isError:S,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:f.dataUpdatedAt,error:w,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!b,isLoadingError:S&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:S&&k,isStale:mv(e,r),refetch:this.refetch,promise:I(this,Wn),isEnabled:Tr(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const U=_=>{T.status==="error"?_.reject(T.error):T.data!==void 0&&_.resolve(T.data)},R=()=>{const _=oe(this,Wn,T.promise=Jh());U(_)},A=I(this,Wn);switch(A.status){case"pending":e.queryHash===s.queryHash&&U(A);break;case"fulfilled":(T.status==="error"||T.data!==A.value)&&R();break;case"rejected":(T.status!=="error"||T.error!==A.reason)&&R();break}}return T}updateResult(){const e=I(this,Xt),r=this.createResult(I(this,We),this.options);if(oe(this,Ia,I(this,We).state),oe(this,ti,this.options),I(this,Ia).data!==void 0&&oe(this,ni,I(this,We)),Nu(r,e))return;oe(this,Xt,r);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!I(this,si).size)return!0;const o=new Set(a??I(this,si));return this.options.throwOnError&&o.add("error"),Object.keys(I(this,Xt)).some(i=>{const c=i;return I(this,Xt)[c]!==e[c]&&o.has(c)})};Le(this,et,zb).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,et,rp).call(this)}},ir=new WeakMap,We=new WeakMap,Il=new WeakMap,Xt=new WeakMap,Ia=new WeakMap,ti=new WeakMap,Wn=new WeakMap,$s=new WeakMap,Dl=new WeakMap,ri=new WeakMap,ni=new WeakMap,Da=new WeakMap,$a=new WeakMap,Ms=new WeakMap,si=new WeakMap,et=new WeakSet,Ki=function(e){Le(this,et,ap).call(this);let r=I(this,We).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(tr)),r},Xh=function(){Le(this,et,np).call(this);const e=Xs(this.options.staleTime,I(this,We));if(Ba||I(this,Xt).isStale||!Gh(e))return;const s=Tb(I(this,Xt).dataUpdatedAt,e)+1;oe(this,Da,setTimeout(()=>{I(this,Xt).isStale||this.updateResult()},s))},ep=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(I(this,We)):this.options.refetchInterval)??!1},tp=function(e){Le(this,et,sp).call(this),oe(this,Ms,e),!(Ba||Tr(this.options.enabled,I(this,We))===!1||!Gh(I(this,Ms))||I(this,Ms)===0)&&oe(this,$a,setInterval(()=>{(this.options.refetchIntervalInBackground||pv.isFocused())&&Le(this,et,Ki).call(this)},I(this,Ms)))},rp=function(){Le(this,et,Xh).call(this),Le(this,et,tp).call(this,Le(this,et,ep).call(this))},np=function(){I(this,Da)&&(clearTimeout(I(this,Da)),oe(this,Da,void 0))},sp=function(){I(this,$a)&&(clearInterval(I(this,$a)),oe(this,$a,void 0))},ap=function(){const e=I(this,ir).getQueryCache().build(I(this,ir),this.options);if(e===I(this,We))return;const r=I(this,We);oe(this,We,e),oe(this,Il,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},zb=function(e){At.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(I(this,Xt))}),I(this,ir).getQueryCache().notify({query:I(this,We),type:"observerResultsUpdated"})})},ax);function LN(t,e){return Tr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Ly(t,e){return LN(t,e)||t.state.data!==void 0&&op(t,e,e.refetchOnMount)}function op(t,e,r){if(Tr(e.enabled,t)!==!1&&Xs(e.staleTime,t)!=="static"){const s=typeof r=="function"?r(t):r;return s==="always"||s!==!1&&mv(t,e)}return!1}function Uy(t,e,r,s){return(t!==e||Tr(s.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&mv(t,r)}function mv(t,e){return Tr(e.enabled,t)!==!1&&t.isStaleByTime(Xs(e.staleTime,t))}function UN(t,e){return!Nu(t.getCurrentResult(),e)}var Fs,Ls,lr,Qn,ts,Kc,ip,ox,zN=(ox=class extends Si{constructor(r,s){super();be(this,ts);be(this,Fs);be(this,Ls);be(this,lr);be(this,Qn);oe(this,Fs,r),this.setOptions(s),this.bindMethods(),Le(this,ts,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=I(this,Fs).defaultMutationOptions(r),Nu(this.options,s)||I(this,Fs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:I(this,lr),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Ka(s.mutationKey)!==Ka(this.options.mutationKey)?this.reset():((n=I(this,lr))==null?void 0:n.state.status)==="pending"&&I(this,lr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=I(this,lr))==null||r.removeObserver(this)}onMutationUpdate(r){Le(this,ts,Kc).call(this),Le(this,ts,ip).call(this,r)}getCurrentResult(){return I(this,Ls)}reset(){var r;(r=I(this,lr))==null||r.removeObserver(this),oe(this,lr,void 0),Le(this,ts,Kc).call(this),Le(this,ts,ip).call(this)}mutate(r,s){var n;return oe(this,Qn,s),(n=I(this,lr))==null||n.removeObserver(this),oe(this,lr,I(this,Fs).getMutationCache().build(I(this,Fs),this.options)),I(this,lr).addObserver(this),I(this,lr).execute(r)}},Fs=new WeakMap,Ls=new WeakMap,lr=new WeakMap,Qn=new WeakMap,ts=new WeakSet,Kc=function(){var s;const r=((s=I(this,lr))==null?void 0:s.state)??Ub();oe(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})},ip=function(r){At.batch(()=>{var s,n,a,o,i,c,u,d;if(I(this,Qn)&&this.hasListeners()){const f=I(this,Ls).variables,m=I(this,Ls).context;(r==null?void 0:r.type)==="success"?((n=(s=I(this,Qn)).onSuccess)==null||n.call(s,r.data,f,m),(o=(a=I(this,Qn)).onSettled)==null||o.call(a,r.data,null,f,m)):(r==null?void 0:r.type)==="error"&&((c=(i=I(this,Qn)).onError)==null||c.call(i,r.error,f,m),(d=(u=I(this,Qn)).onSettled)==null||d.call(u,void 0,r.error,f,m))}this.listeners.forEach(f=>{f(I(this,Ls))})})},ox),Vb=x.createContext(void 0),vr=t=>{const e=x.useContext(Vb);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},VN=({client:t,children:e})=>(x.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),l.jsx(Vb.Provider,{value:t,children:e})),qb=x.createContext(!1),qN=()=>x.useContext(qb);qb.Provider;function HN(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var BN=x.createContext(HN()),KN=()=>x.useContext(BN),WN=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},QN=t=>{x.useEffect(()=>{t.clearReset()},[t])},GN=({result:t,errorResetBoundary:e,throwOnError:r,query:s,suspense:n})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(n&&t.data===void 0||Ib(r,[t.error,s])),ZN=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))}},YN=(t,e)=>t.isLoading&&t.isFetching&&!e,JN=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,zy=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function XN(t,e,r){var f,m,h,w,p;const s=qN(),n=KN(),a=vr(),o=a.defaultQueryOptions(t);(m=(f=a.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,o),o._optimisticResults=s?"isRestoring":"optimistic",ZN(o),WN(o,n),QN(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(g=>{const y=d?c.subscribe(At.batchCalls(g)):tr;return c.updateResult(),y},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),x.useEffect(()=>{c.setOptions(o)},[o,c]),JN(o,u))throw zy(o,c,n);if(GN({result:u,errorResetBoundary:n,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((w=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||w.call(h,o,u),o.experimental_prefetchInRender&&!Ba&&YN(u,s)){const g=i?zy(o,c,n):(p=a.getQueryCache().get(o.queryHash))==null?void 0:p.promise;g==null||g.catch(tr).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function Ir(t,e){return XN(t,FN)}function Ot(t,e){const r=vr(),[s]=x.useState(()=>new zN(r,t));x.useEffect(()=>{s.setOptions(t)},[s,t]);const n=x.useSyncExternalStore(x.useCallback(o=>s.subscribe(At.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=x.useCallback((o,i)=>{s.mutate(o,i).catch(tr)},[s]);if(n.error&&Ib(s.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}const ej="x-agent-deck-client",tj="dashboard",Hb={[ej]:tj};async function Bb(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 Ue(t,e,r){const s=e.startsWith("/api")?`http://localhost:8000${e}`:e,n=await fetch(s,{method:t,headers:{...Hb,...r?{"Content-Type":"application/json"}:{}},body:r?JSON.stringify(r):void 0});return await Bb(n),n}const rj=({on401:t})=>async({queryKey:e})=>{const r=e.join("/"),s=r.startsWith("/api")?`http://localhost:8000${r}`:r,n=await fetch(s,{headers:Hb});return await Bb(n),await n.json()},nj=new MN({defaultOptions:{queries:{queryFn:rj({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),sj=1,aj=1e6;let Af=0;function oj(){return Af=(Af+1)%Number.MAX_SAFE_INTEGER,Af.toString()}const Of=new Map,Vy=t=>{if(Of.has(t))return;const e=setTimeout(()=>{Of.delete(t),il({type:"REMOVE_TOAST",toastId:t})},aj);Of.set(t,e)},ij=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,sj)};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 il(t){Qc=ij(Qc,t),Wc.forEach(e=>{e(Qc)})}function lj({...t}){const e=oj(),r=n=>il({type:"UPDATE_TOAST",toast:{...n,id:e}}),s=()=>il({type:"DISMISS_TOAST",toastId:e});return il({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:n=>{n||s()}}}),{id:e,dismiss:s,update:r}}function gr(){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:lj,dismiss:r=>il({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 Kb(...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 nt(...t){return x.useCallback(Kb(...t),t)}function cj(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=f=>{var y;const{scope:m,children:h,...w}=f,p=((y=m==null?void 0:m[t])==null?void 0:y[c])||i,g=x.useMemo(()=>w,Object.values(w));return l.jsx(p.Provider,{value:g,children:h})};u.displayName=a+"Provider";function d(f,m){var p;const h=((p=m==null?void 0:m[t])==null?void 0:p[c])||i,w=x.useContext(h);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${f}\` 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,uj(n,...e)]}function uj(...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 f=c(a)[`__scope${u}`];return{...i,...f}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function hi(t){const e=fj(t),r=x.forwardRef((s,n)=>{const{children:a,...o}=s,i=x.Children.toArray(a),c=i.find(pj);if(c){const u=c.props.children,d=i.map(f=>f===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);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 dj=hi("Slot");function fj(t){const e=x.forwardRef((r,s)=>{const{children:n,...a}=r;if(x.isValidElement(n)){const o=vj(n),i=mj(a,n.props);return n.type!==x.Fragment&&(i.ref=s?Kb(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 Wb=Symbol("radix.slottable");function hj(t){const e=({children:r})=>l.jsx(l.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Wb,e}function pj(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Wb}function mj(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 vj(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 vv(t){const e=t+"CollectionProvider",[r,s]=ds(e),[n,a]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:y}=p,v=mn.useRef(null),b=mn.useRef(new Map).current;return l.jsx(n,{scope:g,itemMap:b,collectionRef:v,children:y})};o.displayName=e;const i=t+"CollectionSlot",c=hi(i),u=mn.forwardRef((p,g)=>{const{scope:y,children:v}=p,b=a(i,y),S=nt(g,b.collectionRef);return l.jsx(c,{ref:S,children:v})});u.displayName=i;const d=t+"CollectionItemSlot",f="data-radix-collection-item",m=hi(d),h=mn.forwardRef((p,g)=>{const{scope:y,children:v,...b}=p,S=mn.useRef(null),E=nt(g,S),k=a(d,y);return mn.useEffect(()=>(k.itemMap.set(S,{ref:S,...b}),()=>void k.itemMap.delete(S))),l.jsx(m,{[f]:"",ref:E,children:v})});h.displayName=d;function w(p){const g=a(t+"CollectionConsumer",p);return mn.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const b=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((k,N)=>b.indexOf(k.ref.current)-b.indexOf(N.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:u,ItemSlot:h},w,s]}var gj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Re=gj.reduce((t,e)=>{const r=hi(`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 Qb(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 yj(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 xj="DismissableLayer",lp="dismissableLayer.update",wj="dismissableLayer.pointerDownOutside",bj="dismissableLayer.focusOutside",Hy,Gb=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(Gb),[d,f]=x.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=x.useState({}),w=nt(e,N=>f(N)),p=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=p.indexOf(g),v=d?p.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,E=_j(N=>{const T=N.target,D=[...u.branches].some(U=>U.contains(T));!S||D||(n==null||n(N),o==null||o(N),N.defaultPrevented||i==null||i())},m),k=Ej(N=>{const T=N.target;[...u.branches].some(U=>U.contains(T))||(a==null||a(N),o==null||o(N),N.defaultPrevented||i==null||i())},m);return yj(N=>{v===u.layers.size-1&&(s==null||s(N),!N.defaultPrevented&&i&&(N.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 N=()=>h({});return document.addEventListener(lp,N),()=>document.removeEventListener(lp,N)},[]),l.jsx(Re.div,{...c,ref:w,style:{pointerEvents:b?S?"auto":"none":void 0,...t.style},onFocusCapture:Se(t.onFocusCapture,k.onFocusCapture),onBlurCapture:Se(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Se(t.onPointerDownCapture,E.onPointerDownCapture)})});Vl.displayName=xj;var Sj="DismissableLayerBranch",Zb=x.forwardRef((t,e)=>{const r=x.useContext(Gb),s=x.useRef(null),n=nt(e,s);return x.useEffect(()=>{const a=s.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),l.jsx(Re.div,{...t,ref:n})});Zb.displayName=Sj;function _j(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(){Yb(wj,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 Ej(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&&Yb(bj,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(lp);document.dispatchEvent(t)}function Yb(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?Qb(n,a):n.dispatchEvent(a)}var Cj=Vl,Pj=Zb,Bt=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},kj="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?Hk.createPortal(l.jsx(Re.div,{...s,ref:e}),o):null});Ed.displayName=kj;function Nj(t,e){return x.useReducer((r,s)=>e[r][s]??r,t)}var da=t=>{const{present:e,children:r}=t,s=jj(e),n=typeof r=="function"?r({present:s.isPresent}):x.Children.only(r),a=nt(s.ref,Rj(n));return typeof r=="function"||s.isPresent?x.cloneElement(n,{ref:a}):null};da.displayName="Presence";function jj(t){const[e,r]=x.useState(),s=x.useRef(null),n=x.useRef(t),a=x.useRef("none"),o=t?"mounted":"unmounted",[i,c]=Nj(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,h=_c(u);t?c("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==h?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,c]),Bt(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=h=>{const p=_c(s.current).includes(CSS.escape(h.animationName));if(h.target===e&&p&&(c("ANIMATION_END"),!n.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},m=h=>{h.target===e&&(a.current=_c(s.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}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 Rj(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 Tj=xm[" useInsertionEffect ".trim().toString()]||Bt;function Wa({prop:t,defaultProp:e,onChange:r=()=>{},caller:s}){const[n,a,o]=Aj({defaultProp:e,onChange:r}),i=t!==void 0,c=i?t:n;{const d=x.useRef(t!==void 0);x.useEffect(()=>{const f=d.current;f!==i&&console.warn(`${s} is changing from ${f?"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 f;if(i){const m=Oj(d)?d(t):d;m!==t&&((f=o.current)==null||f.call(o,m))}else a(d)},[i,t,a,o]);return[c,u]}function Aj({defaultProp:t,onChange:e}){const[r,s]=x.useState(t),n=x.useRef(r),a=x.useRef(e);return Tj(()=>{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 Oj(t){return typeof t=="function"}var Jb=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"}),Ij="VisuallyHidden",Cd=x.forwardRef((t,e)=>l.jsx(Re.span,{...t,ref:e,style:{...Jb,...t.style}}));Cd.displayName=Ij;var Dj=Cd,gv="ToastProvider",[yv,$j,Mj]=vv("Toast"),[Xb,uF]=ds("Toast",[Mj]),[Fj,Pd]=Xb(gv),eS=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),f=x.useRef(!1),m=x.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${gv}\`. Expected non-empty \`string\`.`),l.jsx(yv.Provider,{scope:e,children:l.jsx(Fj,{scope:e,label:r,duration:s,swipeDirection:n,swipeThreshold:a,toastCount:u,viewport:i,onViewportChange:c,onToastAdd:x.useCallback(()=>d(h=>h+1),[]),onToastRemove:x.useCallback(()=>d(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:o})})};eS.displayName=gv;var tS="ToastViewport",Lj=["F8"],cp="toast.viewportPause",up="toast.viewportResume",rS=x.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:s=Lj,label:n="Notifications ({hotkey})",...a}=t,o=Pd(tS,r),i=$j(r),c=x.useRef(null),u=x.useRef(null),d=x.useRef(null),f=x.useRef(null),m=nt(e,f,o.onViewportChange),h=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),w=o.toastCount>0;x.useEffect(()=>{const g=y=>{var b;s.length!==0&&s.every(S=>y[S]||y.code===S)&&((b=f.current)==null||b.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s]),x.useEffect(()=>{const g=c.current,y=f.current;if(w&&g&&y){const v=()=>{if(!o.isClosePausedRef.current){const k=new CustomEvent(cp);y.dispatchEvent(k),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const k=new CustomEvent(up);y.dispatchEvent(k),o.isClosePausedRef.current=!1}},S=k=>{!g.contains(k.relatedTarget)&&b()},E=()=>{g.contains(document.activeElement)||b()};return g.addEventListener("focusin",v),g.addEventListener("focusout",S),g.addEventListener("pointermove",v),g.addEventListener("pointerleave",E),window.addEventListener("blur",v),window.addEventListener("focus",b),()=>{g.removeEventListener("focusin",v),g.removeEventListener("focusout",S),g.removeEventListener("pointermove",v),g.removeEventListener("pointerleave",E),window.removeEventListener("blur",v),window.removeEventListener("focus",b)}}},[w,o.isClosePausedRef]);const p=x.useCallback(({tabbingDirection:g})=>{const v=i().map(b=>{const S=b.ref.current,E=[S,...Jj(S)];return g==="forwards"?E:E.reverse()});return(g==="forwards"?v.reverse():v).flat()},[i]);return x.useEffect(()=>{const g=f.current;if(g){const y=v=>{var E,k,N;const b=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!b){const T=document.activeElement,D=v.shiftKey;if(v.target===g&&D){(E=u.current)==null||E.focus();return}const A=p({tabbingDirection:D?"backwards":"forwards"}),_=A.findIndex(O=>O===T);If(A.slice(_+1))?v.preventDefault():D?(k=u.current)==null||k.focus():(N=d.current)==null||N.focus()}};return g.addEventListener("keydown",y),()=>g.removeEventListener("keydown",y)}},[i,p]),l.jsxs(Pj,{ref:c,role:"region","aria-label":n.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:w?void 0:"none"},children:[w&&l.jsx(dp,{ref:u,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"forwards"});If(g)}}),l.jsx(yv.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...a,ref:m})}),w&&l.jsx(dp,{ref:d,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"backwards"});If(g)}})]})});rS.displayName=tS;var nS="ToastFocusProxy",dp=x.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:s,...n}=t,a=Pd(nS,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()}})});dp.displayName=nS;var ql="Toast",Uj="toast.swipeStart",zj="toast.swipeMove",Vj="toast.swipeCancel",qj="toast.swipeEnd",sS=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(Kj,{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:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel: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:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});sS.displayName=ql;var[Hj,Bj]=Xb(ql,{onClose(){}}),Kj=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:f,onSwipeCancel:m,onSwipeEnd:h,...w}=t,p=Pd(ql,r),[g,y]=x.useState(null),v=nt(e,O=>y(O)),b=x.useRef(null),S=x.useRef(null),E=n||p.duration,k=x.useRef(0),N=x.useRef(E),T=x.useRef(0),{onToastAdd:D,onToastRemove:U}=p,R=Ur(()=>{var z;(g==null?void 0:g.contains(document.activeElement))&&((z=p.viewport)==null||z.focus()),o()}),A=x.useCallback(O=>{!O||O===1/0||(window.clearTimeout(T.current),k.current=new Date().getTime(),T.current=window.setTimeout(R,O))},[R]);x.useEffect(()=>{const O=p.viewport;if(O){const z=()=>{A(N.current),u==null||u()},j=()=>{const K=new Date().getTime()-k.current;N.current=N.current-K,window.clearTimeout(T.current),c==null||c()};return O.addEventListener(cp,j),O.addEventListener(up,z),()=>{O.removeEventListener(cp,j),O.removeEventListener(up,z)}}},[p.viewport,E,c,u,A]),x.useEffect(()=>{a&&!p.isClosePausedRef.current&&A(E)},[a,E,p.isClosePausedRef,A]),x.useEffect(()=>(D(),()=>U()),[D,U]);const _=x.useMemo(()=>g?dS(g):null,[g]);return p.viewport?l.jsxs(l.Fragment,{children:[_&&l.jsx(Wj,{__scopeToast:r,role:"status","aria-live":s==="foreground"?"assertive":"polite",children:_}),l.jsx(Hj,{scope:r,onClose:R,children:so.createPortal(l.jsx(yv.ItemSlot,{scope:r,children:l.jsx(Cj,{asChild:!0,onEscapeKeyDown:Se(i,()=>{p.isFocusedToastEscapeKeyDownRef.current||R(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.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,O=>{O.key==="Escape"&&(i==null||i(O.nativeEvent),O.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,R()))}),onPointerDown:Se(t.onPointerDown,O=>{O.button===0&&(b.current={x:O.clientX,y:O.clientY})}),onPointerMove:Se(t.onPointerMove,O=>{if(!b.current)return;const z=O.clientX-b.current.x,j=O.clientY-b.current.y,K=!!S.current,C=["left","right"].includes(p.swipeDirection),F=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,L=C?F(0,z):0,Q=C?0:F(0,j),te=O.pointerType==="touch"?10:2,V={x:L,y:Q},de={originalEvent:O,delta:V};K?(S.current=V,Ec(zj,f,de,{discrete:!1})):Ky(V,p.swipeDirection,te)?(S.current=V,Ec(Uj,d,de,{discrete:!1}),O.target.setPointerCapture(O.pointerId)):(Math.abs(z)>te||Math.abs(j)>te)&&(b.current=null)}),onPointerUp:Se(t.onPointerUp,O=>{const z=S.current,j=O.target;if(j.hasPointerCapture(O.pointerId)&&j.releasePointerCapture(O.pointerId),S.current=null,b.current=null,z){const K=O.currentTarget,C={originalEvent:O,delta:z};Ky(z,p.swipeDirection,p.swipeThreshold)?Ec(qj,h,C,{discrete:!0}):Ec(Vj,m,C,{discrete:!0}),K.addEventListener("click",F=>F.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),Wj=t=>{const{__scopeToast:e,children:r,...s}=t,n=Pd(ql,e),[a,o]=x.useState(!1),[i,c]=x.useState(!1);return Zj(()=>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]})})})},Qj="ToastTitle",aS=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return l.jsx(Re.div,{...s,ref:e})});aS.displayName=Qj;var Gj="ToastDescription",oS=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return l.jsx(Re.div,{...s,ref:e})});oS.displayName=Gj;var iS="ToastAction",lS=x.forwardRef((t,e)=>{const{altText:r,...s}=t;return r.trim()?l.jsx(uS,{altText:r,asChild:!0,children:l.jsx(xv,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${iS}\`. Expected non-empty \`string\`.`),null)});lS.displayName=iS;var cS="ToastClose",xv=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t,n=Bj(cS,r);return l.jsx(uS,{asChild:!0,children:l.jsx(Re.button,{type:"button",...s,ref:e,onClick:Se(t.onClick,n.onClose)})})});xv.displayName=cS;var uS=x.forwardRef((t,e)=>{const{__scopeToast:r,altText:s,...n}=t;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...n,ref:e})});function dS(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),Yj(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(...dS(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?Qb(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 Zj(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 Yj(t){return t.nodeType===t.ELEMENT_NODE}function Jj(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 If(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var Xj=eS,fS=rS,hS=sS,pS=aS,mS=oS,vS=lS,gS=xv;function yS(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=yS(t[e]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function xS(){for(var t,e,r=0,s="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=yS(t))&&(s&&(s+=" "),s+=e);return s}const Wy=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Qy=xS,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],f=a==null?void 0:a[u];if(d===null)return null;const m=Wy(d)||Wy(f);return n[u][m]}),i=r&&Object.entries(r).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:f,className:m,...h}=d;return Object.entries(h).every(w=>{let[p,g]=w;return Array.isArray(g)?g.includes({...a,...i}[p]):{...a,...i}[p]===g})?[...u,f,m]:u},[]);return Qy(t,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
|
|
48
|
+
*/var fi=x;function Kk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Wk=typeof Object.is=="function"?Object.is:Kk,Qk=fi.useState,Gk=fi.useEffect,Zk=fi.useLayoutEffect,Yk=fi.useDebugValue;function Jk(t,e){var r=e(),s=Qk({inst:{value:r,getSnapshot:e}}),n=s[0].inst,a=s[1];return Zk(function(){n.value=r,n.getSnapshot=e,Tf(n)&&a({inst:n})},[t,r,e]),Gk(function(){return Tf(n)&&a({inst:n}),t(function(){Tf(n)&&a({inst:n})})},[t]),Yk(r),r}function Tf(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Wk(t,r)}catch{return!0}}function Xk(t,e){return e()}var eN=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Xk:Jk;bb.useSyncExternalStore=fi.useSyncExternalStore!==void 0?fi.useSyncExternalStore:eN;wb.exports=bb;var tN=wb.exports;const rN=xm.useInsertionEffect,nN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sN=nN?x.useLayoutEffect:x.useEffect,aN=rN||sN,Sb=t=>{const e=x.useRef([t,(...r)=>e[0](...r)]).current;return aN(()=>{e[0]=t}),e[1]},oN="popstate",uv="pushState",dv="replaceState",iN="hashchange",Ny=[oN,uv,dv,iN],lN=t=>{for(const e of Ny)addEventListener(e,t);return()=>{for(const e of Ny)removeEventListener(e,t)}},_b=(t,e)=>tN.useSyncExternalStore(lN,t,e),cN=()=>location.search,uN=({ssrSearch:t=""}={})=>_b(cN,()=>t),jy=()=>location.pathname,dN=({ssrPath:t}={})=>_b(jy,t?()=>t:jy),fN=(t,{replace:e=!1,state:r=null}={})=>history[e?dv:uv](r,"",t),hN=(t={})=>[dN(t),fN],Ry=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Ry]>"u"){for(const t of[uv,dv]){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 pN=(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())?"~"+e:e.slice(t.length)||"/",Eb=(t="")=>t==="/"?"":t,mN=(t,e)=>t[0]==="~"?t.slice(1):Eb(e)+t,vN=(t="",e)=>pN(Ty(Eb(t)),Ty(e)),Ty=t=>{try{return decodeURI(t)}catch{return t}},Cb={hook:hN,searchHook:uN,parser:Bk,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:t=>t},Pb=x.createContext(Cb),zl=()=>x.useContext(Pb),kb={},Nb=x.createContext(kb),gN=()=>x.useContext(Nb),_d=t=>{const[e,r]=t.hook(t);return[vN(t.base,e),Sb((s,n)=>r(mN(s,t.base),n))]},yN=()=>_d(zl()),jb=(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((f,m)=>[f,c[m]])):o.groups;let d={...c};return u&&Object.assign(d,u),d})(),...s?[i]:[]]:[!1,null]},xN=({children:t,...e})=>{var d,f;const r=zl(),s=e.hook?Cb: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??((f=e.hook)==null?void 0:f.hrefs);let i=x.useRef({}),c=i.current,u=c;for(let m in s){const h=m==="base"?s[m]+(e[m]||""):e[m]||s[m];c===u&&h!==u[m]&&(i.current=u={...u}),u[m]=h,(h!==s[m]||h!==n[m])&&(n=u)}return x.createElement(Pb.Provider,{value:n,children:t})},Ay=({children:t,component:e},r)=>e?x.createElement(e,{params:r}):typeof t=="function"?t(r):t,wN=t=>{let e=x.useRef(kb);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??jb(n.parser,t,a,e),u=wN({...gN(),...i});if(!o)return null;const d=c?x.createElement(xN,{base:c},Ay(s,u)):Ay(s,u);return x.createElement(Nb.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:f,state:m,...h}=t,w=Sb(g=>{g.ctrlKey||g.metaKey||g.altKey||g.shiftKey||g.button!==0||(i==null||i(g),g.defaultPrevented||(g.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",{...h,onClick:w,href:p,className:d!=null&&d.call?d(s===o):d,children:u,ref:e})});const Rb=t=>Array.isArray(t)?t.flatMap(e=>Rb(e&&e.type===x.Fragment?e.props.children:e)):[t],bN=({children:t,location:e})=>{const r=zl(),[s]=_d(r);for(const n of Rb(t)){let a=0;if(x.isValidElement(n)&&(a=jb(r.parser,n.props.path,e||s,n.props.nest))[0])return x.cloneElement(n,{match:a})}return null};var Si=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 SN(t,e){return typeof t=="function"?t(e):t}function Gh(t){return typeof t=="number"&&t>=0&&t!==1/0}function Tb(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Xs(t,e){return typeof t=="function"?t(e):t}function Tr(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!==fv(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 fv(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ka)(t)}function Ka(t){return JSON.stringify(t,(e,r)=>Zh(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 Ab(t,e){if(t===e)return t;const r=Dy(t)&&Dy(e);if(r||Zh(t)&&Zh(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 f=r?d:a[d];(!r&&c.has(f)||r)&&t[f]===void 0&&e[f]===void 0?(i[f]=void 0,u++):(i[f]=Ab(t[f],e[f]),i[f]===t[f]&&t[f]!==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 Zh(t){if(!$y(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!$y(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function $y(t){return Object.prototype.toString.call(t)==="[object Object]"}function _N(t){return new Promise(e=>{setTimeout(e,t)})}function Yh(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?Ab(t,e):e}function EN(t,e,r=0){const s=[...t,e];return r&&s.length>r?s.slice(1):s}function CN(t,e,r=0){const s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var hv=Symbol();function Ob(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===hv?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Ib(t,e){return typeof t=="function"?t(...e):!!t}var ja,Ts,Ko,Y0,PN=(Y0=class extends Si{constructor(){super();be(this,ja);be(this,Ts);be(this,Ko);oe(this,Ko,e=>{if(!Ba&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){I(this,Ts)||this.setEventListener(I(this,Ko))}onUnsubscribe(){var e;this.hasListeners()||((e=I(this,Ts))==null||e.call(this),oe(this,Ts,void 0))}setEventListener(e){var r;oe(this,Ko,e),(r=I(this,Ts))==null||r.call(this),oe(this,Ts,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){I(this,ja)!==e&&(oe(this,ja,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof I(this,ja)=="boolean"?I(this,ja):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ja=new WeakMap,Ts=new WeakMap,Ko=new WeakMap,Y0),pv=new PN,Wo,As,Qo,J0,kN=(J0=class extends Si{constructor(){super();be(this,Wo,!0);be(this,As);be(this,Qo);oe(this,Qo,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(){I(this,As)||this.setEventListener(I(this,Qo))}onUnsubscribe(){var e;this.hasListeners()||((e=I(this,As))==null||e.call(this),oe(this,As,void 0))}setEventListener(e){var r;oe(this,Qo,e),(r=I(this,As))==null||r.call(this),oe(this,As,e(this.setOnline.bind(this)))}setOnline(e){I(this,Wo)!==e&&(oe(this,Wo,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return I(this,Wo)}},Wo=new WeakMap,As=new WeakMap,Qo=new WeakMap,J0),ju=new kN;function Jh(){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 NN(t){return Math.min(1e3*2**t,3e4)}function Db(t){return(t??"online")==="online"?ju.isOnline():!0}var $b=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Mb(t){let e=!1,r=0,s;const n=Jh(),a=()=>n.status!=="pending",o=p=>{var g;a()||(m(new $b(p)),(g=t.abort)==null||g.call(t))},i=()=>{e=!0},c=()=>{e=!1},u=()=>pv.isFocused()&&(t.networkMode==="always"||ju.isOnline())&&t.canRun(),d=()=>Db(t.networkMode)&&t.canRun(),f=p=>{a()||(s==null||s(),n.resolve(p))},m=p=>{a()||(s==null||s(),n.reject(p))},h=()=>new Promise(p=>{var g;s=y=>{(a()||u())&&p(y)},(g=t.onPause)==null||g.call(t)}).then(()=>{var p;s=void 0,a()||(p=t.onContinue)==null||p.call(t)}),w=()=>{if(a())return;let p;const g=r===0?t.initialPromise:void 0;try{p=g??t.fn()}catch(y){p=Promise.reject(y)}Promise.resolve(p).then(f).catch(y=>{var k;if(a())return;const v=t.retry??(Ba?0:3),b=t.retryDelay??NN,S=typeof b=="function"?b(r,y):b,E=v===!0||typeof v=="number"&&r<v||typeof v=="function"&&v(r,y);if(e||!E){m(y);return}r++,(k=t.onFail)==null||k.call(t,r,y),_N(S).then(()=>u()?void 0:h()).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():h().then(w),n)}}var jN=t=>setTimeout(t,0);function RN(){let t=[],e=0,r=i=>{i()},s=i=>{i()},n=jN;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 At=RN(),Ra,X0,Fb=(X0=class{constructor(){be(this,Ra)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gh(this.gcTime)&&oe(this,Ra,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ba?1/0:5*60*1e3))}clearGcTimeout(){I(this,Ra)&&(clearTimeout(I(this,Ra)),oe(this,Ra,void 0))}},Ra=new WeakMap,X0),Go,Zo,Rr,Ta,$t,Al,Aa,Jr,zn,ex,TN=(ex=class extends Fb{constructor(e){super();be(this,Jr);be(this,Go);be(this,Zo);be(this,Rr);be(this,Ta);be(this,$t);be(this,Al);be(this,Aa);oe(this,Aa,!1),oe(this,Al,e.defaultOptions),this.setOptions(e.options),this.observers=[],oe(this,Ta,e.client),oe(this,Rr,I(this,Ta).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,oe(this,Go,AN(this.options)),this.state=e.state??I(this,Go),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=I(this,$t))==null?void 0:e.promise}setOptions(e){this.options={...I(this,Al),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&I(this,Rr).remove(this)}setData(e,r){const s=Yh(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=I(this,$t))==null?void 0:s.promise;return(n=I(this,$t))==null||n.cancel(e),r?r.then(tr).catch(tr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(I(this,Go))}isActive(){return this.observers.some(e=>Tr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===hv||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:!Tb(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=I(this,$t))==null||r.continue()}onOnline(){var r;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=I(this,$t))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),I(this,Rr).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(I(this,$t)&&(I(this,Aa)?I(this,$t).cancel({revert:!0}):I(this,$t).cancelRetry()),this.scheduleGc()),I(this,Rr).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,f,m,h,w,p,g,y,v,b;if(this.state.fetchStatus!=="idle"&&((c=I(this,$t))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(I(this,$t))return I(this,$t).continueRetry(),I(this,$t).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:()=>(oe(this,Aa,!0),s.signal)})},a=()=>{const S=Ob(this.options,r),k=(()=>{const N={client:I(this,Ta),queryKey:this.queryKey,meta:this.meta};return n(N),N})();return oe(this,Aa,!1),this.options.persister?this.options.persister(S,k,this):S(k)},i=(()=>{const S={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:I(this,Ta),state:this.state,fetchFn:a};return n(S),S})();(u=this.options.behavior)==null||u.onFetch(i,this),oe(this,Zo,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:(f=i.fetchOptions)==null?void 0:f.meta}),oe(this,$t,Mb({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 I(this,$t).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(h=(m=I(this,Rr).config).onSuccess)==null||h.call(m,S,this),(p=(w=I(this,Rr).config).onSettled)==null||p.call(w,S,this.state.error,this),S}catch(S){if(S instanceof $b){if(S.silent)return I(this,$t).promise;if(S.revert){if(this.setState({...I(this,Zo),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=(g=I(this,Rr).config).onError)==null||y.call(g,S,this),(b=(v=I(this,Rr).config).onSettled)==null||b.call(v,this.state.data,S,this),S}finally{this.scheduleGc()}}},Go=new WeakMap,Zo=new WeakMap,Rr=new WeakMap,Ta=new WeakMap,$t=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,...Lb(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 oe(this,Zo,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),At.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),I(this,Rr).notify({query:this,type:"updated",action:e})})},ex);function Lb(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Db(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function AN(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,tx,ON=(tx=class extends Si{constructor(e={}){super();be(this,vn);this.config=e,oe(this,vn,new Map)}build(e,r,s){const n=r.queryKey,a=r.queryHash??fv(n,r);let o=this.get(a);return o||(o=new TN({client:e,queryKey:n,queryHash:a,options:e.defaultQueryOptions(r),state:s,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){I(this,vn).has(e.queryHash)||(I(this,vn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=I(this,vn).get(e.queryHash);r&&(e.destroy(),r===e&&I(this,vn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){At.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return I(this,vn).get(e)}getAll(){return[...I(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){At.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){At.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){At.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vn=new WeakMap,tx),gn,Jt,Oa,yn,bs,rx,IN=(rx=class extends Fb{constructor(e){super();be(this,yn);be(this,gn);be(this,Jt);be(this,Oa);this.mutationId=e.mutationId,oe(this,Jt,e.mutationCache),oe(this,gn,[]),this.state=e.state||Ub(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){I(this,gn).includes(e)||(I(this,gn).push(e),this.clearGcTimeout(),I(this,Jt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){oe(this,gn,I(this,gn).filter(r=>r!==e)),this.scheduleGc(),I(this,Jt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){I(this,gn).length||(this.state.status==="pending"?this.scheduleGc():I(this,Jt).remove(this))}continue(){var e;return((e=I(this,Oa))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,i,c,u,d,f,m,h,w,p,g,y,v,b,S,E,k,N,T;const r=()=>{Le(this,yn,bs).call(this,{type:"continue"})};oe(this,Oa,Mb({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(D,U)=>{Le(this,yn,bs).call(this,{type:"failed",failureCount:D,error:U})},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:()=>I(this,Jt).canRun(this)}));const s=this.state.status==="pending",n=!I(this,Oa).canStart();try{if(s)r();else{Le(this,yn,bs).call(this,{type:"pending",variables:e,isPaused:n}),await((o=(a=I(this,Jt).config).onMutate)==null?void 0:o.call(a,e,this));const U=await((c=(i=this.options).onMutate)==null?void 0:c.call(i,e));U!==this.state.context&&Le(this,yn,bs).call(this,{type:"pending",context:U,variables:e,isPaused:n})}const D=await I(this,Oa).start();return await((d=(u=I(this,Jt).config).onSuccess)==null?void 0:d.call(u,D,e,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,D,e,this.state.context)),await((w=(h=I(this,Jt).config).onSettled)==null?void 0:w.call(h,D,null,this.state.variables,this.state.context,this)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,D,null,e,this.state.context)),Le(this,yn,bs).call(this,{type:"success",data:D}),D}catch(D){try{throw await((v=(y=I(this,Jt).config).onError)==null?void 0:v.call(y,D,e,this.state.context,this)),await((S=(b=this.options).onError)==null?void 0:S.call(b,D,e,this.state.context)),await((k=(E=I(this,Jt).config).onSettled)==null?void 0:k.call(E,void 0,D,this.state.variables,this.state.context,this)),await((T=(N=this.options).onSettled)==null?void 0:T.call(N,void 0,D,e,this.state.context)),D}finally{Le(this,yn,bs).call(this,{type:"error",error:D})}}finally{I(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),At.batch(()=>{I(this,gn).forEach(s=>{s.onMutationUpdate(e)}),I(this,Jt).notify({mutation:this,type:"updated",action:e})})},rx);function Ub(){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,nx,DN=(nx=class extends Si{constructor(e={}){super();be(this,Kn);be(this,Xr);be(this,Ol);this.config=e,oe(this,Kn,new Set),oe(this,Xr,new Map),oe(this,Ol,0)}build(e,r,s){const n=new IN({mutationCache:this,mutationId:++nc(this,Ol)._,options:e.defaultMutationOptions(r),state:s});return this.add(n),n}add(e){I(this,Kn).add(e);const r=Sc(e);if(typeof r=="string"){const s=I(this,Xr).get(r);s?s.push(e):I(this,Xr).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(I(this,Kn).delete(e)){const r=Sc(e);if(typeof r=="string"){const s=I(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&&I(this,Xr).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Sc(e);if(typeof r=="string"){const s=I(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=I(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(){At.batch(()=>{I(this,Kn).forEach(e=>{this.notify({type:"removed",mutation:e})}),I(this,Kn).clear(),I(this,Xr).clear()})}getAll(){return Array.from(I(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){At.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return At.batch(()=>Promise.all(e.map(r=>r.continue().catch(tr))))}},Kn=new WeakMap,Xr=new WeakMap,Ol=new WeakMap,nx);function Sc(t){var e;return(e=t.options.scope)==null?void 0:e.id}function My(t){return{onFetch:(e,r)=>{var d,f,m,h,w;const s=e.options,n=(m=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,a=((h=e.state.data)==null?void 0:h.pages)||[],o=((w=e.state.data)==null?void 0:w.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const g=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?p=!0:e.signal.addEventListener("abort",()=>{p=!0}),e.signal)})},y=Ob(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 N=(()=>{const R={client:e.client,queryKey:e.queryKey,pageParam:S,direction:E?"backward":"forward",meta:e.options.meta};return g(R),R})(),T=await y(N),{maxPages:D}=e.options,U=E?CN:EN;return{pages:U(b.pages,T,D),pageParams:U(b.pageParams,S,D)}};if(n&&a.length){const b=n==="backward",S=b?$N:Fy,E={pages:a,pageParams:o},k=S(s,E);i=await v(E,k,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,g;return(g=(p=e.options).persister)==null?void 0:g.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 $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 wt,Os,Is,Yo,Jo,Ds,Xo,ei,sx,MN=(sx=class{constructor(t={}){be(this,wt);be(this,Os);be(this,Is);be(this,Yo);be(this,Jo);be(this,Ds);be(this,Xo);be(this,ei);oe(this,wt,t.queryCache||new ON),oe(this,Os,t.mutationCache||new DN),oe(this,Is,t.defaultOptions||{}),oe(this,Yo,new Map),oe(this,Jo,new Map),oe(this,Ds,0)}mount(){nc(this,Ds)._++,I(this,Ds)===1&&(oe(this,Xo,pv.subscribe(async t=>{t&&(await this.resumePausedMutations(),I(this,wt).onFocus())})),oe(this,ei,ju.subscribe(async t=>{t&&(await this.resumePausedMutations(),I(this,wt).onOnline())})))}unmount(){var t,e;nc(this,Ds)._--,I(this,Ds)===0&&((t=I(this,Xo))==null||t.call(this),oe(this,Xo,void 0),(e=I(this,ei))==null||e.call(this),oe(this,ei,void 0))}isFetching(t){return I(this,wt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return I(this,Os).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=I(this,wt).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=I(this,wt).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 I(this,wt).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=I(this,wt).get(s.queryHash),a=n==null?void 0:n.state.data,o=SN(e,a);if(o!==void 0)return I(this,wt).build(this,s).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return At.batch(()=>I(this,wt).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=I(this,wt).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=I(this,wt);At.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=I(this,wt);return At.batch(()=>(r.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},s=At.batch(()=>I(this,wt).findAll(t).map(n=>n.cancel(r)));return Promise.all(s).then(tr).catch(tr)}invalidateQueries(t,e={}){return At.batch(()=>(I(this,wt).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=At.batch(()=>I(this,wt).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=I(this,wt).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=My(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(tr).catch(tr)}ensureInfiniteQueryData(t){return t.behavior=My(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return ju.isOnline()?I(this,Os).resumePausedMutations():Promise.resolve()}getQueryCache(){return I(this,wt)}getMutationCache(){return I(this,Os)}getDefaultOptions(){return I(this,Is)}setDefaultOptions(t){oe(this,Is,t)}setQueryDefaults(t,e){I(this,Yo).set(Ka(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...I(this,Yo).values()],r={};return e.forEach(s=>{kl(t,s.queryKey)&&Object.assign(r,s.defaultOptions)}),r}setMutationDefaults(t,e){I(this,Jo).set(Ka(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...I(this,Jo).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={...I(this,Is).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=fv(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===hv&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...I(this,Is).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){I(this,wt).clear(),I(this,Os).clear()}},wt=new WeakMap,Os=new WeakMap,Is=new WeakMap,Yo=new WeakMap,Jo=new WeakMap,Ds=new WeakMap,Xo=new WeakMap,ei=new WeakMap,sx),ir,We,Il,Xt,Ia,ti,Wn,$s,Dl,ri,ni,Da,$a,Ms,si,et,Ki,Xh,ep,tp,rp,np,sp,ap,zb,ax,FN=(ax=class extends Si{constructor(e,r){super();be(this,et);be(this,ir);be(this,We);be(this,Il);be(this,Xt);be(this,Ia);be(this,ti);be(this,Wn);be(this,$s);be(this,Dl);be(this,ri);be(this,ni);be(this,Da);be(this,$a);be(this,Ms);be(this,si,new Set);this.options=r,oe(this,ir,e),oe(this,$s,null),oe(this,Wn,Jh()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(I(this,We).addObserver(this),Ly(I(this,We),this.options)?Le(this,et,Ki).call(this):this.updateResult(),Le(this,et,rp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return op(I(this,We),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return op(I(this,We),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,et,np).call(this),Le(this,et,sp).call(this),I(this,We).removeObserver(this)}setOptions(e){const r=this.options,s=I(this,We);if(this.options=I(this,ir).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tr(this.options.enabled,I(this,We))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,et,ap).call(this),I(this,We).setOptions(this.options),r._defaulted&&!Nu(this.options,r)&&I(this,ir).getQueryCache().notify({type:"observerOptionsUpdated",query:I(this,We),observer:this});const n=this.hasListeners();n&&Uy(I(this,We),s,this.options,r)&&Le(this,et,Ki).call(this),this.updateResult(),n&&(I(this,We)!==s||Tr(this.options.enabled,I(this,We))!==Tr(r.enabled,I(this,We))||Xs(this.options.staleTime,I(this,We))!==Xs(r.staleTime,I(this,We)))&&Le(this,et,Xh).call(this);const a=Le(this,et,ep).call(this);n&&(I(this,We)!==s||Tr(this.options.enabled,I(this,We))!==Tr(r.enabled,I(this,We))||a!==I(this,Ms))&&Le(this,et,tp).call(this,a)}getOptimisticResult(e){const r=I(this,ir).getQueryCache().build(I(this,ir),e),s=this.createResult(r,e);return UN(this,s)&&(oe(this,Xt,s),oe(this,ti,this.options),oe(this,Ia,I(this,We).state)),s}getCurrentResult(){return I(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&&I(this,Wn).status==="pending"&&I(this,Wn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,n))})}trackProp(e){I(this,si).add(e)}getCurrentQuery(){return I(this,We)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=I(this,ir).defaultQueryOptions(e),s=I(this,ir).getQueryCache().build(I(this,ir),r);return s.fetch().then(()=>this.createResult(s,r))}fetch(e){return Le(this,et,Ki).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),I(this,Xt)))}createResult(e,r){var D;const s=I(this,We),n=this.options,a=I(this,Xt),o=I(this,Ia),i=I(this,ti),u=e!==s?e.state:I(this,Il),{state:d}=e;let f={...d},m=!1,h;if(r._optimisticResults){const U=this.hasListeners(),R=!U&&Ly(e,r),A=U&&Uy(e,s,r,n);(R||A)&&(f={...f,...Lb(d.data,e.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:w,errorUpdatedAt:p,status:g}=f;h=f.data;let y=!1;if(r.placeholderData!==void 0&&h===void 0&&g==="pending"){let U;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(U=a.data,y=!0):U=typeof r.placeholderData=="function"?r.placeholderData((D=I(this,ni))==null?void 0:D.state.data,I(this,ni)):r.placeholderData,U!==void 0&&(g="success",h=Yh(a==null?void 0:a.data,U,r),m=!0)}if(r.select&&h!==void 0&&!y)if(a&&h===(o==null?void 0:o.data)&&r.select===I(this,Dl))h=I(this,ri);else try{oe(this,Dl,r.select),h=r.select(h),h=Yh(a==null?void 0:a.data,h,r),oe(this,ri,h),oe(this,$s,null)}catch(U){oe(this,$s,U)}I(this,$s)&&(w=I(this,$s),h=I(this,ri),p=Date.now(),g="error");const v=f.fetchStatus==="fetching",b=g==="pending",S=g==="error",E=b&&v,k=h!==void 0,T={status:g,fetchStatus:f.fetchStatus,isPending:b,isSuccess:g==="success",isError:S,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:f.dataUpdatedAt,error:w,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!b,isLoadingError:S&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:S&&k,isStale:mv(e,r),refetch:this.refetch,promise:I(this,Wn),isEnabled:Tr(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const U=_=>{T.status==="error"?_.reject(T.error):T.data!==void 0&&_.resolve(T.data)},R=()=>{const _=oe(this,Wn,T.promise=Jh());U(_)},A=I(this,Wn);switch(A.status){case"pending":e.queryHash===s.queryHash&&U(A);break;case"fulfilled":(T.status==="error"||T.data!==A.value)&&R();break;case"rejected":(T.status!=="error"||T.error!==A.reason)&&R();break}}return T}updateResult(){const e=I(this,Xt),r=this.createResult(I(this,We),this.options);if(oe(this,Ia,I(this,We).state),oe(this,ti,this.options),I(this,Ia).data!==void 0&&oe(this,ni,I(this,We)),Nu(r,e))return;oe(this,Xt,r);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!I(this,si).size)return!0;const o=new Set(a??I(this,si));return this.options.throwOnError&&o.add("error"),Object.keys(I(this,Xt)).some(i=>{const c=i;return I(this,Xt)[c]!==e[c]&&o.has(c)})};Le(this,et,zb).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,et,rp).call(this)}},ir=new WeakMap,We=new WeakMap,Il=new WeakMap,Xt=new WeakMap,Ia=new WeakMap,ti=new WeakMap,Wn=new WeakMap,$s=new WeakMap,Dl=new WeakMap,ri=new WeakMap,ni=new WeakMap,Da=new WeakMap,$a=new WeakMap,Ms=new WeakMap,si=new WeakMap,et=new WeakSet,Ki=function(e){Le(this,et,ap).call(this);let r=I(this,We).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(tr)),r},Xh=function(){Le(this,et,np).call(this);const e=Xs(this.options.staleTime,I(this,We));if(Ba||I(this,Xt).isStale||!Gh(e))return;const s=Tb(I(this,Xt).dataUpdatedAt,e)+1;oe(this,Da,setTimeout(()=>{I(this,Xt).isStale||this.updateResult()},s))},ep=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(I(this,We)):this.options.refetchInterval)??!1},tp=function(e){Le(this,et,sp).call(this),oe(this,Ms,e),!(Ba||Tr(this.options.enabled,I(this,We))===!1||!Gh(I(this,Ms))||I(this,Ms)===0)&&oe(this,$a,setInterval(()=>{(this.options.refetchIntervalInBackground||pv.isFocused())&&Le(this,et,Ki).call(this)},I(this,Ms)))},rp=function(){Le(this,et,Xh).call(this),Le(this,et,tp).call(this,Le(this,et,ep).call(this))},np=function(){I(this,Da)&&(clearTimeout(I(this,Da)),oe(this,Da,void 0))},sp=function(){I(this,$a)&&(clearInterval(I(this,$a)),oe(this,$a,void 0))},ap=function(){const e=I(this,ir).getQueryCache().build(I(this,ir),this.options);if(e===I(this,We))return;const r=I(this,We);oe(this,We,e),oe(this,Il,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},zb=function(e){At.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(I(this,Xt))}),I(this,ir).getQueryCache().notify({query:I(this,We),type:"observerResultsUpdated"})})},ax);function LN(t,e){return Tr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Ly(t,e){return LN(t,e)||t.state.data!==void 0&&op(t,e,e.refetchOnMount)}function op(t,e,r){if(Tr(e.enabled,t)!==!1&&Xs(e.staleTime,t)!=="static"){const s=typeof r=="function"?r(t):r;return s==="always"||s!==!1&&mv(t,e)}return!1}function Uy(t,e,r,s){return(t!==e||Tr(s.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&mv(t,r)}function mv(t,e){return Tr(e.enabled,t)!==!1&&t.isStaleByTime(Xs(e.staleTime,t))}function UN(t,e){return!Nu(t.getCurrentResult(),e)}var Fs,Ls,lr,Qn,ts,Kc,ip,ox,zN=(ox=class extends Si{constructor(r,s){super();be(this,ts);be(this,Fs);be(this,Ls);be(this,lr);be(this,Qn);oe(this,Fs,r),this.setOptions(s),this.bindMethods(),Le(this,ts,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=I(this,Fs).defaultMutationOptions(r),Nu(this.options,s)||I(this,Fs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:I(this,lr),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Ka(s.mutationKey)!==Ka(this.options.mutationKey)?this.reset():((n=I(this,lr))==null?void 0:n.state.status)==="pending"&&I(this,lr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=I(this,lr))==null||r.removeObserver(this)}onMutationUpdate(r){Le(this,ts,Kc).call(this),Le(this,ts,ip).call(this,r)}getCurrentResult(){return I(this,Ls)}reset(){var r;(r=I(this,lr))==null||r.removeObserver(this),oe(this,lr,void 0),Le(this,ts,Kc).call(this),Le(this,ts,ip).call(this)}mutate(r,s){var n;return oe(this,Qn,s),(n=I(this,lr))==null||n.removeObserver(this),oe(this,lr,I(this,Fs).getMutationCache().build(I(this,Fs),this.options)),I(this,lr).addObserver(this),I(this,lr).execute(r)}},Fs=new WeakMap,Ls=new WeakMap,lr=new WeakMap,Qn=new WeakMap,ts=new WeakSet,Kc=function(){var s;const r=((s=I(this,lr))==null?void 0:s.state)??Ub();oe(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})},ip=function(r){At.batch(()=>{var s,n,a,o,i,c,u,d;if(I(this,Qn)&&this.hasListeners()){const f=I(this,Ls).variables,m=I(this,Ls).context;(r==null?void 0:r.type)==="success"?((n=(s=I(this,Qn)).onSuccess)==null||n.call(s,r.data,f,m),(o=(a=I(this,Qn)).onSettled)==null||o.call(a,r.data,null,f,m)):(r==null?void 0:r.type)==="error"&&((c=(i=I(this,Qn)).onError)==null||c.call(i,r.error,f,m),(d=(u=I(this,Qn)).onSettled)==null||d.call(u,void 0,r.error,f,m))}this.listeners.forEach(f=>{f(I(this,Ls))})})},ox),Vb=x.createContext(void 0),vr=t=>{const e=x.useContext(Vb);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},VN=({client:t,children:e})=>(x.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),l.jsx(Vb.Provider,{value:t,children:e})),qb=x.createContext(!1),qN=()=>x.useContext(qb);qb.Provider;function HN(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var BN=x.createContext(HN()),KN=()=>x.useContext(BN),WN=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},QN=t=>{x.useEffect(()=>{t.clearReset()},[t])},GN=({result:t,errorResetBoundary:e,throwOnError:r,query:s,suspense:n})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(n&&t.data===void 0||Ib(r,[t.error,s])),ZN=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))}},YN=(t,e)=>t.isLoading&&t.isFetching&&!e,JN=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,zy=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function XN(t,e,r){var f,m,h,w,p;const s=qN(),n=KN(),a=vr(),o=a.defaultQueryOptions(t);(m=(f=a.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,o),o._optimisticResults=s?"isRestoring":"optimistic",ZN(o),WN(o,n),QN(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(g=>{const y=d?c.subscribe(At.batchCalls(g)):tr;return c.updateResult(),y},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),x.useEffect(()=>{c.setOptions(o)},[o,c]),JN(o,u))throw zy(o,c,n);if(GN({result:u,errorResetBoundary:n,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((w=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||w.call(h,o,u),o.experimental_prefetchInRender&&!Ba&&YN(u,s)){const g=i?zy(o,c,n):(p=a.getQueryCache().get(o.queryHash))==null?void 0:p.promise;g==null||g.catch(tr).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function Ir(t,e){return XN(t,FN)}function Ot(t,e){const r=vr(),[s]=x.useState(()=>new zN(r,t));x.useEffect(()=>{s.setOptions(t)},[s,t]);const n=x.useSyncExternalStore(x.useCallback(o=>s.subscribe(At.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=x.useCallback((o,i)=>{s.mutate(o,i).catch(tr)},[s]);if(n.error&&Ib(s.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}const ej="x-agent-deck-client",tj="dashboard",Hb={[ej]:tj};async function Bb(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 Ue(t,e,r){const s=await fetch(e,{method:t,headers:{...Hb,...r?{"Content-Type":"application/json"}:{}},body:r?JSON.stringify(r):void 0});return await Bb(s),s}const rj=({on401:t})=>async({queryKey:e})=>{const r=e.join("/"),s=await fetch(r,{headers:Hb});return await Bb(s),await s.json()},nj=new MN({defaultOptions:{queries:{queryFn:rj({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),sj=1,aj=1e6;let Af=0;function oj(){return Af=(Af+1)%Number.MAX_SAFE_INTEGER,Af.toString()}const Of=new Map,Vy=t=>{if(Of.has(t))return;const e=setTimeout(()=>{Of.delete(t),il({type:"REMOVE_TOAST",toastId:t})},aj);Of.set(t,e)},ij=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,sj)};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 il(t){Qc=ij(Qc,t),Wc.forEach(e=>{e(Qc)})}function lj({...t}){const e=oj(),r=n=>il({type:"UPDATE_TOAST",toast:{...n,id:e}}),s=()=>il({type:"DISMISS_TOAST",toastId:e});return il({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:n=>{n||s()}}}),{id:e,dismiss:s,update:r}}function gr(){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:lj,dismiss:r=>il({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 Kb(...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 nt(...t){return x.useCallback(Kb(...t),t)}function cj(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=f=>{var y;const{scope:m,children:h,...w}=f,p=((y=m==null?void 0:m[t])==null?void 0:y[c])||i,g=x.useMemo(()=>w,Object.values(w));return l.jsx(p.Provider,{value:g,children:h})};u.displayName=a+"Provider";function d(f,m){var p;const h=((p=m==null?void 0:m[t])==null?void 0:p[c])||i,w=x.useContext(h);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${f}\` 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,uj(n,...e)]}function uj(...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 f=c(a)[`__scope${u}`];return{...i,...f}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function hi(t){const e=fj(t),r=x.forwardRef((s,n)=>{const{children:a,...o}=s,i=x.Children.toArray(a),c=i.find(pj);if(c){const u=c.props.children,d=i.map(f=>f===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);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 dj=hi("Slot");function fj(t){const e=x.forwardRef((r,s)=>{const{children:n,...a}=r;if(x.isValidElement(n)){const o=vj(n),i=mj(a,n.props);return n.type!==x.Fragment&&(i.ref=s?Kb(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 Wb=Symbol("radix.slottable");function hj(t){const e=({children:r})=>l.jsx(l.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Wb,e}function pj(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Wb}function mj(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 vj(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 vv(t){const e=t+"CollectionProvider",[r,s]=ds(e),[n,a]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:y}=p,v=mn.useRef(null),b=mn.useRef(new Map).current;return l.jsx(n,{scope:g,itemMap:b,collectionRef:v,children:y})};o.displayName=e;const i=t+"CollectionSlot",c=hi(i),u=mn.forwardRef((p,g)=>{const{scope:y,children:v}=p,b=a(i,y),S=nt(g,b.collectionRef);return l.jsx(c,{ref:S,children:v})});u.displayName=i;const d=t+"CollectionItemSlot",f="data-radix-collection-item",m=hi(d),h=mn.forwardRef((p,g)=>{const{scope:y,children:v,...b}=p,S=mn.useRef(null),E=nt(g,S),k=a(d,y);return mn.useEffect(()=>(k.itemMap.set(S,{ref:S,...b}),()=>void k.itemMap.delete(S))),l.jsx(m,{[f]:"",ref:E,children:v})});h.displayName=d;function w(p){const g=a(t+"CollectionConsumer",p);return mn.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const b=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((k,N)=>b.indexOf(k.ref.current)-b.indexOf(N.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:u,ItemSlot:h},w,s]}var gj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Re=gj.reduce((t,e)=>{const r=hi(`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 Qb(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 yj(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 xj="DismissableLayer",lp="dismissableLayer.update",wj="dismissableLayer.pointerDownOutside",bj="dismissableLayer.focusOutside",Hy,Gb=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(Gb),[d,f]=x.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=x.useState({}),w=nt(e,N=>f(N)),p=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=p.indexOf(g),v=d?p.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,E=_j(N=>{const T=N.target,D=[...u.branches].some(U=>U.contains(T));!S||D||(n==null||n(N),o==null||o(N),N.defaultPrevented||i==null||i())},m),k=Ej(N=>{const T=N.target;[...u.branches].some(U=>U.contains(T))||(a==null||a(N),o==null||o(N),N.defaultPrevented||i==null||i())},m);return yj(N=>{v===u.layers.size-1&&(s==null||s(N),!N.defaultPrevented&&i&&(N.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 N=()=>h({});return document.addEventListener(lp,N),()=>document.removeEventListener(lp,N)},[]),l.jsx(Re.div,{...c,ref:w,style:{pointerEvents:b?S?"auto":"none":void 0,...t.style},onFocusCapture:Se(t.onFocusCapture,k.onFocusCapture),onBlurCapture:Se(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Se(t.onPointerDownCapture,E.onPointerDownCapture)})});Vl.displayName=xj;var Sj="DismissableLayerBranch",Zb=x.forwardRef((t,e)=>{const r=x.useContext(Gb),s=x.useRef(null),n=nt(e,s);return x.useEffect(()=>{const a=s.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),l.jsx(Re.div,{...t,ref:n})});Zb.displayName=Sj;function _j(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(){Yb(wj,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 Ej(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&&Yb(bj,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(lp);document.dispatchEvent(t)}function Yb(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?Qb(n,a):n.dispatchEvent(a)}var Cj=Vl,Pj=Zb,Bt=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},kj="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?Hk.createPortal(l.jsx(Re.div,{...s,ref:e}),o):null});Ed.displayName=kj;function Nj(t,e){return x.useReducer((r,s)=>e[r][s]??r,t)}var da=t=>{const{present:e,children:r}=t,s=jj(e),n=typeof r=="function"?r({present:s.isPresent}):x.Children.only(r),a=nt(s.ref,Rj(n));return typeof r=="function"||s.isPresent?x.cloneElement(n,{ref:a}):null};da.displayName="Presence";function jj(t){const[e,r]=x.useState(),s=x.useRef(null),n=x.useRef(t),a=x.useRef("none"),o=t?"mounted":"unmounted",[i,c]=Nj(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,h=_c(u);t?c("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==h?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,c]),Bt(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=h=>{const p=_c(s.current).includes(CSS.escape(h.animationName));if(h.target===e&&p&&(c("ANIMATION_END"),!n.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},m=h=>{h.target===e&&(a.current=_c(s.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}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 Rj(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 Tj=xm[" useInsertionEffect ".trim().toString()]||Bt;function Wa({prop:t,defaultProp:e,onChange:r=()=>{},caller:s}){const[n,a,o]=Aj({defaultProp:e,onChange:r}),i=t!==void 0,c=i?t:n;{const d=x.useRef(t!==void 0);x.useEffect(()=>{const f=d.current;f!==i&&console.warn(`${s} is changing from ${f?"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 f;if(i){const m=Oj(d)?d(t):d;m!==t&&((f=o.current)==null||f.call(o,m))}else a(d)},[i,t,a,o]);return[c,u]}function Aj({defaultProp:t,onChange:e}){const[r,s]=x.useState(t),n=x.useRef(r),a=x.useRef(e);return Tj(()=>{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 Oj(t){return typeof t=="function"}var Jb=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"}),Ij="VisuallyHidden",Cd=x.forwardRef((t,e)=>l.jsx(Re.span,{...t,ref:e,style:{...Jb,...t.style}}));Cd.displayName=Ij;var Dj=Cd,gv="ToastProvider",[yv,$j,Mj]=vv("Toast"),[Xb,cF]=ds("Toast",[Mj]),[Fj,Pd]=Xb(gv),e1=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),f=x.useRef(!1),m=x.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${gv}\`. Expected non-empty \`string\`.`),l.jsx(yv.Provider,{scope:e,children:l.jsx(Fj,{scope:e,label:r,duration:s,swipeDirection:n,swipeThreshold:a,toastCount:u,viewport:i,onViewportChange:c,onToastAdd:x.useCallback(()=>d(h=>h+1),[]),onToastRemove:x.useCallback(()=>d(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:o})})};e1.displayName=gv;var t1="ToastViewport",Lj=["F8"],cp="toast.viewportPause",up="toast.viewportResume",r1=x.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:s=Lj,label:n="Notifications ({hotkey})",...a}=t,o=Pd(t1,r),i=$j(r),c=x.useRef(null),u=x.useRef(null),d=x.useRef(null),f=x.useRef(null),m=nt(e,f,o.onViewportChange),h=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),w=o.toastCount>0;x.useEffect(()=>{const g=y=>{var b;s.length!==0&&s.every(S=>y[S]||y.code===S)&&((b=f.current)==null||b.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s]),x.useEffect(()=>{const g=c.current,y=f.current;if(w&&g&&y){const v=()=>{if(!o.isClosePausedRef.current){const k=new CustomEvent(cp);y.dispatchEvent(k),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const k=new CustomEvent(up);y.dispatchEvent(k),o.isClosePausedRef.current=!1}},S=k=>{!g.contains(k.relatedTarget)&&b()},E=()=>{g.contains(document.activeElement)||b()};return g.addEventListener("focusin",v),g.addEventListener("focusout",S),g.addEventListener("pointermove",v),g.addEventListener("pointerleave",E),window.addEventListener("blur",v),window.addEventListener("focus",b),()=>{g.removeEventListener("focusin",v),g.removeEventListener("focusout",S),g.removeEventListener("pointermove",v),g.removeEventListener("pointerleave",E),window.removeEventListener("blur",v),window.removeEventListener("focus",b)}}},[w,o.isClosePausedRef]);const p=x.useCallback(({tabbingDirection:g})=>{const v=i().map(b=>{const S=b.ref.current,E=[S,...Jj(S)];return g==="forwards"?E:E.reverse()});return(g==="forwards"?v.reverse():v).flat()},[i]);return x.useEffect(()=>{const g=f.current;if(g){const y=v=>{var E,k,N;const b=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!b){const T=document.activeElement,D=v.shiftKey;if(v.target===g&&D){(E=u.current)==null||E.focus();return}const A=p({tabbingDirection:D?"backwards":"forwards"}),_=A.findIndex(O=>O===T);If(A.slice(_+1))?v.preventDefault():D?(k=u.current)==null||k.focus():(N=d.current)==null||N.focus()}};return g.addEventListener("keydown",y),()=>g.removeEventListener("keydown",y)}},[i,p]),l.jsxs(Pj,{ref:c,role:"region","aria-label":n.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:w?void 0:"none"},children:[w&&l.jsx(dp,{ref:u,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"forwards"});If(g)}}),l.jsx(yv.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...a,ref:m})}),w&&l.jsx(dp,{ref:d,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"backwards"});If(g)}})]})});r1.displayName=t1;var n1="ToastFocusProxy",dp=x.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:s,...n}=t,a=Pd(n1,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()}})});dp.displayName=n1;var ql="Toast",Uj="toast.swipeStart",zj="toast.swipeMove",Vj="toast.swipeCancel",qj="toast.swipeEnd",s1=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(Kj,{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:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel: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:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});s1.displayName=ql;var[Hj,Bj]=Xb(ql,{onClose(){}}),Kj=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:f,onSwipeCancel:m,onSwipeEnd:h,...w}=t,p=Pd(ql,r),[g,y]=x.useState(null),v=nt(e,O=>y(O)),b=x.useRef(null),S=x.useRef(null),E=n||p.duration,k=x.useRef(0),N=x.useRef(E),T=x.useRef(0),{onToastAdd:D,onToastRemove:U}=p,R=Ur(()=>{var z;(g==null?void 0:g.contains(document.activeElement))&&((z=p.viewport)==null||z.focus()),o()}),A=x.useCallback(O=>{!O||O===1/0||(window.clearTimeout(T.current),k.current=new Date().getTime(),T.current=window.setTimeout(R,O))},[R]);x.useEffect(()=>{const O=p.viewport;if(O){const z=()=>{A(N.current),u==null||u()},j=()=>{const K=new Date().getTime()-k.current;N.current=N.current-K,window.clearTimeout(T.current),c==null||c()};return O.addEventListener(cp,j),O.addEventListener(up,z),()=>{O.removeEventListener(cp,j),O.removeEventListener(up,z)}}},[p.viewport,E,c,u,A]),x.useEffect(()=>{a&&!p.isClosePausedRef.current&&A(E)},[a,E,p.isClosePausedRef,A]),x.useEffect(()=>(D(),()=>U()),[D,U]);const _=x.useMemo(()=>g?d1(g):null,[g]);return p.viewport?l.jsxs(l.Fragment,{children:[_&&l.jsx(Wj,{__scopeToast:r,role:"status","aria-live":s==="foreground"?"assertive":"polite",children:_}),l.jsx(Hj,{scope:r,onClose:R,children:so.createPortal(l.jsx(yv.ItemSlot,{scope:r,children:l.jsx(Cj,{asChild:!0,onEscapeKeyDown:Se(i,()=>{p.isFocusedToastEscapeKeyDownRef.current||R(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.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,O=>{O.key==="Escape"&&(i==null||i(O.nativeEvent),O.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,R()))}),onPointerDown:Se(t.onPointerDown,O=>{O.button===0&&(b.current={x:O.clientX,y:O.clientY})}),onPointerMove:Se(t.onPointerMove,O=>{if(!b.current)return;const z=O.clientX-b.current.x,j=O.clientY-b.current.y,K=!!S.current,C=["left","right"].includes(p.swipeDirection),F=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,L=C?F(0,z):0,Q=C?0:F(0,j),te=O.pointerType==="touch"?10:2,V={x:L,y:Q},de={originalEvent:O,delta:V};K?(S.current=V,Ec(zj,f,de,{discrete:!1})):Ky(V,p.swipeDirection,te)?(S.current=V,Ec(Uj,d,de,{discrete:!1}),O.target.setPointerCapture(O.pointerId)):(Math.abs(z)>te||Math.abs(j)>te)&&(b.current=null)}),onPointerUp:Se(t.onPointerUp,O=>{const z=S.current,j=O.target;if(j.hasPointerCapture(O.pointerId)&&j.releasePointerCapture(O.pointerId),S.current=null,b.current=null,z){const K=O.currentTarget,C={originalEvent:O,delta:z};Ky(z,p.swipeDirection,p.swipeThreshold)?Ec(qj,h,C,{discrete:!0}):Ec(Vj,m,C,{discrete:!0}),K.addEventListener("click",F=>F.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),Wj=t=>{const{__scopeToast:e,children:r,...s}=t,n=Pd(ql,e),[a,o]=x.useState(!1),[i,c]=x.useState(!1);return Zj(()=>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]})})})},Qj="ToastTitle",a1=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return l.jsx(Re.div,{...s,ref:e})});a1.displayName=Qj;var Gj="ToastDescription",o1=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return l.jsx(Re.div,{...s,ref:e})});o1.displayName=Gj;var i1="ToastAction",l1=x.forwardRef((t,e)=>{const{altText:r,...s}=t;return r.trim()?l.jsx(u1,{altText:r,asChild:!0,children:l.jsx(xv,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${i1}\`. Expected non-empty \`string\`.`),null)});l1.displayName=i1;var c1="ToastClose",xv=x.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t,n=Bj(c1,r);return l.jsx(u1,{asChild:!0,children:l.jsx(Re.button,{type:"button",...s,ref:e,onClick:Se(t.onClick,n.onClose)})})});xv.displayName=c1;var u1=x.forwardRef((t,e)=>{const{__scopeToast:r,altText:s,...n}=t;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...n,ref:e})});function d1(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),Yj(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(...d1(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?Qb(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 Zj(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 Yj(t){return t.nodeType===t.ELEMENT_NODE}function Jj(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 If(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var Xj=e1,f1=r1,h1=s1,p1=a1,m1=o1,v1=l1,g1=xv;function y1(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=y1(t[e]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function x1(){for(var t,e,r=0,s="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=y1(t))&&(s&&(s+=" "),s+=e);return s}const Wy=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Qy=x1,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],f=a==null?void 0:a[u];if(d===null)return null;const m=Wy(d)||Wy(f);return n[u][m]}),i=r&&Object.entries(r).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:f,className:m,...h}=d;return Object.entries(h).every(w=>{let[p,g]=w;return Array.isArray(g)?g.includes({...a,...i}[p]):{...a,...i}[p]===g})?[...u,f,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 e2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),
|
|
53
|
+
*/const e2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),w1=(...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.
|
|
@@ -60,179 +60,184 @@ Error generating stack: `+a.message+`
|
|
|
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 r2=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,...t2,width:e,height:e,stroke:t,strokeWidth:s?Number(r)*24/Number(e):r,className:
|
|
63
|
+
*/const r2=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,...t2,width:e,height:e,stroke:t,strokeWidth:s?Number(r)*24/Number(e):r,className:w1("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
|
|
68
|
+
*/const tt=(t,e)=>{const r=x.forwardRef(({className:s,...n},a)=>x.createElement(r2,{ref:a,iconNode:e,className:w1(`lucide-${e2(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 n2=
|
|
73
|
+
*/const n2=tt("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 b1=tt("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 wv=
|
|
83
|
+
*/const wv=tt("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 s2=
|
|
88
|
+
*/const s2=tt("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 Df=
|
|
93
|
+
*/const Df=tt("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 S1=tt("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 bv=
|
|
103
|
+
*/const bv=tt("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 a2=
|
|
108
|
+
*/const a2=tt("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 _1=tt("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 fp=
|
|
118
|
+
*/const fp=tt("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 Gy=
|
|
123
|
+
*/const Gy=tt("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 o2=
|
|
128
|
+
*/const o2=tt("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"}]]);/**
|
|
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 Zy=
|
|
133
|
+
*/const Zy=tt("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"}]]);/**
|
|
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 ho=
|
|
138
|
+
*/const ho=tt("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"}]]);/**
|
|
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 i2=
|
|
143
|
+
*/const i2=tt("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
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 hp=
|
|
148
|
+
*/const hp=tt("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"}]]);/**
|
|
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 Cc=
|
|
153
|
+
*/const Cc=tt("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"}]]);/**
|
|
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 pp=
|
|
158
|
+
*/const pp=tt("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"}]]);/**
|
|
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 l2=tt("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"}]]);/**
|
|
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 Yy=tt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 c2=tt("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 Vs=tt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
179
179
|
* @license lucide-react v0.453.0 - ISC
|
|
180
180
|
*
|
|
181
181
|
* This source code is licensed under the ISC license.
|
|
182
182
|
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
-
*/const
|
|
183
|
+
*/const E1=tt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
184
184
|
* @license lucide-react v0.453.0 - ISC
|
|
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 Ru=tt("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"}]]);/**
|
|
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 u2=tt("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 Nd=tt("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"}]]);/**
|
|
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 wn=tt("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
204
204
|
* @license lucide-react v0.453.0 - ISC
|
|
205
205
|
*
|
|
206
206
|
* This source code is licensed under the ISC license.
|
|
207
207
|
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
-
*/const
|
|
208
|
+
*/const d2=tt("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"}]]);/**
|
|
209
209
|
* @license lucide-react v0.453.0 - ISC
|
|
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 Au=rt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Sv="-",d2=t=>{const e=h2(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:o=>{const i=o.split(Sv);return i[0]===""&&i.length!==1&&i.shift(),CS(i,e)||f2(o)},getConflictingClassGroupIds:(o,i)=>{const c=r[o]||[];return i&&s[o]?[...c,...s[o]]:c}}},CS=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],s=e.nextPart.get(r),n=s?CS(t.slice(1),s):void 0;if(n)return n;if(e.validators.length===0)return;const a=t.join(Sv);return(o=e.validators.find(({validator:i})=>i(a)))==null?void 0:o.classGroupId},Jy=/^\[(.+)\]$/,f2=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}},h2=t=>{const{theme:e,prefix:r}=t,s={nextPart:new Map,validators:[]};return m2(Object.entries(t.classGroups),r).forEach(([a,o])=>{mp(o,s,a,e)}),s},mp=(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(p2(n)){mp(n(s),e,r,s);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([a,o])=>{mp(o,Xy(e,a),r,s)})})},Xy=(t,e)=>{let r=t;return e.split(Sv).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},p2=t=>t.isThemeGetter,m2=(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,v2=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)}}},PS="!",g2=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,f;for(let g=0;g<i.length;g++){let y=i[g];if(u===0){if(y===n&&(s||i.slice(g,g+a)===e)){c.push(i.slice(d,g)),d=g+a;continue}if(y==="/"){f=g;continue}}y==="["?u++:y==="]"&&u--}const m=c.length===0?i:i.substring(d),h=m.startsWith(PS),w=h?m.substring(1):m,p=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:w,maybePostfixModifierPosition:p}};return r?i=>r({className:i,parseClassName:o}):o},y2=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},x2=t=>({cache:v2(t.cacheSize),parseClassName:g2(t),...d2(t)}),w2=/\s+/,b2=(t,e)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n}=e,a=[],o=t.trim().split(w2);let i="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:h}=r(u);let w=!!h,p=s(w?m.substring(0,h):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 g=y2(d).join(":"),y=f?g+PS:g,v=y+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(y+E)}i=u+(i.length>0?" "+i:i)}return i};function S2(){let t=0,e,r,s="";for(;t<arguments.length;)(e=arguments[t++])&&(r=kS(e))&&(s&&(s+=" "),s+=r);return s}const kS=t=>{if(typeof t=="string")return t;let e,r="";for(let s=0;s<t.length;s++)t[s]&&(e=kS(t[s]))&&(r&&(r+=" "),r+=e);return r};function _2(t,...e){let r,s,n,a=o;function o(c){const u=e.reduce((d,f)=>f(d),t());return r=x2(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=b2(c,r);return n(c,d),d}return function(){return a(S2.apply(null,arguments))}}const lt=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},NS=/^\[(?:([a-z-]+):)?(.+)\]$/i,E2=/^\d+\/\d+$/,C2=new Set(["px","full","screen"]),P2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,k2=/\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$/,N2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,j2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,R2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=t=>zo(t)||C2.has(t)||E2.test(t),xs=t=>_i(t,"length",F2),zo=t=>!!t&&!Number.isNaN(Number(t)),$f=t=>_i(t,"number",zo),Li=t=>!!t&&Number.isInteger(Number(t)),T2=t=>t.endsWith("%")&&zo(t.slice(0,-1)),$e=t=>NS.test(t),ws=t=>P2.test(t),A2=new Set(["length","size","percentage"]),O2=t=>_i(t,A2,jS),I2=t=>_i(t,"position",jS),D2=new Set(["image","url"]),$2=t=>_i(t,D2,U2),M2=t=>_i(t,"",L2),Ui=()=>!0,_i=(t,e,r)=>{const s=NS.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):r(s[2]):!1},F2=t=>k2.test(t)&&!N2.test(t),jS=()=>!1,L2=t=>j2.test(t),U2=t=>R2.test(t),z2=()=>{const t=lt("colors"),e=lt("spacing"),r=lt("blur"),s=lt("brightness"),n=lt("borderColor"),a=lt("borderRadius"),o=lt("borderSpacing"),i=lt("borderWidth"),c=lt("contrast"),u=lt("grayscale"),d=lt("hueRotate"),f=lt("invert"),m=lt("gap"),h=lt("gradientColorStops"),w=lt("gradientColorStopPositions"),p=lt("inset"),g=lt("margin"),y=lt("opacity"),v=lt("padding"),b=lt("saturate"),S=lt("scale"),E=lt("sepia"),k=lt("skew"),N=lt("space"),T=lt("translate"),D=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",$e,e],A=()=>[$e,e],_=()=>["",Un,xs],O=()=>["auto",zo,$e],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],j=()=>["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"],C=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",$e],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[zo,$e];return{cacheSize:500,separator:":",theme:{colors:[Ui],spacing:[Un,xs],blur:["none","",ws,$e],brightness:Q(),borderColor:[t],borderRadius:["none","","full",ws,$e],borderSpacing:A(),borderWidth:_(),contrast:Q(),grayscale:F(),hueRotate:Q(),invert:F(),gap:A(),gradientColorStops:[t],gradientColorStopPositions:[T2,xs],inset:R(),margin:R(),opacity:Q(),padding:A(),saturate:Q(),scale:Q(),sepia:F(),skew:Q(),space:A(),translate:A()},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:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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",Li,$e]}],basis:[{basis:R()}],"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:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Li,$e]}],"grid-cols":[{"grid-cols":[Ui]}],"col-start-end":[{col:["auto",{span:["full",Li,$e]},$e]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Ui]}],"row-start-end":[{row:["auto",{span:[Li,$e]},$e]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"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",...C()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...C(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...C(),"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:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"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",$f]}],"font-family":[{font:[Ui]}],"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",zo,$f]}],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:[...j(),"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:A()}],"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(),I2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",O2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$2]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],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:[...j(),"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:j()}],"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:["",...j()]}],"outline-offset":[{"outline-offset":[Un,$e]}],"outline-w":[{outline:[Un,xs]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Un,xs]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ws,M2]}],"shadow-color":[{shadow:[Ui]}],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",ws,$e]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],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":[f]}],"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:Q()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:Q()}],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:[Li,$e]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",$e]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Un,xs,$f]}],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"]}}},V2=_2(z2);function je(...t){return V2(xS(t))}const q2=Xj,RS=x.forwardRef(({className:t,...e},r)=>l.jsx(fS,{ref:r,className:je("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}));RS.displayName=fS.displayName;const H2=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"}}),TS=x.forwardRef(({className:t,variant:e,...r},s)=>l.jsx(hS,{ref:s,className:je(H2({variant:e}),t),...r}));TS.displayName=hS.displayName;const B2=x.forwardRef(({className:t,...e},r)=>l.jsx(vS,{ref:r,className:je("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}));B2.displayName=vS.displayName;const AS=x.forwardRef(({className:t,...e},r)=>l.jsx(gS,{ref:r,className:je("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"})}));AS.displayName=gS.displayName;const OS=x.forwardRef(({className:t,...e},r)=>l.jsx(pS,{ref:r,className:je("text-sm font-semibold",t),...e}));OS.displayName=pS.displayName;const IS=x.forwardRef(({className:t,...e},r)=>l.jsx(mS,{ref:r,className:je("text-sm opacity-90",t),...e}));IS.displayName=mS.displayName;function K2(){const{toasts:t}=gr();return l.jsxs(q2,{children:[t.map(function({id:e,title:r,description:s,action:n,...a}){return l.jsxs(TS,{...a,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(OS,{children:r}),s&&l.jsx(IS,{children:s})]}),n,l.jsx(AS,{})]},e)}),l.jsx(RS,{})]})}var W2=xm[" useId ".trim().toString()]||(()=>{}),Q2=0;function ea(t){const[e,r]=x.useState(W2());return Bt(()=>{r(s=>s??String(Q2++))},[t]),e?`radix-${e}`:""}const G2=["top","right","bottom","left"],aa=Math.min,br=Math.max,Ou=Math.round,Pc=Math.floor,jn=t=>({x:t,y:t}),Z2={left:"right",right:"left",bottom:"top",top:"bottom"},Y2={start:"end",end:"start"};function vp(t,e,r){return br(t,aa(e,r))}function os(t,e){return typeof t=="function"?t(e):t}function is(t){return t.split("-")[0]}function Ei(t){return t.split("-")[1]}function _v(t){return t==="x"?"y":"x"}function Ev(t){return t==="y"?"height":"width"}const J2=new Set(["top","bottom"]);function Cn(t){return J2.has(is(t))?"y":"x"}function Cv(t){return _v(Cn(t))}function X2(t,e,r){r===void 0&&(r=!1);const s=Ei(t),n=Cv(t),a=Ev(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 eR(t){const e=Iu(t);return[gp(t),e,gp(e)]}function gp(t){return t.replace(/start|end/g,e=>Y2[e])}const e0=["left","right"],t0=["right","left"],tR=["top","bottom"],rR=["bottom","top"];function nR(t,e,r){switch(t){case"top":case"bottom":return r?e?t0:e0:e?e0:t0;case"left":case"right":return e?tR:rR;default:return[]}}function sR(t,e,r,s){const n=Ei(t);let a=nR(is(t),r==="start",s);return n&&(a=a.map(o=>o+"-"+n),e&&(a=a.concat(a.map(gp)))),a}function Iu(t){return t.replace(/left|right|bottom|top/g,e=>Z2[e])}function aR(t){return{top:0,right:0,bottom:0,left:0,...t}}function DS(t){return typeof t!="number"?aR(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=Cv(e),i=Ev(o),c=is(e),u=a==="y",d=s.x+s.width/2-n.width/2,f=s.y+s.height/2-n.height/2,m=s[i]/2-n[i]/2;let h;switch(c){case"top":h={x:d,y:s.y-n.height};break;case"bottom":h={x:d,y:s.y+s.height};break;case"right":h={x:s.x+s.width,y:f};break;case"left":h={x:s.x-n.width,y:f};break;default:h={x:s.x,y:s.y}}switch(Ei(e)){case"start":h[o]-=m*(r&&u?-1:1);break;case"end":h[o]+=m*(r&&u?-1:1);break}return h}const oR=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:f}=r0(u,s,c),m=s,h={},w=0;for(let p=0;p<i.length;p++){const{name:g,fn:y}=i[p],{x:v,y:b,data:S,reset:E}=await y({x:d,y:f,initialPlacement:s,placement:m,strategy:n,middlewareData:h,rects:u,platform:o,elements:{reference:t,floating:e}});d=v??d,f=b??f,h={...h,[g]:{...h[g],...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:f}=r0(u,m,c)),p=-1)}return{x:d,y:f,placement:m,strategy:n,middlewareData:h}};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:f="floating",altBoundary:m=!1,padding:h=0}=os(e,t),w=DS(h),g=i[m?f==="floating"?"reference":"floating":f],y=Du(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(g)))==null||r?g:g.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="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:(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 iR=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 f=DS(d),m={x:r,y:s},h=Cv(n),w=Ev(h),p=await o.getDimensions(u),g=h==="y",y=g?"top":"left",v=g?"bottom":"right",b=g?"clientHeight":"clientWidth",S=a.reference[w]+a.reference[h]-m[h]-a.floating[w],E=m[h]-a.reference[h],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let N=k?k[b]:0;(!N||!await(o.isElement==null?void 0:o.isElement(k)))&&(N=i.floating[b]||a.floating[w]);const T=S/2-E/2,D=N/2-p[w]/2-1,U=aa(f[y],D),R=aa(f[v],D),A=U,_=N-p[w]-R,O=N/2-p[w]/2+T,z=vp(A,O,_),j=!c.arrow&&Ei(n)!=null&&O!==z&&a.reference[w]/2-(O<A?U:R)-p[w]/2<0,K=j?O<A?O-A:O-_:0;return{[h]:m[h]+K,data:{[h]:z,centerOffset:O-z-K,...j&&{alignmentOffset:K}},reset:j}}}),lR=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:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:p=!0,...g}=os(t,e);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const y=is(n),v=Cn(i),b=is(i)===i,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),E=m||(b||!p?[Iu(i)]:eR(i)),k=w!=="none";!m&&k&&E.push(...sR(i,p,w,S));const N=[i,...E],T=await Nl(e,g),D=[];let U=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&D.push(T[y]),f){const O=X2(n,o,S);D.push(T[O[0]],T[O[1]])}if(U=[...U,{placement:n,overflows:D}],!D.every(O=>O<=0)){var R,A;const O=(((R=a.flip)==null?void 0:R.index)||0)+1,z=N[O];if(z&&(!(f==="alignment"?v!==Cn(z):!1)||U.every(C=>Cn(C.placement)===v?C.overflows[0]>0:!0)))return{data:{index:O,overflows:U},reset:{placement:z}};let j=(A=U.filter(K=>K.overflows[0]<=0).sort((K,C)=>K.overflows[1]-C.overflows[1])[0])==null?void 0:A.placement;if(!j)switch(h){case"bestFit":{var _;const K=(_=U.filter(C=>{if(k){const F=Cn(C.placement);return F===v||F==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(F=>F>0).reduce((F,L)=>F+L,0)]).sort((C,F)=>C[1]-F[1])[0])==null?void 0:_[0];K&&(j=K);break}case"initialPlacement":j=i;break}if(n!==j)return{reset:{placement:j}}}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 G2.some(e=>t[e]>=0)}const cR=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 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{}}}}},$S=new Set(["left","top"]);async function uR(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=Ei(r),c=Cn(r)==="y",u=$S.has(o)?-1:1,d=a&&c?-1:1,f=os(e,t);let{mainAxis:m,crossAxis:h,alignmentAxis:w}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return i&&typeof w=="number"&&(h=i==="end"?w*-1:w),c?{x:h*d,y:m*u}:{x:m*u,y:h*d}}const dR=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 uR(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}}}}},fR=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:g=>{let{x:y,y:v}=g;return{x:y,y:v}}},...c}=os(t,e),u={x:r,y:s},d=await Nl(e,c),f=Cn(is(n)),m=_v(f);let h=u[m],w=u[f];if(a){const g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",v=h+d[g],b=h-d[y];h=vp(v,h,b)}if(o){const g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",v=w+d[g],b=w-d[y];w=vp(v,w,b)}const p=i.fn({...e,[m]:h,[f]:w});return{...p,data:{x:p.x-r,y:p.y-s,enabled:{[m]:a,[f]:o}}}}}},hR=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},f=Cn(n),m=_v(f);let h=d[m],w=d[f];const p=os(i,e),g=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]+g.mainAxis,E=a.reference[m]+a.reference[b]-g.mainAxis;h<S?h=S:h>E&&(h=E)}if(u){var y,v;const b=m==="y"?"width":"height",S=$S.has(is(n)),E=a.reference[f]-a.floating[b]+(S&&((y=o.offset)==null?void 0:y[f])||0)+(S?0:g.crossAxis),k=a.reference[f]+a.reference[b]+(S?0:((v=o.offset)==null?void 0:v[f])||0)-(S?g.crossAxis:0);w<E?w=E:w>k&&(w=k)}return{[m]:h,[f]:w}}}},pR=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 Nl(e,u),f=is(n),m=Ei(n),h=Cn(n)==="y",{width:w,height:p}=a.floating;let g,y;f==="top"||f==="bottom"?(g=f,y=m===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(y=f,g=m==="end"?"top":"bottom");const v=p-d.top-d.bottom,b=w-d.left-d.right,S=aa(p-d[g],v),E=aa(w-d[y],b),k=!e.middlewareData.shift;let N=S,T=E;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(T=b),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(N=v),k&&!m){const U=br(d.left,0),R=br(d.right,0),A=br(d.top,0),_=br(d.bottom,0);h?T=w-2*(U!==0||R!==0?U+R:br(d.left,d.right)):N=p-2*(A!==0||_!==0?A+_:br(d.top,d.bottom))}await c({...e,availableWidth:T,availableHeight:N});const D=await o.getDimensions(i.floating);return w!==D.width||p!==D.height?{reset:{rects:!0}}:{}}}};function jd(){return typeof window<"u"}function Ci(t){return MS(t)?(t.nodeName||"").toLowerCase():"#document"}function Er(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function On(t){var e;return(e=(MS(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function MS(t){return jd()?t instanceof Node||t instanceof Er(t).Node:!1}function an(t){return jd()?t instanceof Element||t instanceof Er(t).Element:!1}function Tn(t){return jd()?t instanceof HTMLElement||t instanceof Er(t).HTMLElement:!1}function a0(t){return!jd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Er(t).ShadowRoot}const mR=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)&&!mR.has(n)}const vR=new Set(["table","td","th"]);function gR(t){return vR.has(Ci(t))}const yR=[":popover-open",":modal"];function Rd(t){return yR.some(e=>{try{return t.matches(e)}catch{return!1}})}const xR=["transform","translate","scale","rotate","perspective"],wR=["transform","translate","scale","rotate","perspective","filter"],bR=["paint","layout","strict","content"];function Pv(t){const e=kv(),r=an(t)?on(t):t;return xR.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)||wR.some(s=>(r.willChange||"").includes(s))||bR.some(s=>(r.contain||"").includes(s))}function SR(t){let e=oa(t);for(;Tn(e)&&!pi(e);){if(Pv(e))return e;if(Rd(e))return null;e=oa(e)}return null}function kv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const _R=new Set(["html","body","#document"]);function pi(t){return _R.has(Ci(t))}function on(t){return Er(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(Ci(t)==="html")return t;const e=t.assignedSlot||t.parentNode||a0(t)&&t.host||On(t);return a0(e)?e.host:e}function FS(t){const e=oa(t);return pi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Tn(e)&&Hl(e)?e:FS(e)}function jl(t,e,r){var s;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=FS(t),a=n===((s=t.ownerDocument)==null?void 0:s.body),o=Er(n);if(a){const i=yp(o);return e.concat(o,o.visualViewport||[],Hl(n)?n:[],i&&r?jl(i):[])}return e.concat(n,jl(n,[],r))}function yp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function LS(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 Nv(t){return an(t)?t:t.contextElement}function Vo(t){const e=Nv(t);if(!Tn(e))return jn(1);const r=e.getBoundingClientRect(),{width:s,height:n,$:a}=LS(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 ER=jn(0);function US(t){const e=Er(t);return!kv()||!e.visualViewport?ER:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function CR(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Er(t)?!1:e}function Qa(t,e,r,s){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),a=Nv(t);let o=jn(1);e&&(s?an(s)&&(o=Vo(s)):o=Vo(t));const i=CR(a,r,s)?US(a):jn(0);let c=(n.left+i.x)/o.x,u=(n.top+i.y)/o.y,d=n.width/o.x,f=n.height/o.y;if(a){const m=Er(a),h=s&&an(s)?Er(s):s;let w=m,p=yp(w);for(;p&&s&&h!==w;){const g=Vo(p),y=p.getBoundingClientRect(),v=on(p),b=y.left+(p.clientLeft+parseFloat(v.paddingLeft))*g.x,S=y.top+(p.clientTop+parseFloat(v.paddingTop))*g.y;c*=g.x,u*=g.y,d*=g.x,f*=g.y,c+=b,u+=S,w=Er(p),p=yp(w)}}return Du({width:d,height:f,x:c,y:u})}function Ad(t,e){const r=Td(t).scrollLeft;return e?e.left+r:Qa(On(t)).left+r}function zS(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 PR(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),f=Tn(s);if((f||!f&&!a)&&((Ci(s)!=="body"||Hl(o))&&(c=Td(s)),Tn(s))){const h=Qa(s);u=Vo(s),d.x=h.x+s.clientLeft,d.y=h.y+s.clientTop}const m=o&&!f&&!a?zS(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 kR(t){return Array.from(t.getClientRects())}function NR(t){const e=On(t),r=Td(t),s=t.ownerDocument.body,n=br(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),a=br(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let o=-r.scrollLeft+Ad(t);const i=-r.scrollTop;return on(s).direction==="rtl"&&(o+=br(e.clientWidth,s.clientWidth)-n),{width:n,height:a,x:o,y:i}}const o0=25;function jR(t,e){const r=Er(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=kv();(!d||d&&e==="fixed")&&(i=n.offsetLeft,c=n.offsetTop)}const u=Ad(s);if(u<=0){const d=s.ownerDocument,f=d.body,m=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,w=Math.abs(s.clientWidth-f.clientWidth-h);w<=o0&&(a-=w)}else u<=o0&&(a+=u);return{width:a,height:o,x:i,y:c}}const RR=new Set(["absolute","fixed"]);function TR(t,e){const r=Qa(t,!0,e==="fixed"),s=r.top+t.clientTop,n=r.left+t.clientLeft,a=Tn(t)?Vo(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=jR(t,r);else if(e==="document")s=NR(On(t));else if(an(e))s=TR(e,r);else{const n=US(t);s={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return Du(s)}function VS(t,e){const r=oa(t);return r===e||!an(r)||pi(r)?!1:on(r).position==="fixed"||VS(r,e)}function AR(t,e){const r=e.get(t);if(r)return r;let s=jl(t,[],!1).filter(i=>an(i)&&Ci(i)!=="body"),n=null;const a=on(t).position==="fixed";let o=a?oa(t):t;for(;an(o)&&!pi(o);){const i=on(o),c=Pv(o);!c&&i.position==="fixed"&&(n=null),(a?!c&&!n:!c&&i.position==="static"&&!!n&&RR.has(n.position)||Hl(o)&&!c&&VS(t,o))?s=s.filter(d=>d!==o):n=i,o=oa(o)}return e.set(t,s),s}function OR(t){let{element:e,boundary:r,rootBoundary:s,strategy:n}=t;const o=[...r==="clippingAncestors"?Rd(e)?[]:AR(e,this._c):[].concat(r),s],i=o[0],c=o.reduce((u,d)=>{const f=i0(e,d,n);return u.top=br(f.top,u.top),u.right=aa(f.right,u.right),u.bottom=aa(f.bottom,u.bottom),u.left=br(f.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 IR(t){const{width:e,height:r}=LS(t);return{width:e,height:r}}function DR(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((Ci(e)!=="body"||Hl(n))&&(i=Td(e)),s){const h=Qa(e,!0,a,e);c.x=h.x+e.clientLeft,c.y=h.y+e.clientTop}else n&&u();a&&!s&&n&&u();const d=n&&!s&&!a?zS(n,i):jn(0),f=o.left+i.scrollLeft-c.x-d.x,m=o.top+i.scrollTop-c.y-d.y;return{x:f,y:m,width:o.width,height:o.height}}function Mf(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 qS(t,e){const r=Er(t);if(Rd(t))return r;if(!Tn(t)){let n=oa(t);for(;n&&!pi(n);){if(an(n)&&!Mf(n))return n;n=oa(n)}return r}let s=l0(t,e);for(;s&&gR(s)&&Mf(s);)s=l0(s,e);return s&&pi(s)&&Mf(s)&&!Pv(s)?r:s||SR(t)||r}const $R=async function(t){const e=this.getOffsetParent||qS,r=this.getDimensions,s=await r(t.floating);return{reference:DR(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function MR(t){return on(t).direction==="rtl"}const FR={convertOffsetParentRelativeRectToViewportRelativeRect:PR,getDocumentElement:On,getClippingRect:OR,getOffsetParent:qS,getElementRects:$R,getClientRects:kR,getDimensions:IR,getScale:Vo,isElement:an,isRTL:MR};function HS(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function LR(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:f,width:m,height:h}=u;if(i||e(),!m||!h)return;const w=Pc(f),p=Pc(n.clientWidth-(d+m)),g=Pc(n.clientHeight-(f+h)),y=Pc(d),b={rootMargin:-w+"px "+-p+"px "+-g+"px "+-y+"px",threshold:br(0,aa(1,c))||1};let S=!0;function E(k){const N=k[0].intersectionRatio;if(N!==c){if(!S)return o();N?o(!1,N):s=setTimeout(()=>{o(!1,1e-7)},1e3)}N===1&&!HS(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 UR(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=Nv(t),d=n||a?[...u?jl(u):[],...jl(e)]:[];d.forEach(y=>{n&&y.addEventListener("scroll",r,{passive:!0}),a&&y.addEventListener("resize",r)});const f=u&&i?LR(u,r):null;let m=-1,h=null;o&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),r()}),u&&!c&&h.observe(u),h.observe(e));let w,p=c?Qa(t):null;c&&g();function g(){const y=Qa(t);p&&!HS(p,y)&&r(),p=y,w=requestAnimationFrame(g)}return r(),()=>{var y;d.forEach(v=>{n&&v.removeEventListener("scroll",r),a&&v.removeEventListener("resize",r)}),f==null||f(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(w)}}const zR=dR,VR=fR,qR=lR,HR=pR,BR=cR,c0=iR,KR=hR,WR=(t,e,r)=>{const s=new Map,n={platform:FR,...r},a={...n.platform,_c:s};return oR(t,e,{...n,platform:a})};var QR=typeof document<"u",GR=function(){},Gc=QR?x.useLayoutEffect:GR;function $u(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(!$u(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)&&!$u(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function BS(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function u0(t,e){const r=BS(t);return Math.round(e*r)/r}function Ff(t){const e=x.useRef(t);return Gc(()=>{e.current=t}),e}function ZR(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,f]=x.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[m,h]=x.useState(s);$u(m,s)||h(s);const[w,p]=x.useState(null),[g,y]=x.useState(null),v=x.useCallback(C=>{C!==k.current&&(k.current=C,p(C))},[]),b=x.useCallback(C=>{C!==N.current&&(N.current=C,y(C))},[]),S=a||w,E=o||g,k=x.useRef(null),N=x.useRef(null),T=x.useRef(d),D=c!=null,U=Ff(c),R=Ff(n),A=Ff(u),_=x.useCallback(()=>{if(!k.current||!N.current)return;const C={placement:e,strategy:r,middleware:m};R.current&&(C.platform=R.current),WR(k.current,N.current,C).then(F=>{const L={...F,isPositioned:A.current!==!1};O.current&&!$u(T.current,L)&&(T.current=L,so.flushSync(()=>{f(L)}))})},[m,e,r,R,A]);Gc(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(C=>({...C,isPositioned:!1})))},[u]);const O=x.useRef(!1);Gc(()=>(O.current=!0,()=>{O.current=!1}),[]),Gc(()=>{if(S&&(k.current=S),E&&(N.current=E),S&&E){if(U.current)return U.current(S,E,_);_()}},[S,E,_,U,D]);const z=x.useMemo(()=>({reference:k,floating:N,setReference:v,setFloating:b}),[v,b]),j=x.useMemo(()=>({reference:S,floating:E}),[S,E]),K=x.useMemo(()=>{const C={position:r,left:0,top:0};if(!j.floating)return C;const F=u0(j.floating,d.x),L=u0(j.floating,d.y);return i?{...C,transform:"translate("+F+"px, "+L+"px)",...BS(j.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:L}},[r,i,j.floating,d.x,d.y]);return x.useMemo(()=>({...d,update:_,refs:z,elements:j,floatingStyles:K}),[d,_,z,j,K])}const YR=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):{}}}},JR=(t,e)=>({...zR(t),options:[t,e]}),XR=(t,e)=>({...VR(t),options:[t,e]}),eT=(t,e)=>({...KR(t),options:[t,e]}),tT=(t,e)=>({...qR(t),options:[t,e]}),rT=(t,e)=>({...HR(t),options:[t,e]}),nT=(t,e)=>({...BR(t),options:[t,e]}),sT=(t,e)=>({...YR(t),options:[t,e]});var aT="Arrow",KS=x.forwardRef((t,e)=>{const{children:r,width:s=10,height:n=5,...a}=t;return l.jsx(Re.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"})})});KS.displayName=aT;var oT=KS;function WS(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 jv="Popper",[QS,Od]=ds(jv),[iT,GS]=QS(jv),ZS=t=>{const{__scopePopper:e,children:r}=t,[s,n]=x.useState(null);return l.jsx(iT,{scope:e,anchor:s,onAnchorChange:n,children:r})};ZS.displayName=jv;var YS="PopperAnchor",JS=x.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:s,...n}=t,a=GS(YS,r),o=x.useRef(null),i=nt(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(Re.div,{...n,ref:i})});JS.displayName=YS;var Rv="PopperContent",[lT,cT]=QS(Rv),XS=x.forwardRef((t,e)=>{var X,ve,he,ye,ue,Pe;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:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:w,...p}=t,g=GS(Rv,r),[y,v]=x.useState(null),b=nt(e,Ae=>v(Ae)),[S,E]=x.useState(null),k=WS(S),N=(k==null?void 0:k.width)??0,T=(k==null?void 0:k.height)??0,D=s+(a!=="center"?"-"+a:""),U=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},R=Array.isArray(u)?u:[u],A=R.length>0,_={padding:U,boundary:R.filter(dT),altBoundary:A},{refs:O,floatingStyles:z,placement:j,isPositioned:K,middlewareData:C}=ZR({strategy:"fixed",placement:D,whileElementsMounted:(...Ae)=>UR(...Ae,{animationFrame:h==="always"}),elements:{reference:g.anchor},middleware:[JR({mainAxis:n+T,alignmentAxis:o}),c&&XR({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?eT():void 0,..._}),c&&tT({..._}),rT({..._,apply:({elements:Ae,rects:De,availableWidth:J,availableHeight:ie})=>{const{width:Y,height:ze}=De.reference,ee=Ae.floating.style;ee.setProperty("--radix-popper-available-width",`${J}px`),ee.setProperty("--radix-popper-available-height",`${ie}px`),ee.setProperty("--radix-popper-anchor-width",`${Y}px`),ee.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),S&&sT({element:S,padding:i}),fT({arrowWidth:N,arrowHeight:T}),m&&nT({strategy:"referenceHidden",..._})]}),[F,L]=r1(j),Q=Ur(w);Bt(()=>{K&&(Q==null||Q())},[K,Q]);const te=(X=C.arrow)==null?void 0:X.x,V=(ve=C.arrow)==null?void 0:ve.y,de=((he=C.arrow)==null?void 0:he.centerOffset)!==0,[Te,ge]=x.useState();return Bt(()=>{y&&ge(window.getComputedStyle(y).zIndex)},[y]),l.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:K?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Te,"--radix-popper-transform-origin":[(ye=C.transformOrigin)==null?void 0:ye.x,(ue=C.transformOrigin)==null?void 0:ue.y].join(" "),...((Pe=C.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:l.jsx(lT,{scope:r,placedSide:F,onArrowChange:E,arrowX:te,arrowY:V,shouldHideArrow:de,children:l.jsx(Re.div,{"data-side":F,"data-align":L,...p,ref:b,style:{...p.style,animation:K?void 0:"none"}})})})});XS.displayName=Rv;var e1="PopperArrow",uT={top:"bottom",right:"left",bottom:"top",left:"right"},t1=x.forwardRef(function(e,r){const{__scopePopper:s,...n}=e,a=cT(e1,s),o=uT[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(oT,{...n,ref:r,style:{...n.style,display:"block"}})})});t1.displayName=e1;function dT(t){return t!==null}var fT=t=>({name:"transformOrigin",options:t,fn(e){var g,y,v;const{placement:r,rects:s,middlewareData:n}=e,o=((g=n.arrow)==null?void 0:g.centerOffset)!==0,i=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[u,d]=r1(r),f={start:"0%",center:"50%",end:"100%"}[d],m=(((y=n.arrow)==null?void 0:y.x)??0)+i/2,h=(((v=n.arrow)==null?void 0:v.y)??0)+c/2;let w="",p="";return u==="bottom"?(w=o?f:`${m}px`,p=`${-c}px`):u==="top"?(w=o?f:`${m}px`,p=`${s.floating.height+c}px`):u==="right"?(w=`${-c}px`,p=o?f:`${h}px`):u==="left"&&(w=`${s.floating.width+c}px`,p=o?f:`${h}px`),{data:{x:w,y:p}}}});function r1(t){const[e,r="center"]=t.split("-");return[e,r]}var hT=ZS,n1=JS,s1=XS,a1=t1,[Id,dF]=ds("Tooltip",[Od]),Tv=Od(),o1="TooltipProvider",pT=700,d0="tooltip.open",[mT,i1]=Id(o1),l1=t=>{const{__scopeTooltip:e,delayDuration:r=pT,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(mT,{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})};l1.displayName=o1;var c1="Tooltip",[fF,Dd]=Id(c1),xp="TooltipTrigger",vT=x.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,n=Dd(xp,r),a=i1(xp,r),o=Tv(r),i=x.useRef(null),c=nt(e,i,n.onTriggerChange),u=x.useRef(!1),d=x.useRef(!1),f=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(n1,{asChild:!0,...o,children:l.jsx(Re.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",f,{once:!0})}),onFocus:Se(t.onFocus,()=>{u.current||n.onOpen()}),onBlur:Se(t.onBlur,n.onClose),onClick:Se(t.onClick,n.onClose)})})});vT.displayName=xp;var gT="TooltipPortal",[hF,yT]=Id(gT,{forceMount:void 0}),mi="TooltipContent",u1=x.forwardRef((t,e)=>{const r=yT(mi,t.__scopeTooltip),{forceMount:s=r.forceMount,side:n="top",...a}=t,o=Dd(mi,t.__scopeTooltip);return l.jsx(da,{present:s||o.open,children:o.disableHoverableContent?l.jsx(d1,{side:n,...a,ref:e}):l.jsx(xT,{side:n,...a,ref:e})})}),xT=x.forwardRef((t,e)=>{const r=Dd(mi,t.__scopeTooltip),s=i1(mi,t.__scopeTooltip),n=x.useRef(null),a=nt(e,n),[o,i]=x.useState(null),{trigger:c,onClose:u}=r,d=n.current,{onPointerInTransitChange:f}=s,m=x.useCallback(()=>{i(null),f(!1)},[f]),h=x.useCallback((w,p)=>{const g=w.currentTarget,y={x:w.clientX,y:w.clientY},v=ET(y,g.getBoundingClientRect()),b=CT(y,v),S=PT(p.getBoundingClientRect()),E=NT([...b,...S]);i(E),f(!0)},[f]);return x.useEffect(()=>()=>m(),[m]),x.useEffect(()=>{if(c&&d){const w=g=>h(g,d),p=g=>h(g,c);return c.addEventListener("pointerleave",w),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",w),d.removeEventListener("pointerleave",p)}}},[c,d,h,m]),x.useEffect(()=>{if(o){const w=p=>{const g=p.target,y={x:p.clientX,y:p.clientY},v=(c==null?void 0:c.contains(g))||(d==null?void 0:d.contains(g)),b=!kT(y,o);v?m():b&&(m(),u())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[c,d,o,u,m]),l.jsx(d1,{...t,ref:a})}),[wT,bT]=Id(c1,{isInside:!1}),ST=hj("TooltipContent"),d1=x.forwardRef((t,e)=>{const{__scopeTooltip:r,children:s,"aria-label":n,onEscapeKeyDown:a,onPointerDownOutside:o,...i}=t,c=Dd(mi,r),u=Tv(r),{onClose:d}=c;return x.useEffect(()=>(document.addEventListener(d0,d),()=>document.removeEventListener(d0,d)),[d]),x.useEffect(()=>{if(c.trigger){const f=m=>{const h=m.target;h!=null&&h.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Vl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(s1,{"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(ST,{children:s}),l.jsx(wT,{scope:r,isInside:!0,children:l.jsx(Dj,{id:c.contentId,role:"tooltip",children:n||s})})]})})});u1.displayName=mi;var f1="TooltipArrow",_T=x.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,n=Tv(r);return bT(f1,r).isInside?null:l.jsx(a1,{...n,...s,ref:e})});_T.displayName=f1;function ET(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 CT(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 PT(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 kT(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,f=c.x,m=c.y;d>s!=m>s&&r<(f-u)*(s-d)/(m-d)+u&&(n=!n)}return n}function NT(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),jT(e)}function jT(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 RT=l1,h1=u1;const TT=RT,AT=x.forwardRef(({className:t,sideOffset:e=4,...r},s)=>l.jsx(h1,{ref:s,sideOffset:e,className:je("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}));AT.displayName=h1.displayName;const OT={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 IT(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))}:OT}const xr="#92E4DD",cr="#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"?xr:t.cardColor??xr}function Sn(t){return{borderColor:t,color:t,boxShadow:`0 0 20px ${t}20`}}const DT=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"}}),me=x.forwardRef(({className:t,variant:e,size:r,asChild:s=!1,...n},a)=>{const o=s?dj:"button";return l.jsx(o,{className:je(DT({variant:e,size:r,className:t})),ref:a,...n})});me.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",$T="http://localhost:8000";function p1(t){return t.iconUrl?t.iconUrl.startsWith("http")?t.iconUrl:`${$T}${t.iconUrl}`:null}function qo({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 MT=t=>{const e=Wr(t),r=p1(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 FT({service:t,onDragStart:e,onDragEnd:r,isInActiveDeck:s,onCardClick:n,isInCollection:a=!1,onMouseEnter:o,onMouseLeave:i,activeDeck:c,warnings:u}){const d=vr(),{toast:f}=gr(),m=Wr(t),h=Ot({mutationFn:async()=>{if(!c)throw new Error("No active deck found");return Ue("POST",`/api/decks/${c.id}/services`,{serviceId:t.id,position:0})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Service added to deck",description:`${t.name} has been added to your active deck.`})},onError:y=>{f({title:"Failed to add service",description:y.message,variant:"destructive"})}}),w=Ot({mutationFn:async()=>Ue("DELETE",`/api/services/${t.id}`,{}),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Service deleted",description:`${t.name} has been deleted successfully.`})},onError:y=>{f({title:"Failed to delete service",description:y.message,variant:"destructive"})}}),p=y=>{y.stopPropagation(),h.mutate()},g=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:`
|
|
213
|
+
*/const Tu=tt("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"}]]);/**
|
|
214
|
+
* @license lucide-react v0.453.0 - ISC
|
|
215
|
+
*
|
|
216
|
+
* This source code is licensed under the ISC license.
|
|
217
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
218
|
+
*/const Au=tt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Sv="-",f2=t=>{const e=p2(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:o=>{const i=o.split(Sv);return i[0]===""&&i.length!==1&&i.shift(),C1(i,e)||h2(o)},getConflictingClassGroupIds:(o,i)=>{const c=r[o]||[];return i&&s[o]?[...c,...s[o]]:c}}},C1=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],s=e.nextPart.get(r),n=s?C1(t.slice(1),s):void 0;if(n)return n;if(e.validators.length===0)return;const a=t.join(Sv);return(o=e.validators.find(({validator:i})=>i(a)))==null?void 0:o.classGroupId},Jy=/^\[(.+)\]$/,h2=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}},p2=t=>{const{theme:e,prefix:r}=t,s={nextPart:new Map,validators:[]};return v2(Object.entries(t.classGroups),r).forEach(([a,o])=>{mp(o,s,a,e)}),s},mp=(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(m2(n)){mp(n(s),e,r,s);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([a,o])=>{mp(o,Xy(e,a),r,s)})})},Xy=(t,e)=>{let r=t;return e.split(Sv).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},m2=t=>t.isThemeGetter,v2=(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,g2=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)}}},P1="!",y2=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,f;for(let g=0;g<i.length;g++){let y=i[g];if(u===0){if(y===n&&(s||i.slice(g,g+a)===e)){c.push(i.slice(d,g)),d=g+a;continue}if(y==="/"){f=g;continue}}y==="["?u++:y==="]"&&u--}const m=c.length===0?i:i.substring(d),h=m.startsWith(P1),w=h?m.substring(1):m,p=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:w,maybePostfixModifierPosition:p}};return r?i=>r({className:i,parseClassName:o}):o},x2=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},w2=t=>({cache:g2(t.cacheSize),parseClassName:y2(t),...f2(t)}),b2=/\s+/,S2=(t,e)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n}=e,a=[],o=t.trim().split(b2);let i="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:h}=r(u);let w=!!h,p=s(w?m.substring(0,h):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 g=x2(d).join(":"),y=f?g+P1:g,v=y+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(y+E)}i=u+(i.length>0?" "+i:i)}return i};function _2(){let t=0,e,r,s="";for(;t<arguments.length;)(e=arguments[t++])&&(r=k1(e))&&(s&&(s+=" "),s+=r);return s}const k1=t=>{if(typeof t=="string")return t;let e,r="";for(let s=0;s<t.length;s++)t[s]&&(e=k1(t[s]))&&(r&&(r+=" "),r+=e);return r};function E2(t,...e){let r,s,n,a=o;function o(c){const u=e.reduce((d,f)=>f(d),t());return r=w2(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=S2(c,r);return n(c,d),d}return function(){return a(_2.apply(null,arguments))}}const lt=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},N1=/^\[(?:([a-z-]+):)?(.+)\]$/i,C2=/^\d+\/\d+$/,P2=new Set(["px","full","screen"]),k2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,N2=/\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$/,j2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,R2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=t=>zo(t)||P2.has(t)||C2.test(t),xs=t=>_i(t,"length",L2),zo=t=>!!t&&!Number.isNaN(Number(t)),$f=t=>_i(t,"number",zo),Li=t=>!!t&&Number.isInteger(Number(t)),A2=t=>t.endsWith("%")&&zo(t.slice(0,-1)),$e=t=>N1.test(t),ws=t=>k2.test(t),O2=new Set(["length","size","percentage"]),I2=t=>_i(t,O2,j1),D2=t=>_i(t,"position",j1),$2=new Set(["image","url"]),M2=t=>_i(t,$2,z2),F2=t=>_i(t,"",U2),Ui=()=>!0,_i=(t,e,r)=>{const s=N1.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):r(s[2]):!1},L2=t=>N2.test(t)&&!j2.test(t),j1=()=>!1,U2=t=>R2.test(t),z2=t=>T2.test(t),V2=()=>{const t=lt("colors"),e=lt("spacing"),r=lt("blur"),s=lt("brightness"),n=lt("borderColor"),a=lt("borderRadius"),o=lt("borderSpacing"),i=lt("borderWidth"),c=lt("contrast"),u=lt("grayscale"),d=lt("hueRotate"),f=lt("invert"),m=lt("gap"),h=lt("gradientColorStops"),w=lt("gradientColorStopPositions"),p=lt("inset"),g=lt("margin"),y=lt("opacity"),v=lt("padding"),b=lt("saturate"),S=lt("scale"),E=lt("sepia"),k=lt("skew"),N=lt("space"),T=lt("translate"),D=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",$e,e],A=()=>[$e,e],_=()=>["",Un,xs],O=()=>["auto",zo,$e],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],j=()=>["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"],C=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",$e],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[zo,$e];return{cacheSize:500,separator:":",theme:{colors:[Ui],spacing:[Un,xs],blur:["none","",ws,$e],brightness:Q(),borderColor:[t],borderRadius:["none","","full",ws,$e],borderSpacing:A(),borderWidth:_(),contrast:Q(),grayscale:F(),hueRotate:Q(),invert:F(),gap:A(),gradientColorStops:[t],gradientColorStopPositions:[A2,xs],inset:R(),margin:R(),opacity:Q(),padding:A(),saturate:Q(),scale:Q(),sepia:F(),skew:Q(),space:A(),translate:A()},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:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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",Li,$e]}],basis:[{basis:R()}],"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:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Li,$e]}],"grid-cols":[{"grid-cols":[Ui]}],"col-start-end":[{col:["auto",{span:["full",Li,$e]},$e]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Ui]}],"row-start-end":[{row:["auto",{span:[Li,$e]},$e]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"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",...C()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...C(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...C(),"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:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"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",$f]}],"font-family":[{font:[Ui]}],"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",zo,$f]}],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:[...j(),"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:A()}],"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(),D2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",I2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},M2]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],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:[...j(),"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:j()}],"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:["",...j()]}],"outline-offset":[{"outline-offset":[Un,$e]}],"outline-w":[{outline:[Un,xs]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Un,xs]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ws,F2]}],"shadow-color":[{shadow:[Ui]}],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",ws,$e]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],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":[f]}],"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:Q()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:Q()}],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:[Li,$e]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",$e]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Un,xs,$f]}],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"]}}},q2=E2(V2);function je(...t){return q2(x1(t))}const H2=Xj,R1=x.forwardRef(({className:t,...e},r)=>l.jsx(f1,{ref:r,className:je("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}));R1.displayName=f1.displayName;const B2=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"}}),T1=x.forwardRef(({className:t,variant:e,...r},s)=>l.jsx(h1,{ref:s,className:je(B2({variant:e}),t),...r}));T1.displayName=h1.displayName;const K2=x.forwardRef(({className:t,...e},r)=>l.jsx(v1,{ref:r,className:je("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}));K2.displayName=v1.displayName;const A1=x.forwardRef(({className:t,...e},r)=>l.jsx(g1,{ref:r,className:je("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"})}));A1.displayName=g1.displayName;const O1=x.forwardRef(({className:t,...e},r)=>l.jsx(p1,{ref:r,className:je("text-sm font-semibold",t),...e}));O1.displayName=p1.displayName;const I1=x.forwardRef(({className:t,...e},r)=>l.jsx(m1,{ref:r,className:je("text-sm opacity-90",t),...e}));I1.displayName=m1.displayName;function W2(){const{toasts:t}=gr();return l.jsxs(H2,{children:[t.map(function({id:e,title:r,description:s,action:n,...a}){return l.jsxs(T1,{...a,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(O1,{children:r}),s&&l.jsx(I1,{children:s})]}),n,l.jsx(A1,{})]},e)}),l.jsx(R1,{})]})}var Q2=xm[" useId ".trim().toString()]||(()=>{}),G2=0;function ea(t){const[e,r]=x.useState(Q2());return Bt(()=>{r(s=>s??String(G2++))},[t]),e?`radix-${e}`:""}const Z2=["top","right","bottom","left"],aa=Math.min,br=Math.max,Ou=Math.round,Pc=Math.floor,jn=t=>({x:t,y:t}),Y2={left:"right",right:"left",bottom:"top",top:"bottom"},J2={start:"end",end:"start"};function vp(t,e,r){return br(t,aa(e,r))}function os(t,e){return typeof t=="function"?t(e):t}function is(t){return t.split("-")[0]}function Ei(t){return t.split("-")[1]}function _v(t){return t==="x"?"y":"x"}function Ev(t){return t==="y"?"height":"width"}const X2=new Set(["top","bottom"]);function Cn(t){return X2.has(is(t))?"y":"x"}function Cv(t){return _v(Cn(t))}function eR(t,e,r){r===void 0&&(r=!1);const s=Ei(t),n=Cv(t),a=Ev(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 tR(t){const e=Iu(t);return[gp(t),e,gp(e)]}function gp(t){return t.replace(/start|end/g,e=>J2[e])}const e0=["left","right"],t0=["right","left"],rR=["top","bottom"],nR=["bottom","top"];function sR(t,e,r){switch(t){case"top":case"bottom":return r?e?t0:e0:e?e0:t0;case"left":case"right":return e?rR:nR;default:return[]}}function aR(t,e,r,s){const n=Ei(t);let a=sR(is(t),r==="start",s);return n&&(a=a.map(o=>o+"-"+n),e&&(a=a.concat(a.map(gp)))),a}function Iu(t){return t.replace(/left|right|bottom|top/g,e=>Y2[e])}function oR(t){return{top:0,right:0,bottom:0,left:0,...t}}function D1(t){return typeof t!="number"?oR(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=Cv(e),i=Ev(o),c=is(e),u=a==="y",d=s.x+s.width/2-n.width/2,f=s.y+s.height/2-n.height/2,m=s[i]/2-n[i]/2;let h;switch(c){case"top":h={x:d,y:s.y-n.height};break;case"bottom":h={x:d,y:s.y+s.height};break;case"right":h={x:s.x+s.width,y:f};break;case"left":h={x:s.x-n.width,y:f};break;default:h={x:s.x,y:s.y}}switch(Ei(e)){case"start":h[o]-=m*(r&&u?-1:1);break;case"end":h[o]+=m*(r&&u?-1:1);break}return h}const iR=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:f}=r0(u,s,c),m=s,h={},w=0;for(let p=0;p<i.length;p++){const{name:g,fn:y}=i[p],{x:v,y:b,data:S,reset:E}=await y({x:d,y:f,initialPlacement:s,placement:m,strategy:n,middlewareData:h,rects:u,platform:o,elements:{reference:t,floating:e}});d=v??d,f=b??f,h={...h,[g]:{...h[g],...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:f}=r0(u,m,c)),p=-1)}return{x:d,y:f,placement:m,strategy:n,middlewareData:h}};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:f="floating",altBoundary:m=!1,padding:h=0}=os(e,t),w=D1(h),g=i[m?f==="floating"?"reference":"floating":f],y=Du(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(g)))==null||r?g:g.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="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:(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 lR=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 f=D1(d),m={x:r,y:s},h=Cv(n),w=Ev(h),p=await o.getDimensions(u),g=h==="y",y=g?"top":"left",v=g?"bottom":"right",b=g?"clientHeight":"clientWidth",S=a.reference[w]+a.reference[h]-m[h]-a.floating[w],E=m[h]-a.reference[h],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let N=k?k[b]:0;(!N||!await(o.isElement==null?void 0:o.isElement(k)))&&(N=i.floating[b]||a.floating[w]);const T=S/2-E/2,D=N/2-p[w]/2-1,U=aa(f[y],D),R=aa(f[v],D),A=U,_=N-p[w]-R,O=N/2-p[w]/2+T,z=vp(A,O,_),j=!c.arrow&&Ei(n)!=null&&O!==z&&a.reference[w]/2-(O<A?U:R)-p[w]/2<0,K=j?O<A?O-A:O-_:0;return{[h]:m[h]+K,data:{[h]:z,centerOffset:O-z-K,...j&&{alignmentOffset:K}},reset:j}}}),cR=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:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:p=!0,...g}=os(t,e);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const y=is(n),v=Cn(i),b=is(i)===i,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),E=m||(b||!p?[Iu(i)]:tR(i)),k=w!=="none";!m&&k&&E.push(...aR(i,p,w,S));const N=[i,...E],T=await Nl(e,g),D=[];let U=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&D.push(T[y]),f){const O=eR(n,o,S);D.push(T[O[0]],T[O[1]])}if(U=[...U,{placement:n,overflows:D}],!D.every(O=>O<=0)){var R,A;const O=(((R=a.flip)==null?void 0:R.index)||0)+1,z=N[O];if(z&&(!(f==="alignment"?v!==Cn(z):!1)||U.every(C=>Cn(C.placement)===v?C.overflows[0]>0:!0)))return{data:{index:O,overflows:U},reset:{placement:z}};let j=(A=U.filter(K=>K.overflows[0]<=0).sort((K,C)=>K.overflows[1]-C.overflows[1])[0])==null?void 0:A.placement;if(!j)switch(h){case"bestFit":{var _;const K=(_=U.filter(C=>{if(k){const F=Cn(C.placement);return F===v||F==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(F=>F>0).reduce((F,L)=>F+L,0)]).sort((C,F)=>C[1]-F[1])[0])==null?void 0:_[0];K&&(j=K);break}case"initialPlacement":j=i;break}if(n!==j)return{reset:{placement:j}}}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 Z2.some(e=>t[e]>=0)}const uR=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 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{}}}}},$1=new Set(["left","top"]);async function dR(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=Ei(r),c=Cn(r)==="y",u=$1.has(o)?-1:1,d=a&&c?-1:1,f=os(e,t);let{mainAxis:m,crossAxis:h,alignmentAxis:w}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return i&&typeof w=="number"&&(h=i==="end"?w*-1:w),c?{x:h*d,y:m*u}:{x:m*u,y:h*d}}const fR=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 dR(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}}}}},hR=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:g=>{let{x:y,y:v}=g;return{x:y,y:v}}},...c}=os(t,e),u={x:r,y:s},d=await Nl(e,c),f=Cn(is(n)),m=_v(f);let h=u[m],w=u[f];if(a){const g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",v=h+d[g],b=h-d[y];h=vp(v,h,b)}if(o){const g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",v=w+d[g],b=w-d[y];w=vp(v,w,b)}const p=i.fn({...e,[m]:h,[f]:w});return{...p,data:{x:p.x-r,y:p.y-s,enabled:{[m]:a,[f]:o}}}}}},pR=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},f=Cn(n),m=_v(f);let h=d[m],w=d[f];const p=os(i,e),g=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]+g.mainAxis,E=a.reference[m]+a.reference[b]-g.mainAxis;h<S?h=S:h>E&&(h=E)}if(u){var y,v;const b=m==="y"?"width":"height",S=$1.has(is(n)),E=a.reference[f]-a.floating[b]+(S&&((y=o.offset)==null?void 0:y[f])||0)+(S?0:g.crossAxis),k=a.reference[f]+a.reference[b]+(S?0:((v=o.offset)==null?void 0:v[f])||0)-(S?g.crossAxis:0);w<E?w=E:w>k&&(w=k)}return{[m]:h,[f]:w}}}},mR=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 Nl(e,u),f=is(n),m=Ei(n),h=Cn(n)==="y",{width:w,height:p}=a.floating;let g,y;f==="top"||f==="bottom"?(g=f,y=m===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(y=f,g=m==="end"?"top":"bottom");const v=p-d.top-d.bottom,b=w-d.left-d.right,S=aa(p-d[g],v),E=aa(w-d[y],b),k=!e.middlewareData.shift;let N=S,T=E;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(T=b),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(N=v),k&&!m){const U=br(d.left,0),R=br(d.right,0),A=br(d.top,0),_=br(d.bottom,0);h?T=w-2*(U!==0||R!==0?U+R:br(d.left,d.right)):N=p-2*(A!==0||_!==0?A+_:br(d.top,d.bottom))}await c({...e,availableWidth:T,availableHeight:N});const D=await o.getDimensions(i.floating);return w!==D.width||p!==D.height?{reset:{rects:!0}}:{}}}};function jd(){return typeof window<"u"}function Ci(t){return M1(t)?(t.nodeName||"").toLowerCase():"#document"}function Er(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 jd()?t instanceof Node||t instanceof Er(t).Node:!1}function an(t){return jd()?t instanceof Element||t instanceof Er(t).Element:!1}function Tn(t){return jd()?t instanceof HTMLElement||t instanceof Er(t).HTMLElement:!1}function a0(t){return!jd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Er(t).ShadowRoot}const vR=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)&&!vR.has(n)}const gR=new Set(["table","td","th"]);function yR(t){return gR.has(Ci(t))}const xR=[":popover-open",":modal"];function Rd(t){return xR.some(e=>{try{return t.matches(e)}catch{return!1}})}const wR=["transform","translate","scale","rotate","perspective"],bR=["transform","translate","scale","rotate","perspective","filter"],SR=["paint","layout","strict","content"];function Pv(t){const e=kv(),r=an(t)?on(t):t;return wR.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)||bR.some(s=>(r.willChange||"").includes(s))||SR.some(s=>(r.contain||"").includes(s))}function _R(t){let e=oa(t);for(;Tn(e)&&!pi(e);){if(Pv(e))return e;if(Rd(e))return null;e=oa(e)}return null}function kv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ER=new Set(["html","body","#document"]);function pi(t){return ER.has(Ci(t))}function on(t){return Er(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(Ci(t)==="html")return t;const e=t.assignedSlot||t.parentNode||a0(t)&&t.host||On(t);return a0(e)?e.host:e}function F1(t){const e=oa(t);return pi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Tn(e)&&Hl(e)?e:F1(e)}function jl(t,e,r){var s;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=F1(t),a=n===((s=t.ownerDocument)==null?void 0:s.body),o=Er(n);if(a){const i=yp(o);return e.concat(o,o.visualViewport||[],Hl(n)?n:[],i&&r?jl(i):[])}return e.concat(n,jl(n,[],r))}function yp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function L1(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 Nv(t){return an(t)?t:t.contextElement}function Vo(t){const e=Nv(t);if(!Tn(e))return jn(1);const r=e.getBoundingClientRect(),{width:s,height:n,$:a}=L1(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 CR=jn(0);function U1(t){const e=Er(t);return!kv()||!e.visualViewport?CR:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function PR(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Er(t)?!1:e}function Qa(t,e,r,s){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),a=Nv(t);let o=jn(1);e&&(s?an(s)&&(o=Vo(s)):o=Vo(t));const i=PR(a,r,s)?U1(a):jn(0);let c=(n.left+i.x)/o.x,u=(n.top+i.y)/o.y,d=n.width/o.x,f=n.height/o.y;if(a){const m=Er(a),h=s&&an(s)?Er(s):s;let w=m,p=yp(w);for(;p&&s&&h!==w;){const g=Vo(p),y=p.getBoundingClientRect(),v=on(p),b=y.left+(p.clientLeft+parseFloat(v.paddingLeft))*g.x,S=y.top+(p.clientTop+parseFloat(v.paddingTop))*g.y;c*=g.x,u*=g.y,d*=g.x,f*=g.y,c+=b,u+=S,w=Er(p),p=yp(w)}}return Du({width:d,height:f,x:c,y:u})}function Ad(t,e){const r=Td(t).scrollLeft;return e?e.left+r:Qa(On(t)).left+r}function z1(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 kR(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),f=Tn(s);if((f||!f&&!a)&&((Ci(s)!=="body"||Hl(o))&&(c=Td(s)),Tn(s))){const h=Qa(s);u=Vo(s),d.x=h.x+s.clientLeft,d.y=h.y+s.clientTop}const m=o&&!f&&!a?z1(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 NR(t){return Array.from(t.getClientRects())}function jR(t){const e=On(t),r=Td(t),s=t.ownerDocument.body,n=br(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),a=br(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let o=-r.scrollLeft+Ad(t);const i=-r.scrollTop;return on(s).direction==="rtl"&&(o+=br(e.clientWidth,s.clientWidth)-n),{width:n,height:a,x:o,y:i}}const o0=25;function RR(t,e){const r=Er(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=kv();(!d||d&&e==="fixed")&&(i=n.offsetLeft,c=n.offsetTop)}const u=Ad(s);if(u<=0){const d=s.ownerDocument,f=d.body,m=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,w=Math.abs(s.clientWidth-f.clientWidth-h);w<=o0&&(a-=w)}else u<=o0&&(a+=u);return{width:a,height:o,x:i,y:c}}const TR=new Set(["absolute","fixed"]);function AR(t,e){const r=Qa(t,!0,e==="fixed"),s=r.top+t.clientTop,n=r.left+t.clientLeft,a=Tn(t)?Vo(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=RR(t,r);else if(e==="document")s=jR(On(t));else if(an(e))s=AR(e,r);else{const n=U1(t);s={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return Du(s)}function V1(t,e){const r=oa(t);return r===e||!an(r)||pi(r)?!1:on(r).position==="fixed"||V1(r,e)}function OR(t,e){const r=e.get(t);if(r)return r;let s=jl(t,[],!1).filter(i=>an(i)&&Ci(i)!=="body"),n=null;const a=on(t).position==="fixed";let o=a?oa(t):t;for(;an(o)&&!pi(o);){const i=on(o),c=Pv(o);!c&&i.position==="fixed"&&(n=null),(a?!c&&!n:!c&&i.position==="static"&&!!n&&TR.has(n.position)||Hl(o)&&!c&&V1(t,o))?s=s.filter(d=>d!==o):n=i,o=oa(o)}return e.set(t,s),s}function IR(t){let{element:e,boundary:r,rootBoundary:s,strategy:n}=t;const o=[...r==="clippingAncestors"?Rd(e)?[]:OR(e,this._c):[].concat(r),s],i=o[0],c=o.reduce((u,d)=>{const f=i0(e,d,n);return u.top=br(f.top,u.top),u.right=aa(f.right,u.right),u.bottom=aa(f.bottom,u.bottom),u.left=br(f.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 DR(t){const{width:e,height:r}=L1(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=Ad(n)}if(s||!s&&!a)if((Ci(e)!=="body"||Hl(n))&&(i=Td(e)),s){const h=Qa(e,!0,a,e);c.x=h.x+e.clientLeft,c.y=h.y+e.clientTop}else n&&u();a&&!s&&n&&u();const d=n&&!s&&!a?z1(n,i):jn(0),f=o.left+i.scrollLeft-c.x-d.x,m=o.top+i.scrollTop-c.y-d.y;return{x:f,y:m,width:o.width,height:o.height}}function Mf(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 q1(t,e){const r=Er(t);if(Rd(t))return r;if(!Tn(t)){let n=oa(t);for(;n&&!pi(n);){if(an(n)&&!Mf(n))return n;n=oa(n)}return r}let s=l0(t,e);for(;s&&yR(s)&&Mf(s);)s=l0(s,e);return s&&pi(s)&&Mf(s)&&!Pv(s)?r:s||_R(t)||r}const MR=async function(t){const e=this.getOffsetParent||q1,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 FR(t){return on(t).direction==="rtl"}const LR={convertOffsetParentRelativeRectToViewportRelativeRect:kR,getDocumentElement:On,getClippingRect:IR,getOffsetParent:q1,getElementRects:MR,getClientRects:NR,getDimensions:DR,getScale:Vo,isElement:an,isRTL:FR};function H1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function UR(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:f,width:m,height:h}=u;if(i||e(),!m||!h)return;const w=Pc(f),p=Pc(n.clientWidth-(d+m)),g=Pc(n.clientHeight-(f+h)),y=Pc(d),b={rootMargin:-w+"px "+-p+"px "+-g+"px "+-y+"px",threshold:br(0,aa(1,c))||1};let S=!0;function E(k){const N=k[0].intersectionRatio;if(N!==c){if(!S)return o();N?o(!1,N):s=setTimeout(()=>{o(!1,1e-7)},1e3)}N===1&&!H1(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 zR(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=Nv(t),d=n||a?[...u?jl(u):[],...jl(e)]:[];d.forEach(y=>{n&&y.addEventListener("scroll",r,{passive:!0}),a&&y.addEventListener("resize",r)});const f=u&&i?UR(u,r):null;let m=-1,h=null;o&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),r()}),u&&!c&&h.observe(u),h.observe(e));let w,p=c?Qa(t):null;c&&g();function g(){const y=Qa(t);p&&!H1(p,y)&&r(),p=y,w=requestAnimationFrame(g)}return r(),()=>{var y;d.forEach(v=>{n&&v.removeEventListener("scroll",r),a&&v.removeEventListener("resize",r)}),f==null||f(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(w)}}const VR=fR,qR=hR,HR=cR,BR=mR,KR=uR,c0=lR,WR=pR,QR=(t,e,r)=>{const s=new Map,n={platform:LR,...r},a={...n.platform,_c:s};return iR(t,e,{...n,platform:a})};var GR=typeof document<"u",ZR=function(){},Gc=GR?x.useLayoutEffect:ZR;function $u(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(!$u(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)&&!$u(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function B1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function u0(t,e){const r=B1(t);return Math.round(e*r)/r}function Ff(t){const e=x.useRef(t);return Gc(()=>{e.current=t}),e}function YR(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,f]=x.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[m,h]=x.useState(s);$u(m,s)||h(s);const[w,p]=x.useState(null),[g,y]=x.useState(null),v=x.useCallback(C=>{C!==k.current&&(k.current=C,p(C))},[]),b=x.useCallback(C=>{C!==N.current&&(N.current=C,y(C))},[]),S=a||w,E=o||g,k=x.useRef(null),N=x.useRef(null),T=x.useRef(d),D=c!=null,U=Ff(c),R=Ff(n),A=Ff(u),_=x.useCallback(()=>{if(!k.current||!N.current)return;const C={placement:e,strategy:r,middleware:m};R.current&&(C.platform=R.current),QR(k.current,N.current,C).then(F=>{const L={...F,isPositioned:A.current!==!1};O.current&&!$u(T.current,L)&&(T.current=L,so.flushSync(()=>{f(L)}))})},[m,e,r,R,A]);Gc(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(C=>({...C,isPositioned:!1})))},[u]);const O=x.useRef(!1);Gc(()=>(O.current=!0,()=>{O.current=!1}),[]),Gc(()=>{if(S&&(k.current=S),E&&(N.current=E),S&&E){if(U.current)return U.current(S,E,_);_()}},[S,E,_,U,D]);const z=x.useMemo(()=>({reference:k,floating:N,setReference:v,setFloating:b}),[v,b]),j=x.useMemo(()=>({reference:S,floating:E}),[S,E]),K=x.useMemo(()=>{const C={position:r,left:0,top:0};if(!j.floating)return C;const F=u0(j.floating,d.x),L=u0(j.floating,d.y);return i?{...C,transform:"translate("+F+"px, "+L+"px)",...B1(j.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:L}},[r,i,j.floating,d.x,d.y]);return x.useMemo(()=>({...d,update:_,refs:z,elements:j,floatingStyles:K}),[d,_,z,j,K])}const JR=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):{}}}},XR=(t,e)=>({...VR(t),options:[t,e]}),eT=(t,e)=>({...qR(t),options:[t,e]}),tT=(t,e)=>({...WR(t),options:[t,e]}),rT=(t,e)=>({...HR(t),options:[t,e]}),nT=(t,e)=>({...BR(t),options:[t,e]}),sT=(t,e)=>({...KR(t),options:[t,e]}),aT=(t,e)=>({...JR(t),options:[t,e]});var oT="Arrow",K1=x.forwardRef((t,e)=>{const{children:r,width:s=10,height:n=5,...a}=t;return l.jsx(Re.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"})})});K1.displayName=oT;var iT=K1;function W1(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 jv="Popper",[Q1,Od]=ds(jv),[lT,G1]=Q1(jv),Z1=t=>{const{__scopePopper:e,children:r}=t,[s,n]=x.useState(null);return l.jsx(lT,{scope:e,anchor:s,onAnchorChange:n,children:r})};Z1.displayName=jv;var Y1="PopperAnchor",J1=x.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:s,...n}=t,a=G1(Y1,r),o=x.useRef(null),i=nt(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(Re.div,{...n,ref:i})});J1.displayName=Y1;var Rv="PopperContent",[cT,uT]=Q1(Rv),X1=x.forwardRef((t,e)=>{var X,he,pe,ye,ue,Pe;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:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:w,...p}=t,g=G1(Rv,r),[y,v]=x.useState(null),b=nt(e,Ae=>v(Ae)),[S,E]=x.useState(null),k=W1(S),N=(k==null?void 0:k.width)??0,T=(k==null?void 0:k.height)??0,D=s+(a!=="center"?"-"+a:""),U=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},R=Array.isArray(u)?u:[u],A=R.length>0,_={padding:U,boundary:R.filter(fT),altBoundary:A},{refs:O,floatingStyles:z,placement:j,isPositioned:K,middlewareData:C}=YR({strategy:"fixed",placement:D,whileElementsMounted:(...Ae)=>zR(...Ae,{animationFrame:h==="always"}),elements:{reference:g.anchor},middleware:[XR({mainAxis:n+T,alignmentAxis:o}),c&&eT({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?tT():void 0,..._}),c&&rT({..._}),nT({..._,apply:({elements:Ae,rects:De,availableWidth:J,availableHeight:ie})=>{const{width:Y,height:ze}=De.reference,ee=Ae.floating.style;ee.setProperty("--radix-popper-available-width",`${J}px`),ee.setProperty("--radix-popper-available-height",`${ie}px`),ee.setProperty("--radix-popper-anchor-width",`${Y}px`),ee.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),S&&aT({element:S,padding:i}),hT({arrowWidth:N,arrowHeight:T}),m&&sT({strategy:"referenceHidden",..._})]}),[F,L]=rS(j),Q=Ur(w);Bt(()=>{K&&(Q==null||Q())},[K,Q]);const te=(X=C.arrow)==null?void 0:X.x,V=(he=C.arrow)==null?void 0:he.y,de=((pe=C.arrow)==null?void 0:pe.centerOffset)!==0,[Te,ge]=x.useState();return Bt(()=>{y&&ge(window.getComputedStyle(y).zIndex)},[y]),l.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:K?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Te,"--radix-popper-transform-origin":[(ye=C.transformOrigin)==null?void 0:ye.x,(ue=C.transformOrigin)==null?void 0:ue.y].join(" "),...((Pe=C.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:l.jsx(cT,{scope:r,placedSide:F,onArrowChange:E,arrowX:te,arrowY:V,shouldHideArrow:de,children:l.jsx(Re.div,{"data-side":F,"data-align":L,...p,ref:b,style:{...p.style,animation:K?void 0:"none"}})})})});X1.displayName=Rv;var eS="PopperArrow",dT={top:"bottom",right:"left",bottom:"top",left:"right"},tS=x.forwardRef(function(e,r){const{__scopePopper:s,...n}=e,a=uT(eS,s),o=dT[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(iT,{...n,ref:r,style:{...n.style,display:"block"}})})});tS.displayName=eS;function fT(t){return t!==null}var hT=t=>({name:"transformOrigin",options:t,fn(e){var g,y,v;const{placement:r,rects:s,middlewareData:n}=e,o=((g=n.arrow)==null?void 0:g.centerOffset)!==0,i=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[u,d]=rS(r),f={start:"0%",center:"50%",end:"100%"}[d],m=(((y=n.arrow)==null?void 0:y.x)??0)+i/2,h=(((v=n.arrow)==null?void 0:v.y)??0)+c/2;let w="",p="";return u==="bottom"?(w=o?f:`${m}px`,p=`${-c}px`):u==="top"?(w=o?f:`${m}px`,p=`${s.floating.height+c}px`):u==="right"?(w=`${-c}px`,p=o?f:`${h}px`):u==="left"&&(w=`${s.floating.width+c}px`,p=o?f:`${h}px`),{data:{x:w,y:p}}}});function rS(t){const[e,r="center"]=t.split("-");return[e,r]}var pT=Z1,nS=J1,sS=X1,aS=tS,[Id,uF]=ds("Tooltip",[Od]),Tv=Od(),oS="TooltipProvider",mT=700,d0="tooltip.open",[vT,iS]=Id(oS),lS=t=>{const{__scopeTooltip:e,delayDuration:r=mT,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(vT,{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})};lS.displayName=oS;var cS="Tooltip",[dF,Dd]=Id(cS),xp="TooltipTrigger",gT=x.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,n=Dd(xp,r),a=iS(xp,r),o=Tv(r),i=x.useRef(null),c=nt(e,i,n.onTriggerChange),u=x.useRef(!1),d=x.useRef(!1),f=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(nS,{asChild:!0,...o,children:l.jsx(Re.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",f,{once:!0})}),onFocus:Se(t.onFocus,()=>{u.current||n.onOpen()}),onBlur:Se(t.onBlur,n.onClose),onClick:Se(t.onClick,n.onClose)})})});gT.displayName=xp;var yT="TooltipPortal",[fF,xT]=Id(yT,{forceMount:void 0}),mi="TooltipContent",uS=x.forwardRef((t,e)=>{const r=xT(mi,t.__scopeTooltip),{forceMount:s=r.forceMount,side:n="top",...a}=t,o=Dd(mi,t.__scopeTooltip);return l.jsx(da,{present:s||o.open,children:o.disableHoverableContent?l.jsx(dS,{side:n,...a,ref:e}):l.jsx(wT,{side:n,...a,ref:e})})}),wT=x.forwardRef((t,e)=>{const r=Dd(mi,t.__scopeTooltip),s=iS(mi,t.__scopeTooltip),n=x.useRef(null),a=nt(e,n),[o,i]=x.useState(null),{trigger:c,onClose:u}=r,d=n.current,{onPointerInTransitChange:f}=s,m=x.useCallback(()=>{i(null),f(!1)},[f]),h=x.useCallback((w,p)=>{const g=w.currentTarget,y={x:w.clientX,y:w.clientY},v=CT(y,g.getBoundingClientRect()),b=PT(y,v),S=kT(p.getBoundingClientRect()),E=jT([...b,...S]);i(E),f(!0)},[f]);return x.useEffect(()=>()=>m(),[m]),x.useEffect(()=>{if(c&&d){const w=g=>h(g,d),p=g=>h(g,c);return c.addEventListener("pointerleave",w),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",w),d.removeEventListener("pointerleave",p)}}},[c,d,h,m]),x.useEffect(()=>{if(o){const w=p=>{const g=p.target,y={x:p.clientX,y:p.clientY},v=(c==null?void 0:c.contains(g))||(d==null?void 0:d.contains(g)),b=!NT(y,o);v?m():b&&(m(),u())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[c,d,o,u,m]),l.jsx(dS,{...t,ref:a})}),[bT,ST]=Id(cS,{isInside:!1}),_T=hj("TooltipContent"),dS=x.forwardRef((t,e)=>{const{__scopeTooltip:r,children:s,"aria-label":n,onEscapeKeyDown:a,onPointerDownOutside:o,...i}=t,c=Dd(mi,r),u=Tv(r),{onClose:d}=c;return x.useEffect(()=>(document.addEventListener(d0,d),()=>document.removeEventListener(d0,d)),[d]),x.useEffect(()=>{if(c.trigger){const f=m=>{const h=m.target;h!=null&&h.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Vl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(sS,{"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(_T,{children:s}),l.jsx(bT,{scope:r,isInside:!0,children:l.jsx(Dj,{id:c.contentId,role:"tooltip",children:n||s})})]})})});uS.displayName=mi;var fS="TooltipArrow",ET=x.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,n=Tv(r);return ST(fS,r).isInside?null:l.jsx(aS,{...n,...s,ref:e})});ET.displayName=fS;function CT(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 PT(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 kT(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 NT(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,f=c.x,m=c.y;d>s!=m>s&&r<(f-u)*(s-d)/(m-d)+u&&(n=!n)}return n}function jT(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),RT(e)}function RT(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 TT=lS,hS=uS;const AT=TT,OT=x.forwardRef(({className:t,sideOffset:e=4,...r},s)=>l.jsx(hS,{ref:s,sideOffset:e,className:je("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}));OT.displayName=hS.displayName;const IT={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 DT(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))}:IT}const xr="#92E4DD",cr="#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"?xr:t.cardColor??xr}function Sn(t){return{borderColor:t,color:t,boxShadow:`0 0 20px ${t}20`}}const $T=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"}}),ve=x.forwardRef(({className:t,variant:e,size:r,asChild:s=!1,...n},a)=>{const o=s?dj:"button";return l.jsx(o,{className:je($T({variant:e,size:r,className:t})),ref:a,...n})});ve.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 pS(t){return t.iconUrl?t.iconUrl:null}function qo({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 MT=t=>{const e=Wr(t),r=pS(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 FT({service:t,onDragStart:e,onDragEnd:r,isInActiveDeck:s,onCardClick:n,isInCollection:a=!1,onMouseEnter:o,onMouseLeave:i,activeDeck:c,warnings:u}){const d=vr(),{toast:f}=gr(),m=Wr(t),h=Ot({mutationFn:async()=>{if(!c)throw new Error("No active deck found");return Ue("POST",`/api/decks/${c.id}/services`,{serviceId:t.id,position:0})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Service added to deck",description:`${t.name} has been added to your active deck.`})},onError:y=>{f({title:"Failed to add service",description:y.message,variant:"destructive"})}}),w=Ot({mutationFn:async()=>Ue("DELETE",`/api/services/${t.id}`,{}),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Service deleted",description:`${t.name} has been deleted successfully.`})},onError:y=>{f({title:"Failed to delete service",description:y.message,variant:"destructive"})}}),p=y=>{y.stopPropagation(),h.mutate()},g=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:`
|
|
214
219
|
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
215
220
|
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
216
221
|
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
217
222
|
relative overflow-hidden
|
|
218
223
|
${s?"opacity-60":""}
|
|
219
224
|
${a?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
220
|
-
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(qo,{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(
|
|
225
|
+
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(qo,{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(ve,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:g,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:MT(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(ve,{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||h.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 LT=x.memo(FT);function UT(t){return t.iconUrl?t.iconUrl:null}function mS({credential:t,color:e}){const r=UT(t);return r?l.jsx("img",{src:r,alt:"",className:"h-7 w-7 object-contain rounded-sm",draggable:!1}):l.jsx(hp,{className:"h-7 w-7",strokeWidth:2.25,style:{color:e}})}function zT({credential:t,isInActiveDeck:e,activeDeck:r,isInCollection:s=!0,onDragStart:n,onDragEnd:a,onMouseEnter:o,onMouseLeave:i,onCardClick:c,warnings:u}){const d=vr(),{toast:f}=gr(),m=cr,h=Ot({mutationFn:async()=>{if(!r)throw new Error("No active deck found");return Ue("POST",`/api/decks/${r.id}/credentials`,{credentialId:t.id})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Added to deck",description:`${t.label} is in your active deck.`})},onError:p=>{f({title:"Failed to add to deck",description:p.message,variant:"destructive"})}}),w=Ot({mutationFn:async()=>Ue("DELETE",`/api/credentials/${t.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/credentials/vault"]}),d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"API key removed",description:`${t.label} was deleted from your vault.`})},onError:p=>{f({title:"Failed to remove API key",description:p.message,variant:"destructive"})}});return l.jsx("div",{className:"relative group cursor-pointer",draggable:!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:`
|
|
221
226
|
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
222
227
|
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
223
228
|
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
224
229
|
relative overflow-hidden
|
|
225
230
|
${e?"opacity-60":""}
|
|
226
231
|
${s?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
227
|
-
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(qo,{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(
|
|
232
|
+
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(qo,{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(ve,{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(mS,{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(ve,{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(),h.mutate()},disabled:e||h.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 VT=x.memo(zT);function qT({playbook:t,isInActiveDeck:e,activeDeck:r,isInCollection:s=!0,onDragStart:n,onDragEnd:a,onMouseEnter:o,onMouseLeave:i,onCardClick:c,warnings:u}){const d=vr(),{toast:f}=gr(),m=Yr,h=t.dependsOnCredentialIds.length+t.dependsOnServiceIds.length,w=Ot({mutationFn:async()=>{if(!r)throw new Error("No deck selected");return Ue("POST",`/api/decks/${r.id}/playbooks`,{playbookId:t.id})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Playbook added to deck",description:`${t.title} is on this deck.`})},onError:g=>{f({title:"Failed to add playbook",description:g.message,variant:"destructive"})}}),p=Ot({mutationFn:async()=>Ue("DELETE",`/api/playbooks/${t.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/playbooks/vault"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Playbook deleted",description:`${t.title} was removed from your collection.`})},onError:g=>{f({title:"Failed to delete playbook",description:g.message,variant:"destructive"})}});return l.jsx("div",{className:"relative group cursor-pointer",draggable:!e&&!!n,onDragStart:n?g=>n(g,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:`
|
|
228
233
|
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
229
234
|
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
230
235
|
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
231
236
|
relative overflow-hidden
|
|
232
237
|
${e?"opacity-60":""}
|
|
233
238
|
${s?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
234
|
-
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(qo,{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(me,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:g=>{g.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(wv,{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",h>0?` · ${h} deps`:""]})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(me,{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:g=>{g.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:f,onCredentialClick:m}){const h=v=>{v.preventDefault(),a(v)},w=v=>{v.preventDefault()},p=v=>{const b=Wr(v),S=p1(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(${Mu}) no-repeat center / contain`,mask:`url(${Mu}) no-repeat center / contain`}})},g=e.length+r.length+s.length,y=(v,b)=>l.jsx("div",{className:"relative transition-all duration-500 hover:z-20 hover:scale-110",style:{zIndex:g-b,transform:`rotate(${(b-g/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:()=>f==null?void 0:f(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(qo,{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(wv,{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:["(",g," cards)"]})]})}),l.jsx("div",{className:"relative flex-1 p-4 rounded-xl border-2 border-dashed flex items-center justify-center overflow-hidden",onDrop:h,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:g===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:g-b,transform:`rotate(${(b-g/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:cr,boxShadow:`0 0 20px ${cr}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(qo,{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:cr},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:cr},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:cr},children:l.jsx(m1,{credential:v,color:cr})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:cr},children:v.label}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:cr,borderColor:cr},children:v.hasSecret?"API Key":"Missing key"})]})]})},v.id)),s.map((v,b)=>y(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:g-S,transform:`rotate(${(S-g/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:k=>o(k,v,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(qo,{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 Lf="focusScope.autoFocusOnMount",Uf="focusScope.autoFocusOnUnmount",f0={bubbles:!1,cancelable:!0},WT="FocusScope",Av=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),f=x.useRef(null),m=nt(e,p=>c(p)),h=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(s){let p=function(b){if(h.paused||!i)return;const S=b.target;i.contains(S)?f.current=S:Ss(f.current,{select:!0})},g=function(b){if(h.paused||!i)return;const S=b.relatedTarget;S!==null&&(i.contains(S)||Ss(f.current,{select:!0}))},y=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",g);const v=new MutationObserver(y);return i&&v.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",g),v.disconnect()}}},[s,i,h.paused]),x.useEffect(()=>{if(i){p0.add(h);const p=document.activeElement;if(!i.contains(p)){const y=new CustomEvent(Lf,f0);i.addEventListener(Lf,u),i.dispatchEvent(y),y.defaultPrevented||(QT(XT(v1(i)),{select:!0}),document.activeElement===p&&Ss(i))}return()=>{i.removeEventListener(Lf,u),setTimeout(()=>{const y=new CustomEvent(Uf,f0);i.addEventListener(Uf,d),i.dispatchEvent(y),y.defaultPrevented||Ss(p??document.body,{select:!0}),i.removeEventListener(Uf,d),p0.remove(h)},0)}}},[i,u,d,h]);const w=x.useCallback(p=>{if(!r&&!s||h.paused)return;const g=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(g&&y){const v=p.currentTarget,[b,S]=GT(v);b&&S?!p.shiftKey&&y===S?(p.preventDefault(),r&&Ss(b,{select:!0})):p.shiftKey&&y===b&&(p.preventDefault(),r&&Ss(S,{select:!0})):y===v&&p.preventDefault()}},[r,s,h.paused]);return l.jsx(Re.div,{tabIndex:-1,...o,ref:m,onKeyDown:w})});Av.displayName=WT;function QT(t,{select:e=!1}={}){const r=document.activeElement;for(const s of t)if(Ss(s,{select:e}),document.activeElement!==r)return}function GT(t){const e=v1(t),r=h0(e,t),s=h0(e.reverse(),t);return[r,s]}function v1(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(!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 Ss(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&YT(t)&&e&&t.select()}}var p0=JT();function JT(){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 XT(t){return t.filter(e=>e.tagName!=="A")}var zf=0;function g1(){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()),zf++,()=>{zf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),zf--}},[])}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 y1(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 Zc="right-scroll-bar-position",Yc="width-before-scroll-bar",tA="with-scroll-bars-hidden",rA="--removed-body-scroll-bar-size";function Vf(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,g0=new WeakMap;function aA(t,e){var r=nA(null,function(s){return t.forEach(function(n){return Vf(n,s)})});return sA(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)||Vf(i,null)}),a.forEach(function(i){n.has(i)||Vf(i,o)})}g0.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 x1=function(t){var e=t.sideCar,r=y1(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))};x1.isSideCarExport=!0;function cA(t,e){return t.useMedium(e),x1}var w1=lA(),qf=function(){},$d=x.forwardRef(function(t,e){var r=x.useRef(null),s=x.useState({onScrollCapture:qf,onWheelCapture:qf,onTouchMoveCapture:qf}),n=s[0],a=s[1],o=t.forwardProps,i=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,m=t.sideCar,h=t.noRelative,w=t.noIsolation,p=t.inert,g=t.allowPinchZoom,y=t.as,v=y===void 0?"div":y,b=t.gapMode,S=y1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,k=aA([r,e]),N=_n(_n({},S),n);return x.createElement(x.Fragment,null,d&&x.createElement(E,{sideCar:w1,removeScrollBar:u,shards:f,noRelative:h,noIsolation:w,inert:p,setCallbacks:a,allowPinchZoom:!!g,lockRef:r,gapMode:b}),o?x.cloneElement(x.Children.only(i),_n(_n({},N),{ref:k})):x.createElement(v,_n({},N,{className:c,ref:k}),i))});$d.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};$d.classNames={fullWidth:Yc,zeroRight:Zc};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])}},b1=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},Hf=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[Hf(r),Hf(s),Hf(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=b1(),Ho="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"),`
|
|
235
|
-
.`.concat(
|
|
239
|
+
`,style:{borderColor:m,boxShadow:`0 0 20px ${m}20`},children:[l.jsx(qo,{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(ve,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:g=>{g.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(wv,{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",h>0?` · ${h} deps`:""]})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(ve,{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:g=>{g.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 HT=x.memo(qT);function BT({deck:t,services:e,credentials:r=[],playbooks:s=[],collectionWarnings:n,onDrop:a,onDragStart:o,onCredentialDragStart:i,onPlaybookDragStart:c,onDragEnd:u,onCardClick:d,onPlaybookClick:f,onCredentialClick:m}){const h=v=>{v.preventDefault(),a(v)},w=v=>{v.preventDefault()},p=v=>{const b=Wr(v),S=pS(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(${Mu}) no-repeat center / contain`,mask:`url(${Mu}) no-repeat center / contain`}})},g=e.length+r.length+s.length,y=(v,b)=>l.jsx("div",{className:"relative transition-all duration-500 hover:z-20 hover:scale-110",style:{zIndex:g-b,transform:`rotate(${(b-g/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:()=>f==null?void 0:f(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(qo,{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(wv,{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:["(",g," cards)"]})]})}),l.jsx("div",{className:"relative flex-1 p-4 rounded-xl border-2 border-dashed flex items-center justify-center overflow-hidden",onDrop:h,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:g===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:g-b,transform:`rotate(${(b-g/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:cr,boxShadow:`0 0 20px ${cr}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(qo,{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:cr},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:cr},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:cr},children:l.jsx(mS,{credential:v,color:cr})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:cr},children:v.label}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:cr,borderColor:cr},children:v.hasSecret?"API Key":"Missing key"})]})]})},v.id)),s.map((v,b)=>y(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:g-S,transform:`rotate(${(S-g/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:k=>o(k,v,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(qo,{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 Lf="focusScope.autoFocusOnMount",Uf="focusScope.autoFocusOnUnmount",f0={bubbles:!1,cancelable:!0},KT="FocusScope",Av=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),f=x.useRef(null),m=nt(e,p=>c(p)),h=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(s){let p=function(b){if(h.paused||!i)return;const S=b.target;i.contains(S)?f.current=S:Ss(f.current,{select:!0})},g=function(b){if(h.paused||!i)return;const S=b.relatedTarget;S!==null&&(i.contains(S)||Ss(f.current,{select:!0}))},y=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",g);const v=new MutationObserver(y);return i&&v.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",g),v.disconnect()}}},[s,i,h.paused]),x.useEffect(()=>{if(i){p0.add(h);const p=document.activeElement;if(!i.contains(p)){const y=new CustomEvent(Lf,f0);i.addEventListener(Lf,u),i.dispatchEvent(y),y.defaultPrevented||(WT(JT(vS(i)),{select:!0}),document.activeElement===p&&Ss(i))}return()=>{i.removeEventListener(Lf,u),setTimeout(()=>{const y=new CustomEvent(Uf,f0);i.addEventListener(Uf,d),i.dispatchEvent(y),y.defaultPrevented||Ss(p??document.body,{select:!0}),i.removeEventListener(Uf,d),p0.remove(h)},0)}}},[i,u,d,h]);const w=x.useCallback(p=>{if(!r&&!s||h.paused)return;const g=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(g&&y){const v=p.currentTarget,[b,S]=QT(v);b&&S?!p.shiftKey&&y===S?(p.preventDefault(),r&&Ss(b,{select:!0})):p.shiftKey&&y===b&&(p.preventDefault(),r&&Ss(S,{select:!0})):y===v&&p.preventDefault()}},[r,s,h.paused]);return l.jsx(Re.div,{tabIndex:-1,...o,ref:m,onKeyDown:w})});Av.displayName=KT;function WT(t,{select:e=!1}={}){const r=document.activeElement;for(const s of t)if(Ss(s,{select:e}),document.activeElement!==r)return}function QT(t){const e=vS(t),r=h0(e,t),s=h0(e.reverse(),t);return[r,s]}function vS(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(!GT(r,{upTo:e}))return r}function GT(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 ZT(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&&ZT(t)&&e&&t.select()}}var p0=YT();function YT(){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 JT(t){return t.filter(e=>e.tagName!=="A")}var zf=0;function gS(){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()),zf++,()=>{zf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),zf--}},[])}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 yS(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 XT(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",eA="with-scroll-bars-hidden",tA="--removed-body-scroll-bar-size";function Vf(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function rA(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 nA=typeof window<"u"?x.useLayoutEffect:x.useEffect,g0=new WeakMap;function sA(t,e){var r=rA(null,function(s){return t.forEach(function(n){return Vf(n,s)})});return nA(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)||Vf(i,null)}),a.forEach(function(i){n.has(i)||Vf(i,o)})}g0.set(r,t)},[t]),r}function aA(t){return t}function oA(t,e){e===void 0&&(e=aA);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 iA(t){t===void 0&&(t={});var e=oA(null);return e.options=_n({async:!0,ssr:!1},t),e}var xS=function(t){var e=t.sideCar,r=yS(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))};xS.isSideCarExport=!0;function lA(t,e){return t.useMedium(e),xS}var wS=iA(),qf=function(){},$d=x.forwardRef(function(t,e){var r=x.useRef(null),s=x.useState({onScrollCapture:qf,onWheelCapture:qf,onTouchMoveCapture:qf}),n=s[0],a=s[1],o=t.forwardProps,i=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,m=t.sideCar,h=t.noRelative,w=t.noIsolation,p=t.inert,g=t.allowPinchZoom,y=t.as,v=y===void 0?"div":y,b=t.gapMode,S=yS(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,k=sA([r,e]),N=_n(_n({},S),n);return x.createElement(x.Fragment,null,d&&x.createElement(E,{sideCar:wS,removeScrollBar:u,shards:f,noRelative:h,noIsolation:w,inert:p,setCallbacks:a,allowPinchZoom:!!g,lockRef:r,gapMode:b}),o?x.cloneElement(x.Children.only(i),_n(_n({},N),{ref:k})):x.createElement(v,_n({},N,{className:c,ref:k}),i))});$d.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};$d.classNames={fullWidth:Yc,zeroRight:Zc};var cA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function uA(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=cA();return e&&t.setAttribute("nonce",e),t}function dA(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function fA(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var hA=function(){var t=0,e=null;return{add:function(r){t==0&&(e=uA())&&(dA(e,r),fA(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},pA=function(){var t=hA();return function(e,r){x.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},bS=function(){var t=pA(),e=function(r){var s=r.styles,n=r.dynamic;return t(s,n),null};return e},mA={left:0,top:0,right:0,gap:0},Hf=function(t){return parseInt(t||"",10)||0},vA=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[Hf(r),Hf(s),Hf(n)]},gA=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return mA;var e=vA(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])}},yA=bS(),Ho="data-scroll-locked",xA=function(t,e,r,s){var n=t.left,a=t.top,o=t.right,i=t.gap;return r===void 0&&(r="margin"),`
|
|
240
|
+
.`.concat(eA,` {
|
|
236
241
|
overflow: hidden `).concat(s,`;
|
|
237
242
|
padding-right: `).concat(i,"px ").concat(s,`;
|
|
238
243
|
}
|
|
@@ -266,16 +271,16 @@ Error generating stack: `+a.message+`
|
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
body[`).concat(Ho,`] {
|
|
269
|
-
`).concat(
|
|
274
|
+
`).concat(tA,": ").concat(i,`px;
|
|
270
275
|
}
|
|
271
|
-
`)},y0=function(){var t=parseInt(document.body.getAttribute(Ho)||"0",10);return isFinite(t)?t:0},
|
|
276
|
+
`)},y0=function(){var t=parseInt(document.body.getAttribute(Ho)||"0",10);return isFinite(t)?t:0},wA=function(){x.useEffect(function(){return document.body.setAttribute(Ho,(y0()+1).toString()),function(){var t=y0()-1;t<=0?document.body.removeAttribute(Ho):document.body.setAttribute(Ho,t.toString())}},[])},bA=function(t){var e=t.noRelative,r=t.noImportant,s=t.gapMode,n=s===void 0?"margin":s;wA();var a=x.useMemo(function(){return gA(n)},[n]);return x.createElement(yA,{styles:xA(a,!e,n,r?"":"!important")})},wp=!1;if(typeof window<"u")try{var kc=Object.defineProperty({},"passive",{get:function(){return wp=!0,!0}});window.addEventListener("test",kc,kc),window.removeEventListener("test",kc,kc)}catch{wp=!1}var co=wp?{passive:!1}:!1,SA=function(t){return t.tagName==="TEXTAREA"},SS=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!SA(t)&&r[e]==="visible")},_A=function(t){return SS(t,"overflowY")},EA=function(t){return SS(t,"overflowX")},x0=function(t,e){var r=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var n=_S(t,s);if(n){var a=ES(t,s),o=a[1],i=a[2];if(o>i)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},CA=function(t){var e=t.scrollTop,r=t.scrollHeight,s=t.clientHeight;return[e,r,s]},PA=function(t){var e=t.scrollLeft,r=t.scrollWidth,s=t.clientWidth;return[e,r,s]},_S=function(t,e){return t==="v"?_A(e):EA(e)},ES=function(t,e){return t==="v"?CA(e):PA(e)},kA=function(t,e){return t==="h"&&e==="rtl"?-1:1},NA=function(t,e,r,s,n){var a=kA(t,window.getComputedStyle(e).direction),o=a*s,i=r.target,c=e.contains(i),u=!1,d=o>0,f=0,m=0;do{if(!i)break;var h=ES(t,i),w=h[0],p=h[1],g=h[2],y=p-g-a*w;(w||y)&&_S(t,i)&&(f+=y,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(f)<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},jA=function(t,e){return t[0]===e[0]&&t[1]===e[1]},RA=function(t){return`
|
|
272
277
|
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
273
278
|
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
274
|
-
`)},
|
|
279
|
+
`)},TA=0,uo=[];function AA(t){var e=x.useRef([]),r=x.useRef([0,0]),s=x.useRef(),n=x.useState(TA++)[0],a=x.useState(bS)[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=XT([t.lockRef.current],(t.shards||[]).map(b0),!0).filter(Boolean);return p.forEach(function(g){return g.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),p.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(n))})}}},[t.inert,t.lockRef.current,t.shards]);var i=x.useCallback(function(p,g){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var y=Nc(p),v=r.current,b="deltaX"in p?p.deltaX:v[0]-y[0],S="deltaY"in p?p.deltaY:v[1]-y[1],E,k=p.target,N=Math.abs(b)>Math.abs(S)?"h":"v";if("touches"in p&&N==="h"&&k.type==="range")return!1;var T=x0(N,k);if(!T)return!0;if(T?E=N:(E=N==="v"?"h":"v",T=x0(N,k)),!T)return!1;if(!s.current&&"changedTouches"in p&&(b||S)&&(s.current=E),!E)return!0;var D=s.current||E;return NA(D,g,p,D==="h"?b:S)},[]),c=x.useCallback(function(p){var g=p;if(!(!uo.length||uo[uo.length-1]!==a)){var y="deltaY"in g?w0(g):Nc(g),v=e.current.filter(function(E){return E.name===g.type&&(E.target===g.target||g.target===E.shadowParent)&&jA(E.delta,y)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var b=(o.current.shards||[]).map(b0).filter(Boolean).filter(function(E){return E.contains(g.target)}),S=b.length>0?i(g,b[0]):!o.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),u=x.useCallback(function(p,g,y,v){var b={name:p,delta:g,target:y,should:v,shadowParent:OA(y)};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},[]),f=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:f,onWheelCapture:f,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 h=t.removeScrollBar,w=t.inert;return x.createElement(x.Fragment,null,w?x.createElement(a,{styles:RA(n)}):null,h?x.createElement(bA,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function OA(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const IA=lA(wS,AA);var Ov=x.forwardRef(function(t,e){return x.createElement($d,_n({},t,{ref:e,sideCar:IA}))});Ov.classNames=$d.classNames;var DA=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={},Bf=0,CS=function(t){return t&&(t.host||CS(t.parentNode))},$A=function(t,e){return e.map(function(r){if(t.contains(r))return r;var s=CS(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})},MA=function(t,e,r,s){var n=$A(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(f){!f||i.has(f)||(i.add(f),u(f.parentNode))};n.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(i.has(m))d(m);else try{var h=m.getAttribute(s),w=h!==null&&h!=="false",p=(fo.get(m)||0)+1,g=(a.get(m)||0)+1;fo.set(m,p),a.set(m,g),o.push(m),p===1&&w&&jc.set(m,!0),g===1&&m.setAttribute(r,"true"),w||m.setAttribute(s,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(e),i.clear(),Bf++,function(){o.forEach(function(f){var m=fo.get(f)-1,h=a.get(f)-1;fo.set(f,m),a.set(f,h),m||(jc.has(f)||f.removeAttribute(s),jc.delete(f)),h||f.removeAttribute(r)}),Bf--,Bf||(fo=new WeakMap,fo=new WeakMap,jc=new WeakMap,Rc={})}},PS=function(t,e,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),n=DA(t);return n?(s.push.apply(s,Array.from(n.querySelectorAll("[aria-live], script"))),MA(s,n,r,"aria-hidden")):function(){return null}},Md="Dialog",[kS,hF]=ds(Md),[FA,ln]=kS(Md),NS=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:Md});return l.jsx(FA,{scope:e,triggerRef:i,contentRef:c,contentId:ea(),titleId:ea(),descriptionId:ea(),open:u,onOpenChange:d,onOpenToggle:x.useCallback(()=>d(f=>!f),[d]),modal:o,children:r})};NS.displayName=Md;var jS="DialogTrigger",LA=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(jS,r),a=nt(e,n.triggerRef);return l.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":$v(n.open),...s,ref:a,onClick:Se(t.onClick,n.onOpenToggle)})});LA.displayName=jS;var Iv="DialogPortal",[UA,RS]=kS(Iv,{forceMount:void 0}),TS=t=>{const{__scopeDialog:e,forceMount:r,children:s,container:n}=t,a=ln(Iv,e);return l.jsx(UA,{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})}))})};TS.displayName=Iv;var Fu="DialogOverlay",AS=x.forwardRef((t,e)=>{const r=RS(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(VA,{...n,ref:e})}):null});AS.displayName=Fu;var zA=hi("DialogOverlay.RemoveScroll"),VA=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(Fu,r);return l.jsx(Ov,{as:zA,allowPinchZoom:!0,shards:[n.contentRef],children:l.jsx(Re.div,{"data-state":$v(n.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),Ga="DialogContent",OS=x.forwardRef((t,e)=>{const r=RS(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(qA,{...n,ref:e}):l.jsx(HA,{...n,ref:e})})});OS.displayName=Ga;var qA=x.forwardRef((t,e)=>{const r=ln(Ga,t.__scopeDialog),s=x.useRef(null),n=nt(e,r.contentRef,s);return x.useEffect(()=>{const a=s.current;if(a)return PS(a)},[]),l.jsx(IS,{...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())})}),HA=x.forwardRef((t,e)=>{const r=ln(Ga,t.__scopeDialog),s=x.useRef(!1),n=x.useRef(!1);return l.jsx(IS,{...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()}})}),IS=x.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:a,...o}=t,i=ln(Ga,r),c=x.useRef(null),u=nt(e,c);return gS(),l.jsxs(l.Fragment,{children:[l.jsx(Av,{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":$v(i.open),...o,ref:u,onDismiss:()=>i.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(BA,{titleId:i.titleId}),l.jsx(WA,{contentRef:c,descriptionId:i.descriptionId})]})]})}),Dv="DialogTitle",DS=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(Dv,r);return l.jsx(Re.h2,{id:n.titleId,...s,ref:e})});DS.displayName=Dv;var $S="DialogDescription",MS=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln($S,r);return l.jsx(Re.p,{id:n.descriptionId,...s,ref:e})});MS.displayName=$S;var FS="DialogClose",LS=x.forwardRef((t,e)=>{const{__scopeDialog:r,...s}=t,n=ln(FS,r);return l.jsx(Re.button,{type:"button",...s,ref:e,onClick:Se(t.onClick,()=>n.onOpenChange(!1))})});LS.displayName=FS;function $v(t){return t?"open":"closed"}var US="DialogTitleWarning",[pF,zS]=cj(US,{contentName:Ga,titleName:Dv,docsSlug:"dialog"}),BA=({titleId:t})=>{const e=zS(US),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
275
280
|
|
|
276
281
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
277
282
|
|
|
278
|
-
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 {${z1(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=N1,ZA=T1,V1=A1,q1=O1,H1=D1,B1=M1,YA=L1;const ao=GA,JA=ZA,K1=x.forwardRef(({className:t,...e},r)=>l.jsx(V1,{ref:r,className:je("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}));K1.displayName=V1.displayName;const fa=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(JA,{children:[l.jsx(K1,{}),l.jsxs(q1,{ref:s,className:je("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(Au,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));fa.displayName=q1.displayName;const ha=({className:t,...e})=>l.jsx("div",{className:je("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(H1,{ref:r,className:je("text-lg font-semibold leading-none tracking-tight",t),...e}));pa.displayName=H1.displayName;const Pi=x.forwardRef(({className:t,...e},r)=>l.jsx(B1,{ref:r,className:je("text-sm text-muted-foreground",t),...e}));Pi.displayName=B1.displayName;const ut=x.forwardRef(({className:t,type:e,...r},s)=>l.jsx("input",{type:e,className:je("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}));ut.displayName="Input";const Gn=x.forwardRef(({className:t,...e},r)=>l.jsx("textarea",{className:je("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",W1=x.forwardRef((t,e)=>l.jsx(Re.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())}}));W1.displayName=XA;var Q1=W1;const eO=kd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ge=x.forwardRef(({className:t,...e},r)=>l.jsx(Q1,{ref:r,className:je(eO(),t),...e}));Ge.displayName=Q1.displayName;var tO=x.createContext(void 0);function Mv(t){const e=x.useContext(tO);return t||e||"ltr"}var Kf="rovingFocusGroup.onEntryFocus",rO={bubbles:!1,cancelable:!0},Bl="RovingFocusGroup",[bp,G1,nO]=vv(Bl),[sO,Z1]=ds(Bl,[nO]),[aO,oO]=sO(Bl),Y1=x.forwardRef((t,e)=>l.jsx(bp.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(bp.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(iO,{...t,ref:e})})}));Y1.displayName=Bl;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,...f}=t,m=x.useRef(null),h=nt(e,m),w=Mv(a),[p,g]=Wa({prop:o,defaultProp:i??null,onChange:c,caller:Bl}),[y,v]=x.useState(!1),b=Ur(u),S=G1(r),E=x.useRef(!1),[k,N]=x.useState(0);return x.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(Kf,b),()=>T.removeEventListener(Kf,b)},[b]),l.jsx(aO,{scope:r,orientation:s,dir:w,loop:n,currentTabStopId:p,onItemFocus:x.useCallback(T=>g(T),[g]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:x.useCallback(()=>N(T=>T-1),[]),children:l.jsx(Re.div,{tabIndex:y||k===0?-1:0,"data-orientation":s,...f,ref:h,style:{outline:"none",...t.style},onMouseDown:Se(t.onMouseDown,()=>{E.current=!0}),onFocus:Se(t.onFocus,T=>{const D=!E.current;if(T.target===T.currentTarget&&D&&!y){const U=new CustomEvent(Kf,rO);if(T.currentTarget.dispatchEvent(U),!U.defaultPrevented){const R=S().filter(j=>j.focusable),A=R.find(j=>j.active),_=R.find(j=>j.id===p),z=[A,_,...R].filter(Boolean).map(j=>j.ref.current);e_(z,d)}}E.current=!1}),onBlur:Se(t.onBlur,()=>v(!1))})})}),J1="RovingFocusGroupItem",X1=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(J1,r),f=d.currentTabStopId===u,m=G1(r),{onFocusableItemAdd:h,onFocusableItemRemove:w,currentTabStopId:p}=d;return x.useEffect(()=>{if(s)return h(),()=>w()},[s,h,w]),l.jsx(bp.ItemSlot,{scope:r,id:u,focusable:s,active:n,children:l.jsx(Re.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...i,ref:e,onMouseDown:Se(t.onMouseDown,g=>{s?d.onItemFocus(u):g.preventDefault()}),onFocus:Se(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:Se(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const y=uO(g,d.orientation,d.dir);if(y!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.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(g.currentTarget);b=d.loop?dO(b,S+1):b.slice(S+1)}setTimeout(()=>e_(b))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:p!=null}):o})})});X1.displayName=J1;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 e_(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=Y1,hO=X1,Fd="Tabs",[pO,vF]=ds(Fd,[Z1]),t_=Z1(),[mO,Fv]=pO(Fd),r_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,onValueChange:n,defaultValue:a,orientation:o="horizontal",dir:i,activationMode:c="automatic",...u}=t,d=Mv(i),[f,m]=Wa({prop:s,onChange:n,defaultProp:a??"",caller:Fd});return l.jsx(mO,{scope:r,baseId:ea(),value:f,onValueChange:m,orientation:o,dir:d,activationMode:c,children:l.jsx(Re.div,{dir:d,"data-orientation":o,...u,ref:e})})});r_.displayName=Fd;var n_="TabsList",s_=x.forwardRef((t,e)=>{const{__scopeTabs:r,loop:s=!0,...n}=t,a=Fv(n_,r),o=t_(r);return l.jsx(fO,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:s,children:l.jsx(Re.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:e})})});s_.displayName=n_;var a_="TabsTrigger",o_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,disabled:n=!1,...a}=t,o=Fv(a_,r),i=t_(r),c=c_(o.baseId,s),u=u_(o.baseId,s),d=s===o.value;return l.jsx(hO,{asChild:!0,...i,focusable:!n,active:d,children:l.jsx(Re.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,f=>{!n&&f.button===0&&f.ctrlKey===!1?o.onValueChange(s):f.preventDefault()}),onKeyDown:Se(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(s)}),onFocus:Se(t.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!n&&f&&o.onValueChange(s)})})})});o_.displayName=a_;var i_="TabsContent",l_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,forceMount:n,children:a,...o}=t,i=Fv(i_,r),c=c_(i.baseId,s),u=u_(i.baseId,s),d=s===i.value,f=x.useRef(d);return x.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(da,{present:n||d,children:({present:m})=>l.jsx(Re.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:f.current?"0s":void 0},children:m&&a})})});l_.displayName=i_;function c_(t,e){return`${t}-trigger-${e}`}function u_(t,e){return`${t}-content-${e}`}var vO=r_,d_=s_,f_=o_,h_=l_;const gO=vO,p_=x.forwardRef(({className:t,...e},r)=>l.jsx(d_,{ref:r,className:je("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));p_.displayName=d_.displayName;const Sp=x.forwardRef(({className:t,...e},r)=>l.jsx(f_,{ref:r,className:je("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}));Sp.displayName=f_.displayName;const _p=x.forwardRef(({className:t,...e},r)=>l.jsx(h_,{ref:r,className:je("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));_p.displayName=h_.displayName;function yO({type:t,open:e,onOpenChange:r}){const[s,n]=x.useState("remote"),[a,o]=x.useState("json"),[i,c]=x.useState(`{
|
|
283
|
+
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},KA="DialogDescriptionWarning",WA=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zS(KA).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},QA=NS,GA=TS,VS=AS,qS=OS,HS=DS,BS=MS,ZA=LS;const ao=QA,YA=GA,KS=x.forwardRef(({className:t,...e},r)=>l.jsx(VS,{ref:r,className:je("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}));KS.displayName=VS.displayName;const fa=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(YA,{children:[l.jsx(KS,{}),l.jsxs(qS,{ref:s,className:je("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(ZA,{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=qS.displayName;const ha=({className:t,...e})=>l.jsx("div",{className:je("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(HS,{ref:r,className:je("text-lg font-semibold leading-none tracking-tight",t),...e}));pa.displayName=HS.displayName;const Pi=x.forwardRef(({className:t,...e},r)=>l.jsx(BS,{ref:r,className:je("text-sm text-muted-foreground",t),...e}));Pi.displayName=BS.displayName;const ut=x.forwardRef(({className:t,type:e,...r},s)=>l.jsx("input",{type:e,className:je("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}));ut.displayName="Input";const Gn=x.forwardRef(({className:t,...e},r)=>l.jsx("textarea",{className:je("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 JA="Label",WS=x.forwardRef((t,e)=>l.jsx(Re.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())}}));WS.displayName=JA;var QS=WS;const XA=kd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ge=x.forwardRef(({className:t,...e},r)=>l.jsx(QS,{ref:r,className:je(XA(),t),...e}));Ge.displayName=QS.displayName;var eO=x.createContext(void 0);function Mv(t){const e=x.useContext(eO);return t||e||"ltr"}var Kf="rovingFocusGroup.onEntryFocus",tO={bubbles:!1,cancelable:!0},Bl="RovingFocusGroup",[bp,GS,rO]=vv(Bl),[nO,ZS]=ds(Bl,[rO]),[sO,aO]=nO(Bl),YS=x.forwardRef((t,e)=>l.jsx(bp.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(bp.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(oO,{...t,ref:e})})}));YS.displayName=Bl;var oO=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,...f}=t,m=x.useRef(null),h=nt(e,m),w=Mv(a),[p,g]=Wa({prop:o,defaultProp:i??null,onChange:c,caller:Bl}),[y,v]=x.useState(!1),b=Ur(u),S=GS(r),E=x.useRef(!1),[k,N]=x.useState(0);return x.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(Kf,b),()=>T.removeEventListener(Kf,b)},[b]),l.jsx(sO,{scope:r,orientation:s,dir:w,loop:n,currentTabStopId:p,onItemFocus:x.useCallback(T=>g(T),[g]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:x.useCallback(()=>N(T=>T-1),[]),children:l.jsx(Re.div,{tabIndex:y||k===0?-1:0,"data-orientation":s,...f,ref:h,style:{outline:"none",...t.style},onMouseDown:Se(t.onMouseDown,()=>{E.current=!0}),onFocus:Se(t.onFocus,T=>{const D=!E.current;if(T.target===T.currentTarget&&D&&!y){const U=new CustomEvent(Kf,tO);if(T.currentTarget.dispatchEvent(U),!U.defaultPrevented){const R=S().filter(j=>j.focusable),A=R.find(j=>j.active),_=R.find(j=>j.id===p),z=[A,_,...R].filter(Boolean).map(j=>j.ref.current);e_(z,d)}}E.current=!1}),onBlur:Se(t.onBlur,()=>v(!1))})})}),JS="RovingFocusGroupItem",XS=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=aO(JS,r),f=d.currentTabStopId===u,m=GS(r),{onFocusableItemAdd:h,onFocusableItemRemove:w,currentTabStopId:p}=d;return x.useEffect(()=>{if(s)return h(),()=>w()},[s,h,w]),l.jsx(bp.ItemSlot,{scope:r,id:u,focusable:s,active:n,children:l.jsx(Re.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...i,ref:e,onMouseDown:Se(t.onMouseDown,g=>{s?d.onItemFocus(u):g.preventDefault()}),onFocus:Se(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:Se(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const y=cO(g,d.orientation,d.dir);if(y!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.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(g.currentTarget);b=d.loop?uO(b,S+1):b.slice(S+1)}setTimeout(()=>e_(b))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:p!=null}):o})})});XS.displayName=JS;var iO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function lO(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function cO(t,e,r){const s=lO(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return iO[s]}function e_(t,e=!1){const r=document.activeElement;for(const s of t)if(s===r||(s.focus({preventScroll:e}),document.activeElement!==r))return}function uO(t,e){return t.map((r,s)=>t[(e+s)%t.length])}var dO=YS,fO=XS,Fd="Tabs",[hO,mF]=ds(Fd,[ZS]),t_=ZS(),[pO,Fv]=hO(Fd),r_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,onValueChange:n,defaultValue:a,orientation:o="horizontal",dir:i,activationMode:c="automatic",...u}=t,d=Mv(i),[f,m]=Wa({prop:s,onChange:n,defaultProp:a??"",caller:Fd});return l.jsx(pO,{scope:r,baseId:ea(),value:f,onValueChange:m,orientation:o,dir:d,activationMode:c,children:l.jsx(Re.div,{dir:d,"data-orientation":o,...u,ref:e})})});r_.displayName=Fd;var n_="TabsList",s_=x.forwardRef((t,e)=>{const{__scopeTabs:r,loop:s=!0,...n}=t,a=Fv(n_,r),o=t_(r);return l.jsx(dO,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:s,children:l.jsx(Re.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:e})})});s_.displayName=n_;var a_="TabsTrigger",o_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,disabled:n=!1,...a}=t,o=Fv(a_,r),i=t_(r),c=c_(o.baseId,s),u=u_(o.baseId,s),d=s===o.value;return l.jsx(fO,{asChild:!0,...i,focusable:!n,active:d,children:l.jsx(Re.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,f=>{!n&&f.button===0&&f.ctrlKey===!1?o.onValueChange(s):f.preventDefault()}),onKeyDown:Se(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(s)}),onFocus:Se(t.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!n&&f&&o.onValueChange(s)})})})});o_.displayName=a_;var i_="TabsContent",l_=x.forwardRef((t,e)=>{const{__scopeTabs:r,value:s,forceMount:n,children:a,...o}=t,i=Fv(i_,r),c=c_(i.baseId,s),u=u_(i.baseId,s),d=s===i.value,f=x.useRef(d);return x.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(da,{present:n||d,children:({present:m})=>l.jsx(Re.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:f.current?"0s":void 0},children:m&&a})})});l_.displayName=i_;function c_(t,e){return`${t}-trigger-${e}`}function u_(t,e){return`${t}-content-${e}`}var mO=r_,d_=s_,f_=o_,h_=l_;const vO=mO,p_=x.forwardRef(({className:t,...e},r)=>l.jsx(d_,{ref:r,className:je("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));p_.displayName=d_.displayName;const Sp=x.forwardRef(({className:t,...e},r)=>l.jsx(f_,{ref:r,className:je("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}));Sp.displayName=f_.displayName;const _p=x.forwardRef(({className:t,...e},r)=>l.jsx(h_,{ref:r,className:je("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));_p.displayName=h_.displayName;function gO({type:t,open:e,onOpenChange:r}){const[s,n]=x.useState("remote"),[a,o]=x.useState("json"),[i,c]=x.useState(`{
|
|
279
284
|
"mcpServers": {
|
|
280
285
|
"memory": {
|
|
281
286
|
"command": "npx",
|
|
@@ -295,7 +300,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
295
300
|
}
|
|
296
301
|
}
|
|
297
302
|
}
|
|
298
|
-
}`),d(null),m(null),w(null),g({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:xr}),v({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:xr}),S({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:xr}),r(!1)},_=(C,F)=>{g(L=>({...L,[C]:F}))},O=(C,F)=>{v(L=>({...L,[C]:F}))},z=(C,F)=>{S(L=>({...L,[C]:F}))},j=()=>{if(t==="mcp"&&s==="local"){if(a==="json")return"Parse Configuration";if(a==="review")return h?"Register Anyway":"Register Service"}return"Register Service"},K=()=>{var C,F;if(t==="mcp"&&s==="local"){if(a==="json")return!i.trim();if(a==="review")return!y.name.trim()||!y.command.trim()}else{const L=t==="mcp"?s==="remote"?p:y:b;return!L.name.trim()||t==="mcp"&&s==="remote"&&!((C=L.url)!=null&&C.trim())||t==="a2a"&&!((F=L.manifest_url)!=null&&F.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(s2,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",t==="mcp"?"MCP Server":"A2A Agent"]}),l.jsx(Pi,{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(
|
|
303
|
+
}`),d(null),m(null),w(null),g({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:xr}),v({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:xr}),S({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:xr}),r(!1)},_=(C,F)=>{g(L=>({...L,[C]:F}))},O=(C,F)=>{v(L=>({...L,[C]:F}))},z=(C,F)=>{S(L=>({...L,[C]:F}))},j=()=>{if(t==="mcp"&&s==="local"){if(a==="json")return"Parse Configuration";if(a==="review")return h?"Register Anyway":"Register Service"}return"Register Service"},K=()=>{var C,F;if(t==="mcp"&&s==="local"){if(a==="json")return!i.trim();if(a==="review")return!y.name.trim()||!y.command.trim()}else{const L=t==="mcp"?s==="remote"?p:y:b;return!L.name.trim()||t==="mcp"&&s==="remote"&&!((C=L.url)!=null&&C.trim())||t==="a2a"&&!((F=L.manifest_url)!=null&&F.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(s2,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",t==="mcp"?"MCP Server":"A2A Agent"]}),l.jsx(Pi,{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(vO,{value:s,onValueChange:C=>n(C),className:"w-full",children:[l.jsxs(p_,{className:"grid w-full grid-cols-2 bg-white/10 border border-white/20",children:[l.jsxs(Sp,{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(Sp,{value:"local",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[l.jsx(u2,{className:"w-4 h-4 mr-2"}),"Local MCP"]})]}),l.jsxs(_p,{value:"remote",className:"space-y-4 mt-4",children:[l.jsxs("div",{children:[l.jsx(Ge,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),l.jsx(ut,{id:"name",placeholder:"e.g., Database Tools",value:p.name,onChange:C=>{_("name",C.target.value),C.target.value.trim()?D(C.target.value):w(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),h&&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(Ge,{htmlFor:"url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"MCP URL"}),l.jsx(ut,{id:"url",type:"url",placeholder:"http://localhost:8080/mcp or https://mcp.notion.com/mcp",value:p.url,onChange:C=>_("url",C.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(Ge,{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:C=>_("description",C.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),l.jsxs(_p,{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(Ge,{htmlFor:"local-json",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Local MCP Configuration (JSON)"}),l.jsx(Gn,{id:"local-json",placeholder:`{
|
|
299
304
|
"mcpServers": {
|
|
300
305
|
"memory": {
|
|
301
306
|
"command": "npx",
|
|
@@ -312,12 +317,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
312
317
|
}
|
|
313
318
|
}
|
|
314
319
|
}
|
|
315
|
-
}`})]})]}),l.jsxs(
|
|
320
|
+
}`})]})]}),l.jsxs(ve,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:N,disabled:!i.trim()||i.trim().length<10,"data-testid":"button-parse-json",children:[l.jsx(fp,{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(Ge,{htmlFor:"local-name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),l.jsx(ut,{id:"local-name",placeholder:"e.g., Memory Server",value:y.name,onChange:C=>{O("name",C.target.value),C.target.value.trim()?D(C.target.value):w(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-local-service-name"}),h&&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 "',h,'" already exists.']})]}),l.jsxs("div",{children:[l.jsx(Ge,{htmlFor:"command",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Command"}),l.jsx(ut,{id:"command",placeholder:"e.g., npx, python, node",value:y.command,onChange:C=>O("command",C.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(Ge,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Arguments"}),y.args.map((C,F)=>l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(ut,{placeholder:`Argument ${F+1}`,value:C,onChange:L=>{const Q=[...y.args];Q[F]=L.target.value,O("args",Q)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-arg-${F}`}),F===y.args.length-1&&l.jsx(ve,{type:"button",size:"sm",onClick:()=>O("args",[...y.args,""]),className:"bg-white/20 hover:bg-white/30 text-white",children:l.jsx(Vs,{className:"w-4 h-4"})}),y.args.length>1&&l.jsx(ve,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const L=y.args.filter((Q,te)=>te!==F);O("args",L)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:l.jsx(Au,{className:"w-4 h-4"})})]},F)),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(Ge,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Environment Variables"}),Object.entries(y.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(y.env).map(([C,F],L)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ut,{placeholder:"Variable name",value:C,onChange:Q=>{const te={...y.env};delete te[C],te[Q.target.value]=F,O("env",te)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-key-${L}`}),l.jsx(ut,{placeholder:"Value",value:F,onChange:Q=>{const te={...y.env};te[C]=Q.target.value,O("env",te)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-value-${L}`}),l.jsx(ve,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const Q={...y.env};delete Q[C],O("env",Q)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:l.jsx(Au,{className:"w-4 h-4"})})]},L))}),l.jsxs(ve,{type:"button",size:"sm",onClick:()=>{const C={...y.env};C[""]="",O("env",C)},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(Ge,{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:y.description,onChange:C=>O("description",C.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(ve,{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(ve,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${bn}`,style:Sn(xr),onClick:R,disabled:K(),"data-testid":"button-register",children:[l.jsx(Vs,{className:"w-4 h-4 mr-2"}),U.isPending?"Registering...":j()]})]})]}),a==="complete"&&l.jsxs("div",{className:"text-center py-8",children:[l.jsx(fp,{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(ve,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:A,"data-testid":"button-close",children:"Close"})]})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(Ge,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Agent Name"}),l.jsx(ut,{id:"name",placeholder:"e.g., Code Assistant",value:b.name,onChange:C=>{z("name",C.target.value),C.target.value.trim()?D(C.target.value):w(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),h&&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(Ge,{htmlFor:"manifest_url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Manifest URL"}),l.jsx(ut,{id:"manifest_url",type:"url",placeholder:"http://localhost:8001/.well-known/a2a/manifest.json",value:b.manifest_url,onChange:C=>z("manifest_url",C.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(Ge,{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:C=>z("description",C.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:C=>_("headers_enabled",C.target.checked),className:"rounded border-white/20 bg-white/10"}),l.jsx(Ge,{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(Ge,{htmlFor:"headers",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"HTTP Headers (JSON)"}),l.jsx(Gn,{id:"headers",placeholder:`{
|
|
316
321
|
"Authorization": "Bearer YOUR_TOKEN_HERE",
|
|
317
322
|
"X-API-Key": "YOUR_API_KEY_HERE"
|
|
318
|
-
}`,value:JSON.stringify(p.headers,null,2),onChange:C=>{try{const F=JSON.parse(C.target.value);_("headers",F)}catch(F){console.warn("Invalid JSON in headers:",F)}},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."})})]})]})]}),f&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(wn,{className:"w-4 h-4 mr-1"}),f]}),h&&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 "',h,'" 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(me,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:A,"data-testid":"button-cancel",children:"Cancel"}),!(t==="mcp"&&s==="local")&&l.jsxs(me,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${bn}`,style:Sn(xr),disabled:U.isPending||K(),"data-testid":"button-register",onClick:R,children:[l.jsx(Vs,{className:"w-4 h-4 mr-2"}),U.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=vr(),{toast:u}=gr(),d=Ot({mutationFn:async g=>Ue("POST","/api/decks",{name:g.name,description:g.description,isActive:!1}),onSuccess:async g=>{var v;const y=await g.json();c.invalidateQueries({queryKey:["/api/decks"]}),(v=y.data)!=null&&v.id&&r(y.data.id),u({title:"Deck created",description:`${o.name} has been created successfully.`}),a(!1),i({name:"",description:""})},onError:g=>{u({title:"Failed to create deck",description:g.message,variant:"destructive"})}}),f=Ot({mutationFn:async g=>Ue("DELETE",`/api/decks/${g}`,{}),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:g=>{g.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:g.message,variant:"destructive"})}}),m=async(g,y)=>{g.stopPropagation();try{const b=await(await Ue("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(v){u({title:"Failed to copy manifest",description:v instanceof Error?v.message:"Unknown error",variant:"destructive"})}},h=(g,y)=>{g.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&f.mutate(y)},w=g=>{g.preventDefault(),d.mutate(o)},p=g=>{var y,v;return(((y=g.services)==null?void 0:y.length)??0)+(((v=g.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((g,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(pp,{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(me,{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(g=>{const y=g.id===e,v=p(g);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(g.id),"data-testid":`deck-item-${g.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(me,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:b=>m(b,g),title:"Copy .agent-deck/deck.yaml snippet",children:l.jsx(o2,{className:"w-2 h-2"})}),l.jsx(me,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:b=>h(b,g.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 ${y?"text-yellow-300":"text-white"}`,children:g.name}),l.jsx("p",{className:"text-xs text-gray-400",children:v>0?`${v} cards`:"Empty"})]})]},g.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(Ge,{htmlFor:"deckName",className:"text-sm font-semibold",children:"Deck Name"}),l.jsx(ut,{id:"deckName",placeholder:"e.g., Hiring stack",value:o.name,onChange:g=>i(y=>({...y,name:g.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(Ge,{htmlFor:"deckDescription",className:"text-sm font-semibold",children:"Description"}),l.jsx(Gn,{id:"deckDescription",placeholder:"Brief description of this deck...",value:o.description,onChange:g=>i(y=>({...y,description:g.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(me,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>a(!1),"data-testid":"button-cancel-create",children:"Cancel"}),l.jsx(me,{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=vr(),{toast:i}=gr(),c=Ot({mutationFn:async()=>Ue("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(Pi,{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(Ge,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),l.jsx(ut,{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(Ge,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),l.jsx(ut,{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(me,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(cr),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,f]=x.useState(""),[m,h]=x.useState([]),[w,p]=x.useState([]),g=vr(),{toast:y}=gr(),{data:v}=Ir({queryKey:["/api/credentials/vault"],enabled:t}),{data:b}=Ir({queryKey:["/api/services"],enabled:t}),S=(v==null?void 0:v.data)??[],E=(b==null?void 0:b.data)??[],k=Ot({mutationFn:async()=>Ue("POST","/api/playbooks",{title:r.trim(),body:n,triggers:o.split(",").map(D=>D.trim()).filter(Boolean),dependsOnCredentialIds:m,dependsOnServiceIds:w,exec:c.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{g.invalidateQueries({queryKey:["/api/playbooks/vault"]}),y({title:"Playbook saved",description:`${r.trim()} is in your collection.`}),e(!1),s(""),a(""),i(""),u(""),f(""),h([]),p([])},onError:D=>{y({title:"Could not save playbook",description:D.message,variant:"destructive"})}}),N=(D,U,R)=>{R(D.includes(U)?D.filter(A=>A!==U):[...D,U])},T=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(Pi,{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(Ge,{htmlFor:"playbook-title",children:"Title"}),l.jsx(ut,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:r,onChange:D=>s(D.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated)"}),l.jsx(ut,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:o,onChange:D=>i(D.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),l.jsx(Gn,{id:"playbook-body",rows:8,placeholder:`# Steps
|
|
323
|
+
}`,value:JSON.stringify(p.headers,null,2),onChange:C=>{try{const F=JSON.parse(C.target.value);_("headers",F)}catch(F){console.warn("Invalid JSON in headers:",F)}},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."})})]})]})]}),f&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(wn,{className:"w-4 h-4 mr-1"}),f]}),h&&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 "',h,'" 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(ve,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:A,"data-testid":"button-cancel",children:"Cancel"}),!(t==="mcp"&&s==="local")&&l.jsxs(ve,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${bn}`,style:Sn(xr),disabled:U.isPending||K(),"data-testid":"button-register",onClick:R,children:[l.jsx(Vs,{className:"w-4 h-4 mr-2"}),U.isPending?"Registering...":"Register Service"]})]})]})})}function yO({decks:t,editingDeckId:e,onSelectDeck:r,isLoading:s}){const[n,a]=x.useState(!1),[o,i]=x.useState({name:"",description:""}),c=vr(),{toast:u}=gr(),d=Ot({mutationFn:async g=>Ue("POST","/api/decks",{name:g.name,description:g.description,isActive:!1}),onSuccess:async g=>{var v;const y=await g.json();c.invalidateQueries({queryKey:["/api/decks"]}),(v=y.data)!=null&&v.id&&r(y.data.id),u({title:"Deck created",description:`${o.name} has been created successfully.`}),a(!1),i({name:"",description:""})},onError:g=>{u({title:"Failed to create deck",description:g.message,variant:"destructive"})}}),f=Ot({mutationFn:async g=>Ue("DELETE",`/api/decks/${g}`,{}),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:g=>{g.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:g.message,variant:"destructive"})}}),m=async(g,y)=>{g.stopPropagation();try{const b=await(await Ue("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(v){u({title:"Failed to copy manifest",description:v instanceof Error?v.message:"Unknown error",variant:"destructive"})}},h=(g,y)=>{g.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&f.mutate(y)},w=g=>{g.preventDefault(),d.mutate(o)},p=g=>{var y,v;return(((y=g.services)==null?void 0:y.length)??0)+(((v=g.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((g,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(pp,{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(ve,{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(g=>{const y=g.id===e,v=p(g);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(g.id),"data-testid":`deck-item-${g.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(ve,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:b=>m(b,g),title:"Copy .agent-deck/deck.yaml snippet",children:l.jsx(o2,{className:"w-2 h-2"})}),l.jsx(ve,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:b=>h(b,g.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 ${y?"text-yellow-300":"text-white"}`,children:g.name}),l.jsx("p",{className:"text-xs text-gray-400",children:v>0?`${v} cards`:"Empty"})]})]},g.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(Ge,{htmlFor:"deckName",className:"text-sm font-semibold",children:"Deck Name"}),l.jsx(ut,{id:"deckName",placeholder:"e.g., Hiring stack",value:o.name,onChange:g=>i(y=>({...y,name:g.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(Ge,{htmlFor:"deckDescription",className:"text-sm font-semibold",children:"Description"}),l.jsx(Gn,{id:"deckDescription",placeholder:"Brief description of this deck...",value:o.description,onChange:g=>i(y=>({...y,description:g.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(ve,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>a(!1),"data-testid":"button-cancel-create",children:"Cancel"}),l.jsx(ve,{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 xO({open:t,onOpenChange:e}){const[r,s]=x.useState(""),[n,a]=x.useState(""),o=vr(),{toast:i}=gr(),c=Ot({mutationFn:async()=>Ue("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(Pi,{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(Ge,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),l.jsx(ut,{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(Ge,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),l.jsx(ut,{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(ve,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(cr),onClick:()=>c.mutate(),disabled:!u||c.isPending,children:"Save to vault"})]})]})})}function wO({open:t,onOpenChange:e}){const[r,s]=x.useState(""),[n,a]=x.useState(""),[o,i]=x.useState(""),[c,u]=x.useState(""),[d,f]=x.useState(""),[m,h]=x.useState([]),[w,p]=x.useState([]),g=vr(),{toast:y}=gr(),{data:v}=Ir({queryKey:["/api/credentials/vault"],enabled:t}),{data:b}=Ir({queryKey:["/api/services"],enabled:t}),S=(v==null?void 0:v.data)??[],E=(b==null?void 0:b.data)??[],k=Ot({mutationFn:async()=>Ue("POST","/api/playbooks",{title:r.trim(),body:n,triggers:o.split(",").map(D=>D.trim()).filter(Boolean),dependsOnCredentialIds:m,dependsOnServiceIds:w,exec:c.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{g.invalidateQueries({queryKey:["/api/playbooks/vault"]}),y({title:"Playbook saved",description:`${r.trim()} is in your collection.`}),e(!1),s(""),a(""),i(""),u(""),f(""),h([]),p([])},onError:D=>{y({title:"Could not save playbook",description:D.message,variant:"destructive"})}}),N=(D,U,R)=>{R(D.includes(U)?D.filter(A=>A!==U):[...D,U])},T=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(Pi,{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(Ge,{htmlFor:"playbook-title",children:"Title"}),l.jsx(ut,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:r,onChange:D=>s(D.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated)"}),l.jsx(ut,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:o,onChange:D=>i(D.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),l.jsx(Gn,{id:"playbook-body",rows:8,placeholder:`# Steps
|
|
319
324
|
1. …
|
|
320
|
-
2. …`,value:n,onChange:D=>a(D.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(Ge,{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(D=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:m.includes(D.id),onChange:()=>N(m,D.id,h)}),D.label]},D.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{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(D=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:w.includes(D.id),onChange:()=>N(w,D.id,p)}),D.name]},D.id))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),l.jsx(ut,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:c,onChange:D=>u(D.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),l.jsx(ut,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:D=>f(D.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsx(me,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(Yr),onClick:()=>k.mutate(),disabled:!T||k.isPending,children:"Save to collection"})]})]})})}function SO({playbookId:t,open:e,onOpenChange:r}){const{data:s,isLoading:n}=Ir({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(Pi,{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=vr(),{toast:n}=gr(),[a,o]=x.useState(""),[i,c]=x.useState(""),[u,d]=x.useState(""),{data:f,isLoading:m}=Ir({queryKey:t?[`/api/credentials/${t}`]:["credential-detail-disabled"],enabled:e&&!!t}),h=f==null?void 0:f.data;x.useEffect(()=>{h&&(o(h.label),c(h.docsUrl??""),d(""))},[h==null?void 0:h.id,h==null?void 0:h.label,h==null?void 0:h.docsUrl]);const w=Ot({mutationFn:async()=>{if(!t)throw new Error("No credential selected");const g=a.trim();if(!g)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 Ue("PUT",`/api/credentials/${t}`,{label:g,docsUrl:y}),u.trim()&&await Ue("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:g=>{n({title:"Could not save API key",description:g.message,variant:"destructive"})}}),p=a.trim().length>0&&(a.trim()!==(h==null?void 0:h.label)||i.trim()!==((h==null?void 0:h.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:(h==null?void 0:h.label)??"API key"}),l.jsx(Pi,{className:"font-mono text-xs text-[#A8C4C0]",children:(h==null?void 0:h.id)??t})]}),m||!h?l.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):l.jsxs("div",{className:"space-y-4",children:[!h.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(Ge,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),l.jsx(ut,{id:"credential-detail-name",value:a,onChange:g=>o(g.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:h.hasSecret?"Rotate API key":"API key"}),l.jsx(ut,{id:"credential-detail-key",type:"password",placeholder:h.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:g=>d(g.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),h.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(Ge,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ut,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:i,onChange:g=>c(g.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),i.trim()&&l.jsx(me,{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(ho,{className:"h-4 w-4"})})]})]}),l.jsx(me,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(cr),onClick:()=>w.mutate(),disabled:!p||w.isPending,children:w.isPending?"Saving…":"Save changes"})]})]})})}const EO=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:je(EO({variant:e}),t),...r})}function m_(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",[CO,gF]=ds(Ld),[PO,Lv]=CO(Ld);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:f}=t,[m,h]=Wa({prop:r,defaultProp:n??!1,onChange:c,caller:Ld}),[w,p]=x.useState(null),[g,y]=x.useState(null),v=x.useRef(!1),b=w?!!o||!!w.closest("form"):!0,S={checked:m,disabled:a,setChecked:h,control:w,setControl:p,name:i,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:ta(n)?!1:n,isFormControl:b,bubbleInput:g,setBubbleInput:y};return l.jsx(PO,{scope:e,...S,children:NO(f)?f(S):s})}var v_="CheckboxTrigger",g_=x.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...s},n)=>{const{control:a,value:o,disabled:i,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:h,bubbleInput:w}=Lv(v_,t),p=nt(n,d),g=x.useRef(c);return x.useEffect(()=>{const y=a==null?void 0:a.form;if(y){const v=()=>f(g.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[a,f]),l.jsx(Re.button,{type:"button",role:"checkbox","aria-checked":ta(c)?"mixed":c,"aria-required":u,"data-state":S_(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=>{f(v=>ta(v)?!0:!v),w&&h&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});g_.displayName=v_;var Uv=x.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:s,checked:n,defaultChecked:a,required:o,disabled:i,value:c,onCheckedChange:u,form:d,...f}=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(g_,{...f,ref:e,__scopeCheckbox:r}),m&&l.jsx(b_,{__scopeCheckbox:r})]})})});Uv.displayName=Ld;var y_="CheckboxIndicator",x_=x.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:s,...n}=t,a=Lv(y_,r);return l.jsx(da,{present:s||ta(a.checked)||a.checked===!0,children:l.jsx(Re.span,{"data-state":S_(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:e,style:{pointerEvents:"none",...t.style}})})});x_.displayName=y_;var w_="CheckboxBubbleInput",b_=x.forwardRef(({__scopeCheckbox:t,...e},r)=>{const{control:s,hasConsumerStoppedPropagationRef:n,checked:a,defaultChecked:o,required:i,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:h}=Lv(w_,t),w=nt(r,h),p=m_(a),g=WS(s);x.useEffect(()=>{const v=m;if(!v)return;const b=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(b,"checked").set,k=!n.current;if(p!==a&&E){const N=new Event("click",{bubbles:k});v.indeterminate=ta(a),E.call(v,ta(a)?!1:a),v.dispatchEvent(N)}},[m,p,a,n]);const y=x.useRef(ta(a)?!1:a);return l.jsx(Re.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:i,disabled:c,name:u,value:d,form:f,...e,tabIndex:-1,ref:w,style:{...e.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});b_.displayName=w_;function NO(t){return typeof t=="function"}function ta(t){return t==="indeterminate"}function S_(t){return ta(t)?"indeterminate":t?"checked":"unchecked"}const __=x.forwardRef(({className:t,...e},r)=>l.jsx(Uv,{ref:r,className:je("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(x_,{className:je("flex items-center justify-center text-current"),children:l.jsx(SS,{className:"h-4 w-4"})})}));__.displayName=Uv.displayName;const E_=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:r,className:je("w-full caption-bottom text-sm",t),...e})}));E_.displayName="Table";const C_=x.forwardRef(({className:t,...e},r)=>l.jsx("thead",{ref:r,className:je("[&_tr]:border-b",t),...e}));C_.displayName="TableHeader";const P_=x.forwardRef(({className:t,...e},r)=>l.jsx("tbody",{ref:r,className:je("[&_tr:last-child]:border-0",t),...e}));P_.displayName="TableBody";const jO=x.forwardRef(({className:t,...e},r)=>l.jsx("tfoot",{ref:r,className:je("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));jO.displayName="TableFooter";const Wi=x.forwardRef(({className:t,...e},r)=>l.jsx("tr",{ref:r,className:je("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Wi.displayName="TableRow";const Jc=x.forwardRef(({className:t,...e},r)=>l.jsx("th",{ref:r,className:je("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Jc.displayName="TableHead";const po=x.forwardRef(({className:t,...e},r)=>l.jsx("td",{ref:r,className:je("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));po.displayName="TableCell";const RO=x.forwardRef(({className:t,...e},r)=>l.jsx("caption",{ref:r,className:je("mt-4 text-sm text-muted-foreground",t),...e}));RO.displayName="TableCaption";function Wf(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(()=>Wf(e)),u=vr(),{toast:d}=gr(),f=x.useMemo(()=>e.filter(v=>v.enabled===!1).map(v=>v.name).sort().join("\0"),[e]);x.useEffect(()=>{c(Wf(e))},[t,f,e.length]);const m=Ot({mutationFn:async v=>{await Ue("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(Wf(e))}}),h=v=>{c(v),m.mutate([...v])},w=(v,b)=>{const S=new Set(i);b?S.delete(v):S.add(v),h(S)},p=v=>{if(v){h(new Set);return}h(new Set(e.map(b=>b.name)))},g=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]),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(Tu,{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(me,{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(me,{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(ES,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),l.jsx(ut,{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(E_,{children:[l.jsx(C_,{children:l.jsxs(Wi,{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(P_,{children:g.length===0?l.jsx(Wi,{className:"border-white/10 hover:bg-transparent",children:l.jsx(po,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):g.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(Wi,{className:`border-white/10 ${b?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[l.jsx(po,{className:"text-center",children:l.jsx("div",{className:"flex justify-center",children:l.jsx(__,{checked:b,onCheckedChange:k=>w(v.name,k===!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(po,{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(bv,{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(po,{className:"text-sm text-gray-300",children:v.description||"—"})]}),E&&S&&l.jsx(Wi,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:l.jsx(po,{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 AO({service:t,isOpen:e,onClose:r}){var Oe,Fe,ke,st,vt,Hr,zt,fs,oo,Yt,Br,hs,Nr,Dn,ps,ya,ms,ne,Pt,$n,Mn,Yl,Jl,Xl;const[s,n]=x.useState(null),[a,o]=x.useState(!1),[i,c]=x.useState(""),[u,d]=x.useState(!1),[f,m]=x.useState(!1),[h,w]=x.useState(!1),[p,g]=x.useState(""),[y,v]=x.useState(""),[b,S]=x.useState(!1),[E,k]=x.useState(!1),[N,T]=x.useState(null),[D,U]=x.useState(null),R=vr(),{toast:A}=gr(),_=N||t,O=!!(_&&_.id&&_.url),z=()=>{var Je,Xe,vs;if(!((Xe=(Je=j==null?void 0:j.data)==null?void 0:Je.oauth)!=null&&Xe.required))return{status:"not_required",message:null};const re=!!(_!=null&&_.oauthAccessToken),Ee=!!((vs=_==null?void 0:_.headers)!=null&&vs.Authorization);if(!re||!Ee)return{status:"required",message:"OAuth 2.0 Authentication Required"};const Ke=_==null?void 0:_.oauthTokenExpiresAt;if(Ke){const ef=new Date(Ke).getTime(),rf=new Date().getTime()+5*60*1e3;if(ef<=rf)return{status:"expired",message:"OAuth Token Expired - Please re-authenticate"}}return{status:"authenticated",message:null}},{data:j,isLoading:K,error:C,refetch:F}=Ir({queryKey:["/api/mcp/discover",_==null?void 0:_.url],queryFn:async()=>{if(!_||_.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${_.url}`);try{const Ee=await(await Ue("POST","/api/mcp/discover",{url:_.url})).json();return console.log(`✅ MCP discovery successful for ${_.url}:`,Ee),Ee}catch(re){throw console.log(`❌ MCP discovery failed for ${_.url}:`,re),re}},enabled:O&&_.type==="mcp"&&e,staleTime:0,gcTime:2*60*1e3}),L=z();console.log("MCP Discovery Query Debug:",{apiService:_==null?void 0:_.id,apiServiceType:_==null?void 0:_.type,apiServiceUrl:_==null?void 0:_.url,isOpen:e,hasValidService:O,enabled:O&&_.type==="mcp"&&e,mcpDiscoveryLoading:K,mcpDiscoveryData:j?JSON.stringify(j,null,2):null,mcpDiscoveryDataKeys:j?Object.keys(j):null,oauthRequired:(Fe=(Oe=j==null?void 0:j.data)==null?void 0:Oe.oauth)==null?void 0:Fe.required,oauthData:(ke=j==null?void 0:j.data)!=null&&ke.oauth?JSON.stringify(j.data.oauth,null,2):null,toolsQueryEnabled:O&&_.type==="mcp"&&e&&!((vt=(st=j==null?void 0:j.data)==null?void 0:st.oauth)!=null&&vt.required)});const{data:Q,isLoading:te,error:V,refetch:de}=Ir({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 Ee=await(await Ue("GET",`/api/services/${_.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${_.id}:`,Ee),Ee}catch(re){throw console.log(`❌ MCP tools discovery failed for ${_.id}:`,re),re}},enabled:O&&(_.type==="mcp"||_.type==="local-mcp")&&e&&(_.type==="local-mcp"||L.status==="authenticated"||L.status==="not_required"),staleTime:0,gcTime:2*60*1e3});x.useEffect(()=>{if(!e||!(_!=null&&_.id)||_.type!=="mcp"&&_.type!=="local-mcp"||!(_.type==="local-mcp"||L.status==="authenticated"||L.status==="not_required")||te)return;let Ee=!1;return(async()=>{try{const Xe=await(await Ue("GET",`/api/services/${_.id}`)).json();!Ee&&(Xe!=null&&Xe.success)&&Xe.data&&T(Xe.data),R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]})}catch{}})(),()=>{Ee=!0}},[e,_==null?void 0:_.id,_==null?void 0:_.type,te,V,Q,L.status,R]),x.useEffect(()=>{if(!e||!(_!=null&&_.id)||_.type!=="a2a")return;let re=!1;return(async()=>{try{await Ue("GET",`/api/services/${_.id}/health`);const Je=await(await Ue("GET",`/api/services/${_.id}`)).json();!re&&(Je!=null&&Je.success)&&Je.data&&T(Je.data),R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]})}catch{}})(),()=>{re=!0}},[e,_==null?void 0:_.id,_==null?void 0:_.type,R]),console.log("MCP Tools Query Debug:",{hasValidService:O,apiServiceType:_==null?void 0:_.type,isOpen:e,oauthRequired:(zt=(Hr=j==null?void 0:j.data)==null?void 0:Hr.oauth)==null?void 0:zt.required,oauthStatus:L.status,toolsQueryEnabled:O&&(_.type==="mcp"||_.type==="local-mcp")&&e&&(_.type==="local-mcp"||L.status==="authenticated"||L.status==="not_required"),mcpToolsLoading:te});const{data:Te,isLoading:ge,error:X}=Ir({queryKey:["/api/proxy/a2a",_==null?void 0:_.id,"manifest"],queryFn:async()=>{if(!_||_.type!=="a2a")return null;const Ee=await(await Ue("GET",`/api/proxy/a2a/${_.id}/manifest`)).text();return JSON.parse(Ee)},enabled:O&&_.type==="a2a"&&e,staleTime:0,gcTime:2*60*1e3}),ve=(Q==null?void 0:Q.data)||[],he=Te,ye=te||ge;console.log("ServiceDetailsModal Debug:",{service:t==null?void 0:t.id,serviceType:t==null?void 0:t.type,isOpen:e,mcpDiscoveryLoading:K,mcpDiscoveryData:j,mcpDiscoveryError:C?String(C):null,mcpToolsLoading:te,a2aManifestLoading:ge,mcpToolsError:V?String(V):null,a2aManifestError:X?String(X):null,mcpToolsCount:ve.length,mcpToolsData:Q,hasA2aManifest:!!he,isLoading:ye,oauthRequired:(oo=(fs=j==null?void 0:j.data)==null?void 0:fs.oauth)==null?void 0:oo.required,oauthStatus:L.status,oauthMessage:L.message,hasAccessToken:!!(_!=null&&_.oauthAccessToken),hasHeaders:!!((Yt=_==null?void 0:_.headers)!=null&&Yt.Authorization),expiresAt:_==null?void 0:_.oauthTokenExpiresAt}),x.useEffect(()=>{t&&e&&(T(t),c(t.cardColor||"#92E4DD"),g(t.name||""),v(t.description||""))},[t,e]),x.useEffect(()=>()=>{D&&(clearInterval(D),U(null))},[D]),x.useEffect(()=>{var re,Ee;(Ee=(re=j==null?void 0:j.data)==null?void 0:re.oauth)!=null&&Ee.required&&!D&&ue()},[(hs=(Br=j==null?void 0:j.data)==null?void 0:Br.oauth)==null?void 0:hs.required,D]);const ue=()=>{if(!(_!=null&&_.id))return;D&&clearInterval(D),console.log("🔄 Starting OAuth polling for service:",_.id);const re=setInterval(async()=>{var Ee,Ke;try{console.log("🔍 OAuth polling check for service:",_.id);const Je=await Ue("GET",`/api/services/${_.id}`);if(Je.ok){const Xe=await Je.json(),vs=(Ke=(Ee=Xe.headers)==null?void 0:Ee.Authorization)==null?void 0:Ke.startsWith("Bearer ");console.log("🔍 OAuth polling result:",{serviceId:_.id,hasAuthHeader:vs,headers:Xe.headers}),vs&&(clearInterval(re),U(null),console.log("✅ OAuth completed for service:",_.id),A({title:"OAuth completed",description:"Authentication successful! Refreshing service status...",variant:"default"}),R.invalidateQueries({queryKey:["/api/mcp/discover",_.url]}),await F(),setTimeout(async()=>{R.invalidateQueries({queryKey:["/api/services",_.id,"tools"]}),await de()},1e3))}}catch(Je){console.error("OAuth polling error:",Je)}},2e3);U(re)};x.useEffect(()=>{const re=Ee=>{const Ke=Ee.target;a&&!Ke.closest(".color-picker-container")&&o(!1)};return document.addEventListener("mousedown",re),()=>{document.removeEventListener("mousedown",re)}},[a]);const Pe=()=>(t==null?void 0:t.type)==="mcp"?l.jsx(Zy,{className:"w-6 h-6"}):l.jsx(Df,{className:"w-6 h-6"}),Ae=()=>(t==null?void 0:t.type)==="mcp"?"text-blue-400":"text-purple-400",De=()=>(t==null?void 0:t.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",J=re=>new Date(re).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),ie=async re=>{if(t){d(!0),c(re);try{if((await Ue("PUT",`/api/services/${t.id}`,{cardColor:re})).ok)R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]}),R.invalidateQueries({queryKey:["/api/decks"]}),R.invalidateQueries({queryKey:["/api/decks"]}),A({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"),A({title:"Update failed",description:"Failed to update card color. Please try again.",variant:"destructive"})}finally{d(!1)}}},Y=async()=>{if(!(!t||!p.trim())){S(!0);try{if((await Ue("PUT",`/api/services/${t.id}`,{name:p.trim()})).ok){if(N){const Ee={...N,name:p.trim()};T(Ee)}R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]}),R.invalidateQueries({queryKey:["/api/decks"]}),R.invalidateQueries({queryKey:["/api/decks"]}),A({title:"Name updated",description:"Service name has been updated successfully."}),m(!1)}else throw new Error("Failed to update name")}catch{A({title:"Update failed",description:"Failed to update service name. Please try again.",variant:"destructive"})}finally{S(!1)}}},ze=async()=>{if(t){k(!0);try{if((await Ue("PUT",`/api/services/${t.id}`,{description:y.trim()})).ok){if(N){const Ee={...N,description:y.trim()};T(Ee)}R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]}),R.invalidateQueries({queryKey:["/api/decks"]}),R.invalidateQueries({queryKey:["/api/decks"]}),A({title:"Description updated",description:"Service description has been updated successfully."}),w(!1)}else throw new Error("Failed to update description")}catch{A({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{k(!1)}}},ee=[{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:[Pe(),l.jsx("div",{className:"ml-3 flex items-center",children:f?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:p,onChange:re=>g(re.target.value),onKeyDown:re=>{var Ee;re.key==="Enter"?Y():re.key==="Escape"&&(m(!1),g(((Ee=N||t)==null?void 0:Ee.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(me,{size:"sm",onClick:Y,disabled:b,className:"h-6 px-2 text-xs",children:b?"Saving...":"Save"}),l.jsx(me,{size:"sm",variant:"outline",onClick:()=>{var re;m(!1),g(((re=N||t)==null?void 0:re.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:(Nr=N||t)==null?void 0:Nr.name}),l.jsx(me,{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 ${De()} ${Ae()}`,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(n2,{className:"w-5 h-5 mr-2"}),"Service Overview"]}),l.jsxs("div",{className:"relative color-picker-container",children:[l.jsx(me,{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:ee.map(re=>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)===re.value?"bg-white/20":""}`,onClick:()=>ie(re.value),disabled:u,children:[l.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:re.value}}),l.jsx("span",{className:"text-white",children:re.label}),u&&t.cardColor===re.value&&l.jsx("div",{className:"ml-auto w-3 h-3 border border-white/20 border-t-transparent rounded-full animate-spin"})]},re.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"}),!h&&l.jsx(me,{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"})})]}),h?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{value:y,onChange:re=>v(re.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(me,{size:"sm",onClick:ze,disabled:E,className:"h-6 px-2 text-xs",children:E?"Saving...":"Save"}),l.jsx(me,{size:"sm",variant:"outline",onClick:()=>{var re;w(!1),v(((re=N||t)==null?void 0:re.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:((ps=N||t)==null?void 0:ps.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(me,{size:"sm",variant:"ghost",onClick:()=>window.open(_.url,"_blank"),className:"p-1 h-auto",children:l.jsx(ho,{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":L.status==="required"||L.status==="expired"?"Auth required":"Unknown"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Registered"}),l.jsx("p",{className:"text-white text-sm",children:J(_.registeredAt)})]})]})]}),ye&&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:ve,isLoading:te}),t.type==="a2a"&&he&&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(u2,{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:he.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:he.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:he.description})]}),he.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:he.provider.organization})]}),he.documentationUrl&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),l.jsxs(me,{size:"sm",variant:"ghost",onClick:()=>window.open(he.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[l.jsx(ho,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),he.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(bS,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[he.capabilities.streaming&&l.jsx(hn,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),he.capabilities.pushNotifications&&l.jsx(hn,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),he.capabilities.stateTransitionHistory&&l.jsx(hn,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),he.skills&&he.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(Df,{className:"w-5 h-5 mr-2"}),"Skills (",he.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:he.skills.map((re,Ee)=>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(Df,{className:"w-6 h-6"})}),l.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:re.name}),l.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:re.description}),re.tags&&re.tags.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:re.tags.slice(0,2).map((Ke,Je)=>l.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:Ke},Je))})]}),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"})]},Ee))})]}),(he.defaultInputModes||he.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:[he.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:he.defaultInputModes.map((re,Ee)=>l.jsx(hn,{className:"bg-blue-500/20 text-blue-300 text-xs",children:re},Ee))})]}),he.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:he.defaultOutputModes.map((re,Ee)=>l.jsx(hn,{className:"bg-green-500/20 text-green-300 text-xs",children:re},Ee))})]})]})]})]}),(t==null?void 0:t.type)==="mcp"&&L.status!=="authenticated"&&L.status!=="not_required"&&l.jsxs("div",{className:`${L.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:`${L.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:L.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),l.jsxs("div",{className:`${L.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[l.jsx("p",{children:l.jsx("strong",{children:L.message})}),l.jsx("p",{children:L.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."}),j.data.oauth.authorizationUrl&&l.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[l.jsx(me,{size:"sm",variant:"default",className:"h-8 bg-orange-600 hover:bg-orange-700",onClick:async()=>{var re,Ee;if(_!=null&&_.id)try{A({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Ke=await Ue("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!Ke.ok){const Xe=await Ke.json();(re=Xe.data)!=null&&re.registrationUrl?(window.open(Xe.data.registrationUrl,"_blank"),A({title:"OAuth Registration Required",description:`${Xe.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):A({title:"OAuth Setup Failed",description:Xe.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Je=await Ke.json();Je.success&&((Ee=Je.data)!=null&&Ee.authorizationUrl)?(window.open(Je.data.authorizationUrl,"_blank"),A({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),ue()):A({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Ke){A({title:"OAuth Setup Failed",description:Ke instanceof Error?Ke.message:"Unknown error occurred",variant:"destructive"})}},children:"🔐 Continue OAuth"}),l.jsxs(me,{size:"sm",variant:"ghost",className:"p-1 h-auto text-orange-300",onClick:()=>window.open(j.data.oauth.authorizationUrl,"_blank"),children:[l.jsx(ho,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),l.jsxs("div",{className:"mt-2 text-xs text-orange-100",children:[l.jsx("p",{children:l.jsx("strong",{children:"💡 What this means:"})}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsx("li",{children:"This MCP server requires OAuth 2.0 authentication"}),l.jsx("li",{children:"You need to register an OAuth application with the service provider"}),l.jsx("li",{children:"After registration, you'll get Client ID and Client Secret"}),l.jsx("li",{children:"Configure these credentials in the service settings"})]}),j.data.oauth.resourceName&&l.jsxs("div",{className:"mt-3 p-2 bg-orange-500/10 rounded border border-orange-500/20",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 OAuth Configuration Found:"})}),l.jsxs("p",{children:[l.jsx("strong",{children:"Resource:"})," ",j.data.oauth.resourceName]}),j.data.oauth.issuer&&l.jsxs("p",{children:[l.jsx("strong",{children:"Issuer:"})," ",j.data.oauth.issuer]}),((ya=j.data.oauth.scopesSupported)==null?void 0:ya.length)>0&&l.jsxs("p",{children:[l.jsx("strong",{children:"Supported Scopes:"})," ",j.data.oauth.scopesSupported.join(", ")]}),j.data.oauth.authorizationUrl&&l.jsxs("p",{children:[l.jsx("strong",{children:"Authorization URL:"})," ",j.data.oauth.authorizationUrl]}),j.data.oauth.tokenUrl&&l.jsxs("p",{children:[l.jsx("strong",{children:"Token URL:"})," ",j.data.oauth.tokenUrl]})]})]})]})]}),(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: ",te?"🔄 Loading...":V?"❌ Failed":"✅ Complete"]})]}),te&&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})]})]}),V&&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:V instanceof Error?V.message:String(V)}),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"})]})]})]}),!te&&!V&&ve.length>0&&l.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:l.jsxs("p",{children:["✅ Successfully discovered ",ve.length," tools from MCP server"]})}),!te&&!V&&ve.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"})]})]})]}),V&&(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:V instanceof Error?V.message:String(V)}),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)})]})]})]}),X&&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:X instanceof Error?X.message:String(X)}),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]})]})]}),!ye&&!V&&!X&&(t.type==="mcp"||t.type==="local-mcp")&&ve.length===0&&(t.type==="local-mcp"||!((ne=(ms=j==null?void 0:j.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]}),K&&l.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:l.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),j&&l.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 What we discovered:"})}),j.error&&j.analysis&&l.jsxs("div",{className:"text-yellow-200",children:[j.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"})]}),j.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"})]}),j.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"})]}),j.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"})]}),j.analysis.message&&l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Analysis:"})," ",j.analysis.message]})]}),(($n=(Pt=j==null?void 0:j.data)==null?void 0:Pt.oauth)==null?void 0:$n.required)&&l.jsxs("div",{className:"text-yellow-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),j.data.oauth.authorizationUrl&&l.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[l.jsx(me,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var re,Ee;if(_!=null&&_.id)try{A({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Ke=await Ue("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!Ke.ok){const Xe=await Ke.json();(re=Xe.data)!=null&&re.registrationUrl?(window.open(Xe.data.registrationUrl,"_blank"),A({title:"OAuth Registration Required",description:`${Xe.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):A({title:"OAuth Setup Failed",description:Xe.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Je=await Ke.json();Je.success&&((Ee=Je.data)!=null&&Ee.authorizationUrl)?(window.open(Je.data.authorizationUrl,"_blank"),A({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),ue()):A({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Ke){A({title:"OAuth Setup Failed",description:Ke instanceof Error?Ke.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsxs(me,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(j.data.oauth.authorizationUrl,"_blank"),children:[l.jsx(ho,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!j.data.oauth.authorizationUrl&&j.data.oauth.protectedResourceConfigUrl&&l.jsx("div",{className:"mt-2",children:l.jsxs(me,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(j.data.oauth.protectedResourceConfigUrl,"_blank"),children:[l.jsx(ho,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),j.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(j.data.oauth.authorizationServerMetadataUrl,"_blank"),children:j.data.oauth.authorizationServerMetadataUrl})]})]}),(j==null?void 0:j.success)&&!((Yl=(Mn=j==null?void 0:j.data)==null?void 0:Mn.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=j==null?void 0:j.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"}),j.data.oauth.resourceName&&l.jsxs("p",{children:["• Service: ",j.data.oauth.resourceName]}),j.data.oauth.authorizationUrl&&l.jsxs("p",{children:["• Authorization URL: ",j.data.oauth.authorizationUrl]}),j.data.oauth.tokenUrl&&l.jsxs("p",{children:["• Token URL: ",j.data.oauth.tokenUrl]}),l.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[l.jsx(me,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var re,Ee;if(_!=null&&_.id)try{A({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Ke=await Ue("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!Ke.ok){const Xe=await Ke.json();(re=Xe.data)!=null&&re.registrationUrl?(window.open(Xe.data.registrationUrl,"_blank"),A({title:"OAuth Registration Required",description:`${Xe.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):A({title:"OAuth Setup Failed",description:Xe.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Je=await Ke.json();Je.success&&((Ee=Je.data)!=null&&Ee.authorizationUrl)?(window.open(Je.data.authorizationUrl,"_blank"),A({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),ue()):A({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Ke){A({title:"OAuth Setup Failed",description:Ke instanceof Error?Ke.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsx(me,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const re=`OAuth Setup Instructions:
|
|
325
|
+
2. …`,value:n,onChange:D=>a(D.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(Ge,{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(D=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:m.includes(D.id),onChange:()=>N(m,D.id,h)}),D.label]},D.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{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(D=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:w.includes(D.id),onChange:()=>N(w,D.id,p)}),D.name]},D.id))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),l.jsx(ut,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:c,onChange:D=>u(D.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),l.jsx(ut,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:D=>f(D.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsx(ve,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(Yr),onClick:()=>k.mutate(),disabled:!T||k.isPending,children:"Save to collection"})]})]})})}function bO({playbookId:t,open:e,onOpenChange:r}){const{data:s,isLoading:n}=Ir({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(Pi,{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 SO({credentialId:t,open:e,onOpenChange:r}){const s=vr(),{toast:n}=gr(),[a,o]=x.useState(""),[i,c]=x.useState(""),[u,d]=x.useState(""),{data:f,isLoading:m}=Ir({queryKey:t?[`/api/credentials/${t}`]:["credential-detail-disabled"],enabled:e&&!!t}),h=f==null?void 0:f.data;x.useEffect(()=>{h&&(o(h.label),c(h.docsUrl??""),d(""))},[h==null?void 0:h.id,h==null?void 0:h.label,h==null?void 0:h.docsUrl]);const w=Ot({mutationFn:async()=>{if(!t)throw new Error("No credential selected");const g=a.trim();if(!g)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 Ue("PUT",`/api/credentials/${t}`,{label:g,docsUrl:y}),u.trim()&&await Ue("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:g=>{n({title:"Could not save API key",description:g.message,variant:"destructive"})}}),p=a.trim().length>0&&(a.trim()!==(h==null?void 0:h.label)||i.trim()!==((h==null?void 0:h.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:(h==null?void 0:h.label)??"API key"}),l.jsx(Pi,{className:"font-mono text-xs text-[#A8C4C0]",children:(h==null?void 0:h.id)??t})]}),m||!h?l.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):l.jsxs("div",{className:"space-y-4",children:[!h.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(Ge,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),l.jsx(ut,{id:"credential-detail-name",value:a,onChange:g=>o(g.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:h.hasSecret?"Rotate API key":"API key"}),l.jsx(ut,{id:"credential-detail-key",type:"password",placeholder:h.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:g=>d(g.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),h.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(Ge,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ut,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:i,onChange:g=>c(g.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),i.trim()&&l.jsx(ve,{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(ho,{className:"h-4 w-4"})})]})]}),l.jsx(ve,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${bn}`,style:Sn(cr),onClick:()=>w.mutate(),disabled:!p||w.isPending,children:w.isPending?"Saving…":"Save changes"})]})]})})}const _O=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:je(_O({variant:e}),t),...r})}function m_(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",[EO,vF]=ds(Ld),[CO,Lv]=EO(Ld);function PO(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:f}=t,[m,h]=Wa({prop:r,defaultProp:n??!1,onChange:c,caller:Ld}),[w,p]=x.useState(null),[g,y]=x.useState(null),v=x.useRef(!1),b=w?!!o||!!w.closest("form"):!0,S={checked:m,disabled:a,setChecked:h,control:w,setControl:p,name:i,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:ta(n)?!1:n,isFormControl:b,bubbleInput:g,setBubbleInput:y};return l.jsx(CO,{scope:e,...S,children:kO(f)?f(S):s})}var v_="CheckboxTrigger",g_=x.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...s},n)=>{const{control:a,value:o,disabled:i,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:h,bubbleInput:w}=Lv(v_,t),p=nt(n,d),g=x.useRef(c);return x.useEffect(()=>{const y=a==null?void 0:a.form;if(y){const v=()=>f(g.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[a,f]),l.jsx(Re.button,{type:"button",role:"checkbox","aria-checked":ta(c)?"mixed":c,"aria-required":u,"data-state":S_(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=>{f(v=>ta(v)?!0:!v),w&&h&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});g_.displayName=v_;var Uv=x.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:s,checked:n,defaultChecked:a,required:o,disabled:i,value:c,onCheckedChange:u,form:d,...f}=t;return l.jsx(PO,{__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(g_,{...f,ref:e,__scopeCheckbox:r}),m&&l.jsx(b_,{__scopeCheckbox:r})]})})});Uv.displayName=Ld;var y_="CheckboxIndicator",x_=x.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:s,...n}=t,a=Lv(y_,r);return l.jsx(da,{present:s||ta(a.checked)||a.checked===!0,children:l.jsx(Re.span,{"data-state":S_(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:e,style:{pointerEvents:"none",...t.style}})})});x_.displayName=y_;var w_="CheckboxBubbleInput",b_=x.forwardRef(({__scopeCheckbox:t,...e},r)=>{const{control:s,hasConsumerStoppedPropagationRef:n,checked:a,defaultChecked:o,required:i,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:h}=Lv(w_,t),w=nt(r,h),p=m_(a),g=W1(s);x.useEffect(()=>{const v=m;if(!v)return;const b=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(b,"checked").set,k=!n.current;if(p!==a&&E){const N=new Event("click",{bubbles:k});v.indeterminate=ta(a),E.call(v,ta(a)?!1:a),v.dispatchEvent(N)}},[m,p,a,n]);const y=x.useRef(ta(a)?!1:a);return l.jsx(Re.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:i,disabled:c,name:u,value:d,form:f,...e,tabIndex:-1,ref:w,style:{...e.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});b_.displayName=w_;function kO(t){return typeof t=="function"}function ta(t){return t==="indeterminate"}function S_(t){return ta(t)?"indeterminate":t?"checked":"unchecked"}const __=x.forwardRef(({className:t,...e},r)=>l.jsx(Uv,{ref:r,className:je("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(x_,{className:je("flex items-center justify-center text-current"),children:l.jsx(S1,{className:"h-4 w-4"})})}));__.displayName=Uv.displayName;const E_=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:r,className:je("w-full caption-bottom text-sm",t),...e})}));E_.displayName="Table";const C_=x.forwardRef(({className:t,...e},r)=>l.jsx("thead",{ref:r,className:je("[&_tr]:border-b",t),...e}));C_.displayName="TableHeader";const P_=x.forwardRef(({className:t,...e},r)=>l.jsx("tbody",{ref:r,className:je("[&_tr:last-child]:border-0",t),...e}));P_.displayName="TableBody";const NO=x.forwardRef(({className:t,...e},r)=>l.jsx("tfoot",{ref:r,className:je("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));NO.displayName="TableFooter";const Wi=x.forwardRef(({className:t,...e},r)=>l.jsx("tr",{ref:r,className:je("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Wi.displayName="TableRow";const Jc=x.forwardRef(({className:t,...e},r)=>l.jsx("th",{ref:r,className:je("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Jc.displayName="TableHead";const po=x.forwardRef(({className:t,...e},r)=>l.jsx("td",{ref:r,className:je("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));po.displayName="TableCell";const jO=x.forwardRef(({className:t,...e},r)=>l.jsx("caption",{ref:r,className:je("mt-4 text-sm text-muted-foreground",t),...e}));jO.displayName="TableCaption";function Wf(t){return new Set(t.filter(e=>e.enabled===!1).map(e=>e.name))}function RO({serviceId:t,tools:e,isLoading:r}){const[s,n]=x.useState(""),[a,o]=x.useState(null),[i,c]=x.useState(()=>Wf(e)),u=vr(),{toast:d}=gr(),f=x.useMemo(()=>e.filter(v=>v.enabled===!1).map(v=>v.name).sort().join("\0"),[e]);x.useEffect(()=>{c(Wf(e))},[t,f,e.length]);const m=Ot({mutationFn:async v=>{await Ue("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(Wf(e))}}),h=v=>{c(v),m.mutate([...v])},w=(v,b)=>{const S=new Set(i);b?S.delete(v):S.add(v),h(S)},p=v=>{if(v){h(new Set);return}h(new Set(e.map(b=>b.name)))},g=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]),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(Tu,{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(ve,{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(ve,{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(E1,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),l.jsx(ut,{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(E_,{children:[l.jsx(C_,{children:l.jsxs(Wi,{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(P_,{children:g.length===0?l.jsx(Wi,{className:"border-white/10 hover:bg-transparent",children:l.jsx(po,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):g.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(Wi,{className:`border-white/10 ${b?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[l.jsx(po,{className:"text-center",children:l.jsx("div",{className:"flex justify-center",children:l.jsx(__,{checked:b,onCheckedChange:k=>w(v.name,k===!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(po,{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(bv,{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(po,{className:"text-sm text-gray-300",children:v.description||"—"})]}),E&&S&&l.jsx(Wi,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:l.jsx(po,{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 TO({service:t,isOpen:e,onClose:r}){var Oe,Fe,ke,st,vt,Hr,zt,fs,oo,Yt,Br,hs,Nr,Dn,ps,ya,ms,ne,Pt,$n,Mn,Yl,Jl,Xl;const[s,n]=x.useState(null),[a,o]=x.useState(!1),[i,c]=x.useState(""),[u,d]=x.useState(!1),[f,m]=x.useState(!1),[h,w]=x.useState(!1),[p,g]=x.useState(""),[y,v]=x.useState(""),[b,S]=x.useState(!1),[E,k]=x.useState(!1),[N,T]=x.useState(null),[D,U]=x.useState(null),R=vr(),{toast:A}=gr(),_=N||t,O=!!(_&&_.id&&_.url),z=()=>{var Je,Xe,vs;if(!((Xe=(Je=j==null?void 0:j.data)==null?void 0:Je.oauth)!=null&&Xe.required))return{status:"not_required",message:null};const re=!!(_!=null&&_.oauthAccessToken),Ee=!!((vs=_==null?void 0:_.headers)!=null&&vs.Authorization);if(!re||!Ee)return{status:"required",message:"OAuth 2.0 Authentication Required"};const Ke=_==null?void 0:_.oauthTokenExpiresAt;if(Ke){const ef=new Date(Ke).getTime(),rf=new Date().getTime()+5*60*1e3;if(ef<=rf)return{status:"expired",message:"OAuth Token Expired - Please re-authenticate"}}return{status:"authenticated",message:null}},{data:j,isLoading:K,error:C,refetch:F}=Ir({queryKey:["/api/mcp/discover",_==null?void 0:_.url],queryFn:async()=>{if(!_||_.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${_.url}`);try{const Ee=await(await Ue("POST","/api/mcp/discover",{url:_.url})).json();return console.log(`✅ MCP discovery successful for ${_.url}:`,Ee),Ee}catch(re){throw console.log(`❌ MCP discovery failed for ${_.url}:`,re),re}},enabled:O&&_.type==="mcp"&&e,staleTime:0,gcTime:2*60*1e3}),L=z();console.log("MCP Discovery Query Debug:",{apiService:_==null?void 0:_.id,apiServiceType:_==null?void 0:_.type,apiServiceUrl:_==null?void 0:_.url,isOpen:e,hasValidService:O,enabled:O&&_.type==="mcp"&&e,mcpDiscoveryLoading:K,mcpDiscoveryData:j?JSON.stringify(j,null,2):null,mcpDiscoveryDataKeys:j?Object.keys(j):null,oauthRequired:(Fe=(Oe=j==null?void 0:j.data)==null?void 0:Oe.oauth)==null?void 0:Fe.required,oauthData:(ke=j==null?void 0:j.data)!=null&&ke.oauth?JSON.stringify(j.data.oauth,null,2):null,toolsQueryEnabled:O&&_.type==="mcp"&&e&&!((vt=(st=j==null?void 0:j.data)==null?void 0:st.oauth)!=null&&vt.required)});const{data:Q,isLoading:te,error:V,refetch:de}=Ir({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 Ee=await(await Ue("GET",`/api/services/${_.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${_.id}:`,Ee),Ee}catch(re){throw console.log(`❌ MCP tools discovery failed for ${_.id}:`,re),re}},enabled:O&&(_.type==="mcp"||_.type==="local-mcp")&&e&&(_.type==="local-mcp"||L.status==="authenticated"||L.status==="not_required"),staleTime:0,gcTime:2*60*1e3});x.useEffect(()=>{if(!e||!(_!=null&&_.id)||_.type!=="mcp"&&_.type!=="local-mcp"||!(_.type==="local-mcp"||L.status==="authenticated"||L.status==="not_required")||te)return;let Ee=!1;return(async()=>{try{const Xe=await(await Ue("GET",`/api/services/${_.id}`)).json();!Ee&&(Xe!=null&&Xe.success)&&Xe.data&&T(Xe.data),R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]})}catch{}})(),()=>{Ee=!0}},[e,_==null?void 0:_.id,_==null?void 0:_.type,te,V,Q,L.status,R]),x.useEffect(()=>{if(!e||!(_!=null&&_.id)||_.type!=="a2a")return;let re=!1;return(async()=>{try{await Ue("GET",`/api/services/${_.id}/health`);const Je=await(await Ue("GET",`/api/services/${_.id}`)).json();!re&&(Je!=null&&Je.success)&&Je.data&&T(Je.data),R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]})}catch{}})(),()=>{re=!0}},[e,_==null?void 0:_.id,_==null?void 0:_.type,R]),console.log("MCP Tools Query Debug:",{hasValidService:O,apiServiceType:_==null?void 0:_.type,isOpen:e,oauthRequired:(zt=(Hr=j==null?void 0:j.data)==null?void 0:Hr.oauth)==null?void 0:zt.required,oauthStatus:L.status,toolsQueryEnabled:O&&(_.type==="mcp"||_.type==="local-mcp")&&e&&(_.type==="local-mcp"||L.status==="authenticated"||L.status==="not_required"),mcpToolsLoading:te});const{data:Te,isLoading:ge,error:X}=Ir({queryKey:["/api/proxy/a2a",_==null?void 0:_.id,"manifest"],queryFn:async()=>{if(!_||_.type!=="a2a")return null;const Ee=await(await Ue("GET",`/api/proxy/a2a/${_.id}/manifest`)).text();return JSON.parse(Ee)},enabled:O&&_.type==="a2a"&&e,staleTime:0,gcTime:2*60*1e3}),he=(Q==null?void 0:Q.data)||[],pe=Te,ye=te||ge;console.log("ServiceDetailsModal Debug:",{service:t==null?void 0:t.id,serviceType:t==null?void 0:t.type,isOpen:e,mcpDiscoveryLoading:K,mcpDiscoveryData:j,mcpDiscoveryError:C?String(C):null,mcpToolsLoading:te,a2aManifestLoading:ge,mcpToolsError:V?String(V):null,a2aManifestError:X?String(X):null,mcpToolsCount:he.length,mcpToolsData:Q,hasA2aManifest:!!pe,isLoading:ye,oauthRequired:(oo=(fs=j==null?void 0:j.data)==null?void 0:fs.oauth)==null?void 0:oo.required,oauthStatus:L.status,oauthMessage:L.message,hasAccessToken:!!(_!=null&&_.oauthAccessToken),hasHeaders:!!((Yt=_==null?void 0:_.headers)!=null&&Yt.Authorization),expiresAt:_==null?void 0:_.oauthTokenExpiresAt}),x.useEffect(()=>{t&&e&&(T(t),c(t.cardColor||"#92E4DD"),g(t.name||""),v(t.description||""))},[t,e]),x.useEffect(()=>()=>{D&&(clearInterval(D),U(null))},[D]),x.useEffect(()=>{var re,Ee;(Ee=(re=j==null?void 0:j.data)==null?void 0:re.oauth)!=null&&Ee.required&&!D&&ue()},[(hs=(Br=j==null?void 0:j.data)==null?void 0:Br.oauth)==null?void 0:hs.required,D]);const ue=()=>{if(!(_!=null&&_.id))return;D&&clearInterval(D),console.log("🔄 Starting OAuth polling for service:",_.id);const re=setInterval(async()=>{var Ee,Ke;try{console.log("🔍 OAuth polling check for service:",_.id);const Je=await Ue("GET",`/api/services/${_.id}`);if(Je.ok){const Xe=await Je.json(),vs=(Ke=(Ee=Xe.headers)==null?void 0:Ee.Authorization)==null?void 0:Ke.startsWith("Bearer ");console.log("🔍 OAuth polling result:",{serviceId:_.id,hasAuthHeader:vs,headers:Xe.headers}),vs&&(clearInterval(re),U(null),console.log("✅ OAuth completed for service:",_.id),A({title:"OAuth completed",description:"Authentication successful! Refreshing service status...",variant:"default"}),R.invalidateQueries({queryKey:["/api/mcp/discover",_.url]}),await F(),setTimeout(async()=>{R.invalidateQueries({queryKey:["/api/services",_.id,"tools"]}),await de()},1e3))}}catch(Je){console.error("OAuth polling error:",Je)}},2e3);U(re)};x.useEffect(()=>{const re=Ee=>{const Ke=Ee.target;a&&!Ke.closest(".color-picker-container")&&o(!1)};return document.addEventListener("mousedown",re),()=>{document.removeEventListener("mousedown",re)}},[a]);const Pe=()=>(t==null?void 0:t.type)==="mcp"?l.jsx(Zy,{className:"w-6 h-6"}):l.jsx(Df,{className:"w-6 h-6"}),Ae=()=>(t==null?void 0:t.type)==="mcp"?"text-blue-400":"text-purple-400",De=()=>(t==null?void 0:t.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",J=re=>new Date(re).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),ie=async re=>{if(t){d(!0),c(re);try{if((await Ue("PUT",`/api/services/${t.id}`,{cardColor:re})).ok)R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]}),R.invalidateQueries({queryKey:["/api/decks"]}),R.invalidateQueries({queryKey:["/api/decks"]}),A({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"),A({title:"Update failed",description:"Failed to update card color. Please try again.",variant:"destructive"})}finally{d(!1)}}},Y=async()=>{if(!(!t||!p.trim())){S(!0);try{if((await Ue("PUT",`/api/services/${t.id}`,{name:p.trim()})).ok){if(N){const Ee={...N,name:p.trim()};T(Ee)}R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]}),R.invalidateQueries({queryKey:["/api/decks"]}),R.invalidateQueries({queryKey:["/api/decks"]}),A({title:"Name updated",description:"Service name has been updated successfully."}),m(!1)}else throw new Error("Failed to update name")}catch{A({title:"Update failed",description:"Failed to update service name. Please try again.",variant:"destructive"})}finally{S(!1)}}},ze=async()=>{if(t){k(!0);try{if((await Ue("PUT",`/api/services/${t.id}`,{description:y.trim()})).ok){if(N){const Ee={...N,description:y.trim()};T(Ee)}R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]}),R.invalidateQueries({queryKey:["/api/decks"]}),R.invalidateQueries({queryKey:["/api/decks"]}),A({title:"Description updated",description:"Service description has been updated successfully."}),w(!1)}else throw new Error("Failed to update description")}catch{A({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{k(!1)}}},ee=[{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:[Pe(),l.jsx("div",{className:"ml-3 flex items-center",children:f?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:p,onChange:re=>g(re.target.value),onKeyDown:re=>{var Ee;re.key==="Enter"?Y():re.key==="Escape"&&(m(!1),g(((Ee=N||t)==null?void 0:Ee.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(ve,{size:"sm",onClick:Y,disabled:b,className:"h-6 px-2 text-xs",children:b?"Saving...":"Save"}),l.jsx(ve,{size:"sm",variant:"outline",onClick:()=>{var re;m(!1),g(((re=N||t)==null?void 0:re.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:(Nr=N||t)==null?void 0:Nr.name}),l.jsx(ve,{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 ${De()} ${Ae()}`,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(n2,{className:"w-5 h-5 mr-2"}),"Service Overview"]}),l.jsxs("div",{className:"relative color-picker-container",children:[l.jsx(ve,{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:ee.map(re=>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)===re.value?"bg-white/20":""}`,onClick:()=>ie(re.value),disabled:u,children:[l.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:re.value}}),l.jsx("span",{className:"text-white",children:re.label}),u&&t.cardColor===re.value&&l.jsx("div",{className:"ml-auto w-3 h-3 border border-white/20 border-t-transparent rounded-full animate-spin"})]},re.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"}),!h&&l.jsx(ve,{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"})})]}),h?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{value:y,onChange:re=>v(re.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(ve,{size:"sm",onClick:ze,disabled:E,className:"h-6 px-2 text-xs",children:E?"Saving...":"Save"}),l.jsx(ve,{size:"sm",variant:"outline",onClick:()=>{var re;w(!1),v(((re=N||t)==null?void 0:re.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:((ps=N||t)==null?void 0:ps.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(ve,{size:"sm",variant:"ghost",onClick:()=>window.open(_.url,"_blank"),className:"p-1 h-auto",children:l.jsx(ho,{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":L.status==="required"||L.status==="expired"?"Auth required":"Unknown"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Registered"}),l.jsx("p",{className:"text-white text-sm",children:J(_.registeredAt)})]})]})]}),ye&&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(RO,{serviceId:_.id,tools:he,isLoading:te}),t.type==="a2a"&&pe&&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(d2,{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:pe.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:pe.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:pe.description})]}),pe.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:pe.provider.organization})]}),pe.documentationUrl&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),l.jsxs(ve,{size:"sm",variant:"ghost",onClick:()=>window.open(pe.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[l.jsx(ho,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),pe.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(b1,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[pe.capabilities.streaming&&l.jsx(hn,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),pe.capabilities.pushNotifications&&l.jsx(hn,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),pe.capabilities.stateTransitionHistory&&l.jsx(hn,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),pe.skills&&pe.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(Df,{className:"w-5 h-5 mr-2"}),"Skills (",pe.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:pe.skills.map((re,Ee)=>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(Df,{className:"w-6 h-6"})}),l.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:re.name}),l.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:re.description}),re.tags&&re.tags.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:re.tags.slice(0,2).map((Ke,Je)=>l.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:Ke},Je))})]}),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"})]},Ee))})]}),(pe.defaultInputModes||pe.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:[pe.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:pe.defaultInputModes.map((re,Ee)=>l.jsx(hn,{className:"bg-blue-500/20 text-blue-300 text-xs",children:re},Ee))})]}),pe.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:pe.defaultOutputModes.map((re,Ee)=>l.jsx(hn,{className:"bg-green-500/20 text-green-300 text-xs",children:re},Ee))})]})]})]})]}),(t==null?void 0:t.type)==="mcp"&&L.status!=="authenticated"&&L.status!=="not_required"&&l.jsxs("div",{className:`${L.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:`${L.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:L.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),l.jsxs("div",{className:`${L.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[l.jsx("p",{children:l.jsx("strong",{children:L.message})}),l.jsx("p",{children:L.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."}),j.data.oauth.authorizationUrl&&l.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[l.jsx(ve,{size:"sm",variant:"default",className:"h-8 bg-orange-600 hover:bg-orange-700",onClick:async()=>{var re,Ee;if(_!=null&&_.id)try{A({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Ke=await Ue("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!Ke.ok){const Xe=await Ke.json();(re=Xe.data)!=null&&re.registrationUrl?(window.open(Xe.data.registrationUrl,"_blank"),A({title:"OAuth Registration Required",description:`${Xe.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):A({title:"OAuth Setup Failed",description:Xe.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Je=await Ke.json();Je.success&&((Ee=Je.data)!=null&&Ee.authorizationUrl)?(window.open(Je.data.authorizationUrl,"_blank"),A({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),ue()):A({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Ke){A({title:"OAuth Setup Failed",description:Ke instanceof Error?Ke.message:"Unknown error occurred",variant:"destructive"})}},children:"🔐 Continue OAuth"}),l.jsxs(ve,{size:"sm",variant:"ghost",className:"p-1 h-auto text-orange-300",onClick:()=>window.open(j.data.oauth.authorizationUrl,"_blank"),children:[l.jsx(ho,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),l.jsxs("div",{className:"mt-2 text-xs text-orange-100",children:[l.jsx("p",{children:l.jsx("strong",{children:"💡 What this means:"})}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsx("li",{children:"This MCP server requires OAuth 2.0 authentication"}),l.jsx("li",{children:"You need to register an OAuth application with the service provider"}),l.jsx("li",{children:"After registration, you'll get Client ID and Client Secret"}),l.jsx("li",{children:"Configure these credentials in the service settings"})]}),j.data.oauth.resourceName&&l.jsxs("div",{className:"mt-3 p-2 bg-orange-500/10 rounded border border-orange-500/20",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 OAuth Configuration Found:"})}),l.jsxs("p",{children:[l.jsx("strong",{children:"Resource:"})," ",j.data.oauth.resourceName]}),j.data.oauth.issuer&&l.jsxs("p",{children:[l.jsx("strong",{children:"Issuer:"})," ",j.data.oauth.issuer]}),((ya=j.data.oauth.scopesSupported)==null?void 0:ya.length)>0&&l.jsxs("p",{children:[l.jsx("strong",{children:"Supported Scopes:"})," ",j.data.oauth.scopesSupported.join(", ")]}),j.data.oauth.authorizationUrl&&l.jsxs("p",{children:[l.jsx("strong",{children:"Authorization URL:"})," ",j.data.oauth.authorizationUrl]}),j.data.oauth.tokenUrl&&l.jsxs("p",{children:[l.jsx("strong",{children:"Token URL:"})," ",j.data.oauth.tokenUrl]})]})]})]})]}),(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: ",te?"🔄 Loading...":V?"❌ Failed":"✅ Complete"]})]}),te&&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})]})]}),V&&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:V instanceof Error?V.message:String(V)}),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"})]})]})]}),!te&&!V&&he.length>0&&l.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:l.jsxs("p",{children:["✅ Successfully discovered ",he.length," tools from MCP server"]})}),!te&&!V&&he.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"})]})]})]}),V&&(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:V instanceof Error?V.message:String(V)}),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)})]})]})]}),X&&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:X instanceof Error?X.message:String(X)}),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]})]})]}),!ye&&!V&&!X&&(t.type==="mcp"||t.type==="local-mcp")&&he.length===0&&(t.type==="local-mcp"||!((ne=(ms=j==null?void 0:j.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]}),K&&l.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:l.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),j&&l.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 What we discovered:"})}),j.error&&j.analysis&&l.jsxs("div",{className:"text-yellow-200",children:[j.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"})]}),j.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"})]}),j.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"})]}),j.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"})]}),j.analysis.message&&l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Analysis:"})," ",j.analysis.message]})]}),(($n=(Pt=j==null?void 0:j.data)==null?void 0:Pt.oauth)==null?void 0:$n.required)&&l.jsxs("div",{className:"text-yellow-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),j.data.oauth.authorizationUrl&&l.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[l.jsx(ve,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var re,Ee;if(_!=null&&_.id)try{A({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Ke=await Ue("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!Ke.ok){const Xe=await Ke.json();(re=Xe.data)!=null&&re.registrationUrl?(window.open(Xe.data.registrationUrl,"_blank"),A({title:"OAuth Registration Required",description:`${Xe.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):A({title:"OAuth Setup Failed",description:Xe.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Je=await Ke.json();Je.success&&((Ee=Je.data)!=null&&Ee.authorizationUrl)?(window.open(Je.data.authorizationUrl,"_blank"),A({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),ue()):A({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Ke){A({title:"OAuth Setup Failed",description:Ke instanceof Error?Ke.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsxs(ve,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(j.data.oauth.authorizationUrl,"_blank"),children:[l.jsx(ho,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!j.data.oauth.authorizationUrl&&j.data.oauth.protectedResourceConfigUrl&&l.jsx("div",{className:"mt-2",children:l.jsxs(ve,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(j.data.oauth.protectedResourceConfigUrl,"_blank"),children:[l.jsx(ho,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),j.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(j.data.oauth.authorizationServerMetadataUrl,"_blank"),children:j.data.oauth.authorizationServerMetadataUrl})]})]}),(j==null?void 0:j.success)&&!((Yl=(Mn=j==null?void 0:j.data)==null?void 0:Mn.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=j==null?void 0:j.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"}),j.data.oauth.resourceName&&l.jsxs("p",{children:["• Service: ",j.data.oauth.resourceName]}),j.data.oauth.authorizationUrl&&l.jsxs("p",{children:["• Authorization URL: ",j.data.oauth.authorizationUrl]}),j.data.oauth.tokenUrl&&l.jsxs("p",{children:["• Token URL: ",j.data.oauth.tokenUrl]}),l.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[l.jsx(ve,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var re,Ee;if(_!=null&&_.id)try{A({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Ke=await Ue("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!Ke.ok){const Xe=await Ke.json();(re=Xe.data)!=null&&re.registrationUrl?(window.open(Xe.data.registrationUrl,"_blank"),A({title:"OAuth Registration Required",description:`${Xe.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):A({title:"OAuth Setup Failed",description:Xe.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Je=await Ke.json();Je.success&&((Ee=Je.data)!=null&&Ee.authorizationUrl)?(window.open(Je.data.authorizationUrl,"_blank"),A({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),ue()):A({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Ke){A({title:"OAuth Setup Failed",description:Ke instanceof Error?Ke.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsx(ve,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const re=`OAuth Setup Instructions:
|
|
321
326
|
|
|
322
327
|
1. Go to the service provider's OAuth/Developer settings
|
|
323
328
|
2. Create a new OAuth application
|
|
@@ -327,8 +332,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
327
332
|
|
|
328
333
|
${j.data.oauth.authorizationUrl?`Authorization URL: ${j.data.oauth.authorizationUrl}`:""}
|
|
329
334
|
${j.data.oauth.tokenUrl?`Token URL: ${j.data.oauth.tokenUrl}`:""}
|
|
330
|
-
${j.data.oauth.issuer?`Issuer: ${j.data.oauth.issuer}`:""}`;A({title:"OAuth Setup Instructions",description:re,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"})]})]})]}),C&&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:C instanceof Error?C.message:String(C)})]})]})]}),!ye&&!V&&!X&&t.type==="a2a"&&!he&&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 OO(){const[t,e]=x.useState("connecting"),[r,s]=x.useState(null),n=x.useRef(null),a=x.useRef(null),o=vr();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=f=>{try{const m=JSON.parse(f.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=f=>{console.error("WebSocket error:",f),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 S0(t,e){const r=t==="credential"?`credentialId=${encodeURIComponent(e)}`:`serviceId=${encodeURIComponent(e)}`;return(await(await Ue("GET",`/api/playbooks/dependents/check?${r}`)).json()).data??[]}function IO(t){const[e,r]=x.useState(null),[s,n]=x.useState(null),[a,o]=x.useState(null),[i,c]=x.useState(!1),u=vr(),{toast:d}=gr(),f=()=>{if(!t)throw new Error("Select a deck to edit first");return t},m=Ot({mutationFn:async R=>{var K,C,F;const A=f(),z=(K=(await(await Ue("GET","/api/decks")).json()).data)==null?void 0:K.find(L=>L.id===A);if(!z)throw new Error("Selected deck not found");if((C=z.services)!=null&&C.some(L=>L.id===R))throw new Error("Service is already in the deck");const j=((F=z.services)==null?void 0:F.length)??0;return Ue("POST",`/api/decks/${A}/services`,{serviceId:R,position:j})},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:R=>{d({title:"Failed to add service",description:R.message,variant:"destructive"})}}),h=Ot({mutationFn:async R=>{var j,K;const A=f(),z=(j=(await(await Ue("GET","/api/decks")).json()).data)==null?void 0:j.find(C=>C.id===A);if((K=z==null?void 0:z.credentials)!=null&&K.some(C=>C.id===R))throw new Error("API key is already in the deck");return Ue("POST",`/api/decks/${A}/credentials`,{credentialId:R})},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:R=>{d({title:"Failed to add API key",description:R.message,variant:"destructive"})}}),w=Ot({mutationFn:async R=>{var j,K;const A=f(),z=(j=(await(await Ue("GET","/api/decks")).json()).data)==null?void 0:j.find(C=>C.id===A);if((K=z==null?void 0:z.playbooks)!=null&&K.some(C=>C.id===R))throw new Error("Playbook is already in the deck");return Ue("POST",`/api/decks/${A}/playbooks`,{playbookId:R})},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:R=>{d({title:"Failed to add playbook",description:R.message,variant:"destructive"})}}),p=Ot({mutationFn:async R=>{const A=await S0("service",R);if(A.length>0){const O=A.map(j=>j.title).join(", ");if(!window.confirm(`Warning: ${A.length} playbook(s) depend on this MCP (${O}). Remove from deck anyway?`))throw new Error("Cancelled")}const _=f();return Ue("DELETE",`/api/decks/${_}/services`,{serviceId:R})},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:R=>{R.message!=="Cancelled"&&d({title:"Failed to remove service",description:R.message,variant:"destructive"})}}),g=Ot({mutationFn:async R=>{const A=await S0("credential",R);if(A.length>0){const O=A.map(j=>j.title).join(", ");if(!window.confirm(`Warning: ${A.length} playbook(s) depend on this API key (${O}). Remove from deck anyway?`))throw new Error("Cancelled")}const _=f();return Ue("DELETE",`/api/decks/${_}/credentials`,{credentialId:R})},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:R=>{R.message!=="Cancelled"&&d({title:"Failed to remove API key",description:R.message,variant:"destructive"})}}),y=Ot({mutationFn:async R=>{const A=f();return Ue("DELETE",`/api/decks/${A}/playbooks`,{playbookId:R})},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:R=>{d({title:"Failed to remove playbook",description:R.message,variant:"destructive"})}}),v=(R,A)=>{R.currentTarget instanceof HTMLElement&&(R.currentTarget.style.opacity=A)},b=(R,A)=>{R.dataTransfer.setData("text/plain",A.id),R.dataTransfer.setData("application/json",JSON.stringify(A)),R.dataTransfer.effectAllowed=A.fromDeck?"move":"copy"},S=(R,A,_=!1)=>{r(A),n(null),o(null),c(_),b(R,{kind:"service",id:A.id,fromDeck:_}),v(R,"0.5")},E=(R,A,_=!1)=>{n(A),r(null),o(null),c(_),b(R,{kind:"credential",id:A.id,fromDeck:_}),v(R,"0.5")},k=(R,A,_=!1)=>{o(A),r(null),n(null),c(_),b(R,{kind:"playbook",id:A.id,fromDeck:_}),v(R,"0.5")},N=R=>{r(null),n(null),o(null),v(R,"1")},T=R=>{if(R.kind==="service"){R.fromDeck?p.mutate(R.id):m.mutate(R.id);return}if(R.kind==="credential"){R.fromDeck?g.mutate(R.id):h.mutate(R.id);return}R.fromDeck?y.mutate(R.id):w.mutate(R.id)};return{draggedService:e,draggedCredential:s,draggedPlaybook:a,isDraggingFromDeck:i,handleDragStart:S,handleCredentialDragStart:E,handlePlaybookDragStart:k,handleDragEnd:N,handleDrop:R=>{R.preventDefault();const A=R.dataTransfer.getData("application/json");if(A){try{T(JSON.parse(A))}catch{const _=R.dataTransfer.getData("text/plain");_&&e&&m.mutate(_)}r(null),n(null),o(null),c(!1)}},handleGlobalDrop:R=>{R.preventDefault();const A=R.dataTransfer.getData("application/json");if(A){try{const _=JSON.parse(A);_.fromDeck&&T(_)}catch{}r(null),n(null),o(null),c(!1)}},isDropping:m.isPending||h.isPending||w.isPending||p.isPending||g.isPending||y.isPending}}const Qf="agent-deck-editing-deck-id";function DO(t){const[e,r]=x.useState(()=>typeof window>"u"?null:localStorage.getItem(Qf));x.useEffect(()=>{if(t.length===0)return;if(!(e&&t.some(o=>o.id===e))){const o=t[0].id;r(o),localStorage.setItem(Qf,o)}},[t,e]);const s=a=>{r(a),localStorage.setItem(Qf,a)};return{editingDeck:t.find(a=>a.id===e)??null,editingDeckId:e,setEditingDeckId:s}}function _0(t,[e,r]){return Math.min(r,Math.max(e,t))}var $O=[" ","Enter","ArrowUp","ArrowDown"],MO=[" ","Enter"],Za="Select",[Ud,zd,FO]=vv(Za),[ki,yF]=ds(Za,[FO,Od]),Vd=Od(),[LO,ma]=ki(Za),[UO,zO]=ki(Za),k_=t=>{const{__scopeSelect:e,children:r,open:s,defaultOpen:n,onOpenChange:a,value:o,defaultValue:i,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:h,form:w}=t,p=Vd(e),[g,y]=x.useState(null),[v,b]=x.useState(null),[S,E]=x.useState(!1),k=Mv(u),[N,T]=Wa({prop:s,defaultProp:n??!1,onChange:a,caller:Za}),[D,U]=Wa({prop:o,defaultProp:i,onChange:c,caller:Za}),R=x.useRef(null),A=g?w||!!g.closest("form"):!0,[_,O]=x.useState(new Set),z=Array.from(_).map(j=>j.props.value).join(";");return l.jsx(hT,{...p,children:l.jsxs(LO,{required:h,scope:e,trigger:g,onTriggerChange:y,valueNode:v,onValueNodeChange:b,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:ea(),value:D,onValueChange:U,open:N,onOpenChange:T,dir:k,triggerPointerDownPosRef:R,disabled:m,children:[l.jsx(Ud.Provider,{scope:e,children:l.jsx(UO,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(j=>{O(K=>new Set(K).add(j))},[]),onNativeOptionRemove:x.useCallback(j=>{O(K=>{const C=new Set(K);return C.delete(j),C})},[]),children:r})}),A?l.jsxs(Y_,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:D,onChange:j=>U(j.target.value),disabled:m,form:w,children:[D===void 0?l.jsx("option",{value:""}):null,Array.from(_)]},z):null]})})};k_.displayName=Za;var N_="SelectTrigger",j_=x.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:s=!1,...n}=t,a=Vd(r),o=ma(N_,r),i=o.disabled||s,c=nt(e,o.onTriggerChange),u=zd(r),d=x.useRef("touch"),[f,m,h]=X_(p=>{const g=u().filter(b=>!b.disabled),y=g.find(b=>b.value===o.value),v=eE(g,p,y);v!==void 0&&o.onValueChange(v.value)}),w=p=>{i||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return l.jsx(n1,{asChild:!0,...a,children:l.jsx(Re.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":J_(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 g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(w(p),p.preventDefault())}),onKeyDown:Se(n.onKeyDown,p=>{const g=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(g&&p.key===" ")&&$O.includes(p.key)&&(w(),p.preventDefault())})})})});j_.displayName=N_;var R_="SelectValue",T_=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:s,style:n,children:a,placeholder:o="",...i}=t,c=ma(R_,r),{onValueNodeHasChildrenChange:u}=c,d=a!==void 0,f=nt(e,c.onValueNodeChange);return Bt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...i,ref:f,style:{pointerEvents:"none"},children:J_(c.value)?l.jsx(l.Fragment,{children:o}):a})});T_.displayName=R_;var VO="SelectIcon",A_=x.forwardRef((t,e)=>{const{__scopeSelect:r,children:s,...n}=t;return l.jsx(Re.span,{"aria-hidden":!0,...n,ref:e,children:s||"▼"})});A_.displayName=VO;var qO="SelectPortal",O_=t=>l.jsx(Ed,{asChild:!0,...t});O_.displayName=qO;var Ya="SelectContent",I_=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(D_,{scope:t.__scopeSelect,children:l.jsx(Ud.Slot,{scope:t.__scopeSelect,children:l.jsx("div",{children:t.children})})}),a):null}return l.jsx($_,{...t,ref:e})});I_.displayName=Ya;var Qr=10,[D_,va]=ki(Ya),HO="SelectContentImpl",BO=hi("SelectContent.RemoveScroll"),$_=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:f,collisionBoundary:m,collisionPadding:h,sticky:w,hideWhenDetached:p,avoidCollisions:g,...y}=t,v=ma(Ya,r),[b,S]=x.useState(null),[E,k]=x.useState(null),N=nt(e,X=>S(X)),[T,D]=x.useState(null),[U,R]=x.useState(null),A=zd(r),[_,O]=x.useState(!1),z=x.useRef(!1);x.useEffect(()=>{if(b)return P1(b)},[b]),g1();const j=x.useCallback(X=>{const[ve,...he]=A().map(Pe=>Pe.ref.current),[ye]=he.slice(-1),ue=document.activeElement;for(const Pe of X)if(Pe===ue||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ve&&E&&(E.scrollTop=0),Pe===ye&&E&&(E.scrollTop=E.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==ue))return},[A,E]),K=x.useCallback(()=>j([T,b]),[j,T,b]);x.useEffect(()=>{_&&K()},[_,K]);const{onOpenChange:C,triggerPointerDownPosRef:F}=v;x.useEffect(()=>{if(b){let X={x:0,y:0};const ve=ye=>{var ue,Pe;X={x:Math.abs(Math.round(ye.pageX)-(((ue=F.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((Pe=F.current)==null?void 0:Pe.y)??0))}},he=ye=>{X.x<=10&&X.y<=10?ye.preventDefault():b.contains(ye.target)||C(!1),document.removeEventListener("pointermove",ve),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ve),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ve),document.removeEventListener("pointerup",he,{capture:!0})}}},[b,C,F]),x.useEffect(()=>{const X=()=>C(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[C]);const[L,Q]=X_(X=>{const ve=A().filter(ue=>!ue.disabled),he=ve.find(ue=>ue.ref.current===document.activeElement),ye=eE(ve,X,he);ye&&setTimeout(()=>ye.ref.current.focus())}),te=x.useCallback((X,ve,he)=>{const ye=!z.current&&!he;(v.value!==void 0&&v.value===ve||ye)&&(D(X),ye&&(z.current=!0))},[v.value]),V=x.useCallback(()=>b==null?void 0:b.focus(),[b]),de=x.useCallback((X,ve,he)=>{const ye=!z.current&&!he;(v.value!==void 0&&v.value===ve||ye)&&R(X)},[v.value]),Te=s==="popper"?Ep:M_,ge=Te===Ep?{side:i,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:w,hideWhenDetached:p,avoidCollisions:g}:{};return l.jsx(D_,{scope:r,content:b,viewport:E,onViewportChange:k,itemRefCallback:te,selectedItem:T,onItemLeave:V,itemTextRefCallback:de,focusSelectedItem:K,selectedItemText:U,position:s,isPositioned:_,searchRef:L,children:l.jsx(Ov,{as:BO,allowPinchZoom:!0,children:l.jsx(Av,{asChild:!0,trapped:v.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:Se(n,X=>{var ve;(ve=v.trigger)==null||ve.focus({preventScroll:!0}),X.preventDefault()}),children:l.jsx(Vl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(Te,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:X=>X.preventDefault(),...y,...ge,onPlaced:()=>O(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Se(y.onKeyDown,X=>{const ve=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ve&&X.key.length===1&&Q(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let ye=A().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(X.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const ue=X.target,Pe=ye.indexOf(ue);ye=ye.slice(Pe+1)}setTimeout(()=>j(ye)),X.preventDefault()}})})})})})})});$_.displayName=HO;var KO="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),f=nt(e,N=>d(N)),m=zd(r),h=x.useRef(!1),w=x.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:y,focusSelectedItem:v}=o,b=x.useCallback(()=>{if(a.trigger&&a.valueNode&&i&&u&&p&&g&&y){const N=a.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),D=a.valueNode.getBoundingClientRect(),U=y.getBoundingClientRect();if(a.dir!=="rtl"){const ue=U.left-T.left,Pe=D.left-ue,Ae=N.left-Pe,De=N.width+Ae,J=Math.max(De,T.width),ie=window.innerWidth-Qr,Y=_0(Pe,[Qr,Math.max(Qr,ie-J)]);i.style.minWidth=De+"px",i.style.left=Y+"px"}else{const ue=T.right-U.right,Pe=window.innerWidth-D.right-ue,Ae=window.innerWidth-N.right-Pe,De=N.width+Ae,J=Math.max(De,T.width),ie=window.innerWidth-Qr,Y=_0(Pe,[Qr,Math.max(Qr,ie-J)]);i.style.minWidth=De+"px",i.style.right=Y+"px"}const R=m(),A=window.innerHeight-Qr*2,_=p.scrollHeight,O=window.getComputedStyle(u),z=parseInt(O.borderTopWidth,10),j=parseInt(O.paddingTop,10),K=parseInt(O.borderBottomWidth,10),C=parseInt(O.paddingBottom,10),F=z+j+_+C+K,L=Math.min(g.offsetHeight*5,F),Q=window.getComputedStyle(p),te=parseInt(Q.paddingTop,10),V=parseInt(Q.paddingBottom,10),de=N.top+N.height/2-Qr,Te=A-de,ge=g.offsetHeight/2,X=g.offsetTop+ge,ve=z+j+X,he=F-ve;if(ve<=de){const ue=R.length>0&&g===R[R.length-1].ref.current;i.style.bottom="0px";const Pe=u.clientHeight-p.offsetTop-p.offsetHeight,Ae=Math.max(Te,ge+(ue?V:0)+Pe+K),De=ve+Ae;i.style.height=De+"px"}else{const ue=R.length>0&&g===R[0].ref.current;i.style.top="0px";const Ae=Math.max(de,z+p.offsetTop+(ue?te:0)+ge)+he;i.style.height=Ae+"px",p.scrollTop=ve-de+p.offsetTop}i.style.margin=`${Qr}px 0`,i.style.minHeight=L+"px",i.style.maxHeight=A+"px",s==null||s(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,i,u,p,g,y,a.dir,s]);Bt(()=>b(),[b]);const[S,E]=x.useState();Bt(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const k=x.useCallback(N=>{N&&w.current===!0&&(b(),v==null||v(),w.current=!1)},[b,v]);return l.jsx(QO,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:l.jsx(Re.div,{...n,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});M_.displayName=KO;var WO="SelectPopperPosition",Ep=x.forwardRef((t,e)=>{const{__scopeSelect:r,align:s="start",collisionPadding:n=Qr,...a}=t,o=Vd(r);return l.jsx(s1,{...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)"}})});Ep.displayName=WO;var[QO,zv]=ki(Ya,{}),Cp="SelectViewport",F_=x.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:s,...n}=t,a=va(Cp,r),o=zv(Cp,r),i=nt(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(Re.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:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const h=Math.abs(c.current-d.scrollTop);if(h>0){const w=window.innerHeight-Qr*2,p=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),y=Math.max(p,g);if(y<w){const v=y+h,b=Math.min(w,v),S=v-b;f.style.height=b+"px",f.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});F_.displayName=Cp;var L_="SelectGroup",[GO,ZO]=ki(L_),YO=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=ea();return l.jsx(GO,{scope:r,id:n,children:l.jsx(Re.div,{role:"group","aria-labelledby":n,...s,ref:e})})});YO.displayName=L_;var U_="SelectLabel",z_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=ZO(U_,r);return l.jsx(Re.div,{id:n.id,...s,ref:e})});z_.displayName=U_;var Lu="SelectItem",[JO,V_]=ki(Lu),q_=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,f]=x.useState(a??""),[m,h]=x.useState(!1),w=nt(e,v=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,v,s,n)}),p=ea(),g=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(JO,{scope:r,value:s,disabled:n,textId:p,isSelected:u,onItemTextChange:x.useCallback(v=>{f(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(Re.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,()=>h(!0)),onBlur:Se(o.onBlur,()=>h(!1)),onClick:Se(o.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:Se(o.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:Se(o.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:Se(o.onPointerMove,v=>{var b;g.current=v.pointerType,n?(b=c.onItemLeave)==null||b.call(c):g.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===" "||(MO.includes(v.key)&&y(),v.key===" "&&v.preventDefault())})})})})});q_.displayName=Lu;var Qi="SelectItemText",H_=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:s,style:n,...a}=t,o=ma(Qi,r),i=va(Qi,r),c=V_(Qi,r),u=zO(Qi,r),[d,f]=x.useState(null),m=nt(e,y=>f(y),c.onItemTextChange,y=>{var v;return(v=i.itemTextRefCallback)==null?void 0:v.call(i,y,c.value,c.disabled)}),h=d==null?void 0:d.textContent,w=x.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=u;return Bt(()=>(p(w),()=>g(w)),[p,g,w]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...a,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?so.createPortal(a.children,o.valueNode):null]})});H_.displayName=Qi;var B_="SelectItemIndicator",K_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t;return V_(B_,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...s,ref:e}):null});K_.displayName=B_;var Pp="SelectScrollUpButton",W_=x.forwardRef((t,e)=>{const r=va(Pp,t.__scopeSelect),s=zv(Pp,t.__scopeSelect),[n,a]=x.useState(!1),o=nt(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(G_,{...t,ref:o,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});W_.displayName=Pp;var kp="SelectScrollDownButton",Q_=x.forwardRef((t,e)=>{const r=va(kp,t.__scopeSelect),s=zv(kp,t.__scopeSelect),[n,a]=x.useState(!1),o=nt(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(G_,{...t,ref:o,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});Q_.displayName=kp;var G_=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(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[i]),l.jsx(Re.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()})})}),XO="SelectSeparator",Z_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t;return l.jsx(Re.div,{"aria-hidden":!0,...s,ref:e})});Z_.displayName=XO;var Np="SelectArrow",eI=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=Vd(r),a=ma(Np,r),o=va(Np,r);return a.open&&o.position==="popper"?l.jsx(a1,{...n,...s,ref:e}):null});eI.displayName=Np;var tI="SelectBubbleInput",Y_=x.forwardRef(({__scopeSelect:t,value:e,...r},s)=>{const n=x.useRef(null),a=nt(s,n),o=m_(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 f=new Event("change",{bubbles:!0});d.call(i,e),i.dispatchEvent(f)}},[o,e]),l.jsx(Re.select,{...r,style:{...Jb,...r.style},ref:a,defaultValue:e})});Y_.displayName=tI;function J_(t){return t===""||t===void 0}function X_(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 eE(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=rI(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 rI(t,e){return t.map((r,s)=>t[(e+s)%t.length])}var nI=k_,tE=j_,sI=T_,aI=A_,oI=O_,rE=I_,iI=F_,nE=z_,sE=q_,lI=H_,cI=K_,aE=W_,oE=Q_,iE=Z_;const uI=nI,dI=sI,lE=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(tE,{ref:s,className:je("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(aI,{asChild:!0,children:l.jsx(bv,{className:"h-4 w-4 opacity-50"})})]}));lE.displayName=tE.displayName;const cE=x.forwardRef(({className:t,...e},r)=>l.jsx(aE,{ref:r,className:je("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(a2,{className:"h-4 w-4"})}));cE.displayName=aE.displayName;const uE=x.forwardRef(({className:t,...e},r)=>l.jsx(oE,{ref:r,className:je("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(bv,{className:"h-4 w-4"})}));uE.displayName=oE.displayName;const dE=x.forwardRef(({className:t,children:e,position:r="popper",...s},n)=>l.jsx(oI,{children:l.jsxs(rE,{ref:n,className:je("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(cE,{}),l.jsx(iI,{className:je("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(uE,{})]})}));dE.displayName=rE.displayName;const fI=x.forwardRef(({className:t,...e},r)=>l.jsx(nE,{ref:r,className:je("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));fI.displayName=nE.displayName;const mo=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(sE,{ref:s,className:je("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(cI,{children:l.jsx(SS,{className:"h-4 w-4"})})}),l.jsx(lI,{children:e})]}));mo.displayName=sE.displayName;const hI=x.forwardRef(({className:t,...e},r)=>l.jsx(iE,{ref:r,className:je("-mx-1 my-1 h-px bg-muted",t),...e}));hI.displayName=iE.displayName;const pI="/assets/AgentDeckLogo2-z3pVqJJ3.png";function mI(){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,f]=x.useState(!1),[m,h]=x.useState(!1),[w,p]=x.useState(null),[g,y]=x.useState(!1),[v,b]=x.useState(!1),[S,E]=x.useState(null),[k,N]=x.useState(!1),[T,D]=x.useState(null),{toast:U}=gr(),{connectionStatus:R}=OO(),{data:A,isLoading:_,error:O}=Ir({queryKey:["/api/decks"]}),z=(A==null?void 0:A.data)||[],{editingDeck:j,editingDeckId:K,setEditingDeckId:C}=DO(z),{handleDragStart:F,handleCredentialDragStart:L,handlePlaybookDragStart:Q,handleDragEnd:te,handleDrop:V,handleGlobalDrop:de,isDraggingFromDeck:Te}=IO(K),{data:ge,isLoading:X,error:ve}=Ir({queryKey:["/api/services"]}),{data:he,isLoading:ye}=Ir({queryKey:["/api/credentials/vault"]}),{data:ue,isLoading:Pe}=Ir({queryKey:["/api/playbooks/vault"]}),{data:Ae}=Ir({queryKey:["/api/collection/warnings"],staleTime:6e4}),De=(ge==null?void 0:ge.data)||[],J=(he==null?void 0:he.data)||[],ie=(ue==null?void 0:ue.data)||[],Y=x.useMemo(()=>IT(Ae==null?void 0:Ae.data),[Ae==null?void 0:Ae.data]),ze=(ne,Pt)=>n?ne==="service"?Y.serviceWarnings.has(Pt):ne==="credential"?Y.credentialWarnings.has(Pt):Y.playbookWarnings.has(Pt):!0,ee=De.filter(ne=>{var Mn;if(!ze("service",ne.id)||r==="api-key"||r==="playbook")return!1;const Pt=ne.name.toLowerCase().includes(t.toLowerCase())||((Mn=ne.description)==null?void 0:Mn.toLowerCase().includes(t.toLowerCase())),$n=!r||r==="all"||ne.type===r;return Pt&&$n}),Oe=J.filter(ne=>!ze("credential",ne.id)||r&&r!=="all"&&r!=="api-key"?!1:ne.label.toLowerCase().includes(t.toLowerCase())),Fe=ie.filter(ne=>!ze("playbook",ne.id)||r&&r!=="all"&&r!=="playbook"?!1:ne.title.toLowerCase().includes(t.toLowerCase())||ne.body.toLowerCase().includes(t.toLowerCase())),ke=ee.length+Oe.length+Fe.length;ve&&console.error("Services error:",ve),O&&console.error("Decks error:",O);const st=()=>{e(""),s(""),a(!1)},vt=!!(t||r||n),Hr=new Set(((j==null?void 0:j.credentials)??[]).map(ne=>ne.id)),zt=new Set(((j==null?void 0:j.playbooks)??[]).map(ne=>ne.id)),fs=(j==null?void 0:j.services)||[],oo=(j==null?void 0:j.playbooks)||[],Yt=ne=>{u(ne),f(!0)},Br=ne=>{E(ne.id),N(!0)},hs=ne=>{p(ne.id),y(!0)},Nr=ne=>{D(ne)};return ve||O?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("h2",{className:"text-2xl font-bold text-red-400 mb-4",children:"Error Loading Data"}),l.jsx("p",{className:"text-gray-300 mb-4",children:"There was an error loading the application data."}),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"})]})}):X||_||ye||Pe?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:de,onDragOver:ne=>ne.preventDefault(),style:{position:"relative",...Te&&{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:pI,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 ${R==="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 ${R==="connected"?"bg-emerald-400":"bg-red-400"}`}),l.jsx("button",{className:`text-sm hover:underline cursor-pointer ${R==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{U({title:"MCP URL copied!",description:"The MCP server URL has been copied to your clipboard."})})},title:"Click to copy MCP URL",children:"Get MCP URL"})]}),j&&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:j.name}),l.jsxs("span",{className:"text-xs",style:{color:"#92E4DD",opacity:.7},"data-testid":"editing-deck-count",children:[(((ps=j.services)==null?void 0:ps.length)??0)+(((ya=j.credentials)==null?void 0:ya.length)??0)+(((ms=j.playbooks)==null?void 0:ms.length)??0)," ","cards"]})]})})]})]})})}),Te&&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:C,isLoading:_})}),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(bS,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),l.jsx("span",{style:{color:"#92E4DD"},children:"Add Connections"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(me,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(xr),onClick:()=>i(!0),"data-testid":"button-register-mcp",children:[l.jsx(Ru,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),l.jsxs(me,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(cr),onClick:()=>h(!0),"data-testid":"button-register-api-key",children:[l.jsx(hp,{className:"w-3 h-3 mr-2"}),"Register API key"]}),l.jsxs(me,{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(wv,{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:j?l.jsx("div",{className:"h-full",children:l.jsx(KT,{deck:j,services:fs,credentials:j.credentials??[],playbooks:oo,allServices:De,collectionWarnings:Y,onDrop:V,onDragStart:F,onCredentialDragStart:L,onPlaybookDragStart:Q,onDragEnd:te,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(pp,{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(me,{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(me,{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(pp,{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-6",children:[l.jsxs("h2",{className:"text-2xl font-bold flex items-center",children:[l.jsx("i",{className:"fas fa-th-large mr-3 text-blue-400"}),"My Collection",l.jsxs("span",{className:"ml-3 text-sm font-normal text-gray-400",children:["(",ke," cards)"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(ES,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),l.jsx(ut,{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(uI,{value:r,onValueChange:s,children:[l.jsxs(lE,{className:"w-20 h-8 bg-white/10 border-white/20 text-white text-sm","data-testid":"select-type",children:[l.jsx(i2,{className:"w-3 h-3 mr-1"}),l.jsx(dI,{placeholder:"Type"})]}),l.jsxs(dE,{children:[l.jsx(mo,{value:"all",children:"All"}),l.jsx(mo,{value:"mcp",children:"MCP"}),l.jsx(mo,{value:"local-mcp",children:"Local MCP"}),l.jsx(mo,{value:"api-key",children:"API Key"}),l.jsx(mo,{value:"playbook",children:"Playbook"})]})]}),(t||r||n)&&l.jsx(me,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:st,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:ke})," card",ke===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."})]})})]})}),X||ye||Pe?l.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,80px)] gap-0",children:Array.from({length:10}).map((ne,Pt)=>l.jsx("div",{className:"animate-pulse",children:l.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},Pt))}):ke===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 connections yet"}),l.jsx("p",{className:"text-gray-400 text-sm mb-4",children:vt?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"}),!vt&&l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsxs(me,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${bn}`,style:Sn(xr),onClick:()=>i(!0),"data-testid":"button-register-mcp-empty",children:[l.jsx(Ru,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),l.jsxs(me,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${bn}`,style:Sn(cr),onClick:()=>h(!0),"data-testid":"button-register-api-key-empty",children:[l.jsx(hp,{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:[Fe.map((ne,Pt)=>l.jsx("div",{className:"relative group",style:{zIndex:T===ne.id?999999:ke-Pt},children:l.jsx(BT,{playbook:ne,isInActiveDeck:zt.has(ne.id),activeDeck:j??void 0,isInCollection:!0,onDragStart:Q,onDragEnd:te,onCardClick:Br,onMouseEnter:()=>Nr(ne.id),onMouseLeave:()=>Nr(null),warnings:Y.playbookWarnings.get(ne.id)})},ne.id)),Oe.map((ne,Pt)=>l.jsx("div",{className:"relative group",style:{zIndex:T===ne.id?999999:ke-Fe.length-Pt},children:l.jsx(qT,{credential:ne,isInActiveDeck:Hr.has(ne.id),activeDeck:j??void 0,isInCollection:!0,onDragStart:L,onDragEnd:te,onMouseEnter:()=>Nr(ne.id),onMouseLeave:()=>Nr(null),onCardClick:hs,warnings:Y.credentialWarnings.get(ne.id)})},ne.id)),ee.map((ne,Pt)=>{var $n;return l.jsx("div",{className:"relative group",style:{zIndex:T===ne.id?999999:ke-Fe.length-Oe.length-Pt},children:l.jsx(LT,{service:ne,onDragStart:F,onDragEnd:te,isInActiveDeck:(($n=j==null?void 0:j.services)==null?void 0:$n.some(Mn=>Mn.id===ne.id))||!1,onCardClick:Yt,isInCollection:!0,onMouseEnter:()=>Nr(ne.id),onMouseLeave:()=>Nr(null),activeDeck:j??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(AO,{service:c,isOpen:d,onClose:()=>f(!1)}),l.jsx(wO,{open:m,onOpenChange:h}),l.jsx(_O,{credentialId:w,open:g,onOpenChange:y}),l.jsx(bO,{open:v,onOpenChange:b}),l.jsx(SO,{playbookId:S,open:k,onOpenChange:N})]})}const Cs=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:je("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:je("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:je("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:je("text-sm text-muted-foreground",t),...e}));Xc.displayName="CardDescription";const Ps=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:je("p-6 pt-0",t),...e}));Ps.displayName="CardContent";const vI=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:je("flex items-center p-6 pt-0",t),...e}));vI.displayName="CardFooter";function gI(){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(_S,{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 yI(){const[t]=yN(),[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 Ao(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(xI).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function xI([t,e]){return`${encodeURIComponent(t)}${e.length>0?`=${encodeURIComponent(e)}`:""}`}var E0=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=Ao(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 Ao(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=Ao(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?Ao(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}`}},Ze;(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})(Ze||(Ze={}));var C0;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(C0||(C0={}));const ce=Ze.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 ce.undefined;case"string":return ce.string;case"number":return Number.isNaN(t)?ce.nan:ce.number;case"boolean":return ce.boolean;case"function":return ce.function;case"bigint":return ce.bigint;case"symbol":return ce.symbol;case"object":return Array.isArray(t)?ce.array:t===null?ce.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ce.promise:typeof Map<"u"&&t instanceof Map?ce.map:typeof Set<"u"&&t instanceof Set?ce.set:typeof Date<"u"&&t instanceof Date?ce.date:ce.object;default:return ce.unknown}},Z=Ze.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,Ze.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 jp=(t,e)=>{let r;switch(t.code){case Z.invalid_type:t.received===ce.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.joinValues(t.keys,", ")}`;break;case Z.invalid_union:r="Invalid input";break;case Z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.joinValues(t.options)}`;break;case Z.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.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}"`:Ze.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,Ze.assertNever(t)}return{message:r}};let wI=jp;function bI(){return wI}const SI=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=bI(),s=SI({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===jp?void 0:jp].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 _e;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 _e;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 _e=Object.freeze({status:"aborted"}),Gi=t=>({status:"dirty",value:t}),zr=t=>({status:"valid",value:t}),P0=t=>t.status==="aborted",k0=t=>t.status==="dirty",vi=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 N0=(t,e)=>{if(vi(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 Me(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 N0(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 vi(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=>vi(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 N0(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 es.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({...Me(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Wu({...Me(this._def),innerType:this,defaultValue:r,typeName:Ce.ZodDefault})}brand(){return new mE({typeName:Ce.ZodBranded,type:this,...Me(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Qu({...Me(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 qv.create(this,e)}readonly(){return Gu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _I=/^c[^\s-]{8,}$/i,EI=/^[0-9a-z]+$/,CI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,PI=/^[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,kI=/^[a-z0-9_-]{21}$/i,NI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jI=/^[-+]?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)?)??$/,RI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,TI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gf;const AI=/^(?:(?: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])$/,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])\/(3[0-2]|[12]?[0-9])$/,II=/^(([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]))$/,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]))\/(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}=))?$/,MI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fE="((\\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])))",FI=new RegExp(`^${fE}$`);function hE(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 LI(t){return new RegExp(`^${hE(t)}$`)}function UI(t){let e=`${fE}T${hE(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)&&AI.test(t)||(e==="v6"||!e)&&II.test(t))}function VI(t,e){if(!NI.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 qI(t,e){return!!((e==="v4"||!e)&&OI.test(t)||(e==="v6"||!e)&&DI.test(t))}class Jn extends Be{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ce.string){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:ce.string,received:a.parsedType}),_e}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")RI.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")Gf||(Gf=new RegExp(TI,"u")),Gf.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")PI.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")kI.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")_I.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")EI.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")CI.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"?UI(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"?FI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?LI(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"?jI.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"?VI(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"?qI(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"?$I.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"base64",code:Z.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?MI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"base64url",code:Z.invalid_string,message:a.message}),s.dirty()):Ze.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 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,...Me(t)});function HI(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 gi 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)!==ce.number){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:ce.number,received:a.parsedType}),_e}let s;const n=new nr;for(const a of this._def.checks)a.kind==="int"?Ze.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"?HI(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()):Ze.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 gi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:pe.toString(n)}]})}_addCheck(e){return new gi({...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"&&Ze.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)}}gi.create=t=>new gi({checks:[],typeName:Ce.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Me(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)!==ce.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()):Ze.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return ae(r,{code:Z.invalid_type,expected:ce.bigint,received:r.parsedType}),_e}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,...Me(t)});class Rp extends Be{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ce.boolean){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.boolean,received:s.parsedType}),_e}return zr(e.data)}}Rp.create=t=>new Rp({typeName:Ce.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Me(t)});class zu extends Be{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ce.date){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:ce.date,received:a.parsedType}),_e}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_date}),_e}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()):Ze.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,...Me(t)});class j0 extends Be{_parse(e){if(this._getType(e)!==ce.symbol){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.symbol,received:s.parsedType}),_e}return zr(e.data)}}j0.create=t=>new j0({typeName:Ce.ZodSymbol,...Me(t)});class Tp extends Be{_parse(e){if(this._getType(e)!==ce.undefined){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.undefined,received:s.parsedType}),_e}return zr(e.data)}}Tp.create=t=>new Tp({typeName:Ce.ZodUndefined,...Me(t)});class Ap extends Be{_parse(e){if(this._getType(e)!==ce.null){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.null,received:s.parsedType}),_e}return zr(e.data)}}Ap.create=t=>new Ap({typeName:Ce.ZodNull,...Me(t)});class Op extends Be{constructor(){super(...arguments),this._any=!0}_parse(e){return zr(e.data)}}Op.create=t=>new Op({typeName:Ce.ZodAny,...Me(t)});class Ip extends Be{constructor(){super(...arguments),this._unknown=!0}_parse(e){return zr(e.data)}}Ip.create=t=>new Ip({typeName:Ce.ZodUnknown,...Me(t)});class ia extends Be{_parse(e){const r=this._getOrReturnCtx(e);return ae(r,{code:Z.invalid_type,expected:ce.never,received:r.parsedType}),_e}}ia.create=t=>new ia({typeName:Ce.ZodNever,...Me(t)});class R0 extends Be{_parse(e){if(this._getType(e)!==ce.undefined){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.void,received:s.parsedType}),_e}return zr(e.data)}}R0.create=t=>new R0({typeName:Ce.ZodVoid,...Me(t)});class Rn extends Be{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==ce.array)return ae(r,{code:Z.invalid_type,expected:ce.array,received:r.parsedType}),_e;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,...Me(e)});function vo(t){if(t instanceof Nt){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=es.create(vo(s))}return new Nt({...t._def,shape:()=>e})}else return t instanceof Rn?new Rn({...t._def,type:vo(t.element)}):t instanceof es?es.create(vo(t.unwrap())):t instanceof to?to.create(vo(t.unwrap())):t instanceof Ja?Ja.create(t.items.map(e=>vo(e))):t}class Nt 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=Ze.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ce.object){const u=this._getOrReturnCtx(e);return ae(u,{code:Z.invalid_type,expected:ce.object,received:u.parsedType}),_e}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],f=n.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new An(n,f,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 f=n.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new An(n,f,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,m=await d.value;u.push({key:f,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 Nt({...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 Nt({...this._def,unknownKeys:"strip"})}passthrough(){return new Nt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Nt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Nt({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 Nt({...this._def,catchall:e})}pick(e){const r={};for(const s of Ze.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new Nt({...this._def,shape:()=>r})}omit(e){const r={};for(const s of Ze.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new Nt({...this._def,shape:()=>r})}deepPartial(){return vo(this)}partial(e){const r={};for(const s of Ze.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new Nt({...this._def,shape:()=>r})}required(e){const r={};for(const s of Ze.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 Nt({...this._def,shape:()=>r})}keyof(){return pE(Ze.objectKeys(this.shape))}}Nt.create=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strip",catchall:ia.create(),typeName:Ce.ZodObject,...Me(e)});Nt.strictCreate=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strict",catchall:ia.create(),typeName:Ce.ZodObject,...Me(e)});Nt.lazycreate=(t,e)=>new Nt({shape:t,unknownKeys:"strip",catchall:ia.create(),typeName:Ce.ZodObject,...Me(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 ls(i.ctx.common.issues));return ae(r,{code:Z.invalid_union,unionErrors:o}),_e}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:Z.invalid_union,unionErrors:i}),_e}}get options(){return this._def.options}}Vu.create=(t,e)=>new Vu({options:t,typeName:Ce.ZodUnion,...Me(e)});const Vn=t=>t instanceof $p?Vn(t.schema):t instanceof eo?Vn(t.innerType()):t instanceof Bu?[t.value]:t instanceof Xa?t.options:t instanceof Mp?Ze.objectValues(t.enum):t instanceof Wu?Vn(t._def.innerType):t instanceof Tp?[void 0]:t instanceof Ap?[null]:t instanceof es?[void 0,...Vn(t.unwrap())]:t instanceof to?[null,...Vn(t.unwrap())]:t instanceof mE||t instanceof Gu?Vn(t.unwrap()):t instanceof Qu?Vn(t._def.innerType):[];class Vv extends Be{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==ce.object)return ae(r,{code:Z.invalid_type,expected:ce.object,received:r.parsedType}),_e;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]}),_e)}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 Vv({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...Me(s)})}}function Dp(t,e){const r=ks(t),s=ks(e);if(t===e)return{valid:!0,data:t};if(r===ce.object&&s===ce.object){const n=Ze.objectKeys(e),a=Ze.objectKeys(t).filter(i=>n.indexOf(i)!==-1),o={...t,...e};for(const i of a){const c=Dp(t[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(r===ce.array&&s===ce.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=Dp(o,i);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===ce.date&&s===ce.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(P0(a)||P0(o))return _e;const i=Dp(a.value,o.value);return i.valid?((k0(a)||k0(o))&&r.dirty(),{status:r.value,value:i.data}):(ae(s,{code:Z.invalid_intersection_types}),_e)};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,...Me(r)});class Ja extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==ce.array)return ae(s,{code:Z.invalid_type,expected:ce.array,received:s.parsedType}),_e;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"}),_e;!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,...Me(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!==ce.object)return ae(s,{code:Z.invalid_type,expected:ce.object,received:s.parsedType}),_e;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,...Me(s)}):new Hu({keyType:Jn.create(),valueType:e,typeName:Ce.ZodRecord,...Me(r)})}}class T0 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!==ce.map)return ae(s,{code:Z.invalid_type,expected:ce.map,received:s.parsedType}),_e;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 _e;(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 _e;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}}}}T0.create=(t,e,r)=>new T0({valueType:e,keyType:t,typeName:Ce.ZodMap,...Me(r)});class Tl extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==ce.set)return ae(s,{code:Z.invalid_type,expected:ce.set,received:s.parsedType}),_e;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 _e;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,...Me(e)});class $p 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})}}$p.create=(t,e)=>new $p({getter:t,typeName:Ce.ZodLazy,...Me(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}),_e}return{status:"valid",value:e.data}}get value(){return this._def.value}}Bu.create=(t,e)=>new Bu({value:t,typeName:Ce.ZodLiteral,...Me(e)});function pE(t,e){return new Xa({values:t,typeName:Ce.ZodEnum,...Me(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:Ze.joinValues(s),received:r.parsedType,code:Z.invalid_type}),_e}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}),_e}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=pE;class Mp extends Be{_parse(e){const r=Ze.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==ce.string&&s.parsedType!==ce.number){const n=Ze.objectValues(r);return ae(s,{expected:Ze.joinValues(n),received:s.parsedType,code:Z.invalid_type}),_e}if(this._cache||(this._cache=new Set(Ze.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=Ze.objectValues(r);return ae(s,{received:s.data,code:Z.invalid_enum_value,options:n}),_e}return zr(e.data)}get enum(){return this._def.values}}Mp.create=(t,e)=>new Mp({values:t,typeName:Ce.ZodNativeEnum,...Me(e)});class Ku extends Be{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==ce.promise&&r.common.async===!1)return ae(r,{code:Z.invalid_type,expected:ce.promise,received:r.parsedType}),_e;const s=r.parsedType===ce.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,...Me(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 _e;const c=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return c.status==="aborted"?_e:c.status==="dirty"||r.value==="dirty"?Gi(c.value):c});{if(r.value==="aborted")return _e;const i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?_e:i.status==="dirty"||r.value==="dirty"?Gi(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"?_e:(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"?_e:(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(!vi(o))return _e;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=>vi(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:r.value,value:i})):_e);Ze.assertNever(n)}}eo.create=(t,e,r)=>new eo({schema:t,typeName:Ce.ZodEffects,effect:e,...Me(r)});eo.createWithPreprocess=(t,e,r)=>new eo({schema:e,effect:{type:"preprocess",transform:t},typeName:Ce.ZodEffects,...Me(r)});class es extends Be{_parse(e){return this._getType(e)===ce.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,...Me(e)});class to extends Be{_parse(e){return this._getType(e)===ce.null?zr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}to.create=(t,e)=>new to({innerType:t,typeName:Ce.ZodNullable,...Me(e)});class Wu extends Be{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===ce.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,...Me(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 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}}Qu.create=(t,e)=>new Qu({innerType:t,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Me(e)});class A0 extends Be{_parse(e){if(this._getType(e)!==ce.nan){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.nan,received:s.parsedType}),_e}return{status:"valid",value:e.data}}}A0.create=t=>new A0({typeName:Ce.ZodNaN,...Me(t)});class mE 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 qv 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"?_e:a.status==="dirty"?(r.dirty(),Gi(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"?_e: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 qv({in:e,out:r,typeName:Ce.ZodPipeline})}}class Gu extends Be{_parse(e){const r=this._def.innerType._parse(e),s=n=>(vi(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,...Me(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 q=Jn.create,Ut=gi.create,Dt=Rp.create,BI=Op.create,Kl=Ip.create;ia.create;const fe=Rn.create,se=Nt.create,or=Vu.create,KI=Vv.create;qu.create;Ja.create;const Wl=Hu.create,Ie=Bu.create,cs=Xa.create;Ku.create;const W=es.create;to.create;const WI=_e,qd="2025-06-18",QI=[qd,"2025-03-26","2024-11-05","2024-10-07"],Hd="2.0",vE=or([q(),Ut().int()]),gE=q(),GI=se({progressToken:W(vE)}).passthrough(),Vr=se({_meta:W(GI)}).passthrough(),yr=se({method:q(),params:W(Vr)}),Ql=se({_meta:W(se({}).passthrough())}).passthrough(),In=se({method:q(),params:W(Ql)}),qr=se({_meta:W(se({}).passthrough())}).passthrough(),Bd=or([q(),Ut().int()]),yE=se({jsonrpc:Ie(Hd),id:Bd}).merge(yr).strict(),xE=t=>yE.safeParse(t).success,wE=se({jsonrpc:Ie(Hd)}).merge(In).strict(),ZI=t=>wE.safeParse(t).success,bE=se({jsonrpc:Ie(Hd),id:Bd,result:qr}).strict(),Fp=t=>bE.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 SE=se({jsonrpc:Ie(Hd),id:Bd,error:se({code:Ut().int(),message:q(),data:W(Kl())})}).strict(),YI=t=>SE.safeParse(t).success,eu=or([yE,wE,bE,SE]),Oo=qr.strict(),Hv=In.extend({method:Ie("notifications/cancelled"),params:Ql.extend({requestId:Bd,reason:q().optional()})}),Gl=se({name:q(),title:W(q())}).passthrough(),_E=Gl.extend({version:q()}),JI=se({experimental:W(se({}).passthrough()),sampling:W(se({}).passthrough()),elicitation:W(se({}).passthrough()),roots:W(se({listChanged:W(Dt())}).passthrough())}).passthrough(),XI=yr.extend({method:Ie("initialize"),params:Vr.extend({protocolVersion:q(),capabilities:JI,clientInfo:_E})}),eD=se({experimental:W(se({}).passthrough()),logging:W(se({}).passthrough()),completions:W(se({}).passthrough()),prompts:W(se({listChanged:W(Dt())}).passthrough()),resources:W(se({subscribe:W(Dt()),listChanged:W(Dt())}).passthrough()),tools:W(se({listChanged:W(Dt())}).passthrough())}).passthrough(),EE=qr.extend({protocolVersion:q(),capabilities:eD,serverInfo:_E,instructions:W(q())}),CE=In.extend({method:Ie("notifications/initialized")}),tD=t=>CE.safeParse(t).success,Bv=yr.extend({method:Ie("ping")}),rD=se({progress:Ut(),total:W(Ut()),message:W(q())}).passthrough(),Kv=In.extend({method:Ie("notifications/progress"),params:Ql.merge(rD).extend({progressToken:vE})}),Kd=yr.extend({params:Vr.extend({cursor:W(gE)}).optional()}),Wd=qr.extend({nextCursor:W(gE)}),PE=se({uri:q(),mimeType:W(q()),_meta:W(se({}).passthrough())}).passthrough(),kE=PE.extend({text:q()}),Wv=q().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),NE=PE.extend({blob:Wv}),jE=Gl.extend({uri:q(),description:W(q()),mimeType:W(q()),_meta:W(se({}).passthrough())}),nD=Gl.extend({uriTemplate:q(),description:W(q()),mimeType:W(q()),_meta:W(se({}).passthrough())}),sD=Kd.extend({method:Ie("resources/list")}),Zu=Wd.extend({resources:fe(jE)}),aD=Kd.extend({method:Ie("resources/templates/list")}),RE=Wd.extend({resourceTemplates:fe(nD)}),oD=yr.extend({method:Ie("resources/read"),params:Vr.extend({uri:q()})}),Qv=qr.extend({contents:fe(or([kE,NE]))}),iD=In.extend({method:Ie("notifications/resources/list_changed")}),lD=yr.extend({method:Ie("resources/subscribe"),params:Vr.extend({uri:q()})}),cD=yr.extend({method:Ie("resources/unsubscribe"),params:Vr.extend({uri:q()})}),uD=In.extend({method:Ie("notifications/resources/updated"),params:Ql.extend({uri:q()})}),dD=se({name:q(),description:W(q()),required:W(Dt())}).passthrough(),fD=Gl.extend({description:W(q()),arguments:W(fe(dD)),_meta:W(se({}).passthrough())}),hD=Kd.extend({method:Ie("prompts/list")}),Yu=Wd.extend({prompts:fe(fD)}),pD=yr.extend({method:Ie("prompts/get"),params:Vr.extend({name:q(),arguments:W(Wl(q()))})}),Gv=se({type:Ie("text"),text:q(),_meta:W(se({}).passthrough())}).passthrough(),Zv=se({type:Ie("image"),data:Wv,mimeType:q(),_meta:W(se({}).passthrough())}).passthrough(),Yv=se({type:Ie("audio"),data:Wv,mimeType:q(),_meta:W(se({}).passthrough())}).passthrough(),mD=se({type:Ie("resource"),resource:or([kE,NE]),_meta:W(se({}).passthrough())}).passthrough(),vD=jE.extend({type:Ie("resource_link")}),TE=or([Gv,Zv,Yv,vD,mD]),gD=se({role:cs(["user","assistant"]),content:TE}).passthrough(),Jv=qr.extend({description:W(q()),messages:fe(gD)}),yD=In.extend({method:Ie("notifications/prompts/list_changed")}),xD=se({title:W(q()),readOnlyHint:W(Dt()),destructiveHint:W(Dt()),idempotentHint:W(Dt()),openWorldHint:W(Dt())}).passthrough(),wD=Gl.extend({description:W(q()),inputSchema:se({type:Ie("object"),properties:W(se({}).passthrough()),required:W(fe(q()))}).passthrough(),outputSchema:W(se({type:Ie("object"),properties:W(se({}).passthrough()),required:W(fe(q()))}).passthrough()),annotations:W(xD),_meta:W(se({}).passthrough())}),bD=Kd.extend({method:Ie("tools/list")}),Xv=Wd.extend({tools:fe(wD)}),Qd=qr.extend({content:fe(TE).default([]),structuredContent:se({}).passthrough().optional(),isError:W(Dt())});Qd.or(qr.extend({toolResult:Kl()}));const SD=yr.extend({method:Ie("tools/call"),params:Vr.extend({name:q(),arguments:W(Wl(Kl()))})}),_D=In.extend({method:Ie("notifications/tools/list_changed")}),AE=cs(["debug","info","notice","warning","error","critical","alert","emergency"]),ED=yr.extend({method:Ie("logging/setLevel"),params:Vr.extend({level:AE})}),CD=In.extend({method:Ie("notifications/message"),params:Ql.extend({level:AE,logger:W(q()),data:Kl()})}),PD=se({name:q().optional()}).passthrough(),kD=se({hints:W(fe(PD)),costPriority:W(Ut().min(0).max(1)),speedPriority:W(Ut().min(0).max(1)),intelligencePriority:W(Ut().min(0).max(1))}).passthrough(),ND=se({role:cs(["user","assistant"]),content:or([Gv,Zv,Yv])}).passthrough(),jD=yr.extend({method:Ie("sampling/createMessage"),params:Vr.extend({messages:fe(ND),systemPrompt:W(q()),includeContext:W(cs(["none","thisServer","allServers"])),temperature:W(Ut()),maxTokens:Ut().int(),stopSequences:W(fe(q())),metadata:W(se({}).passthrough()),modelPreferences:W(kD)})}),RD=qr.extend({model:q(),stopReason:W(cs(["endTurn","stopSequence","maxTokens"]).or(q())),role:cs(["user","assistant"]),content:KI("type",[Gv,Zv,Yv])}),TD=se({type:Ie("boolean"),title:W(q()),description:W(q()),default:W(Dt())}).passthrough(),AD=se({type:Ie("string"),title:W(q()),description:W(q()),minLength:W(Ut()),maxLength:W(Ut()),format:W(cs(["email","uri","date","date-time"]))}).passthrough(),OD=se({type:cs(["number","integer"]),title:W(q()),description:W(q()),minimum:W(Ut()),maximum:W(Ut())}).passthrough(),ID=se({type:Ie("string"),title:W(q()),description:W(q()),enum:fe(q()),enumNames:W(fe(q()))}).passthrough(),DD=or([TD,AD,OD,ID]),$D=yr.extend({method:Ie("elicitation/create"),params:Vr.extend({message:q(),requestedSchema:se({type:Ie("object"),properties:Wl(q(),DD),required:W(fe(q()))}).passthrough()})}),MD=qr.extend({action:cs(["accept","decline","cancel"]),content:W(Wl(q(),Kl()))}),FD=se({type:Ie("ref/resource"),uri:q()}).passthrough(),LD=se({type:Ie("ref/prompt"),name:q()}).passthrough(),UD=yr.extend({method:Ie("completion/complete"),params:Vr.extend({ref:or([LD,FD]),argument:se({name:q(),value:q()}).passthrough(),context:W(se({arguments:W(Wl(q(),q()))}))})}),OE=qr.extend({completion:se({values:fe(q()).max(100),total:W(Ut().int()),hasMore:W(Dt())}).passthrough()}),zD=se({uri:q().startsWith("file://"),name:W(q()),_meta:W(se({}).passthrough())}).passthrough(),VD=yr.extend({method:Ie("roots/list")}),qD=qr.extend({roots:fe(zD)}),HD=In.extend({method:Ie("notifications/roots/list_changed")});or([Bv,XI,UD,ED,pD,hD,sD,aD,oD,lD,cD,SD,bD]);or([Hv,Kv,CE,HD]);or([Oo,RD,MD,qD]);or([Bv,jD,$D,VD]);or([Hv,Kv,CD,uD,iD,_D,yD]);or([Oo,EE,OE,Jv,Yu,Zu,RE,Qv,Qd,Xv]);class qs extends Error{constructor(e,r,s){super(`MCP error ${e}: ${r}`),this.code=e,this.data=s,this.name="McpError"}}class O0 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 Zf(t){}function IE(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=Zf,onError:r=Zf,onRetry:s=Zf,onComment:n}=t;let a="",o=!0,i,c="",u="";function d(p){const g=o?p.replace(/^\xEF\xBB\xBF/,""):p,[y,v]=BD(`${a}${g}`);for(const b of y)f(b);a=v,o=!1}function f(p){if(p===""){h();return}if(p.startsWith(":")){n&&n(p.slice(p.startsWith(": ")?2:1));return}const g=p.indexOf(":");if(g!==-1){const y=p.slice(0,g),v=p[g+1]===" "?2:1,b=p.slice(g+v);m(y,b,p);return}m(p,"",p)}function m(p,g,y){switch(p){case"event":u=g;break;case"data":c=`${c}${g}
|
|
335
|
+
${j.data.oauth.issuer?`Issuer: ${j.data.oauth.issuer}`:""}`;A({title:"OAuth Setup Instructions",description:re,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"})]})]})]}),C&&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:C instanceof Error?C.message:String(C)})]})]})]}),!ye&&!V&&!X&&t.type==="a2a"&&!pe&&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 AO(){const[t,e]=x.useState("connecting"),[r,s]=x.useState(null),n=x.useRef(null),a=x.useRef(null),o=vr();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=f=>{try{const m=JSON.parse(f.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=f=>{console.error("WebSocket error:",f),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 S0(t,e){const r=t==="credential"?`credentialId=${encodeURIComponent(e)}`:`serviceId=${encodeURIComponent(e)}`;return(await(await Ue("GET",`/api/playbooks/dependents/check?${r}`)).json()).data??[]}function OO(t){const[e,r]=x.useState(null),[s,n]=x.useState(null),[a,o]=x.useState(null),[i,c]=x.useState(!1),u=vr(),{toast:d}=gr(),f=()=>{if(!t)throw new Error("Select a deck to edit first");return t},m=Ot({mutationFn:async R=>{var K,C,F;const A=f(),z=(K=(await(await Ue("GET","/api/decks")).json()).data)==null?void 0:K.find(L=>L.id===A);if(!z)throw new Error("Selected deck not found");if((C=z.services)!=null&&C.some(L=>L.id===R))throw new Error("Service is already in the deck");const j=((F=z.services)==null?void 0:F.length)??0;return Ue("POST",`/api/decks/${A}/services`,{serviceId:R,position:j})},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:R=>{d({title:"Failed to add service",description:R.message,variant:"destructive"})}}),h=Ot({mutationFn:async R=>{var j,K;const A=f(),z=(j=(await(await Ue("GET","/api/decks")).json()).data)==null?void 0:j.find(C=>C.id===A);if((K=z==null?void 0:z.credentials)!=null&&K.some(C=>C.id===R))throw new Error("API key is already in the deck");return Ue("POST",`/api/decks/${A}/credentials`,{credentialId:R})},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:R=>{d({title:"Failed to add API key",description:R.message,variant:"destructive"})}}),w=Ot({mutationFn:async R=>{var j,K;const A=f(),z=(j=(await(await Ue("GET","/api/decks")).json()).data)==null?void 0:j.find(C=>C.id===A);if((K=z==null?void 0:z.playbooks)!=null&&K.some(C=>C.id===R))throw new Error("Playbook is already in the deck");return Ue("POST",`/api/decks/${A}/playbooks`,{playbookId:R})},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:R=>{d({title:"Failed to add playbook",description:R.message,variant:"destructive"})}}),p=Ot({mutationFn:async R=>{const A=await S0("service",R);if(A.length>0){const O=A.map(j=>j.title).join(", ");if(!window.confirm(`Warning: ${A.length} playbook(s) depend on this MCP (${O}). Remove from deck anyway?`))throw new Error("Cancelled")}const _=f();return Ue("DELETE",`/api/decks/${_}/services`,{serviceId:R})},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:R=>{R.message!=="Cancelled"&&d({title:"Failed to remove service",description:R.message,variant:"destructive"})}}),g=Ot({mutationFn:async R=>{const A=await S0("credential",R);if(A.length>0){const O=A.map(j=>j.title).join(", ");if(!window.confirm(`Warning: ${A.length} playbook(s) depend on this API key (${O}). Remove from deck anyway?`))throw new Error("Cancelled")}const _=f();return Ue("DELETE",`/api/decks/${_}/credentials`,{credentialId:R})},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:R=>{R.message!=="Cancelled"&&d({title:"Failed to remove API key",description:R.message,variant:"destructive"})}}),y=Ot({mutationFn:async R=>{const A=f();return Ue("DELETE",`/api/decks/${A}/playbooks`,{playbookId:R})},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:R=>{d({title:"Failed to remove playbook",description:R.message,variant:"destructive"})}}),v=(R,A)=>{R.currentTarget instanceof HTMLElement&&(R.currentTarget.style.opacity=A)},b=(R,A)=>{R.dataTransfer.setData("text/plain",A.id),R.dataTransfer.setData("application/json",JSON.stringify(A)),R.dataTransfer.effectAllowed=A.fromDeck?"move":"copy"},S=(R,A,_=!1)=>{r(A),n(null),o(null),c(_),b(R,{kind:"service",id:A.id,fromDeck:_}),v(R,"0.5")},E=(R,A,_=!1)=>{n(A),r(null),o(null),c(_),b(R,{kind:"credential",id:A.id,fromDeck:_}),v(R,"0.5")},k=(R,A,_=!1)=>{o(A),r(null),n(null),c(_),b(R,{kind:"playbook",id:A.id,fromDeck:_}),v(R,"0.5")},N=R=>{r(null),n(null),o(null),v(R,"1")},T=R=>{if(R.kind==="service"){R.fromDeck?p.mutate(R.id):m.mutate(R.id);return}if(R.kind==="credential"){R.fromDeck?g.mutate(R.id):h.mutate(R.id);return}R.fromDeck?y.mutate(R.id):w.mutate(R.id)};return{draggedService:e,draggedCredential:s,draggedPlaybook:a,isDraggingFromDeck:i,handleDragStart:S,handleCredentialDragStart:E,handlePlaybookDragStart:k,handleDragEnd:N,handleDrop:R=>{R.preventDefault();const A=R.dataTransfer.getData("application/json");if(A){try{T(JSON.parse(A))}catch{const _=R.dataTransfer.getData("text/plain");_&&e&&m.mutate(_)}r(null),n(null),o(null),c(!1)}},handleGlobalDrop:R=>{R.preventDefault();const A=R.dataTransfer.getData("application/json");if(A){try{const _=JSON.parse(A);_.fromDeck&&T(_)}catch{}r(null),n(null),o(null),c(!1)}},isDropping:m.isPending||h.isPending||w.isPending||p.isPending||g.isPending||y.isPending}}const Qf="agent-deck-editing-deck-id";function IO(t){const[e,r]=x.useState(()=>typeof window>"u"?null:localStorage.getItem(Qf));x.useEffect(()=>{if(t.length===0)return;if(!(e&&t.some(o=>o.id===e))){const o=t[0].id;r(o),localStorage.setItem(Qf,o)}},[t,e]);const s=a=>{r(a),localStorage.setItem(Qf,a)};return{editingDeck:t.find(a=>a.id===e)??null,editingDeckId:e,setEditingDeckId:s}}function _0(t,[e,r]){return Math.min(r,Math.max(e,t))}var DO=[" ","Enter","ArrowUp","ArrowDown"],$O=[" ","Enter"],Za="Select",[Ud,zd,MO]=vv(Za),[ki,gF]=ds(Za,[MO,Od]),Vd=Od(),[FO,ma]=ki(Za),[LO,UO]=ki(Za),k_=t=>{const{__scopeSelect:e,children:r,open:s,defaultOpen:n,onOpenChange:a,value:o,defaultValue:i,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:h,form:w}=t,p=Vd(e),[g,y]=x.useState(null),[v,b]=x.useState(null),[S,E]=x.useState(!1),k=Mv(u),[N,T]=Wa({prop:s,defaultProp:n??!1,onChange:a,caller:Za}),[D,U]=Wa({prop:o,defaultProp:i,onChange:c,caller:Za}),R=x.useRef(null),A=g?w||!!g.closest("form"):!0,[_,O]=x.useState(new Set),z=Array.from(_).map(j=>j.props.value).join(";");return l.jsx(pT,{...p,children:l.jsxs(FO,{required:h,scope:e,trigger:g,onTriggerChange:y,valueNode:v,onValueNodeChange:b,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:ea(),value:D,onValueChange:U,open:N,onOpenChange:T,dir:k,triggerPointerDownPosRef:R,disabled:m,children:[l.jsx(Ud.Provider,{scope:e,children:l.jsx(LO,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(j=>{O(K=>new Set(K).add(j))},[]),onNativeOptionRemove:x.useCallback(j=>{O(K=>{const C=new Set(K);return C.delete(j),C})},[]),children:r})}),A?l.jsxs(Y_,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:D,onChange:j=>U(j.target.value),disabled:m,form:w,children:[D===void 0?l.jsx("option",{value:""}):null,Array.from(_)]},z):null]})})};k_.displayName=Za;var N_="SelectTrigger",j_=x.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:s=!1,...n}=t,a=Vd(r),o=ma(N_,r),i=o.disabled||s,c=nt(e,o.onTriggerChange),u=zd(r),d=x.useRef("touch"),[f,m,h]=X_(p=>{const g=u().filter(b=>!b.disabled),y=g.find(b=>b.value===o.value),v=eE(g,p,y);v!==void 0&&o.onValueChange(v.value)}),w=p=>{i||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return l.jsx(nS,{asChild:!0,...a,children:l.jsx(Re.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":J_(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 g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(w(p),p.preventDefault())}),onKeyDown:Se(n.onKeyDown,p=>{const g=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(g&&p.key===" ")&&DO.includes(p.key)&&(w(),p.preventDefault())})})})});j_.displayName=N_;var R_="SelectValue",T_=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:s,style:n,children:a,placeholder:o="",...i}=t,c=ma(R_,r),{onValueNodeHasChildrenChange:u}=c,d=a!==void 0,f=nt(e,c.onValueNodeChange);return Bt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...i,ref:f,style:{pointerEvents:"none"},children:J_(c.value)?l.jsx(l.Fragment,{children:o}):a})});T_.displayName=R_;var zO="SelectIcon",A_=x.forwardRef((t,e)=>{const{__scopeSelect:r,children:s,...n}=t;return l.jsx(Re.span,{"aria-hidden":!0,...n,ref:e,children:s||"▼"})});A_.displayName=zO;var VO="SelectPortal",O_=t=>l.jsx(Ed,{asChild:!0,...t});O_.displayName=VO;var Ya="SelectContent",I_=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(D_,{scope:t.__scopeSelect,children:l.jsx(Ud.Slot,{scope:t.__scopeSelect,children:l.jsx("div",{children:t.children})})}),a):null}return l.jsx($_,{...t,ref:e})});I_.displayName=Ya;var Qr=10,[D_,va]=ki(Ya),qO="SelectContentImpl",HO=hi("SelectContent.RemoveScroll"),$_=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:f,collisionBoundary:m,collisionPadding:h,sticky:w,hideWhenDetached:p,avoidCollisions:g,...y}=t,v=ma(Ya,r),[b,S]=x.useState(null),[E,k]=x.useState(null),N=nt(e,X=>S(X)),[T,D]=x.useState(null),[U,R]=x.useState(null),A=zd(r),[_,O]=x.useState(!1),z=x.useRef(!1);x.useEffect(()=>{if(b)return PS(b)},[b]),gS();const j=x.useCallback(X=>{const[he,...pe]=A().map(Pe=>Pe.ref.current),[ye]=pe.slice(-1),ue=document.activeElement;for(const Pe of X)if(Pe===ue||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===he&&E&&(E.scrollTop=0),Pe===ye&&E&&(E.scrollTop=E.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==ue))return},[A,E]),K=x.useCallback(()=>j([T,b]),[j,T,b]);x.useEffect(()=>{_&&K()},[_,K]);const{onOpenChange:C,triggerPointerDownPosRef:F}=v;x.useEffect(()=>{if(b){let X={x:0,y:0};const he=ye=>{var ue,Pe;X={x:Math.abs(Math.round(ye.pageX)-(((ue=F.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((Pe=F.current)==null?void 0:Pe.y)??0))}},pe=ye=>{X.x<=10&&X.y<=10?ye.preventDefault():b.contains(ye.target)||C(!1),document.removeEventListener("pointermove",he),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",he),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",pe,{capture:!0})}}},[b,C,F]),x.useEffect(()=>{const X=()=>C(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[C]);const[L,Q]=X_(X=>{const he=A().filter(ue=>!ue.disabled),pe=he.find(ue=>ue.ref.current===document.activeElement),ye=eE(he,X,pe);ye&&setTimeout(()=>ye.ref.current.focus())}),te=x.useCallback((X,he,pe)=>{const ye=!z.current&&!pe;(v.value!==void 0&&v.value===he||ye)&&(D(X),ye&&(z.current=!0))},[v.value]),V=x.useCallback(()=>b==null?void 0:b.focus(),[b]),de=x.useCallback((X,he,pe)=>{const ye=!z.current&&!pe;(v.value!==void 0&&v.value===he||ye)&&R(X)},[v.value]),Te=s==="popper"?Ep:M_,ge=Te===Ep?{side:i,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:w,hideWhenDetached:p,avoidCollisions:g}:{};return l.jsx(D_,{scope:r,content:b,viewport:E,onViewportChange:k,itemRefCallback:te,selectedItem:T,onItemLeave:V,itemTextRefCallback:de,focusSelectedItem:K,selectedItemText:U,position:s,isPositioned:_,searchRef:L,children:l.jsx(Ov,{as:HO,allowPinchZoom:!0,children:l.jsx(Av,{asChild:!0,trapped:v.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:Se(n,X=>{var he;(he=v.trigger)==null||he.focus({preventScroll:!0}),X.preventDefault()}),children:l.jsx(Vl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(Te,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:X=>X.preventDefault(),...y,...ge,onPlaced:()=>O(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Se(y.onKeyDown,X=>{const he=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!he&&X.key.length===1&&Q(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let ye=A().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(X.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const ue=X.target,Pe=ye.indexOf(ue);ye=ye.slice(Pe+1)}setTimeout(()=>j(ye)),X.preventDefault()}})})})})})})});$_.displayName=qO;var BO="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),f=nt(e,N=>d(N)),m=zd(r),h=x.useRef(!1),w=x.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:y,focusSelectedItem:v}=o,b=x.useCallback(()=>{if(a.trigger&&a.valueNode&&i&&u&&p&&g&&y){const N=a.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),D=a.valueNode.getBoundingClientRect(),U=y.getBoundingClientRect();if(a.dir!=="rtl"){const ue=U.left-T.left,Pe=D.left-ue,Ae=N.left-Pe,De=N.width+Ae,J=Math.max(De,T.width),ie=window.innerWidth-Qr,Y=_0(Pe,[Qr,Math.max(Qr,ie-J)]);i.style.minWidth=De+"px",i.style.left=Y+"px"}else{const ue=T.right-U.right,Pe=window.innerWidth-D.right-ue,Ae=window.innerWidth-N.right-Pe,De=N.width+Ae,J=Math.max(De,T.width),ie=window.innerWidth-Qr,Y=_0(Pe,[Qr,Math.max(Qr,ie-J)]);i.style.minWidth=De+"px",i.style.right=Y+"px"}const R=m(),A=window.innerHeight-Qr*2,_=p.scrollHeight,O=window.getComputedStyle(u),z=parseInt(O.borderTopWidth,10),j=parseInt(O.paddingTop,10),K=parseInt(O.borderBottomWidth,10),C=parseInt(O.paddingBottom,10),F=z+j+_+C+K,L=Math.min(g.offsetHeight*5,F),Q=window.getComputedStyle(p),te=parseInt(Q.paddingTop,10),V=parseInt(Q.paddingBottom,10),de=N.top+N.height/2-Qr,Te=A-de,ge=g.offsetHeight/2,X=g.offsetTop+ge,he=z+j+X,pe=F-he;if(he<=de){const ue=R.length>0&&g===R[R.length-1].ref.current;i.style.bottom="0px";const Pe=u.clientHeight-p.offsetTop-p.offsetHeight,Ae=Math.max(Te,ge+(ue?V:0)+Pe+K),De=he+Ae;i.style.height=De+"px"}else{const ue=R.length>0&&g===R[0].ref.current;i.style.top="0px";const Ae=Math.max(de,z+p.offsetTop+(ue?te:0)+ge)+pe;i.style.height=Ae+"px",p.scrollTop=he-de+p.offsetTop}i.style.margin=`${Qr}px 0`,i.style.minHeight=L+"px",i.style.maxHeight=A+"px",s==null||s(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,i,u,p,g,y,a.dir,s]);Bt(()=>b(),[b]);const[S,E]=x.useState();Bt(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const k=x.useCallback(N=>{N&&w.current===!0&&(b(),v==null||v(),w.current=!1)},[b,v]);return l.jsx(WO,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:l.jsx(Re.div,{...n,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});M_.displayName=BO;var KO="SelectPopperPosition",Ep=x.forwardRef((t,e)=>{const{__scopeSelect:r,align:s="start",collisionPadding:n=Qr,...a}=t,o=Vd(r);return l.jsx(sS,{...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)"}})});Ep.displayName=KO;var[WO,zv]=ki(Ya,{}),Cp="SelectViewport",F_=x.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:s,...n}=t,a=va(Cp,r),o=zv(Cp,r),i=nt(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(Re.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:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const h=Math.abs(c.current-d.scrollTop);if(h>0){const w=window.innerHeight-Qr*2,p=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),y=Math.max(p,g);if(y<w){const v=y+h,b=Math.min(w,v),S=v-b;f.style.height=b+"px",f.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});F_.displayName=Cp;var L_="SelectGroup",[QO,GO]=ki(L_),ZO=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=ea();return l.jsx(QO,{scope:r,id:n,children:l.jsx(Re.div,{role:"group","aria-labelledby":n,...s,ref:e})})});ZO.displayName=L_;var U_="SelectLabel",z_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=GO(U_,r);return l.jsx(Re.div,{id:n.id,...s,ref:e})});z_.displayName=U_;var Lu="SelectItem",[YO,V_]=ki(Lu),q_=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,f]=x.useState(a??""),[m,h]=x.useState(!1),w=nt(e,v=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,v,s,n)}),p=ea(),g=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(YO,{scope:r,value:s,disabled:n,textId:p,isSelected:u,onItemTextChange:x.useCallback(v=>{f(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(Re.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,()=>h(!0)),onBlur:Se(o.onBlur,()=>h(!1)),onClick:Se(o.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:Se(o.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:Se(o.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:Se(o.onPointerMove,v=>{var b;g.current=v.pointerType,n?(b=c.onItemLeave)==null||b.call(c):g.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===" "||($O.includes(v.key)&&y(),v.key===" "&&v.preventDefault())})})})})});q_.displayName=Lu;var Qi="SelectItemText",H_=x.forwardRef((t,e)=>{const{__scopeSelect:r,className:s,style:n,...a}=t,o=ma(Qi,r),i=va(Qi,r),c=V_(Qi,r),u=UO(Qi,r),[d,f]=x.useState(null),m=nt(e,y=>f(y),c.onItemTextChange,y=>{var v;return(v=i.itemTextRefCallback)==null?void 0:v.call(i,y,c.value,c.disabled)}),h=d==null?void 0:d.textContent,w=x.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=u;return Bt(()=>(p(w),()=>g(w)),[p,g,w]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...a,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?so.createPortal(a.children,o.valueNode):null]})});H_.displayName=Qi;var B_="SelectItemIndicator",K_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t;return V_(B_,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...s,ref:e}):null});K_.displayName=B_;var Pp="SelectScrollUpButton",W_=x.forwardRef((t,e)=>{const r=va(Pp,t.__scopeSelect),s=zv(Pp,t.__scopeSelect),[n,a]=x.useState(!1),o=nt(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(G_,{...t,ref:o,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});W_.displayName=Pp;var kp="SelectScrollDownButton",Q_=x.forwardRef((t,e)=>{const r=va(kp,t.__scopeSelect),s=zv(kp,t.__scopeSelect),[n,a]=x.useState(!1),o=nt(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(G_,{...t,ref:o,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});Q_.displayName=kp;var G_=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(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[i]),l.jsx(Re.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()})})}),JO="SelectSeparator",Z_=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t;return l.jsx(Re.div,{"aria-hidden":!0,...s,ref:e})});Z_.displayName=JO;var Np="SelectArrow",XO=x.forwardRef((t,e)=>{const{__scopeSelect:r,...s}=t,n=Vd(r),a=ma(Np,r),o=va(Np,r);return a.open&&o.position==="popper"?l.jsx(aS,{...n,...s,ref:e}):null});XO.displayName=Np;var eI="SelectBubbleInput",Y_=x.forwardRef(({__scopeSelect:t,value:e,...r},s)=>{const n=x.useRef(null),a=nt(s,n),o=m_(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 f=new Event("change",{bubbles:!0});d.call(i,e),i.dispatchEvent(f)}},[o,e]),l.jsx(Re.select,{...r,style:{...Jb,...r.style},ref:a,defaultValue:e})});Y_.displayName=eI;function J_(t){return t===""||t===void 0}function X_(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 eE(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=tI(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 tI(t,e){return t.map((r,s)=>t[(e+s)%t.length])}var rI=k_,tE=j_,nI=T_,sI=A_,aI=O_,rE=I_,oI=F_,nE=z_,sE=q_,iI=H_,lI=K_,aE=W_,oE=Q_,iE=Z_;const cI=rI,uI=nI,lE=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(tE,{ref:s,className:je("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(sI,{asChild:!0,children:l.jsx(bv,{className:"h-4 w-4 opacity-50"})})]}));lE.displayName=tE.displayName;const cE=x.forwardRef(({className:t,...e},r)=>l.jsx(aE,{ref:r,className:je("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(a2,{className:"h-4 w-4"})}));cE.displayName=aE.displayName;const uE=x.forwardRef(({className:t,...e},r)=>l.jsx(oE,{ref:r,className:je("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(bv,{className:"h-4 w-4"})}));uE.displayName=oE.displayName;const dE=x.forwardRef(({className:t,children:e,position:r="popper",...s},n)=>l.jsx(aI,{children:l.jsxs(rE,{ref:n,className:je("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(cE,{}),l.jsx(oI,{className:je("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(uE,{})]})}));dE.displayName=rE.displayName;const dI=x.forwardRef(({className:t,...e},r)=>l.jsx(nE,{ref:r,className:je("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));dI.displayName=nE.displayName;const mo=x.forwardRef(({className:t,children:e,...r},s)=>l.jsxs(sE,{ref:s,className:je("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(lI,{children:l.jsx(S1,{className:"h-4 w-4"})})}),l.jsx(iI,{children:e})]}));mo.displayName=sE.displayName;const fI=x.forwardRef(({className:t,...e},r)=>l.jsx(iE,{ref:r,className:je("-mx-1 my-1 h-px bg-muted",t),...e}));fI.displayName=iE.displayName;const hI="/assets/AgentDeckLogo2-z3pVqJJ3.png";function pI(){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,f]=x.useState(!1),[m,h]=x.useState(!1),[w,p]=x.useState(null),[g,y]=x.useState(!1),[v,b]=x.useState(!1),[S,E]=x.useState(null),[k,N]=x.useState(!1),[T,D]=x.useState(null),{toast:U}=gr(),{connectionStatus:R}=AO(),{data:A,isLoading:_,error:O}=Ir({queryKey:["/api/decks"]}),z=(A==null?void 0:A.data)||[],{editingDeck:j,editingDeckId:K,setEditingDeckId:C}=IO(z),{handleDragStart:F,handleCredentialDragStart:L,handlePlaybookDragStart:Q,handleDragEnd:te,handleDrop:V,handleGlobalDrop:de,isDraggingFromDeck:Te}=OO(K),{data:ge,isLoading:X,error:he}=Ir({queryKey:["/api/services"]}),{data:pe,isLoading:ye}=Ir({queryKey:["/api/credentials/vault"]}),{data:ue,isLoading:Pe}=Ir({queryKey:["/api/playbooks/vault"]}),{data:Ae}=Ir({queryKey:["/api/collection/warnings"],staleTime:6e4}),De=(ge==null?void 0:ge.data)||[],J=(pe==null?void 0:pe.data)||[],ie=(ue==null?void 0:ue.data)||[],Y=x.useMemo(()=>DT(Ae==null?void 0:Ae.data),[Ae==null?void 0:Ae.data]),ze=(ne,Pt)=>n?ne==="service"?Y.serviceWarnings.has(Pt):ne==="credential"?Y.credentialWarnings.has(Pt):Y.playbookWarnings.has(Pt):!0,ee=De.filter(ne=>{var Mn;if(!ze("service",ne.id)||r==="api-key"||r==="playbook")return!1;const Pt=ne.name.toLowerCase().includes(t.toLowerCase())||((Mn=ne.description)==null?void 0:Mn.toLowerCase().includes(t.toLowerCase())),$n=!r||r==="all"||ne.type===r;return Pt&&$n}),Oe=J.filter(ne=>!ze("credential",ne.id)||r&&r!=="all"&&r!=="api-key"?!1:ne.label.toLowerCase().includes(t.toLowerCase())),Fe=ie.filter(ne=>!ze("playbook",ne.id)||r&&r!=="all"&&r!=="playbook"?!1:ne.title.toLowerCase().includes(t.toLowerCase())||ne.body.toLowerCase().includes(t.toLowerCase())),ke=ee.length+Oe.length+Fe.length;he&&console.error("Services error:",he),O&&console.error("Decks error:",O);const st=()=>{e(""),s(""),a(!1)},vt=!!(t||r||n),Hr=new Set(((j==null?void 0:j.credentials)??[]).map(ne=>ne.id)),zt=new Set(((j==null?void 0:j.playbooks)??[]).map(ne=>ne.id)),fs=(j==null?void 0:j.services)||[],oo=(j==null?void 0:j.playbooks)||[],Yt=ne=>{u(ne),f(!0)},Br=ne=>{E(ne.id),N(!0)},hs=ne=>{p(ne.id),y(!0)},Nr=ne=>{D(ne)};if(he||O){const ne=(O instanceof Error?O.message:null)??(he instanceof Error?he.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 X||_||ye||Pe?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:de,onDragOver:ne=>ne.preventDefault(),style:{position:"relative",...Te&&{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:hI,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 ${R==="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 ${R==="connected"?"bg-emerald-400":"bg-red-400"}`}),l.jsx("button",{className:`text-sm hover:underline cursor-pointer ${R==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{U({title:"MCP URL copied!",description:"The MCP server URL has been copied to your clipboard."})})},title:"Click to copy MCP URL",children:"Get MCP URL"})]}),j&&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:j.name}),l.jsxs("span",{className:"text-xs",style:{color:"#92E4DD",opacity:.7},"data-testid":"editing-deck-count",children:[(((ps=j.services)==null?void 0:ps.length)??0)+(((ya=j.credentials)==null?void 0:ya.length)??0)+(((ms=j.playbooks)==null?void 0:ms.length)??0)," ","cards"]})]})})]})]})})}),Te&&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(yO,{decks:z,editingDeckId:K,onSelectDeck:C,isLoading:_})}),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(b1,{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(ve,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(xr),onClick:()=>i(!0),"data-testid":"button-register-mcp",children:[l.jsx(Ru,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),l.jsxs(ve,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${bn}`,style:Sn(cr),onClick:()=>h(!0),"data-testid":"button-register-api-key",children:[l.jsx(hp,{className:"w-3 h-3 mr-2"}),"Register API key"]}),l.jsxs(ve,{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(wv,{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:j?l.jsx("div",{className:"h-full",children:l.jsx(BT,{deck:j,services:fs,credentials:j.credentials??[],playbooks:oo,allServices:De,collectionWarnings:Y,onDrop:V,onDragStart:F,onCredentialDragStart:L,onPlaybookDragStart:Q,onDragEnd:te,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(pp,{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(ve,{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(ve,{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(pp,{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(l2,{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:["(",ke," cards)"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(E1,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),l.jsx(ut,{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(cI,{value:r,onValueChange:s,children:[l.jsxs(lE,{className:"w-20 h-8 bg-white/10 border-white/20 text-white text-sm","data-testid":"select-type",children:[l.jsx(i2,{className:"w-3 h-3 mr-1"}),l.jsx(uI,{placeholder:"Type"})]}),l.jsxs(dE,{children:[l.jsx(mo,{value:"all",children:"All"}),l.jsx(mo,{value:"mcp",children:"MCP"}),l.jsx(mo,{value:"local-mcp",children:"Local MCP"}),l.jsx(mo,{value:"api-key",children:"API Key"}),l.jsx(mo,{value:"playbook",children:"Playbook"})]})]}),(t||r||n)&&l.jsx(ve,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:st,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:ke})," card",ke===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."})]})})]})}),X||ye||Pe?l.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,80px)] gap-0",children:Array.from({length:10}).map((ne,Pt)=>l.jsx("div",{className:"animate-pulse",children:l.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},Pt))}):ke===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:vt?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"}),!vt&&l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsxs(ve,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${bn}`,style:Sn(xr),onClick:()=>i(!0),"data-testid":"button-register-mcp-empty",children:[l.jsx(Ru,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),l.jsxs(ve,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${bn}`,style:Sn(cr),onClick:()=>h(!0),"data-testid":"button-register-api-key-empty",children:[l.jsx(hp,{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:[Fe.map((ne,Pt)=>l.jsx("div",{className:"relative group",style:{zIndex:T===ne.id?999999:ke-Pt},children:l.jsx(HT,{playbook:ne,isInActiveDeck:zt.has(ne.id),activeDeck:j??void 0,isInCollection:!0,onDragStart:Q,onDragEnd:te,onCardClick:Br,onMouseEnter:()=>Nr(ne.id),onMouseLeave:()=>Nr(null),warnings:Y.playbookWarnings.get(ne.id)})},ne.id)),Oe.map((ne,Pt)=>l.jsx("div",{className:"relative group",style:{zIndex:T===ne.id?999999:ke-Fe.length-Pt},children:l.jsx(VT,{credential:ne,isInActiveDeck:Hr.has(ne.id),activeDeck:j??void 0,isInCollection:!0,onDragStart:L,onDragEnd:te,onMouseEnter:()=>Nr(ne.id),onMouseLeave:()=>Nr(null),onCardClick:hs,warnings:Y.credentialWarnings.get(ne.id)})},ne.id)),ee.map((ne,Pt)=>{var $n;return l.jsx("div",{className:"relative group",style:{zIndex:T===ne.id?999999:ke-Fe.length-Oe.length-Pt},children:l.jsx(LT,{service:ne,onDragStart:F,onDragEnd:te,isInActiveDeck:(($n=j==null?void 0:j.services)==null?void 0:$n.some(Mn=>Mn.id===ne.id))||!1,onCardClick:Yt,isInCollection:!0,onMouseEnter:()=>Nr(ne.id),onMouseLeave:()=>Nr(null),activeDeck:j??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(gO,{type:"mcp",open:o,onOpenChange:i}),l.jsx(TO,{service:c,isOpen:d,onClose:()=>f(!1)}),l.jsx(xO,{open:m,onOpenChange:h}),l.jsx(SO,{credentialId:w,open:g,onOpenChange:y}),l.jsx(wO,{open:v,onOpenChange:b}),l.jsx(bO,{playbookId:S,open:k,onOpenChange:N})]})}const Cs=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:je("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:je("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:je("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:je("text-sm text-muted-foreground",t),...e}));Xc.displayName="CardDescription";const Ps=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:je("p-6 pt-0",t),...e}));Ps.displayName="CardContent";const mI=x.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:je("flex items-center p-6 pt-0",t),...e}));mI.displayName="CardFooter";function vI(){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(_1,{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 gI(){const[t]=yN(),[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 Ao(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(yI).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function yI([t,e]){return`${encodeURIComponent(t)}${e.length>0?`=${encodeURIComponent(e)}`:""}`}var E0=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=Ao(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 Ao(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=Ao(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?Ao(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}`}},Ze;(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})(Ze||(Ze={}));var C0;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(C0||(C0={}));const ce=Ze.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 ce.undefined;case"string":return ce.string;case"number":return Number.isNaN(t)?ce.nan:ce.number;case"boolean":return ce.boolean;case"function":return ce.function;case"bigint":return ce.bigint;case"symbol":return ce.symbol;case"object":return Array.isArray(t)?ce.array:t===null?ce.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ce.promise:typeof Map<"u"&&t instanceof Map?ce.map:typeof Set<"u"&&t instanceof Set?ce.set:typeof Date<"u"&&t instanceof Date?ce.date:ce.object;default:return ce.unknown}},Z=Ze.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,Ze.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 jp=(t,e)=>{let r;switch(t.code){case Z.invalid_type:t.received===ce.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.joinValues(t.keys,", ")}`;break;case Z.invalid_union:r="Invalid input";break;case Z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.joinValues(t.options)}`;break;case Z.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.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}"`:Ze.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,Ze.assertNever(t)}return{message:r}};let xI=jp;function wI(){return xI}const bI=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=wI(),s=bI({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===jp?void 0:jp].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 _e;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 _e;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 _e=Object.freeze({status:"aborted"}),Gi=t=>({status:"dirty",value:t}),zr=t=>({status:"valid",value:t}),P0=t=>t.status==="aborted",k0=t=>t.status==="dirty",vi=t=>t.status==="valid",Uu=t=>typeof Promise<"u"&&t instanceof Promise;var me;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(me||(me={}));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 N0=(t,e)=>{if(vi(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 Me(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 N0(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 vi(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=>vi(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 N0(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 es.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({...Me(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Wu({...Me(this._def),innerType:this,defaultValue:r,typeName:Ce.ZodDefault})}brand(){return new mE({typeName:Ce.ZodBranded,type:this,...Me(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Qu({...Me(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 qv.create(this,e)}readonly(){return Gu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const SI=/^c[^\s-]{8,}$/i,_I=/^[0-9a-z]+$/,EI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,CI=/^[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,PI=/^[a-z0-9_-]{21}$/i,kI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,NI=/^[-+]?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)?)??$/,jI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gf;const TI=/^(?:(?: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])$/,AI=/^(?:(?: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])$/,OI=/^(([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]))$/,II=/^(([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])$/,DI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$I=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fE="((\\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])))",MI=new RegExp(`^${fE}$`);function hE(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 FI(t){return new RegExp(`^${hE(t)}$`)}function LI(t){let e=`${fE}T${hE(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 UI(t,e){return!!((e==="v4"||!e)&&TI.test(t)||(e==="v6"||!e)&&OI.test(t))}function zI(t,e){if(!kI.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 VI(t,e){return!!((e==="v4"||!e)&&AI.test(t)||(e==="v6"||!e)&&II.test(t))}class Jn extends Be{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ce.string){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:ce.string,received:a.parsedType}),_e}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")jI.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")Gf||(Gf=new RegExp(RI,"u")),Gf.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")CI.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")PI.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")SI.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")_I.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")EI.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"?LI(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"?MI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{code:Z.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?FI(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"?NI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"duration",code:Z.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?UI(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"?zI(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"?VI(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"?DI.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"base64",code:Z.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?$I.test(e.data)||(n=this._getOrReturnCtx(e,n),ae(n,{validation:"base64url",code:Z.invalid_string,message:a.message}),s.dirty()):Ze.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,...me.errToObj(s)})}_addCheck(e){return new Jn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...me.errToObj(e)})}url(e){return this._addCheck({kind:"url",...me.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...me.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...me.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...me.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...me.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...me.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...me.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...me.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...me.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...me.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...me.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...me.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,...me.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,...me.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...me.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...me.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...me.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...me.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...me.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...me.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...me.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...me.errToObj(r)})}nonempty(e){return this.min(1,me.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,...Me(t)});function qI(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 gi 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)!==ce.number){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:ce.number,received:a.parsedType}),_e}let s;const n=new nr;for(const a of this._def.checks)a.kind==="int"?Ze.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"?qI(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()):Ze.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,me.toString(r))}gt(e,r){return this.setLimit("min",e,!1,me.toString(r))}lte(e,r){return this.setLimit("max",e,!0,me.toString(r))}lt(e,r){return this.setLimit("max",e,!1,me.toString(r))}setLimit(e,r,s,n){return new gi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:me.toString(n)}]})}_addCheck(e){return new gi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:me.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:me.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:me.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.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"&&Ze.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)}}gi.create=t=>new gi({checks:[],typeName:Ce.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Me(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)!==ce.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()):Ze.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return ae(r,{code:Z.invalid_type,expected:ce.bigint,received:r.parsedType}),_e}gte(e,r){return this.setLimit("min",e,!0,me.toString(r))}gt(e,r){return this.setLimit("min",e,!1,me.toString(r))}lte(e,r){return this.setLimit("max",e,!0,me.toString(r))}lt(e,r){return this.setLimit("max",e,!1,me.toString(r))}setLimit(e,r,s,n){return new Rl({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:me.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:me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:me.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,...Me(t)});class Rp extends Be{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ce.boolean){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.boolean,received:s.parsedType}),_e}return zr(e.data)}}Rp.create=t=>new Rp({typeName:Ce.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Me(t)});class zu extends Be{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ce.date){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_type,expected:ce.date,received:a.parsedType}),_e}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return ae(a,{code:Z.invalid_date}),_e}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()):Ze.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:me.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:me.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,...Me(t)});class j0 extends Be{_parse(e){if(this._getType(e)!==ce.symbol){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.symbol,received:s.parsedType}),_e}return zr(e.data)}}j0.create=t=>new j0({typeName:Ce.ZodSymbol,...Me(t)});class Tp extends Be{_parse(e){if(this._getType(e)!==ce.undefined){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.undefined,received:s.parsedType}),_e}return zr(e.data)}}Tp.create=t=>new Tp({typeName:Ce.ZodUndefined,...Me(t)});class Ap extends Be{_parse(e){if(this._getType(e)!==ce.null){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.null,received:s.parsedType}),_e}return zr(e.data)}}Ap.create=t=>new Ap({typeName:Ce.ZodNull,...Me(t)});class Op extends Be{constructor(){super(...arguments),this._any=!0}_parse(e){return zr(e.data)}}Op.create=t=>new Op({typeName:Ce.ZodAny,...Me(t)});class Ip extends Be{constructor(){super(...arguments),this._unknown=!0}_parse(e){return zr(e.data)}}Ip.create=t=>new Ip({typeName:Ce.ZodUnknown,...Me(t)});class ia extends Be{_parse(e){const r=this._getOrReturnCtx(e);return ae(r,{code:Z.invalid_type,expected:ce.never,received:r.parsedType}),_e}}ia.create=t=>new ia({typeName:Ce.ZodNever,...Me(t)});class R0 extends Be{_parse(e){if(this._getType(e)!==ce.undefined){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.void,received:s.parsedType}),_e}return zr(e.data)}}R0.create=t=>new R0({typeName:Ce.ZodVoid,...Me(t)});class Rn extends Be{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==ce.array)return ae(r,{code:Z.invalid_type,expected:ce.array,received:r.parsedType}),_e;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:me.toString(r)}})}max(e,r){return new Rn({...this._def,maxLength:{value:e,message:me.toString(r)}})}length(e,r){return new Rn({...this._def,exactLength:{value:e,message:me.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,...Me(e)});function vo(t){if(t instanceof Nt){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=es.create(vo(s))}return new Nt({...t._def,shape:()=>e})}else return t instanceof Rn?new Rn({...t._def,type:vo(t.element)}):t instanceof es?es.create(vo(t.unwrap())):t instanceof to?to.create(vo(t.unwrap())):t instanceof Ja?Ja.create(t.items.map(e=>vo(e))):t}class Nt 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=Ze.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ce.object){const u=this._getOrReturnCtx(e);return ae(u,{code:Z.invalid_type,expected:ce.object,received:u.parsedType}),_e}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],f=n.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new An(n,f,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 f=n.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new An(n,f,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,m=await d.value;u.push({key:f,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 me.errToObj,new Nt({...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:me.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new Nt({...this._def,unknownKeys:"strip"})}passthrough(){return new Nt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Nt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Nt({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 Nt({...this._def,catchall:e})}pick(e){const r={};for(const s of Ze.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new Nt({...this._def,shape:()=>r})}omit(e){const r={};for(const s of Ze.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new Nt({...this._def,shape:()=>r})}deepPartial(){return vo(this)}partial(e){const r={};for(const s of Ze.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new Nt({...this._def,shape:()=>r})}required(e){const r={};for(const s of Ze.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 Nt({...this._def,shape:()=>r})}keyof(){return pE(Ze.objectKeys(this.shape))}}Nt.create=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strip",catchall:ia.create(),typeName:Ce.ZodObject,...Me(e)});Nt.strictCreate=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strict",catchall:ia.create(),typeName:Ce.ZodObject,...Me(e)});Nt.lazycreate=(t,e)=>new Nt({shape:t,unknownKeys:"strip",catchall:ia.create(),typeName:Ce.ZodObject,...Me(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 ls(i.ctx.common.issues));return ae(r,{code:Z.invalid_union,unionErrors:o}),_e}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:Z.invalid_union,unionErrors:i}),_e}}get options(){return this._def.options}}Vu.create=(t,e)=>new Vu({options:t,typeName:Ce.ZodUnion,...Me(e)});const Vn=t=>t instanceof $p?Vn(t.schema):t instanceof eo?Vn(t.innerType()):t instanceof Bu?[t.value]:t instanceof Xa?t.options:t instanceof Mp?Ze.objectValues(t.enum):t instanceof Wu?Vn(t._def.innerType):t instanceof Tp?[void 0]:t instanceof Ap?[null]:t instanceof es?[void 0,...Vn(t.unwrap())]:t instanceof to?[null,...Vn(t.unwrap())]:t instanceof mE||t instanceof Gu?Vn(t.unwrap()):t instanceof Qu?Vn(t._def.innerType):[];class Vv extends Be{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==ce.object)return ae(r,{code:Z.invalid_type,expected:ce.object,received:r.parsedType}),_e;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]}),_e)}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 Vv({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...Me(s)})}}function Dp(t,e){const r=ks(t),s=ks(e);if(t===e)return{valid:!0,data:t};if(r===ce.object&&s===ce.object){const n=Ze.objectKeys(e),a=Ze.objectKeys(t).filter(i=>n.indexOf(i)!==-1),o={...t,...e};for(const i of a){const c=Dp(t[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(r===ce.array&&s===ce.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=Dp(o,i);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===ce.date&&s===ce.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(P0(a)||P0(o))return _e;const i=Dp(a.value,o.value);return i.valid?((k0(a)||k0(o))&&r.dirty(),{status:r.value,value:i.data}):(ae(s,{code:Z.invalid_intersection_types}),_e)};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,...Me(r)});class Ja extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==ce.array)return ae(s,{code:Z.invalid_type,expected:ce.array,received:s.parsedType}),_e;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"}),_e;!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,...Me(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!==ce.object)return ae(s,{code:Z.invalid_type,expected:ce.object,received:s.parsedType}),_e;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,...Me(s)}):new Hu({keyType:Jn.create(),valueType:e,typeName:Ce.ZodRecord,...Me(r)})}}class T0 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!==ce.map)return ae(s,{code:Z.invalid_type,expected:ce.map,received:s.parsedType}),_e;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 _e;(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 _e;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),i.set(u.value,d.value)}return{status:r.value,value:i}}}}T0.create=(t,e,r)=>new T0({valueType:e,keyType:t,typeName:Ce.ZodMap,...Me(r)});class Tl extends Be{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==ce.set)return ae(s,{code:Z.invalid_type,expected:ce.set,received:s.parsedType}),_e;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 _e;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:me.toString(r)}})}max(e,r){return new Tl({...this._def,maxSize:{value:e,message:me.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,...Me(e)});class $p 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})}}$p.create=(t,e)=>new $p({getter:t,typeName:Ce.ZodLazy,...Me(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}),_e}return{status:"valid",value:e.data}}get value(){return this._def.value}}Bu.create=(t,e)=>new Bu({value:t,typeName:Ce.ZodLiteral,...Me(e)});function pE(t,e){return new Xa({values:t,typeName:Ce.ZodEnum,...Me(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:Ze.joinValues(s),received:r.parsedType,code:Z.invalid_type}),_e}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}),_e}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=pE;class Mp extends Be{_parse(e){const r=Ze.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==ce.string&&s.parsedType!==ce.number){const n=Ze.objectValues(r);return ae(s,{expected:Ze.joinValues(n),received:s.parsedType,code:Z.invalid_type}),_e}if(this._cache||(this._cache=new Set(Ze.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=Ze.objectValues(r);return ae(s,{received:s.data,code:Z.invalid_enum_value,options:n}),_e}return zr(e.data)}get enum(){return this._def.values}}Mp.create=(t,e)=>new Mp({values:t,typeName:Ce.ZodNativeEnum,...Me(e)});class Ku extends Be{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==ce.promise&&r.common.async===!1)return ae(r,{code:Z.invalid_type,expected:ce.promise,received:r.parsedType}),_e;const s=r.parsedType===ce.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,...Me(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 _e;const c=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return c.status==="aborted"?_e:c.status==="dirty"||r.value==="dirty"?Gi(c.value):c});{if(r.value==="aborted")return _e;const i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?_e:i.status==="dirty"||r.value==="dirty"?Gi(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"?_e:(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"?_e:(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(!vi(o))return _e;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=>vi(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:r.value,value:i})):_e);Ze.assertNever(n)}}eo.create=(t,e,r)=>new eo({schema:t,typeName:Ce.ZodEffects,effect:e,...Me(r)});eo.createWithPreprocess=(t,e,r)=>new eo({schema:e,effect:{type:"preprocess",transform:t},typeName:Ce.ZodEffects,...Me(r)});class es extends Be{_parse(e){return this._getType(e)===ce.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,...Me(e)});class to extends Be{_parse(e){return this._getType(e)===ce.null?zr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}to.create=(t,e)=>new to({innerType:t,typeName:Ce.ZodNullable,...Me(e)});class Wu extends Be{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===ce.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,...Me(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 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}}Qu.create=(t,e)=>new Qu({innerType:t,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Me(e)});class A0 extends Be{_parse(e){if(this._getType(e)!==ce.nan){const s=this._getOrReturnCtx(e);return ae(s,{code:Z.invalid_type,expected:ce.nan,received:s.parsedType}),_e}return{status:"valid",value:e.data}}}A0.create=t=>new A0({typeName:Ce.ZodNaN,...Me(t)});class mE 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 qv 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"?_e:a.status==="dirty"?(r.dirty(),Gi(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"?_e: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 qv({in:e,out:r,typeName:Ce.ZodPipeline})}}class Gu extends Be{_parse(e){const r=this._def.innerType._parse(e),s=n=>(vi(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,...Me(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 q=Jn.create,Ut=gi.create,Dt=Rp.create,HI=Op.create,Kl=Ip.create;ia.create;const fe=Rn.create,se=Nt.create,or=Vu.create,BI=Vv.create;qu.create;Ja.create;const Wl=Hu.create,Ie=Bu.create,cs=Xa.create;Ku.create;const W=es.create;to.create;const KI=_e,qd="2025-06-18",WI=[qd,"2025-03-26","2024-11-05","2024-10-07"],Hd="2.0",vE=or([q(),Ut().int()]),gE=q(),QI=se({progressToken:W(vE)}).passthrough(),Vr=se({_meta:W(QI)}).passthrough(),yr=se({method:q(),params:W(Vr)}),Ql=se({_meta:W(se({}).passthrough())}).passthrough(),In=se({method:q(),params:W(Ql)}),qr=se({_meta:W(se({}).passthrough())}).passthrough(),Bd=or([q(),Ut().int()]),yE=se({jsonrpc:Ie(Hd),id:Bd}).merge(yr).strict(),xE=t=>yE.safeParse(t).success,wE=se({jsonrpc:Ie(Hd)}).merge(In).strict(),GI=t=>wE.safeParse(t).success,bE=se({jsonrpc:Ie(Hd),id:Bd,result:qr}).strict(),Fp=t=>bE.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 SE=se({jsonrpc:Ie(Hd),id:Bd,error:se({code:Ut().int(),message:q(),data:W(Kl())})}).strict(),ZI=t=>SE.safeParse(t).success,eu=or([yE,wE,bE,SE]),Oo=qr.strict(),Hv=In.extend({method:Ie("notifications/cancelled"),params:Ql.extend({requestId:Bd,reason:q().optional()})}),Gl=se({name:q(),title:W(q())}).passthrough(),_E=Gl.extend({version:q()}),YI=se({experimental:W(se({}).passthrough()),sampling:W(se({}).passthrough()),elicitation:W(se({}).passthrough()),roots:W(se({listChanged:W(Dt())}).passthrough())}).passthrough(),JI=yr.extend({method:Ie("initialize"),params:Vr.extend({protocolVersion:q(),capabilities:YI,clientInfo:_E})}),XI=se({experimental:W(se({}).passthrough()),logging:W(se({}).passthrough()),completions:W(se({}).passthrough()),prompts:W(se({listChanged:W(Dt())}).passthrough()),resources:W(se({subscribe:W(Dt()),listChanged:W(Dt())}).passthrough()),tools:W(se({listChanged:W(Dt())}).passthrough())}).passthrough(),EE=qr.extend({protocolVersion:q(),capabilities:XI,serverInfo:_E,instructions:W(q())}),CE=In.extend({method:Ie("notifications/initialized")}),eD=t=>CE.safeParse(t).success,Bv=yr.extend({method:Ie("ping")}),tD=se({progress:Ut(),total:W(Ut()),message:W(q())}).passthrough(),Kv=In.extend({method:Ie("notifications/progress"),params:Ql.merge(tD).extend({progressToken:vE})}),Kd=yr.extend({params:Vr.extend({cursor:W(gE)}).optional()}),Wd=qr.extend({nextCursor:W(gE)}),PE=se({uri:q(),mimeType:W(q()),_meta:W(se({}).passthrough())}).passthrough(),kE=PE.extend({text:q()}),Wv=q().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),NE=PE.extend({blob:Wv}),jE=Gl.extend({uri:q(),description:W(q()),mimeType:W(q()),_meta:W(se({}).passthrough())}),rD=Gl.extend({uriTemplate:q(),description:W(q()),mimeType:W(q()),_meta:W(se({}).passthrough())}),nD=Kd.extend({method:Ie("resources/list")}),Zu=Wd.extend({resources:fe(jE)}),sD=Kd.extend({method:Ie("resources/templates/list")}),RE=Wd.extend({resourceTemplates:fe(rD)}),aD=yr.extend({method:Ie("resources/read"),params:Vr.extend({uri:q()})}),Qv=qr.extend({contents:fe(or([kE,NE]))}),oD=In.extend({method:Ie("notifications/resources/list_changed")}),iD=yr.extend({method:Ie("resources/subscribe"),params:Vr.extend({uri:q()})}),lD=yr.extend({method:Ie("resources/unsubscribe"),params:Vr.extend({uri:q()})}),cD=In.extend({method:Ie("notifications/resources/updated"),params:Ql.extend({uri:q()})}),uD=se({name:q(),description:W(q()),required:W(Dt())}).passthrough(),dD=Gl.extend({description:W(q()),arguments:W(fe(uD)),_meta:W(se({}).passthrough())}),fD=Kd.extend({method:Ie("prompts/list")}),Yu=Wd.extend({prompts:fe(dD)}),hD=yr.extend({method:Ie("prompts/get"),params:Vr.extend({name:q(),arguments:W(Wl(q()))})}),Gv=se({type:Ie("text"),text:q(),_meta:W(se({}).passthrough())}).passthrough(),Zv=se({type:Ie("image"),data:Wv,mimeType:q(),_meta:W(se({}).passthrough())}).passthrough(),Yv=se({type:Ie("audio"),data:Wv,mimeType:q(),_meta:W(se({}).passthrough())}).passthrough(),pD=se({type:Ie("resource"),resource:or([kE,NE]),_meta:W(se({}).passthrough())}).passthrough(),mD=jE.extend({type:Ie("resource_link")}),TE=or([Gv,Zv,Yv,mD,pD]),vD=se({role:cs(["user","assistant"]),content:TE}).passthrough(),Jv=qr.extend({description:W(q()),messages:fe(vD)}),gD=In.extend({method:Ie("notifications/prompts/list_changed")}),yD=se({title:W(q()),readOnlyHint:W(Dt()),destructiveHint:W(Dt()),idempotentHint:W(Dt()),openWorldHint:W(Dt())}).passthrough(),xD=Gl.extend({description:W(q()),inputSchema:se({type:Ie("object"),properties:W(se({}).passthrough()),required:W(fe(q()))}).passthrough(),outputSchema:W(se({type:Ie("object"),properties:W(se({}).passthrough()),required:W(fe(q()))}).passthrough()),annotations:W(yD),_meta:W(se({}).passthrough())}),wD=Kd.extend({method:Ie("tools/list")}),Xv=Wd.extend({tools:fe(xD)}),Qd=qr.extend({content:fe(TE).default([]),structuredContent:se({}).passthrough().optional(),isError:W(Dt())});Qd.or(qr.extend({toolResult:Kl()}));const bD=yr.extend({method:Ie("tools/call"),params:Vr.extend({name:q(),arguments:W(Wl(Kl()))})}),SD=In.extend({method:Ie("notifications/tools/list_changed")}),AE=cs(["debug","info","notice","warning","error","critical","alert","emergency"]),_D=yr.extend({method:Ie("logging/setLevel"),params:Vr.extend({level:AE})}),ED=In.extend({method:Ie("notifications/message"),params:Ql.extend({level:AE,logger:W(q()),data:Kl()})}),CD=se({name:q().optional()}).passthrough(),PD=se({hints:W(fe(CD)),costPriority:W(Ut().min(0).max(1)),speedPriority:W(Ut().min(0).max(1)),intelligencePriority:W(Ut().min(0).max(1))}).passthrough(),kD=se({role:cs(["user","assistant"]),content:or([Gv,Zv,Yv])}).passthrough(),ND=yr.extend({method:Ie("sampling/createMessage"),params:Vr.extend({messages:fe(kD),systemPrompt:W(q()),includeContext:W(cs(["none","thisServer","allServers"])),temperature:W(Ut()),maxTokens:Ut().int(),stopSequences:W(fe(q())),metadata:W(se({}).passthrough()),modelPreferences:W(PD)})}),jD=qr.extend({model:q(),stopReason:W(cs(["endTurn","stopSequence","maxTokens"]).or(q())),role:cs(["user","assistant"]),content:BI("type",[Gv,Zv,Yv])}),RD=se({type:Ie("boolean"),title:W(q()),description:W(q()),default:W(Dt())}).passthrough(),TD=se({type:Ie("string"),title:W(q()),description:W(q()),minLength:W(Ut()),maxLength:W(Ut()),format:W(cs(["email","uri","date","date-time"]))}).passthrough(),AD=se({type:cs(["number","integer"]),title:W(q()),description:W(q()),minimum:W(Ut()),maximum:W(Ut())}).passthrough(),OD=se({type:Ie("string"),title:W(q()),description:W(q()),enum:fe(q()),enumNames:W(fe(q()))}).passthrough(),ID=or([RD,TD,AD,OD]),DD=yr.extend({method:Ie("elicitation/create"),params:Vr.extend({message:q(),requestedSchema:se({type:Ie("object"),properties:Wl(q(),ID),required:W(fe(q()))}).passthrough()})}),$D=qr.extend({action:cs(["accept","decline","cancel"]),content:W(Wl(q(),Kl()))}),MD=se({type:Ie("ref/resource"),uri:q()}).passthrough(),FD=se({type:Ie("ref/prompt"),name:q()}).passthrough(),LD=yr.extend({method:Ie("completion/complete"),params:Vr.extend({ref:or([FD,MD]),argument:se({name:q(),value:q()}).passthrough(),context:W(se({arguments:W(Wl(q(),q()))}))})}),OE=qr.extend({completion:se({values:fe(q()).max(100),total:W(Ut().int()),hasMore:W(Dt())}).passthrough()}),UD=se({uri:q().startsWith("file://"),name:W(q()),_meta:W(se({}).passthrough())}).passthrough(),zD=yr.extend({method:Ie("roots/list")}),VD=qr.extend({roots:fe(UD)}),qD=In.extend({method:Ie("notifications/roots/list_changed")});or([Bv,JI,LD,_D,hD,fD,nD,sD,aD,iD,lD,bD,wD]);or([Hv,Kv,CE,qD]);or([Oo,jD,$D,VD]);or([Bv,ND,DD,zD]);or([Hv,Kv,ED,cD,oD,SD,gD]);or([Oo,EE,OE,Jv,Yu,Zu,RE,Qv,Qd,Xv]);class qs extends Error{constructor(e,r,s){super(`MCP error ${e}: ${r}`),this.code=e,this.data=s,this.name="McpError"}}class O0 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 Zf(t){}function IE(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=Zf,onError:r=Zf,onRetry:s=Zf,onComment:n}=t;let a="",o=!0,i,c="",u="";function d(p){const g=o?p.replace(/^\xEF\xBB\xBF/,""):p,[y,v]=HD(`${a}${g}`);for(const b of y)f(b);a=v,o=!1}function f(p){if(p===""){h();return}if(p.startsWith(":")){n&&n(p.slice(p.startsWith(": ")?2:1));return}const g=p.indexOf(":");if(g!==-1){const y=p.slice(0,g),v=p[g+1]===" "?2:1,b=p.slice(g+v);m(y,b,p);return}m(p,"",p)}function m(p,g,y){switch(p){case"event":u=g;break;case"data":c=`${c}${g}
|
|
331
336
|
`;break;case"id":i=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?s(parseInt(g,10)):r(new O0(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:y}));break;default:r(new O0(`Unknown field "${p.length>20?`${p.slice(0,20)}…`:p}"`,{type:"unknown-field",field:p,value:g,line:y}));break}}function h(){c.length>0&&e({id:i,event:u||void 0,data:c.endsWith(`
|
|
332
|
-
`)?c.slice(0,-1):c}),i=void 0,c="",u=""}function w(p={}){a&&p.consume&&f(a),o=!0,i=void 0,c="",u="",a=""}return{feed:d,reset:w}}function
|
|
337
|
+
`)?c.slice(0,-1):c}),i=void 0,c="",u=""}function w(p={}){a&&p.consume&&f(a),o=!0,i=void 0,c="",u="",a=""}return{feed:d,reset:w}}function HD(t){const e=[];let r="",s=0;for(;s<t.length;){const n=t.indexOf("\r",s),a=t.indexOf(`
|
|
333
338
|
`,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]===`
|
|
334
|
-
`&&s++}}return[e,r]}class I0 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(D0(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(D0(this),r)}}function KD(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Lp(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Lp).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Lp(t.cause)}`:t.message:`${t}`}function D0(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var DE=t=>{throw TypeError(t)},eg=(t,e,r)=>e.has(t)||DE("Cannot "+r),Ve=(t,e,r)=>(eg(t,e,"read from private field"),r?r.call(t):e.get(t)),Rt=(t,e,r)=>e.has(t)?DE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),pt=(t,e,r,s)=>(eg(t,e,"write to private field"),e.set(t,r),r),qn=(t,e,r)=>(eg(t,e,"access private method"),r),ur,Ca,go,tu,Ju,ll,Io,cl,Rs,yo,Bo,xo,Zi,Gr,Up,zp,Vp,$0,qp,Hp,Yi,Bp,Kp;class ru extends EventTarget{constructor(e,r){var s,n;super(),Rt(this,Gr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Rt(this,ur),Rt(this,Ca),Rt(this,go),Rt(this,tu),Rt(this,Ju),Rt(this,ll),Rt(this,Io),Rt(this,cl,null),Rt(this,Rs),Rt(this,yo),Rt(this,Bo,null),Rt(this,xo,null),Rt(this,Zi,null),Rt(this,zp,async a=>{var o;Ve(this,yo).reset();const{body:i,redirected:c,status:u,headers:d}=a;if(u===204){qn(this,Gr,Yi).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?pt(this,go,new URL(a.url)):pt(this,go,void 0),u!==200){qn(this,Gr,Yi).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){qn(this,Gr,Yi).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ve(this,ur)===this.CLOSED)return;pt(this,ur,this.OPEN);const f=new Event("open");if((o=Ve(this,Zi))==null||o.call(this,f),this.dispatchEvent(f),typeof i!="object"||!i||!("getReader"in i)){qn(this,Gr,Yi).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const m=new TextDecoder,h=i.getReader();let w=!0;do{const{done:p,value:g}=await h.read();g&&Ve(this,yo).feed(m.decode(g,{stream:!p})),p&&(w=!1,Ve(this,yo).reset(),qn(this,Gr,Bp).call(this))}while(w)}),Rt(this,Vp,a=>{pt(this,Rs,void 0),!(a.name==="AbortError"||a.type==="aborted")&&qn(this,Gr,Bp).call(this,Lp(a))}),Rt(this,qp,a=>{typeof a.id=="string"&&pt(this,cl,a.id);const o=new MessageEvent(a.event||"message",{data:a.data,origin:Ve(this,go)?Ve(this,go).origin:Ve(this,Ca).origin,lastEventId:a.id||""});Ve(this,xo)&&(!a.event||a.event==="message")&&Ve(this,xo).call(this,o),this.dispatchEvent(o)}),Rt(this,Hp,a=>{pt(this,ll,a)}),Rt(this,Kp,()=>{pt(this,Io,void 0),Ve(this,ur)===this.CONNECTING&&qn(this,Gr,Up).call(this)});try{if(e instanceof URL)pt(this,Ca,e);else if(typeof e=="string")pt(this,Ca,new URL(e,WD()));else throw new Error("Invalid URL")}catch{throw KD("An invalid or illegal string was specified")}pt(this,yo,IE({onEvent:Ve(this,qp),onRetry:Ve(this,Hp)})),pt(this,ur,this.CONNECTING),pt(this,ll,3e3),pt(this,Ju,(s=r==null?void 0:r.fetch)!=null?s:globalThis.fetch),pt(this,tu,(n=r==null?void 0:r.withCredentials)!=null?n:!1),qn(this,Gr,Up).call(this)}get readyState(){return Ve(this,ur)}get url(){return Ve(this,Ca).href}get withCredentials(){return Ve(this,tu)}get onerror(){return Ve(this,Bo)}set onerror(e){pt(this,Bo,e)}get onmessage(){return Ve(this,xo)}set onmessage(e){pt(this,xo,e)}get onopen(){return Ve(this,Zi)}set onopen(e){pt(this,Zi,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,Io)&&clearTimeout(Ve(this,Io)),Ve(this,ur)!==this.CLOSED&&(Ve(this,Rs)&&Ve(this,Rs).abort(),pt(this,ur,this.CLOSED),pt(this,Rs,void 0))}}ur=new WeakMap,Ca=new WeakMap,go=new WeakMap,tu=new WeakMap,Ju=new WeakMap,ll=new WeakMap,Io=new WeakMap,cl=new WeakMap,Rs=new WeakMap,yo=new WeakMap,Bo=new WeakMap,xo=new WeakMap,Zi=new WeakMap,Gr=new WeakSet,Up=function(){pt(this,ur,this.CONNECTING),pt(this,Rs,new AbortController),Ve(this,Ju)(Ve(this,Ca),qn(this,Gr,$0).call(this)).then(Ve(this,zp)).catch(Ve(this,Vp))},zp=new WeakMap,Vp=new WeakMap,$0=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},qp=new WeakMap,Hp=new WeakMap,Yi=function(t,e){var r;Ve(this,ur)!==this.CLOSED&&pt(this,ur,this.CLOSED);const s=new I0("error",{code:e,message:t});(r=Ve(this,Bo))==null||r.call(this,s),this.dispatchEvent(s)},Bp=function(t,e){var r;if(Ve(this,ur)===this.CLOSED)return;pt(this,ur,this.CONNECTING);const s=new I0("error",{code:e,message:t});(r=Ve(this,Bo))==null||r.call(this,s),this.dispatchEvent(s),pt(this,Io,setTimeout(Ve(this,Kp),Ve(this,ll)))},Kp=new WeakMap,ru.CONNECTING=0,ru.OPEN=1,ru.CLOSED=2;function WD(){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 tg;tg=globalThis.crypto;async function QD(t){return(await tg).getRandomValues(new Uint8Array(t))}async function GD(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const s=await QD(t);for(let n=0;n<t;n++){const a=s[n]%e.length;r+=e[a]}return r}async function ZD(t){return await GD(t)}async function YD(t){const e=await(await tg).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function JD(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await ZD(t),r=await YD(e);return{code_verifier:e,code_challenge:r}}const Ft=q().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Z.custom,message:"URL must be parseable",fatal:!0}),WI}).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"}),XD=se({resource:q().url(),authorization_servers:fe(Ft).optional(),jwks_uri:q().url().optional(),scopes_supported:fe(q()).optional(),bearer_methods_supported:fe(q()).optional(),resource_signing_alg_values_supported:fe(q()).optional(),resource_name:q().optional(),resource_documentation:q().optional(),resource_policy_uri:q().url().optional(),resource_tos_uri:q().url().optional(),tls_client_certificate_bound_access_tokens:Dt().optional(),authorization_details_types_supported:fe(q()).optional(),dpop_signing_alg_values_supported:fe(q()).optional(),dpop_bound_access_tokens_required:Dt().optional()}).passthrough(),$E=se({issuer:q(),authorization_endpoint:Ft,token_endpoint:Ft,registration_endpoint:Ft.optional(),scopes_supported:fe(q()).optional(),response_types_supported:fe(q()),response_modes_supported:fe(q()).optional(),grant_types_supported:fe(q()).optional(),token_endpoint_auth_methods_supported:fe(q()).optional(),token_endpoint_auth_signing_alg_values_supported:fe(q()).optional(),service_documentation:Ft.optional(),revocation_endpoint:Ft.optional(),revocation_endpoint_auth_methods_supported:fe(q()).optional(),revocation_endpoint_auth_signing_alg_values_supported:fe(q()).optional(),introspection_endpoint:q().optional(),introspection_endpoint_auth_methods_supported:fe(q()).optional(),introspection_endpoint_auth_signing_alg_values_supported:fe(q()).optional(),code_challenge_methods_supported:fe(q()).optional()}).passthrough(),e4=se({issuer:q(),authorization_endpoint:Ft,token_endpoint:Ft,userinfo_endpoint:Ft.optional(),jwks_uri:Ft,registration_endpoint:Ft.optional(),scopes_supported:fe(q()).optional(),response_types_supported:fe(q()),response_modes_supported:fe(q()).optional(),grant_types_supported:fe(q()).optional(),acr_values_supported:fe(q()).optional(),subject_types_supported:fe(q()),id_token_signing_alg_values_supported:fe(q()),id_token_encryption_alg_values_supported:fe(q()).optional(),id_token_encryption_enc_values_supported:fe(q()).optional(),userinfo_signing_alg_values_supported:fe(q()).optional(),userinfo_encryption_alg_values_supported:fe(q()).optional(),userinfo_encryption_enc_values_supported:fe(q()).optional(),request_object_signing_alg_values_supported:fe(q()).optional(),request_object_encryption_alg_values_supported:fe(q()).optional(),request_object_encryption_enc_values_supported:fe(q()).optional(),token_endpoint_auth_methods_supported:fe(q()).optional(),token_endpoint_auth_signing_alg_values_supported:fe(q()).optional(),display_values_supported:fe(q()).optional(),claim_types_supported:fe(q()).optional(),claims_supported:fe(q()).optional(),service_documentation:q().optional(),claims_locales_supported:fe(q()).optional(),ui_locales_supported:fe(q()).optional(),claims_parameter_supported:Dt().optional(),request_parameter_supported:Dt().optional(),request_uri_parameter_supported:Dt().optional(),require_request_uri_registration:Dt().optional(),op_policy_uri:Ft.optional(),op_tos_uri:Ft.optional()}).passthrough(),t4=e4.merge($E.pick({code_challenge_methods_supported:!0})),ME=se({access_token:q(),id_token:q().optional(),token_type:q(),expires_in:Ut().optional(),scope:q().optional(),refresh_token:q().optional()}).strip(),r4=se({error:q(),error_description:q().optional(),error_uri:q().optional()}),n4=se({redirect_uris:fe(Ft),token_endpoint_auth_method:q().optional(),grant_types:fe(q()).optional(),response_types:fe(q()).optional(),client_name:q().optional(),client_uri:Ft.optional(),logo_uri:Ft.optional(),scope:q().optional(),contacts:fe(q()).optional(),tos_uri:Ft.optional(),policy_uri:q().optional(),jwks_uri:Ft.optional(),jwks:BI().optional(),software_id:q().optional(),software_version:q().optional(),software_statement:q().optional()}).strip(),s4=se({client_id:q(),client_secret:q().optional(),client_id_issued_at:Ut().optional(),client_secret_expires_at:Ut().optional()}).strip(),a4=n4.merge(s4);se({error:q(),error_description:q().optional()}).strip();se({token:q(),token_type_hint:q().optional()}).strip();function o4(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function i4({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 Wp extends Kt{}Wp.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 Qp extends Kt{}Qp.errorCode="unsupported_grant_type";class Gp extends Kt{}Gp.errorCode="invalid_scope";class Zp extends Kt{}Zp.errorCode="access_denied";class yi extends Kt{}yi.errorCode="server_error";class Yp extends Kt{}Yp.errorCode="temporarily_unavailable";class Jp extends Kt{}Jp.errorCode="unsupported_response_type";class Xp extends Kt{}Xp.errorCode="unsupported_token_type";class em extends Kt{}em.errorCode="invalid_token";class tm extends Kt{}tm.errorCode="method_not_allowed";class rm extends Kt{}rm.errorCode="too_many_requests";class nm extends Kt{}nm.errorCode="invalid_client_metadata";class sm extends Kt{}sm.errorCode="insufficient_scope";const l4={[Wp.errorCode]:Wp,[Xu.errorCode]:Xu,[ed.errorCode]:ed,[td.errorCode]:td,[Qp.errorCode]:Qp,[Gp.errorCode]:Gp,[Zp.errorCode]:Zp,[yi.errorCode]:yi,[Yp.errorCode]:Yp,[Jp.errorCode]:Jp,[Xp.errorCode]:Xp,[em.errorCode]:em,[tm.errorCode]:tm,[rm.errorCode]:rm,[nm.errorCode]:nm,[sm.errorCode]:sm};class Dr extends Error{constructor(e){super(e??"Unauthorized")}}function FE(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 LE(t,e,r,s){const{client_id:n,client_secret:a}=e;switch(t){case"client_secret_basic":c4(n,a,r);return;case"client_secret_post":u4(n,a,s);return;case"none":d4(n,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function c4(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 u4(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function d4(t,e){e.set("client_id",t)}async function rg(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const s=r4.parse(JSON.parse(r)),{error:n,error_description:a,error_uri:o}=s,i=l4[n]||yi;return new i(a||"",o)}catch(s){const n=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${r}`;return new yi(n)}}async function Pn(t,e){var r,s;try{return await Yf(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 Yf(t,e);if(n instanceof ed)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await Yf(t,e);throw n}}async function Yf(t,{serverUrl:e,authorizationCode:r,scope:s,resourceMetadataUrl:n,fetchFn:a}){let o,i;try{o=await h4(e,{resourceMetadataUrl:n},a),o.authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch{}i||(i=e);const c=await f4(e,t,o),u=await y4(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 S4(i,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:a});await t.saveClientInformation(p),d=p}if(r!==void 0){const p=await t.codeVerifier(),g=await w4(i,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:p,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(g),"AUTHORIZED"}const f=await t.tokens();if(f!=null&&f.refresh_token)try{const p=await b4(i,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof Kt)||p instanceof yi))throw p}const m=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:w}=await x4(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(h),"REDIRECT"}async function f4(t,e,r){const s=o4(t);if(e.validateResourceURL)return await e.validateResourceURL(s,r==null?void 0:r.resource);if(r){if(!i4({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 am(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 h4(t,e,r=fetch){const s=await v4(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 XD.parse(await s.json())}async function ng(t,e,r=fetch){try{return await r(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?ng(t,void 0,r):void 0;throw s}}function p4(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function M0(t,e,r=fetch){return await ng(t,{"MCP-Protocol-Version":e},r)}function m4(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function v4(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=p4(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 M0(c,i,r);if(!(s!=null&&s.metadataUrl)&&m4(u,o.pathname)){const d=new URL(`/.well-known/${e}`,o);u=await M0(d,i,r)}return u}function g4(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 y4(t,{fetchFn:e=fetch,protocolVersion:r=qd}={}){var s;const n={"MCP-Protocol-Version":r},a=g4(t);for(const{url:o,type:i}of a){const c=await ng(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 $E.parse(await c.json());{const u=t4.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 x4(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 JD(),f=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:f}}async function w4(t,{metadata:e,clientInformation:r,authorizationCode:s,codeVerifier:n,redirectUri:a,resource:o,addClientAuthentication:i,fetchFn:c}){var u;const d="authorization_code",f=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"}),h=new URLSearchParams({grant_type:d,code:s,code_verifier:n,redirect_uri:String(a)});if(i)i(m,h,t,e);else{const p=(u=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],g=FE(r,p);LE(g,r,m,h)}o&&h.set("resource",o.href);const w=await(c??fetch)(f,{method:"POST",headers:m,body:h});if(!w.ok)throw await rg(w);return ME.parse(await w.json())}async function b4(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"}),f=new URLSearchParams({grant_type:c,refresh_token:s});if(a)a(d,f,t,e);else{const h=(i=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&i!==void 0?i:[],w=FE(r,h);LE(w,r,d,f)}n&&f.set("resource",n.href);const m=await(o??fetch)(u,{method:"POST",headers:d,body:f});if(!m.ok)throw await rg(m);return ME.parse({refresh_token:s,...await m.json()})}async function S4(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 rg(a);return a4.parse(await a.json())}class _4 extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class E4{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=am(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 _4(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 f;try{f=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,f)}})}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=am(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 C4 extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let n;super({start(a){n=IE({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 P4={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Jf extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class k4{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:P4}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 Jf(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,f;try{const m=e.pipeThrough(new TextDecoderStream).pipeThrough(new C4).getReader();for(;;){const{value:h,done:w}=await m.read();if(w)break;if(h.id&&(o=h.id,n==null||n(h.id)),!h.event||h.event==="message")try{const p=eu.parse(JSON.parse(h.data));a!==void 0&&Fp(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(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}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:xE(e)?e.id:void 0}).catch(g=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,g)});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},f=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,d),m=f.headers.get("mcp-session-id");if(m&&(this._sessionId=m),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=am(f),await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr;return this.send(e)}const g=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${g}`)}if(f.status===202){tD(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(g=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,g)});return}const w=(Array.isArray(e)?e:[e]).filter(g=>"method"in g&&"id"in g&&g.id!==void 0).length>0,p=f.headers.get("content-type");if(w)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(p!=null&&p.includes("application/json")){const g=await f.json(),y=Array.isArray(g)?g.map(v=>eu.parse(v)):[eu.parse(g)];for(const v of y)(a=this.onmessage)===null||a===void 0||a.call(this,v)}else throw new Jf(-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 Jf(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 N4=6e4;class j4{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(Hv,r=>{const s=this._requestHandlerAbortControllers.get(r.params.requestId);s==null||s.abort(r.params.reason)}),this.setNotificationHandler(Kv,r=>{this._onprogress(r)}),this.setRequestHandler(Bv,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),Fp(c)||YI(c)?this._onresponse(c):xE(c)?this._onrequest(c,u):ZI(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,f)=>this.request(u,d,{...f,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),Fp(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,f,m,h,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++,g={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),g.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._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(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`))),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 k=r.parse(S.result);i(k)}catch(k){c(k)}}}),(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 v=(h=s==null?void 0:s.timeout)!==null&&h!==void 0?h:N4,b=()=>y(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(g,{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 R4(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 om={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)})(yC,function(r){function s(){for(var $=arguments.length,P=Array($),M=0;M<$;M++)P[M]=arguments[M];if(P.length>1){P[0]=P[0].slice(0,-1);for(var B=P.length-1,H=1;H<B;++H)P[H]=P[H].slice(1,-1);return P[B]=P[B].slice(1),P.join("")}else return P[0]}function n($){return"(?:"+$+")"}function a($){return $===void 0?"undefined":$===null?"null":Object.prototype.toString.call($).split(" ").pop().split("]").shift().toLowerCase()}function o($){return $.toUpperCase()}function i($){return $!=null?$ instanceof Array?$:typeof $.length!="number"||$.split||$.setInterval||$.call?[$]:Array.prototype.slice.call($):[]}function c($,P){var M=$;if(P)for(var B in P)M[B]=P[B];return M}function u($){var P="[A-Za-z]",M="[0-9]",B=s(M,"[A-Fa-f]"),H=n(n("%[EFef]"+B+"%"+B+B+"%"+B+B)+"|"+n("%[89A-Fa-f]"+B+"%"+B+B)+"|"+n("%"+B+B)),xe="[\\:\\/\\?\\#\\[\\]\\@]",we="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Qe=s(xe,we),it=$?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",_t=$?"[\\uE000-\\uF8FF]":"[]",He=s(P,M,"[\\-\\.\\_\\~]",it);n(P+s(P,M,"[\\+\\-\\.]")+"*"),n(n(H+"|"+s(He,we,"[\\:]"))+"*");var at=n(n("25[0-5]")+"|"+n("2[0-4]"+M)+"|"+n("1"+M+M)+"|"+n("0?[1-9]"+M)+"|0?0?"+M),Et=n(at+"\\."+at+"\\."+at+"\\."+at),Ne=n(B+"{1,4}"),ft=n(n(Ne+"\\:"+Ne)+"|"+Et),kt=n(n(Ne+"\\:")+"{6}"+ft),ht=n("\\:\\:"+n(Ne+"\\:")+"{5}"+ft),gs=n(n(Ne)+"?\\:\\:"+n(Ne+"\\:")+"{4}"+ft),cn=n(n(n(Ne+"\\:")+"{0,1}"+Ne)+"?\\:\\:"+n(Ne+"\\:")+"{3}"+ft),un=n(n(n(Ne+"\\:")+"{0,2}"+Ne)+"?\\:\\:"+n(Ne+"\\:")+"{2}"+ft),io=n(n(n(Ne+"\\:")+"{0,3}"+Ne)+"?\\:\\:"+Ne+"\\:"+ft),xa=n(n(n(Ne+"\\:")+"{0,4}"+Ne)+"?\\:\\:"+ft),jr=n(n(n(Ne+"\\:")+"{0,5}"+Ne)+"?\\:\\:"+Ne),dn=n(n(n(Ne+"\\:")+"{0,6}"+Ne)+"?\\:\\:"),wa=n([kt,ht,gs,cn,un,io,xa,jr,dn].join("|")),Fn=n(n(He+"|"+H)+"+");n("[vV]"+B+"+\\."+s(He,we,"[\\:]")+"+"),n(n(H+"|"+s(He,we))+"*");var ji=n(H+"|"+s(He,we,"[\\:\\@]"));return n(n(H+"|"+s(He,we,"[\\@]"))+"+"),n(n(ji+"|"+s("[\\/\\?]",_t))+"*"),{NOT_SCHEME:new RegExp(s("[^]",P,M,"[\\+\\-\\.]"),"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,"[\\:\\@\\/\\?]",_t),"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(H,"g"),IPV4ADDRESS:new RegExp("^("+Et+")$"),IPV6ADDRESS:new RegExp("^\\[?("+wa+")"+n(n("\\%25|\\%(?!"+B+"{2})")+"("+Fn+")")+"?\\]?$")}}var d=u(!1),f=u(!0),m=function(){function $(P,M){var B=[],H=!0,xe=!1,we=void 0;try{for(var Qe=P[Symbol.iterator](),it;!(H=(it=Qe.next()).done)&&(B.push(it.value),!(M&&B.length===M));H=!0);}catch(_t){xe=!0,we=_t}finally{try{!H&&Qe.return&&Qe.return()}finally{if(xe)throw we}}return B}return function(P,M){if(Array.isArray(P))return P;if(Symbol.iterator in Object(P))return $(P,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function($){if(Array.isArray($)){for(var P=0,M=Array($.length);P<$.length;P++)M[P]=$[P];return M}else return Array.from($)},w=2147483647,p=36,g=1,y=26,v=38,b=700,S=72,E=128,k="-",N=/^xn--/,T=/[^\0-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,U={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=p-g,A=Math.floor,_=String.fromCharCode;function O($){throw new RangeError(U[$])}function z($,P){for(var M=[],B=$.length;B--;)M[B]=P($[B]);return M}function j($,P){var M=$.split("@"),B="";M.length>1&&(B=M[0]+"@",$=M[1]),$=$.replace(D,".");var H=$.split("."),xe=z(H,P).join(".");return B+xe}function K($){for(var P=[],M=0,B=$.length;M<B;){var H=$.charCodeAt(M++);if(H>=55296&&H<=56319&&M<B){var xe=$.charCodeAt(M++);(xe&64512)==56320?P.push(((H&1023)<<10)+(xe&1023)+65536):(P.push(H),M--)}else P.push(H)}return P}var C=function(P){return String.fromCodePoint.apply(String,h(P))},F=function(P){return P-48<10?P-22:P-65<26?P-65:P-97<26?P-97:p},L=function(P,M){return P+22+75*(P<26)-((M!=0)<<5)},Q=function(P,M,B){var H=0;for(P=B?A(P/b):P>>1,P+=A(P/M);P>R*y>>1;H+=p)P=A(P/R);return A(H+(R+1)*P/(P+v))},te=function(P){var M=[],B=P.length,H=0,xe=E,we=S,Qe=P.lastIndexOf(k);Qe<0&&(Qe=0);for(var it=0;it<Qe;++it)P.charCodeAt(it)>=128&&O("not-basic"),M.push(P.charCodeAt(it));for(var _t=Qe>0?Qe+1:0;_t<B;){for(var He=H,at=1,Et=p;;Et+=p){_t>=B&&O("invalid-input");var Ne=F(P.charCodeAt(_t++));(Ne>=p||Ne>A((w-H)/at))&&O("overflow"),H+=Ne*at;var ft=Et<=we?g:Et>=we+y?y:Et-we;if(Ne<ft)break;var kt=p-ft;at>A(w/kt)&&O("overflow"),at*=kt}var ht=M.length+1;we=Q(H-He,ht,He==0),A(H/ht)>w-xe&&O("overflow"),xe+=A(H/ht),H%=ht,M.splice(H++,0,xe)}return String.fromCodePoint.apply(String,M)},V=function(P){var M=[];P=K(P);var B=P.length,H=E,xe=0,we=S,Qe=!0,it=!1,_t=void 0;try{for(var He=P[Symbol.iterator](),at;!(Qe=(at=He.next()).done);Qe=!0){var Et=at.value;Et<128&&M.push(_(Et))}}catch(Ri){it=!0,_t=Ri}finally{try{!Qe&&He.return&&He.return()}finally{if(it)throw _t}}var Ne=M.length,ft=Ne;for(Ne&&M.push(k);ft<B;){var kt=w,ht=!0,gs=!1,cn=void 0;try{for(var un=P[Symbol.iterator](),io;!(ht=(io=un.next()).done);ht=!0){var xa=io.value;xa>=H&&xa<kt&&(kt=xa)}}catch(Ri){gs=!0,cn=Ri}finally{try{!ht&&un.return&&un.return()}finally{if(gs)throw cn}}var jr=ft+1;kt-H>A((w-xe)/jr)&&O("overflow"),xe+=(kt-H)*jr,H=kt;var dn=!0,wa=!1,Fn=void 0;try{for(var ji=P[Symbol.iterator](),pg;!(dn=(pg=ji.next()).done);dn=!0){var mg=pg.value;if(mg<H&&++xe>w&&O("overflow"),mg==H){for(var ec=xe,tc=p;;tc+=p){var rc=tc<=we?g:tc>=we+y?y:tc-we;if(ec<rc)break;var vg=ec-rc,gg=p-rc;M.push(_(L(rc+vg%gg,0))),ec=A(vg/gg)}M.push(_(L(ec,0))),we=Q(xe,jr,ft==Ne),xe=0,++ft}}}catch(Ri){wa=!0,Fn=Ri}finally{try{!dn&&ji.return&&ji.return()}finally{if(wa)throw Fn}}++xe,++H}return M.join("")},de=function(P){return j(P,function(M){return N.test(M)?te(M.slice(4).toLowerCase()):M})},Te=function(P){return j(P,function(M){return T.test(M)?"xn--"+V(M):M})},ge={version:"2.1.0",ucs2:{decode:K,encode:C},decode:te,encode:V,toASCII:Te,toUnicode:de},X={};function ve($){var P=$.charCodeAt(0),M=void 0;return P<16?M="%0"+P.toString(16).toUpperCase():P<128?M="%"+P.toString(16).toUpperCase():P<2048?M="%"+(P>>6|192).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase():M="%"+(P>>12|224).toString(16).toUpperCase()+"%"+(P>>6&63|128).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase(),M}function he($){for(var P="",M=0,B=$.length;M<B;){var H=parseInt($.substr(M+1,2),16);if(H<128)P+=String.fromCharCode(H),M+=3;else if(H>=194&&H<224){if(B-M>=6){var xe=parseInt($.substr(M+4,2),16);P+=String.fromCharCode((H&31)<<6|xe&63)}else P+=$.substr(M,6);M+=6}else if(H>=224){if(B-M>=9){var we=parseInt($.substr(M+4,2),16),Qe=parseInt($.substr(M+7,2),16);P+=String.fromCharCode((H&15)<<12|(we&63)<<6|Qe&63)}else P+=$.substr(M,9);M+=9}else P+=$.substr(M,3),M+=3}return P}function ye($,P){function M(B){var H=he(B);return H.match(P.UNRESERVED)?H:B}return $.scheme&&($.scheme=String($.scheme).replace(P.PCT_ENCODED,M).toLowerCase().replace(P.NOT_SCHEME,"")),$.userinfo!==void 0&&($.userinfo=String($.userinfo).replace(P.PCT_ENCODED,M).replace(P.NOT_USERINFO,ve).replace(P.PCT_ENCODED,o)),$.host!==void 0&&($.host=String($.host).replace(P.PCT_ENCODED,M).toLowerCase().replace(P.NOT_HOST,ve).replace(P.PCT_ENCODED,o)),$.path!==void 0&&($.path=String($.path).replace(P.PCT_ENCODED,M).replace($.scheme?P.NOT_PATH:P.NOT_PATH_NOSCHEME,ve).replace(P.PCT_ENCODED,o)),$.query!==void 0&&($.query=String($.query).replace(P.PCT_ENCODED,M).replace(P.NOT_QUERY,ve).replace(P.PCT_ENCODED,o)),$.fragment!==void 0&&($.fragment=String($.fragment).replace(P.PCT_ENCODED,M).replace(P.NOT_FRAGMENT,ve).replace(P.PCT_ENCODED,o)),$}function ue($){return $.replace(/^0*(.*)/,"$1")||"0"}function Pe($,P){var M=$.match(P.IPV4ADDRESS)||[],B=m(M,2),H=B[1];return H?H.split(".").map(ue).join("."):$}function Ae($,P){var M=$.match(P.IPV6ADDRESS)||[],B=m(M,3),H=B[1],xe=B[2];if(H){for(var we=H.toLowerCase().split("::").reverse(),Qe=m(we,2),it=Qe[0],_t=Qe[1],He=_t?_t.split(":").map(ue):[],at=it.split(":").map(ue),Et=P.IPV4ADDRESS.test(at[at.length-1]),Ne=Et?7:8,ft=at.length-Ne,kt=Array(Ne),ht=0;ht<Ne;++ht)kt[ht]=He[ht]||at[ft+ht]||"";Et&&(kt[Ne-1]=Pe(kt[Ne-1],P));var gs=kt.reduce(function(jr,dn,wa){if(!dn||dn==="0"){var Fn=jr[jr.length-1];Fn&&Fn.index+Fn.length===wa?Fn.length++:jr.push({index:wa,length:1})}return jr},[]),cn=gs.sort(function(jr,dn){return dn.length-jr.length})[0],un=void 0;if(cn&&cn.length>1){var io=kt.slice(0,cn.index),xa=kt.slice(cn.index+cn.length);un=io.join(":")+"::"+xa.join(":")}else un=kt.join(":");return xe&&(un+="%"+xe),un}else return $}var De=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,J="".match(/(){0}/)[1]===void 0;function ie($){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M={},B=P.iri!==!1?f:d;P.reference==="suffix"&&($=(P.scheme?P.scheme+":":"")+"//"+$);var H=$.match(De);if(H){J?(M.scheme=H[1],M.userinfo=H[3],M.host=H[4],M.port=parseInt(H[5],10),M.path=H[6]||"",M.query=H[7],M.fragment=H[8],isNaN(M.port)&&(M.port=H[5])):(M.scheme=H[1]||void 0,M.userinfo=$.indexOf("@")!==-1?H[3]:void 0,M.host=$.indexOf("//")!==-1?H[4]:void 0,M.port=parseInt(H[5],10),M.path=H[6]||"",M.query=$.indexOf("?")!==-1?H[7]:void 0,M.fragment=$.indexOf("#")!==-1?H[8]:void 0,isNaN(M.port)&&(M.port=$.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?H[4]:void 0)),M.host&&(M.host=Ae(Pe(M.host,B),B)),M.scheme===void 0&&M.userinfo===void 0&&M.host===void 0&&M.port===void 0&&!M.path&&M.query===void 0?M.reference="same-document":M.scheme===void 0?M.reference="relative":M.fragment===void 0?M.reference="absolute":M.reference="uri",P.reference&&P.reference!=="suffix"&&P.reference!==M.reference&&(M.error=M.error||"URI is not a "+P.reference+" reference.");var xe=X[(P.scheme||M.scheme||"").toLowerCase()];if(!P.unicodeSupport&&(!xe||!xe.unicodeSupport)){if(M.host&&(P.domainHost||xe&&xe.domainHost))try{M.host=ge.toASCII(M.host.replace(B.PCT_ENCODED,he).toLowerCase())}catch(we){M.error=M.error||"Host's domain name can not be converted to ASCII via punycode: "+we}ye(M,d)}else ye(M,B);xe&&xe.parse&&xe.parse(M,P)}else M.error=M.error||"URI can not be parsed.";return M}function Y($,P){var M=P.iri!==!1?f:d,B=[];return $.userinfo!==void 0&&(B.push($.userinfo),B.push("@")),$.host!==void 0&&B.push(Ae(Pe(String($.host),M),M).replace(M.IPV6ADDRESS,function(H,xe,we){return"["+xe+(we?"%25"+we:"")+"]"})),(typeof $.port=="number"||typeof $.port=="string")&&(B.push(":"),B.push(String($.port))),B.length?B.join(""):void 0}var ze=/^\.\.?\//,ee=/^\/\.(\/|$)/,Oe=/^\/\.\.(\/|$)/,Fe=/^\/?(?:.|\n)*?(?=\/|$)/;function ke($){for(var P=[];$.length;)if($.match(ze))$=$.replace(ze,"");else if($.match(ee))$=$.replace(ee,"/");else if($.match(Oe))$=$.replace(Oe,"/"),P.pop();else if($==="."||$==="..")$="";else{var M=$.match(Fe);if(M){var B=M[0];$=$.slice(B.length),P.push(B)}else throw new Error("Unexpected dot segment condition")}return P.join("")}function st($){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=P.iri?f:d,B=[],H=X[(P.scheme||$.scheme||"").toLowerCase()];if(H&&H.serialize&&H.serialize($,P),$.host&&!M.IPV6ADDRESS.test($.host)){if(P.domainHost||H&&H.domainHost)try{$.host=P.iri?ge.toUnicode($.host):ge.toASCII($.host.replace(M.PCT_ENCODED,he).toLowerCase())}catch(Qe){$.error=$.error||"Host's domain name can not be converted to "+(P.iri?"Unicode":"ASCII")+" via punycode: "+Qe}}ye($,M),P.reference!=="suffix"&&$.scheme&&(B.push($.scheme),B.push(":"));var xe=Y($,P);if(xe!==void 0&&(P.reference!=="suffix"&&B.push("//"),B.push(xe),$.path&&$.path.charAt(0)!=="/"&&B.push("/")),$.path!==void 0){var we=$.path;!P.absolutePath&&(!H||!H.absolutePath)&&(we=ke(we)),xe===void 0&&(we=we.replace(/^\/\//,"/%2F")),B.push(we)}return $.query!==void 0&&(B.push("?"),B.push($.query)),$.fragment!==void 0&&(B.push("#"),B.push($.fragment)),B.join("")}function vt($,P){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},B=arguments[3],H={};return B||($=ie(st($,M),M),P=ie(st(P,M),M)),M=M||{},!M.tolerant&&P.scheme?(H.scheme=P.scheme,H.userinfo=P.userinfo,H.host=P.host,H.port=P.port,H.path=ke(P.path||""),H.query=P.query):(P.userinfo!==void 0||P.host!==void 0||P.port!==void 0?(H.userinfo=P.userinfo,H.host=P.host,H.port=P.port,H.path=ke(P.path||""),H.query=P.query):(P.path?(P.path.charAt(0)==="/"?H.path=ke(P.path):(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path?H.path="/"+P.path:$.path?H.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+P.path:H.path=P.path,H.path=ke(H.path)),H.query=P.query):(H.path=$.path,P.query!==void 0?H.query=P.query:H.query=$.query),H.userinfo=$.userinfo,H.host=$.host,H.port=$.port),H.scheme=$.scheme),H.fragment=P.fragment,H}function Hr($,P,M){var B=c({scheme:"null"},M);return st(vt(ie($,B),ie(P,B),B,!0),B)}function zt($,P){return typeof $=="string"?$=st(ie($,P),P):a($)==="object"&&($=ie(st($,P),P)),$}function fs($,P,M){return typeof $=="string"?$=st(ie($,M),M):a($)==="object"&&($=st($,M)),typeof P=="string"?P=st(ie(P,M),M):a(P)==="object"&&(P=st(P,M)),$===P}function oo($,P){return $&&$.toString().replace(!P||!P.iri?d.ESCAPE:f.ESCAPE,ve)}function Yt($,P){return $&&$.toString().replace(!P||!P.iri?d.PCT_ENCODED:f.PCT_ENCODED,he)}var Br={scheme:"http",domainHost:!0,parse:function(P,M){return P.host||(P.error=P.error||"HTTP URIs must have a host."),P},serialize:function(P,M){var B=String(P.scheme).toLowerCase()==="https";return(P.port===(B?443:80)||P.port==="")&&(P.port=void 0),P.path||(P.path="/"),P}},hs={scheme:"https",domainHost:Br.domainHost,parse:Br.parse,serialize:Br.serialize};function Nr($){return typeof $.secure=="boolean"?$.secure:String($.scheme).toLowerCase()==="wss"}var Dn={scheme:"ws",domainHost:!0,parse:function(P,M){var B=P;return B.secure=Nr(B),B.resourceName=(B.path||"/")+(B.query?"?"+B.query:""),B.path=void 0,B.query=void 0,B},serialize:function(P,M){if((P.port===(Nr(P)?443:80)||P.port==="")&&(P.port=void 0),typeof P.secure=="boolean"&&(P.scheme=P.secure?"wss":"ws",P.secure=void 0),P.resourceName){var B=P.resourceName.split("?"),H=m(B,2),xe=H[0],we=H[1];P.path=xe&&xe!=="/"?xe:void 0,P.query=we,P.resourceName=void 0}return P.fragment=void 0,P}},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]",Pt=n(n("%[EFef]"+ne+"%"+ne+ne+"%"+ne+ne)+"|"+n("%[89A-Fa-f]"+ne+"%"+ne+ne)+"|"+n("%"+ne+ne)),$n="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Mn="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Yl=s(Mn,'[\\"\\\\]'),Jl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Xl=new RegExp(ms,"g"),re=new RegExp(Pt,"g"),Ee=new RegExp(s("[^]",$n,"[\\.]",'[\\"]',Yl),"g"),Ke=new RegExp(s("[^]",ms,Jl),"g"),Je=Ke;function Xe($){var P=he($);return P.match(Xl)?P:$}var vs={scheme:"mailto",parse:function(P,M){var B=P,H=B.to=B.path?B.path.split(","):[];if(B.path=void 0,B.query){for(var xe=!1,we={},Qe=B.query.split("&"),it=0,_t=Qe.length;it<_t;++it){var He=Qe[it].split("=");switch(He[0]){case"to":for(var at=He[1].split(","),Et=0,Ne=at.length;Et<Ne;++Et)H.push(at[Et]);break;case"subject":B.subject=Yt(He[1],M);break;case"body":B.body=Yt(He[1],M);break;default:xe=!0,we[Yt(He[0],M)]=Yt(He[1],M);break}}xe&&(B.headers=we)}B.query=void 0;for(var ft=0,kt=H.length;ft<kt;++ft){var ht=H[ft].split("@");if(ht[0]=Yt(ht[0]),M.unicodeSupport)ht[1]=Yt(ht[1],M).toLowerCase();else try{ht[1]=ge.toASCII(Yt(ht[1],M).toLowerCase())}catch(gs){B.error=B.error||"Email address's domain name can not be converted to ASCII via punycode: "+gs}H[ft]=ht.join("@")}return B},serialize:function(P,M){var B=P,H=i(P.to);if(H){for(var xe=0,we=H.length;xe<we;++xe){var Qe=String(H[xe]),it=Qe.lastIndexOf("@"),_t=Qe.slice(0,it).replace(re,Xe).replace(re,o).replace(Ee,ve),He=Qe.slice(it+1);try{He=M.iri?ge.toUnicode(He):ge.toASCII(Yt(He,M).toLowerCase())}catch(ft){B.error=B.error||"Email address's domain name can not be converted to "+(M.iri?"Unicode":"ASCII")+" via punycode: "+ft}H[xe]=_t+"@"+He}B.path=H.join(",")}var at=P.headers=P.headers||{};P.subject&&(at.subject=P.subject),P.body&&(at.body=P.body);var Et=[];for(var Ne in at)at[Ne]!==ya[Ne]&&Et.push(Ne.replace(re,Xe).replace(re,o).replace(Ke,ve)+"="+at[Ne].replace(re,Xe).replace(re,o).replace(Je,ve));return Et.length&&(B.query=Et.join("&")),B}},ef=/^([^\:]+)\:(.*)/,tf={scheme:"urn",parse:function(P,M){var B=P.path&&P.path.match(ef),H=P;if(B){var xe=M.scheme||H.scheme||"urn",we=B[1].toLowerCase(),Qe=B[2],it=xe+":"+(M.nid||we),_t=X[it];H.nid=we,H.nss=Qe,H.path=void 0,_t&&(H=_t.parse(H,M))}else H.error=H.error||"URN can not be parsed.";return H},serialize:function(P,M){var B=M.scheme||P.scheme||"urn",H=P.nid,xe=B+":"+(M.nid||H),we=X[xe];we&&(P=we.serialize(P,M));var Qe=P,it=P.nss;return Qe.path=(H||M.nid)+":"+it,Qe}},rf=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,hg={scheme:"urn:uuid",parse:function(P,M){var B=P;return B.uuid=B.nss,B.nss=void 0,!M.tolerant&&(!B.uuid||!B.uuid.match(rf))&&(B.error=B.error||"UUID is not valid."),B},serialize:function(P,M){var B=P;return B.nss=(P.uuid||"").toLowerCase(),B}};X[Br.scheme]=Br,X[hs.scheme]=hs,X[Dn.scheme]=Dn,X[ps.scheme]=ps,X[vs.scheme]=vs,X[tf.scheme]=tf,X[hg.scheme]=hg,r.SCHEMES=X,r.pctEncChar=ve,r.pctDecChars=he,r.parse=ie,r.removeDotSegments=ke,r.serialize=st,r.resolveComponents=vt,r.resolve=Hr,r.normalize=zt,r.equal=fs,r.escapeComponent=oo,r.unescapeComponent=Yt,Object.defineProperty(r,"__esModule",{value:!0})})})(om,om.exports);var T4=om.exports,sg=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},A4=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},Ni={copy:O4,checkDataType:im,checkDataTypes:I4,coerceToTypes:D4,toHash:ag,getProperty:og,escapeQuotes:ig,equal:sg,ucs2length:A4,varOccurences:F4,varReplace:L4,schemaHasRules:U4,schemaHasRulesExcept:z4,schemaUnknownRules:V4,toQuotedString:lm,getPathExpr:q4,getPath:H4,getData:W4,unescapeFragment:Q4,unescapeJsonPointer:cg,escapeFragment:G4,escapeJsonPointer:lg};function O4(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function im(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 I4(t,e,r){switch(t.length){case 1:return im(t[0],e,r,!0);default:var s="",n=ag(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?" && ":"")+im(a,e,r,!0);return s}}var F0=ag(["string","number","integer","boolean","null"]);function D4(t,e){if(Array.isArray(e)){for(var r=[],s=0;s<e.length;s++){var n=e[s];(F0[n]||t==="array"&&n==="array")&&(r[r.length]=n)}if(r.length)return r}else{if(F0[e])return[e];if(t==="array"&&e==="array")return["array"]}}function ag(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var $4=/^[a-z$_][a-z$_0-9]*$/i,M4=/'|\\/g;function og(t){return typeof t=="number"?"["+t+"]":$4.test(t)?"."+t:"['"+ig(t)+"']"}function ig(t){return t.replace(M4,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function F4(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function L4(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function U4(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 V4(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function lm(t){return"'"+ig(t)+"'"}function q4(t,e,r,s){var n=r?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return UE(t,n)}function H4(t,e,r){var s=lm(r?"/"+lg(e):og(e));return UE(t,s)}var B4=/^\/(?:[^~]|~0|~1)*$/,K4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function W4(t,e,r){var s,n,a,o;if(t==="")return"rootData";if(t[0]=="/"){if(!B4.test(t))throw new Error("Invalid JSON-pointer: "+t);n=t,a="rootData"}else{if(o=t.match(K4),!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+=og(cg(d)),i+=" && "+a)}return i}function UE(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Q4(t){return cg(decodeURIComponent(t))}function G4(t){return encodeURIComponent(lg(t))}function lg(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function cg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var Z4=Ni,zE=Y4;function Y4(t){Z4.copy(t,this)}var VE={exports:{}},Hs=VE.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 f=s[d];if(Array.isArray(f)){if(d in Hs.arrayKeywords)for(var m=0;m<f.length;m++)nu(t,e,r,f[m],n+"/"+d+"/"+m,a,n,d,s,m)}else if(d in Hs.propsKeywords){if(f&&typeof f=="object")for(var h in f)nu(t,e,r,f[h],n+"/"+d+"/"+J4(h),a,n,d,s,h)}else(d in Hs.keywords||t.allKeys&&!(d in Hs.skipKeywords))&&nu(t,e,r,f,n+"/"+d,a,n,d,s)}r(s,n,a,o,i,c,u)}}function J4(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var X4=VE.exports,Zl=T4,L0=sg,Gd=Ni,rd=zE,e$=X4,ug=ga;ga.normalizeId=ra;ga.fullPath=nd;ga.url=sd;ga.ids=a$;ga.inlineRef=cm;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 cm(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=cm(a,this._opts.inlineRefs)?a:t.call(this,a,e,void 0,i)),o}function Zd(t,e){var r=Zl.parse(e),s=HE(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 t$.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 qE.call(this,r,n,t.schema,t)}function t$(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)),qE.call(this,r,a,n,t)}}var r$=Gd.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function qE(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(!r$[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 n$=Gd.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function cm(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return um(t);if(e)return dm(t)<=e}function um(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!um(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!um(e)))return!1;return!0}function dm(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+=dm(r)),e==1/0)return 1/0}else for(var n in t){if(n=="$ref")return 1/0;if(n$[n])e++;else if(r=t[n],typeof r=="object"&&(e+=dm(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 HE(r)}function HE(t){return Zl.serialize(t).split("#")[0]+"#"}var s$=/#\/?$/;function ra(t){return t?t.replace(s$,""):""}function sd(t,e){return e=ra(e),Zl.resolve(t,e)}function a$(t){var e=ra(this._getId(t)),r={"":e},s={"":nd(e,!1)},n={},a=this;return e$(t,{allKeys:!0},function(o,i,c,u,d,f,m){if(i!==""){var h=a._getId(o),w=r[u],p=s[u]+"/"+d;if(m!==void 0&&(p+="/"+(typeof m=="number"?m:Gd.escapeFragment(m))),typeof h=="string"){h=w=ra(w?Zl.resolve(w,h):h);var g=a._refs[h];if(typeof g=="string"&&(g=a._refs[g]),g&&g.schema){if(!L0(o,g.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=ra(p))if(h[0]=="#"){if(n[h]&&!L0(o,n[h]))throw new Error('id "'+h+'" resolves to more than one schema');n[h]=o}else a._refs[h]=p}r[i]=w,s[i]=p}}),n}var Xf=ug,dg={Validation:U0(o$),MissingRef:U0(fg)};function o$(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}fg.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function fg(t,e,r){this.message=r||fg.message(t,e),this.missingRef=Xf.url(t,e),this.missingSchema=Xf.normalizeId(Xf.fullPath(this.missingRef))}function U0(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var BE=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 f=d[i],m=a(o[f]);m&&(c&&(c+=","),c+=JSON.stringify(f)+":"+m)}return n.splice(u,1),"{"+c+"}"}}(t)},KE=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,f=e.dataLevel,m=e.schema[r],h=e.schemaPath+e.util.getProperty(r),w=e.errSchemaPath+"/"+r,E=!e.opts.allErrors,T,p="data"+(f||""),S="valid"+d;if(e.schema===!1){e.isTop?E=!0:n+=" var "+S+" = false; ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(T||"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=g.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 v=e.isTop,d=e.level=0,f=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,f=e.dataLevel,p="data"+(f||"");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,k="",N="",T,D=e.schema.type,U=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(U?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],U=!0)),U&&D.length==1&&(D=D[0],U=!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")),D){if(e.opts.coerceTypes)var R=e.util.coerceToTypes(e.opts.coerceTypes,D);var A=e.RULES.types[D];if(R||U||A===!0||A&&!ee(A)){var h=e.schemaPath+".type",w=e.errSchemaPath+"/type",h=e.schemaPath+".type",w=e.errSchemaPath+"/type",_=U?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[_](D,p,e.opts.strictNumbers,!0)+") { ",R){var O="dataType"+d,z="coerced"+d;n+=" var "+O+" = typeof "+p+"; var "+z+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+O+" == 'object' && Array.isArray("+p+") && "+p+".length == 1) { "+p+" = "+p+"[0]; "+O+" = typeof "+p+"; if ("+e.util.checkDataType(e.schema.type,p,e.opts.strictNumbers)+") "+z+" = "+p+"; } "),n+=" if ("+z+" !== undefined) ; ";var j=R;if(j)for(var K,C=-1,F=j.length-1;C<F;)K=j[C+=1],K=="string"?n+=" else if ("+O+" == 'number' || "+O+" == 'boolean') "+z+" = '' + "+p+"; else if ("+p+" === null) "+z+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+O+" == 'boolean' || "+p+" === null || ("+O+" == '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 ("+O+" == 'string' || "+O+" == 'number' || "+O+" == 'boolean' || "+p+" == null) "+z+" = ["+p+"]; ");n+=" else { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(T||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",U?n+=""+D.join(","):n+=""+D,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",U?n+=""+D.join(","):n+=""+D,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=g.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=f?"data"+(f-1||""):"parentData",Q=f?e.dataPathArr[f]:"parentDataProperty";n+=" "+p+" = "+z+"; ",f||(n+="if ("+L+" !== undefined)"),n+=" "+L+"["+Q+"] = "+z+"; } "}else{var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(T||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",U?n+=""+D.join(","):n+=""+D,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",U?n+=""+D.join(","):n+=""+D,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=g.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 === ",v?n+="0":n+="errs_"+d,n+=") { ",N+="}");else{var te=e.RULES;if(te){for(var A,V=-1,de=te.length-1;V<de;)if(A=te[V+=1],ee(A)){if(A.type&&(n+=" if ("+e.util.checkDataType(A.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(A.type=="object"&&e.schema.properties){var m=e.schema.properties,Te=Object.keys(m),ge=Te;if(ge)for(var X,ve=-1,he=ge.length-1;ve<he;){X=ge[ve+=1];var ye=m[X];if(ye.default!==void 0){var ue=p+e.util.getProperty(X);if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+ue;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else n+=" if ("+ue+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+ue+" === null || "+ue+" === '' "),n+=" ) "+ue+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(ye.default)+" ":n+=" "+JSON.stringify(ye.default)+" ",n+="; "}}}else if(A.type=="array"&&Array.isArray(e.schema.items)){var Pe=e.schema.items;if(Pe){for(var ye,C=-1,Ae=Pe.length-1;C<Ae;)if(ye=Pe[C+=1],ye.default!==void 0){var ue=p+"["+C+"]";if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+ue;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else n+=" if ("+ue+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+ue+" === null || "+ue+" === '' "),n+=" ) "+ue+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(ye.default)+" ":n+=" "+JSON.stringify(ye.default)+" ",n+="; "}}}}var De=A.rules;if(De){for(var J,ie=-1,Y=De.length-1;ie<Y;)if(J=De[ie+=1],Oe(J)){var ze=J.code(e,J.keyword,A.type);ze&&(n+=" "+ze+" ",E&&(k+="}"))}}if(E&&(n+=" "+k+" ",k=""),A.type&&(n+=" } ",D&&D===A.type&&!R)){n+=" else { ";var h=e.schemaPath+".type",w=e.errSchemaPath+"/type",g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(T||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",U?n+=""+D.join(","):n+=""+D,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",U?n+=""+D.join(","):n+=""+D,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=g.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 === ",v?n+="0":n+="errs_"+d,n+=") { ",N+="}")}}}E&&(n+=" "+N+" "),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 ee(ke){for(var st=ke.rules,vt=0;vt<st.length;vt++)if(Oe(st[vt]))return!0}function Oe(ke){return e.schema[ke.keyword]!==void 0||ke.implements&&Fe(ke)}function Fe(ke){for(var st=ke.implements,vt=0;vt<st.length;vt++)if(e.schema[st[vt]]!==void 0)return!0}return n},Tc=ug,ad=Ni,WE=dg,i$=BE,z0=KE,l$=ad.ucs2length,c$=sg,u$=WE.Validation,d$=fm;function fm(t,e,r,s){var n=this,a=this._opts,o=[void 0],i={},c=[],u={},d=[],f={},m=[];e=e||{schema:t,refVal:o,refs:i};var h=f$.call(this,t,e,s),w=this._compilations[h.index];if(h.compiling)return w.callValidate=b;var p=this._formats,g=this.RULES;try{var y=S(t,e,r,s);w.validate=y;var v=w.callValidate;return v&&(v.schema=y.schema,v.errors=null,v.refs=y.refs,v.refVal=y.refVal,v.root=y.root,v.$async=y.$async,a.sourceCode&&(v.source=y.source)),y}finally{h$.call(this,t,e,s)}function b(){var _=w.validate,O=_.apply(this,arguments);return b.errors=_.errors,O}function S(_,O,z,j){var K=!O||O&&O.schema==_;if(O.schema!=e.schema)return fm.call(n,_,O,z,j);var C=_.$async===!0,F=z0({isTop:!0,schema:_,isRoot:K,baseId:j,root:O,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:WE.MissingRef,RULES:g,validate:z0,util:ad,resolve:Tc,resolveRef:E,usePattern:U,useDefault:R,useCustomRule:A,opts:a,formats:p,logger:n.logger,self:n});F=Ac(o,v$)+Ac(c,p$)+Ac(d,m$)+Ac(m,g$)+F,a.processCode&&(F=a.processCode(F,_));var L;try{var Q=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",F);L=Q(n,g,p,e,o,d,m,c$,l$,u$),o[0]=L}catch(te){throw n.logger.error("Error compiling schema, function code:",F),te}return L.schema=_,L.errors=null,L.refs=i,L.refVal=o,L.root=K?L:O,C&&(L.$async=!0),a.sourceCode===!0&&(L.source={code:F,patterns:c,defaults:d}),L}function E(_,O,z){O=Tc.url(_,O);var j=i[O],K,C;if(j!==void 0)return K=o[j],C="refVal["+j+"]",D(K,C);if(!z&&e.refs){var F=e.refs[O];if(F!==void 0)return K=e.refVal[F],C=k(O,K),D(K,C)}C=k(O);var L=Tc.call(n,S,e,O);if(L===void 0){var Q=r&&r[O];Q&&(L=Tc.inlineRef(Q,a.inlineRefs)?Q:fm.call(n,Q,e,r,_))}if(L===void 0)N(O);else return T(O,L),D(L,C)}function k(_,O){var z=o.length;return o[z]=O,i[_]=z,"refVal"+z}function N(_){delete i[_]}function T(_,O){var z=i[_];o[z]=O}function D(_,O){return typeof _=="object"||typeof _=="boolean"?{code:O,schema:_,inline:!0}:{code:O,$async:_&&!!_.$async}}function U(_){var O=u[_];return O===void 0&&(O=u[_]=c.length,c[O]=_),"pattern"+O}function R(_){switch(typeof _){case"boolean":case"number":return""+_;case"string":return ad.toQuotedString(_);case"object":if(_===null)return"null";var O=i$(_),z=f[O];return z===void 0&&(z=f[O]=d.length,d[z]=_),"default"+z}}function A(_,O,z,j){if(n._opts.validateSchema!==!1){var K=_.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 C=_.definition.validateSchema;if(C){var F=C(O);if(!F){var L="keyword schema is invalid: "+n.errorsText(C.errors);if(n._opts.validateSchema=="log")n.logger.error(L);else throw new Error(L)}}}var Q=_.definition.compile,te=_.definition.inline,V=_.definition.macro,de;if(Q)de=Q.call(n,O,z,j);else if(V)de=V.call(n,O,z,j),a.validateSchema!==!1&&n.validateSchema(de,!0);else if(te)de=te.call(n,j,_.keyword,O,z);else if(de=_.definition.validate,!de)return;if(de===void 0)throw new Error('custom keyword "'+_.keyword+'"failed to compile');var Te=m.length;return m[Te]=de,{code:"customRule"+Te,validate:de}}}function f$(t,e,r){var s=QE.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 h$(t,e,r){var s=QE.call(this,t,e,r);s>=0&&this._compilations.splice(s,1)}function QE(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 p$(t,e){return"var pattern"+t+" = new RegExp("+ad.toQuotedString(e[t])+");"}function m$(t){return"var default"+t+" = defaults["+t+"];"}function v$(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function g$(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 GE={exports:{}},Yd=GE.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 y$=GE.exports,x$=Ni,w$=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,b$=[0,31,28,31,30,31,30,31,31,30,31,30,31],S$=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,ZE=/^(?=.{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,_$=/^(?:[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,E$=/^(?:[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,YE=/^(?:(?:[^\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,JE=/^(?:(?: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,XE=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,eC=/^(?:\/(?:[^~/]|~0|~1)*)*$/,tC=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,rC=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,C$=Jd;function Jd(t){return t=t=="full"?"full":"fast",x$.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":YE,url:JE,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:ZE,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:aC,uuid:XE,"json-pointer":eC,"json-pointer-uri-fragment":tC,"relative-json-pointer":rC};Jd.full={date:nC,time:sC,"date-time":N$,uri:R$,"uri-reference":E$,"uri-template":YE,url:JE,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:ZE,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:aC,uuid:XE,"json-pointer":eC,"json-pointer-uri-fragment":tC,"relative-json-pointer":rC};function P$(t){return t%4===0&&(t%100!==0||t%400===0)}function nC(t){var e=t.match(w$);if(!e)return!1;var r=+e[1],s=+e[2],n=+e[3];return s>=1&&s<=12&&n>=1&&n<=(s==2&&P$(r)?29:b$[s])}function sC(t,e){var r=t.match(S$);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 k$=/t|\s/i;function N$(t){var e=t.split(k$);return e.length==2&&nC(e[0])&&sC(e[1],!0)}var j$=/\/|:/;function R$(t){return j$.test(t)&&_$.test(t)}var T$=/[^\\]\\Z/;function aC(t){if(T$.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var A$=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||""),f="valid"+a,m,h;if(i=="#"||i=="#/")e.isRoot?(m=e.async,h="validate"):(m=e.root.schema.$async===!0,h="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 g=g||[];g.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=g.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 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,h=w.code}if(h){var g=g||[];g.push(n),n="",e.opts.passContext?n+=" "+h+".call(this, ":n+=" "+h+"( ",n+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var E=o?"data"+(o-1||""):"parentData",k=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+E+" , "+k+", rootData) ";var N=n;if(n=g.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+f+"; "),n+=" try { await "+N+"; ",u&&(n+=" "+f+" = 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+=" "+f+" = false; "),n+=" } ",u&&(n+=" if ("+f+") { ")}else n+=" if (!"+N+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n},O$=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 f="valid"+u.level,m=u.baseId,h=!0,w=a;if(w)for(var p,g=-1,y=w.length-1;g<y;)p=w[g+=1],(e.opts.strictKeywords?typeof p=="object"&&Object.keys(p).length>0||p===!1:e.util.schemaHasRules(p,e.RULES.all))&&(h=!1,u.schema=p,u.schemaPath=o+"["+g+"]",u.errSchemaPath=i+"/"+g,n+=" "+e.validate(u)+" ",u.baseId=m,c&&(n+=" if ("+f+") { ",d+="}"));return c&&(h?n+=" if (true) { ":n+=" "+d.slice(0,-1)+" "),n},I$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e),p="";w.level++;var g="valid"+w.level,y=i.every(function(T){return e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all)});if(y){var v=w.baseId;n+=" var "+h+" = errors; var "+m+" = false; ";var b=e.compositeRule;e.compositeRule=w.compositeRule=!0;var S=i;if(S)for(var E,k=-1,N=S.length-1;k<N;)E=S[k+=1],w.schema=E,w.schemaPath=c+"["+k+"]",w.errSchemaPath=u+"/"+k,n+=" "+e.validate(w)+" ",w.baseId=v,n+=" "+m+" = "+m+" || "+g+"; 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: "+f+" "),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 = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else d&&(n+=" if (true) { ");return n},D$=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},$$=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,f="data"+(o||""),m="valid"+a,h=e.opts.$data&&i&&i.$data;h&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; "),h||(n+=" var schema"+a+" = validate.schema"+c+";"),n+="var "+m+" = equal("+f+", 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: "+f+" "),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},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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e),p="";w.level++;var g="valid"+w.level,y="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 "+h+" = errors;var "+m+";",E){var k=e.compositeRule;e.compositeRule=w.compositeRule=!0,w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" var "+g+" = false; for (var "+y+" = 0; "+y+" < "+f+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var N=f+"["+y+"]";w.dataPathArr[v]=y;var T=e.validate(w);w.baseId=S,e.util.varOccurences(T,b)<2?n+=" "+e.util.varReplace(T,b,N)+" ":n+=" var "+b+" = "+N+"; "+T+" ",n+=" if ("+g+") break; } ",e.compositeRule=w.compositeRule=k,n+=" "+p+" if (!"+g+") {"}else n+=" if ("+f+".length == 0) {";var D=D||[];D.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: "+f+" "),n+=" } "):n+=" {} ";var U=n;return n=D.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++; ",n+=" } else { ",E&&(n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n},F$=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,f="data"+(o||""),m="errs__"+a,h=e.util.copy(e),w="";h.level++;var p="valid"+h.level,g={},y={},v=e.opts.ownProperties;for(k in i)if(k!="__proto__"){var b=i[k],S=Array.isArray(b)?y:g;S[k]=b}n+="var "+m+" = errors;";var E=e.errorPath;n+="var missing"+a+";";for(var k in y)if(S=y[k],S.length){if(n+=" if ( "+f+e.util.getProperty(k)+" !== undefined ",v&&(n+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(k)+"') "),d){n+=" && ( ";var N=S;if(N)for(var T,D=-1,U=N.length-1;D<U;){T=N[D+=1],D&&(n+=" || ");var R=e.util.getProperty(T),A=f+R;n+=" ( ( "+A+" === undefined ",v&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(T)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?T:R)+") ) "}n+=")) { ";var _="missing"+a,O="' + "+_+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,_,!0):E+" + "+_);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(k)+"', missingProperty: '"+O+"', 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(k)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var j=n;n=z.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=S;if(K)for(var T,C=-1,F=K.length-1;C<F;){T=K[C+=1];var R=e.util.getProperty(T),O=e.util.escapeQuotes(T),A=f+R;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,T,e.opts.jsonPointers)),n+=" if ( "+A+" === undefined ",v&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(T)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(k)+"', missingProperty: '"+O+"', 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(k)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",d&&(w+="}",n+=" else { ")}e.errorPath=E;var L=h.baseId;for(var k in g){var b=g[k];(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(n+=" "+p+" = true; if ( "+f+e.util.getProperty(k)+" !== undefined ",v&&(n+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(k)+"') "),n+=") { ",h.schema=b,h.schemaPath=c+e.util.getProperty(k),h.errSchemaPath=u+"/"+e.util.escapeFragment(k),n+=" "+e.validate(h)+" ",h.baseId=L,n+=" } ",d&&(n+=" if ("+p+") { ",w+="}"))}return d&&(n+=" "+w+" if ("+m+" == errors) {"),n},L$=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,f="data"+(o||""),m="valid"+a,h=e.opts.$data&&i&&i.$data;h&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var w="i"+a,p="schema"+a;h||(n+=" var "+p+" = validate.schema"+c+";"),n+="var "+m+";",h&&(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("+f+", "+p+"["+w+"])) { "+m+" = true; break; }",h&&(n+=" } "),n+=" if (!"+m+") { ";var g=g||[];g.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: "+f+" "),n+=" } "):n+=" {} ";var y=n;return n=g.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},U$=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,f="data"+(o||"");if(e.opts.format===!1)return d&&(n+=" if (true) { "),n;var m=e.opts.$data&&i&&i.$data,h;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i;var w=e.opts.unknownFormats,p=Array.isArray(w);if(m){var g="format"+a,y="isObject"+a,v="formatType"+a;n+=" var "+g+" = formats["+h+"]; var "+y+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+v+" = "+y+" && "+g+".type || 'string'; if ("+y+") { ",e.async&&(n+=" var async"+a+" = "+g+".async; "),n+=" "+g+" = "+g+".validate; } if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" (",w!="ignore"&&(n+=" ("+h+" && !"+g+" ",p&&(n+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),n+=") || "),n+=" ("+g+" && "+v+" == '"+s+"' && !(typeof "+g+" == 'function' ? ",e.async?n+=" (async"+a+" ? await "+g+"("+f+") : "+g+"("+f+")) ":n+=" "+g+"("+f+") ",n+=" : "+g+".test("+f+"))))) {"}else{var g=e.formats[i];if(!g){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 g=="object"&&!(g instanceof RegExp)&&g.validate,v=y&&g.type||"string";if(y){var b=g.async===!0;g=g.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+"("+f+"))) { "}else{n+=" if (! ";var S="formats"+e.util.getProperty(i);y&&(S+=".validate"),typeof g=="function"?n+=" "+S+"("+f+") ":n+=" "+S+".test("+f+") ",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+=""+h:n+=""+e.util.toQuotedString(i),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+h+" + '":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: "+f+" "),n+=" } "):n+=" {} ";var k=n;return n=E.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+k+"]); ":n+=" validate.errors = ["+k+"]; return false; ":n+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n},z$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e);w.level++;var p="valid"+w.level,g=e.schema.then,y=e.schema.else,v=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,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(v||b){var E;w.createErrors=!1,w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" var "+h+" = errors; var "+m+" = true; ";var k=e.compositeRule;e.compositeRule=w.compositeRule=!0,n+=" "+e.validate(w)+" ",w.baseId=S,w.createErrors=!0,n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=w.compositeRule=k,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: "+f+" "),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},V$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e),p="";w.level++;var g="valid"+w.level,y="i"+a,v=w.dataLevel=e.dataLevel+1,b="data"+v,S=e.baseId;if(n+="var "+h+" = errors;var "+m+";",Array.isArray(i)){var E=e.schema.additionalItems;if(E===!1){n+=" "+m+" = "+f+".length <= "+i.length+"; ";var k=u;u=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var N=N||[];N.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: "+f+" "),n+=" } "):n+=" {} ";var T=n;n=N.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u=k,d&&(p+="}",n+=" else { ")}var D=i;if(D){for(var U,R=-1,A=D.length-1;R<A;)if(U=D[R+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){n+=" "+g+" = true; if ("+f+".length > "+R+") { ";var _=f+"["+R+"]";w.schema=U,w.schemaPath=c+"["+R+"]",w.errSchemaPath=u+"/"+R,w.errorPath=e.util.getPathExpr(e.errorPath,R,e.opts.jsonPointers,!0),w.dataPathArr[v]=R;var O=e.validate(w);w.baseId=S,e.util.varOccurences(O,b)<2?n+=" "+e.util.varReplace(O,b,_)+" ":n+=" var "+b+" = "+_+"; "+O+" ",n+=" } ",d&&(n+=" if ("+g+") { ",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+=" "+g+" = true; if ("+f+".length > "+i.length+") { for (var "+y+" = "+i.length+"; "+y+" < "+f+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var _=f+"["+y+"]";w.dataPathArr[v]=y;var O=e.validate(w);w.baseId=S,e.util.varOccurences(O,b)<2?n+=" "+e.util.varReplace(O,b,_)+" ":n+=" var "+b+" = "+_+"; "+O+" ",d&&(n+=" if (!"+g+") break; "),n+=" } } ",d&&(n+=" if ("+g+") { ",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+" < "+f+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var _=f+"["+y+"]";w.dataPathArr[v]=y;var O=e.validate(w);w.baseId=S,e.util.varOccurences(O,b)<2?n+=" "+e.util.varReplace(O,b,_)+" ":n+=" var "+b+" = "+_+"; "+O+" ",d&&(n+=" if (!"+g+") break; "),n+=" }"}return d&&(n+=" "+p+" if ("+h+" == errors) {"),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,S,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i;var w=r=="maximum",p=w?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[p],y=e.opts.$data&&g&&g.$data,v=w?"<":">",b=w?">":"<",S=void 0;if(!(m||typeof i=="number"||i===void 0))throw new Error(r+" must be number");if(!(y||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(p+" must be number or boolean");if(y){var E=e.util.getData(g.$data,o,e.dataPathArr),k="exclusive"+a,N="exclType"+a,T="exclIsNumber"+a,D="op"+a,U="' + "+D+" + '";n+=" var schemaExcl"+a+" = "+E+"; ",E="schemaExcl"+a,n+=" var "+k+"; var "+N+" = typeof "+E+"; if ("+N+" != 'boolean' && "+N+" != 'undefined' && "+N+" != 'number') { ";var S=p,R=R||[];R.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: "+f+" "),n+=" } "):n+=" {} ";var A=n;n=R.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+N+" == 'number' ? ( ("+k+" = "+h+" === undefined || "+E+" "+v+"= "+h+") ? "+f+" "+b+"= "+E+" : "+f+" "+b+" "+h+" ) : ( ("+k+" = "+E+" === true) ? "+f+" "+b+"= "+h+" : "+f+" "+b+" "+h+" ) || "+f+" !== "+f+") { var op"+a+" = "+k+" ? '"+v+"' : '"+v+"='; ",i===void 0&&(S=p,u=e.errSchemaPath+"/"+p,h=E,m=y)}else{var T=typeof g=="number",U=v;if(T&&m){var D="'"+U+"'";n+=" if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" ( "+h+" === undefined || "+g+" "+v+"= "+h+" ? "+f+" "+b+"= "+g+" : "+f+" "+b+" "+h+" ) || "+f+" !== "+f+") { "}else{T&&i===void 0?(k=!0,S=p,u=e.errSchemaPath+"/"+p,h=g,b+="="):(T&&(h=Math[w?"min":"max"](g,i)),g===(T?h:!0)?(k=!0,S=p,u=e.errSchemaPath+"/"+p,b+="="):(k=!1,U+="="));var D="'"+U+"'";n+=" if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+f+" "+b+" "+h+" || "+f+" !== "+f+") { "}}S=S||r;var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(S||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+D+", limit: "+h+", exclusive: "+k+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+U+" ",m?n+="' + "+h:n+=""+h+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var A=n;return n=R.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; 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,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+f+".length "+w+" "+h+") { ";var p=r,g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",r=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+h+" + '":n+=""+i,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var y=n;return n=g.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},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,p,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),e.opts.unicode===!1?n+=" "+f+".length ":n+=" ucs2length("+f+") ",n+=" "+w+" "+h+") { ";var p=r,g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",r=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+h+" + '":n+=""+i,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var y=n;return n=g.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},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,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" Object.keys("+f+").length "+w+" "+h+") { ";var p=r,g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",r=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+h+" + '":n+=""+i,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var y=n;return n=g.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},q$=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,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i,!(m||typeof i=="number"))throw new Error(r+" must be number");n+="var division"+a+";if (",m&&(n+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),n+=" (division"+a+" = "+f+" / "+h+", ",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: "+h+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+h:n+=""+h+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),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},H$=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,f="data"+(o||""),m="errs__"+a,h=e.util.copy(e);h.level++;var w="valid"+h.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){h.schema=i,h.schemaPath=c,h.errSchemaPath=u,n+=" var "+m+" = errors; ";var p=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1;var g;h.opts.allErrors&&(g=h.opts.allErrors,h.opts.allErrors=!1),n+=" "+e.validate(h)+" ",h.createErrors=!0,g&&(h.opts.allErrors=g),e.compositeRule=h.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: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.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: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(n+=" if (false) { ");return n},B$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e),p="";w.level++;var g="valid"+w.level,y=w.baseId,v="prevValid"+a,b="passingSchemas"+a;n+="var "+h+" = errors , "+v+" = false , "+m+" = false , "+b+" = null; ";var S=e.compositeRule;e.compositeRule=w.compositeRule=!0;var E=i;if(E)for(var k,N=-1,T=E.length-1;N<T;)k=E[N+=1],(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))?(w.schema=k,w.schemaPath=c+"["+N+"]",w.errSchemaPath=u+"/"+N,n+=" "+e.validate(w)+" ",w.baseId=y):n+=" var "+g+" = true; ",N&&(n+=" if ("+g+" && "+v+") { "+m+" = false; "+b+" = ["+b+", "+N+"]; } else { ",p+="}"),n+=" if ("+g+") { "+m+" = "+v+" = true; "+b+" = "+N+"; }";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: "+f+" "),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 = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n},K$=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,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i;var w=m?"(new RegExp("+h+"))":e.usePattern(i);n+="if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" !"+w+".test("+f+") ) { ";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+=""+h:n+=""+e.util.toQuotedString(i),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+h+" + '":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: "+f+" "),n+=" } "):n+=" {} ";var g=n;return n=p.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},W$=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,f="data"+(o||""),m="errs__"+a,h=e.util.copy(e),w="";h.level++;var p="valid"+h.level,g="key"+a,y="idx"+a,v=h.dataLevel=e.dataLevel+1,b="data"+v,S="dataProperties"+a,E=Object.keys(i||{}).filter(C),k=e.schema.patternProperties||{},N=Object.keys(k).filter(C),T=e.schema.additionalProperties,D=E.length||N.length,U=T===!1,R=typeof T=="object"&&Object.keys(T).length,A=e.opts.removeAdditional,_=U||R||A,O=e.opts.ownProperties,z=e.baseId,j=e.schema.required;if(j&&!(e.opts.$data&&j.$data)&&j.length<e.opts.loopRequired)var K=e.util.toHash(j);function C(fs){return fs!=="__proto__"}if(n+="var "+m+" = errors;var "+p+" = true;",O&&(n+=" var "+S+" = undefined;"),_){if(O?n+=" "+S+" = "+S+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+S+".length; "+y+"++) { var "+g+" = "+S+"["+y+"]; ":n+=" for (var "+g+" in "+f+") { ",D){if(n+=" var isAdditional"+a+" = !(false ",E.length)if(E.length>8)n+=" || validate.schema"+c+".hasOwnProperty("+g+") ";else{var F=E;if(F)for(var L,Q=-1,te=F.length-1;Q<te;)L=F[Q+=1],n+=" || "+g+" == "+e.util.toQuotedString(L)+" "}if(N.length){var V=N;if(V)for(var de,Te=-1,ge=V.length-1;Te<ge;)de=V[Te+=1],n+=" || "+e.usePattern(de)+".test("+g+") "}n+=" ); if (isAdditional"+a+") { "}if(A=="all")n+=" delete "+f+"["+g+"]; ";else{var X=e.errorPath,ve="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),U)if(A)n+=" delete "+f+"["+g+"]; ";else{n+=" "+p+" = false; ";var he=u;u=e.errSchemaPath+"/additionalProperties";var ye=ye||[];ye.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+ve+"' } ",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: "+f+" "),n+=" } "):n+=" {} ";var ue=n;n=ye.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+ue+"]); ":n+=" validate.errors = ["+ue+"]; return false; ":n+=" var err = "+ue+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=he,d&&(n+=" break; ")}else if(R)if(A=="failing"){n+=" var "+m+" = errors; ";var Pe=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=T,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[v]=g;var De=e.validate(h);h.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Ae)+" ":n+=" var "+b+" = "+Ae+"; "+De+" ",n+=" if (!"+p+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+g+"]; } ",e.compositeRule=h.compositeRule=Pe}else{h.schema=T,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[v]=g;var De=e.validate(h);h.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Ae)+" ":n+=" var "+b+" = "+Ae+"; "+De+" ",d&&(n+=" if (!"+p+") break; ")}e.errorPath=X}D&&(n+=" } "),n+=" } ",d&&(n+=" if ("+p+") { ",w+="}")}var J=e.opts.useDefaults&&!e.compositeRule;if(E.length){var ie=E;if(ie)for(var L,Y=-1,ze=ie.length-1;Y<ze;){L=ie[Y+=1];var ee=i[L];if(e.opts.strictKeywords?typeof ee=="object"&&Object.keys(ee).length>0||ee===!1:e.util.schemaHasRules(ee,e.RULES.all)){var Oe=e.util.getProperty(L),Ae=f+Oe,Fe=J&&ee.default!==void 0;h.schema=ee,h.schemaPath=c+Oe,h.errSchemaPath=u+"/"+e.util.escapeFragment(L),h.errorPath=e.util.getPath(e.errorPath,L,e.opts.jsonPointers),h.dataPathArr[v]=e.util.toQuotedString(L);var De=e.validate(h);if(h.baseId=z,e.util.varOccurences(De,b)<2){De=e.util.varReplace(De,b,Ae);var ke=Ae}else{var ke=b;n+=" var "+b+" = "+Ae+"; "}if(Fe)n+=" "+De+" ";else{if(K&&K[L]){n+=" if ( "+ke+" === undefined ",O&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),n+=") { "+p+" = false; ";var X=e.errorPath,he=u,st=e.util.escapeQuotes(L);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(X,L,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var ye=ye||[];ye.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+st+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+st+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var ue=n;n=ye.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+ue+"]); ":n+=" validate.errors = ["+ue+"]; return false; ":n+=" var err = "+ue+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=he,e.errorPath=X,n+=" } else { "}else d?(n+=" if ( "+ke+" === undefined ",O&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),n+=") { "+p+" = true; } else { "):(n+=" if ("+ke+" !== undefined ",O&&(n+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),n+=" ) { ");n+=" "+De+" } "}}d&&(n+=" if ("+p+") { ",w+="}")}}if(N.length){var vt=N;if(vt)for(var de,Hr=-1,zt=vt.length-1;Hr<zt;){de=vt[Hr+=1];var ee=k[de];if(e.opts.strictKeywords?typeof ee=="object"&&Object.keys(ee).length>0||ee===!1:e.util.schemaHasRules(ee,e.RULES.all)){h.schema=ee,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(de),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(de),O?n+=" "+S+" = "+S+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+S+".length; "+y+"++) { var "+g+" = "+S+"["+y+"]; ":n+=" for (var "+g+" in "+f+") { ",n+=" if ("+e.usePattern(de)+".test("+g+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[v]=g;var De=e.validate(h);h.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Ae)+" ":n+=" var "+b+" = "+Ae+"; "+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},Q$=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,f="data"+(o||""),m="errs__"+a,h=e.util.copy(e),w="";h.level++;var p="valid"+h.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)){h.schema=i,h.schemaPath=c,h.errSchemaPath=u;var g="key"+a,y="idx"+a,v="i"+a,b="' + "+g+" + '",S=h.dataLevel=e.dataLevel+1,E="data"+S,k="dataProperties"+a,N=e.opts.ownProperties,T=e.baseId;N&&(n+=" var "+k+" = undefined; "),N?n+=" "+k+" = "+k+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+k+".length; "+y+"++) { var "+g+" = "+k+"["+y+"]; ":n+=" for (var "+g+" in "+f+") { ",n+=" var startErrs"+a+" = errors; ";var D=g,U=e.compositeRule;e.compositeRule=h.compositeRule=!0;var R=e.validate(h);h.baseId=T,e.util.varOccurences(R,E)<2?n+=" "+e.util.varReplace(R,E,D)+" ":n+=" var "+E+" = "+D+"; "+R+" ",e.compositeRule=h.compositeRule=U,n+=" if (!"+p+") { for (var "+v+"=startErrs"+a+"; "+v+"<errors; "+v+"++) { vErrors["+v+"].propertyName = "+g+"; } 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: "+f+" "),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},G$=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,f="data"+(o||""),m="valid"+a,h=e.opts.$data&&i&&i.$data;h&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var w="schema"+a;if(!h)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],g=i;if(g)for(var y,v=-1,b=g.length-1;v<b;){y=g[v+=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(h||p.length){var E=e.errorPath,k=h||p.length>=e.opts.loopRequired,N=e.opts.ownProperties;if(d)if(n+=" var missing"+a+"; ",k){h||(n+=" var "+w+" = validate.schema"+c+"; ");var T="i"+a,D="schema"+a+"["+T+"]",U="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,D,e.opts.jsonPointers)),n+=" var "+m+" = true; ",h&&(n+=" if (schema"+a+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+a+")) "+m+" = false; else {"),n+=" for (var "+T+" = 0; "+T+" < "+w+".length; "+T+"++) { "+m+" = "+f+"["+w+"["+T+"]] !== undefined ",N&&(n+=" && Object.prototype.hasOwnProperty.call("+f+", "+w+"["+T+"]) "),n+="; if (!"+m+") break; } ",h&&(n+=" } "),n+=" if (!"+m+") { ";var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var A=n;n=R.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var _=p;if(_)for(var O,T=-1,z=_.length-1;T<z;){O=_[T+=1],T&&(n+=" || ");var j=e.util.getProperty(O),K=f+j;n+=" ( ( "+K+" === undefined ",N&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(O)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?O:j)+") ) "}n+=") { ";var D="missing"+a,U="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,D,!0):E+" + "+D);var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var A=n;n=R.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(k){h||(n+=" var "+w+" = validate.schema"+c+"; ");var T="i"+a,D="schema"+a+"["+T+"]",U="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,D,e.opts.jsonPointers)),h&&(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: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+w+" !== undefined) { "),n+=" for (var "+T+" = 0; "+T+" < "+w+".length; "+T+"++) { if ("+f+"["+w+"["+T+"]] === undefined ",N&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+w+"["+T+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(n+=" } ")}else{var C=p;if(C)for(var O,F=-1,L=C.length-1;F<L;){O=C[F+=1];var j=e.util.getProperty(O),U=e.util.escapeQuotes(O),K=f+j;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,O,e.opts.jsonPointers)),n+=" if ( "+K+" === undefined ",N&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(O)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=E}else d&&(n+=" if (true) {");return n},Z$=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,f="data"+(o||""),m="valid"+a,h=e.opts.$data&&i&&i.$data,w;if(h?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",w="schema"+a):w=i,(i||h)&&e.opts.uniqueItems!==!1){h&&(n+=" var "+m+"; if ("+w+" === false || "+w+" === undefined) "+m+" = true; else if (typeof "+w+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+f+".length , "+m+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,g=Array.isArray(p);if(!p||p=="object"||p=="array"||g&&(p.indexOf("object")>=0||p.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var y="checkDataType"+(g?"s":"");n+=" if ("+e.util[y](p,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",h&&(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: ",h?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),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},Y$={$ref:A$,allOf:O$,anyOf:I$,$comment:D$,const:$$,contains:M$,dependencies:F$,enum:L$,format:U$,if:z$,items:V$,maximum:V0,minimum:V0,maxItems:q0,minItems:q0,maxLength:H0,minLength:H0,maxProperties:B0,minProperties:B0,multipleOf:q$,not:H$,oneOf:B$,pattern:K$,properties:W$,propertyNames:Q$,required:G$,uniqueItems:Z$,validate:KE},K0=Y$,eh=Ni.toHash,J$=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=eh(r),e.types=eh(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:K0[o],implements:i};return u}),e.all.$comment={keyword:"$comment",code:K0.$comment},a.type&&(e.types[a.type]=a)}),e.keywords=eh(r.concat(s)),e.custom={},e},W0=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],X$=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<W0.length;a++){var o=W0[a],i=n[o];i&&(n[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},eM=dg.MissingRef,tM=oC;function oC(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)?oC.call(s,{$ref:c},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(u){if(u instanceof eM)return c(u);throw u}function c(u){var d=u.missingSchema;if(h(d))throw new Error("Schema "+d+" is loaded but "+u.missingRef+" cannot be resolved");var f=s._loadingSchemas[d];return f||(f=s._loadingSchemas[d]=s._opts.loadSchema(d),f.then(m,m)),f.then(function(w){if(!h(d))return a(w).then(function(){h(d)||s.addSchema(w,d,void 0,e)})}).then(function(){return o(i)});function m(){delete s._loadingSchemas[d]}function h(w){return s._refs[w]||s._schemas[w]}}}}var rM=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,f,m="data"+(o||""),h="valid"+a,w="errs__"+a,p=e.opts.$data&&i&&i.$data,g;p?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+a):g=i;var y=this,v="definition"+a,b=y.definition,S="",E,k,N,T,D;if(p&&b.$data){D="keywordValidate"+a;var U=b.validateSchema;n+=" var "+v+" = RULES.custom['"+r+"'].definition; var "+D+" = "+v+".validate;"}else{if(T=e.useCustomRule(y,i,e.schema,e),!T)return;g="validate.schema"+c,D=T.code,E=b.compile,k=b.inline,N=b.macro}var R=D+".errors",A="i"+a,_="ruleErr"+a,O=b.async;if(O&&!e.async)throw new Error("async keyword in sync schema");if(k||N||(n+=""+R+" = null;"),n+="var "+w+" = errors;var "+h+";",p&&b.$data&&(S+="}",n+=" if ("+g+" === undefined) { "+h+" = true; } else { ",U&&(S+="}",n+=" "+h+" = "+v+".validateSchema("+g+"); if ("+h+") { ")),k)b.statements?n+=" "+T.validate+" ":n+=" "+h+" = "+T.validate+"; ";else if(N){var z=e.util.copy(e),S="";z.level++;var j="valid"+z.level;z.schema=T.validate,z.schemaPath="";var K=e.compositeRule;e.compositeRule=z.compositeRule=!0;var C=e.validate(z).replace(/validate\.schema/g,D);e.compositeRule=z.compositeRule=K,n+=" "+C}else{var F=F||[];F.push(n),n="",n+=" "+D+".call( ",e.opts.passContext?n+="this":n+="self",E||b.schema===!1?n+=" , "+m+" ":n+=" , "+g+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var L=o?"data"+(o-1||""):"parentData",Q=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+L+" , "+Q+" , rootData ) ";var te=n;n=F.pop(),b.errors===!1?(n+=" "+h+" = ",O&&(n+="await "),n+=""+te+"; "):O?(R="customErrors"+a,n+=" var "+R+" = null; try { "+h+" = await "+te+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+R+" = e.errors; else throw e; } "):n+=" "+R+" = null; "+h+" = "+te+"; "}if(b.modifying&&(n+=" if ("+L+") "+m+" = "+L+"["+Q+"];"),n+=""+S,b.valid)d&&(n+=" if (true) { ");else{n+=" if ( ",b.valid===void 0?(n+=" !",N?n+=""+j:n+=""+h):n+=" "+!b.valid+" ",n+=") { ",f=y.keyword;var F=F||[];F.push(n),n="";var F=F||[];F.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"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 V=n;n=F.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++; ";var de=n;n=F.pop(),k?b.errors?b.errors!="full"&&(n+=" for (var "+A+"="+w+"; "+A+"<errors; "+A+"++) { var "+_+" = vErrors["+A+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+_+".schema = "+g+"; "+_+".data = "+m+"; "),n+=" } "):b.errors===!1?n+=" "+de+" ":(n+=" if ("+w+" == errors) { "+de+" } else { for (var "+A+"="+w+"; "+A+"<errors; "+A+"++) { var "+_+" = vErrors["+A+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+_+".schema = "+g+"; "+_+".data = "+m+"; "),n+=" } } "):N?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(f||"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+=" "+de+" ":(n+=" if (Array.isArray("+R+")) { if (vErrors === null) vErrors = "+R+"; else vErrors = vErrors.concat("+R+"); errors = vErrors.length; for (var "+A+"="+w+"; "+A+"<errors; "+A+"++) { var "+_+" = vErrors["+A+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+e.errorPath+"; "+_+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(n+=" "+_+".schema = "+g+"; "+_+".data = "+m+"; "),n+=" } } else { "+de+" } "),n+=" } ",d&&(n+=" else { ")}return n};const nM="http://json-schema.org/draft-07/schema#",sM="http://json-schema.org/draft-07/schema#",aM="Core schema meta-schema",oM={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:[]}},iM=["object","boolean"],lM={$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:"#"}},iC={$schema:nM,$id:sM,title:aM,definitions:oM,type:iM,properties:lM,default:!0};var Q0=iC,cM={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Q0.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Q0.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"}]}}},uM=/^[a-z_$][a-z0-9_$-]*$/i,dM=rM,fM=cM,hM={add:pM,get:mM,remove:vM,validate:hm};function pM(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!uM.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,f=0;f<r.length;f++){var m=r[f];if(m.type==c){d=m;break}}d||(d={type:c,rules:[]},r.push(d));var h={keyword:i,definition:u,custom:!0,code:dM,implements:u.implements};d.rules.push(h),r.custom[i]=h}return this}function mM(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function vM(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 hm(t,e){hm.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(fM,!0);if(r(t))return!0;if(hm.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}const gM="http://json-schema.org/draft-07/schema#",yM="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",xM="Meta-schema for $data reference (JSON Schema extension proposal)",wM="object",bM=["$data"],SM={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},_M=!1,EM={$schema:gM,$id:yM,description:xM,type:wM,required:bM,properties:SM,additionalProperties:_M};var lC=d$,La=ug,CM=y$,cC=zE,PM=BE,kM=C$,NM=J$,uC=X$,dC=Ni,jM=St;St.prototype.validate=TM;St.prototype.compile=AM;St.prototype.addSchema=OM;St.prototype.addMetaSchema=IM;St.prototype.validateSchema=DM;St.prototype.getSchema=MM;St.prototype.removeSchema=LM;St.prototype.addFormat=WM;St.prototype.errorsText=KM;St.prototype._addSchema=UM;St.prototype._compile=zM;St.prototype.compileAsync=tM;var Xd=hM;St.prototype.addKeyword=Xd.add;St.prototype.getKeyword=Xd.get;St.prototype.removeKeyword=Xd.remove;St.prototype.validateKeyword=Xd.validate;var fC=dg;St.ValidationError=fC.Validation;St.MissingRefError=fC.MissingRef;St.$dataMetaSchema=uC;var od="http://json-schema.org/draft-07/schema",G0=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],RM=["/properties"];function St(t){if(!(this instanceof St))return new St(t);t=this._opts=dC.copy(t)||{},XM(this),this._schemas={},this._refs={},this._fragments={},this._formats=kM(t.format),this._cache=t.cache||new CM,this._loadingSchemas={},this._compilations=[],this.RULES=NM(),this._getId=VM(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=PM),this._metaOpts=JM(this),t.formats&&ZM(this),t.keywords&&YM(this),QM(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),GM(this)}function TM(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 AM(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function OM(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),pC(this,e),this._schemas[e]=this._addSchema(t,r,s,!0),this}function IM(t,e,r){return this.addSchema(t,e,r,!0),this}function DM(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||$M(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 $M(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 MM(t){var e=hC(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return FM(this,t)}}function FM(t,e){var r=La.schema.call(t,{schema:{}},e);if(r){var s=r.schema,n=r.root,a=r.baseId,o=lC.call(t,s,n,void 0,a);return t._fragments[e]=new cC({ref:e,fragment:!0,schema:s,root:n,baseId:a,validate:o}),o}}function hC(t,e){return e=La.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function LM(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=hC(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 UM(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&&pC(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),f=new cC({id:i,schema:t,localRefs:d,cacheKey:a,meta:r});return i[0]!="#"&&s&&(this._refs[i]=f),this._cache.put(a,f),c&&u&&this.validateSchema(t,!0),f}function zM(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=lC.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 VM(t){switch(t.schemaId){case"auto":return BM;case"id":return qM;default:return HM}}function qM(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function HM(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function BM(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 KM(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 WM(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function QM(t){var e;if(t._opts.$data&&(e=EM,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=iC;t._opts.$data&&(r=uC(r,RM)),t.addMetaSchema(r,od,!0),t._refs["http://json-schema.org/schema"]=od}}function GM(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 ZM(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function YM(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function pC(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function JM(t){for(var e=dC.copy(t._opts),r=0;r<G0.length;r++)delete e[G0[r]];return e}function XM(t){var e=t._opts.logger;if(e===!1)t.logger={log:th,warn:th,error:th};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 th(){}const eF=pm(jM);class tF extends j4{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 eF}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=R4(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}},EE,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!QI.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"},Oo,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},OE,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Oo,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Jv,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},RE,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Qv,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Oo,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Oo,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},Xv,r);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function zi(t,e){if(!t)throw new Error(e)}var Z0=3e3,rF=5e3,rh=5*60*1e3;function nF(t){const{url:e,clientName:r,clientUri:s,callbackUrl:n=typeof window<"u"?Ao(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:a="mcp:auth",clientConfig:o={},customHeaders:i={},autoRetry:c=!1,autoReconnect:u=Z0,transportType:d="auto",preventAutoAuth:f=!1,onPopupWindow:m}=t,[h,w]=x.useState("discovering"),[p,g]=x.useState([]),[y,v]=x.useState([]),[b,S]=x.useState([]),[E,k]=x.useState([]),[N,T]=x.useState(void 0),[D,U]=x.useState([]),[R,A]=x.useState(void 0),_=x.useRef(null),O=x.useRef(null),z=x.useRef(null),j=x.useRef(!1),K=x.useRef(!0),C=x.useRef(0),F=x.useRef(null),L=x.useRef(h),Q=x.useRef(u),te=x.useRef(null);x.useEffect(()=>{L.current=h,Q.current=u},[h,u]);const V=x.useCallback((J,ie,...Y)=>{const ze=Y.length>0?`${ie} ${Y.map(ee=>JSON.stringify(ee)).join(" ")}`:ie;console[J](`[useMcp] ${ze}`),K.current&&U(ee=>[...ee.slice(-100),{level:J,message:ze,timestamp:Date.now()}])},[]),de=x.useCallback(async(J=!1)=>{J||V("info","Disconnecting..."),j.current=!1,F.current&&clearTimeout(F.current),F.current=null;const ie=O.current;if(_.current=null,O.current=null,K.current&&!J&&(w("discovering"),g([]),v([]),S([]),k([]),T(void 0),A(void 0)),ie)try{await ie.close(),J||V("debug","Transport closed")}catch(Y){J||V("warn","Error closing transport:",Y)}},[V]),Te=x.useCallback((J,ie)=>{var Y;if(V("error",J,ie??""),K.current){w("failed"),T(J);const ze=(Y=z.current)==null?void 0:Y.getLastAttemptedAuthUrl();ze&&(A(ze),V("info","Manual authentication URL may be available.",ze))}j.current=!1},[V]),ge=x.useCallback(async()=>{if(j.current){V("debug","Connection attempt already in progress.");return}if(!K.current){V("debug","Connect called after unmount, aborting.");return}j.current=!0,C.current+=1,T(void 0),A(void 0),te.current=null,w("discovering"),V("info",`Connecting attempt #${C.current} to ${e}...`),z.current||(z.current=new E0(e,{storageKeyPrefix:a,clientName:r,clientUri:s,callbackUrl:n,preventAutoAuth:f,onPopupWindow:m}),V("debug","BrowserOAuthClientProvider initialized in connect.")),_.current||(_.current=new tF({name:o.name||"use-mcp-react-client",version:o.version||"0.1.0"},{capabilities:{}}),V("debug","MCP Client initialized in connect."));const J=async Y=>{V("info",`Attempting connection with ${Y.toUpperCase()} transport...`),L.current!=="authenticating"&&w("connecting");let ze;try{zi(z.current,"Auth Provider must be initialized"),zi(_.current,"Client must be initialized"),O.current&&(await O.current.close().catch(ke=>V("warn",`Error closing previous transport: ${ke.message}`)),O.current=null);const ee={authProvider:z.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...i}}},Oe=Ao(e),Fe=new URL(Oe);V("debug",`Creating ${Y.toUpperCase()} transport for URL: ${Fe.toString()}`),V("debug","Transport options:",{authProvider:!!z.current,headers:i,url:Fe.toString()}),Y==="http"?(V("debug","Creating StreamableHTTPClientTransport..."),ze=new k4(Fe,ee),V("debug","StreamableHTTPClientTransport created successfully")):(V("debug","Creating SSEClientTransport..."),ze=new E4(Fe,ee),V("debug","SSEClientTransport created successfully")),O.current=ze,V("debug",`${Y.toUpperCase()} transport created and assigned to ref.`)}catch(ee){return Te(`Failed to create ${Y.toUpperCase()} transport: ${ee instanceof Error?ee.message:String(ee)}`,ee instanceof Error?ee:void 0),"failed"}ze.onmessage=ee=>{var Oe,Fe;V("debug",`[Transport] Received: ${JSON.stringify(ee)}`),(Fe=(Oe=_.current)==null?void 0:Oe.handleMessage)==null||Fe.call(Oe,ee)},ze.onerror=ee=>{V("warn",`Transport error event (${Y.toUpperCase()}):`,ee),V("debug","Error details:",{message:ee.message,stack:ee.stack,name:ee.name,cause:ee.cause}),Te(`Transport error (${Y.toUpperCase()}): ${ee.message}`,ee)},ze.onclose=()=>{if(!K.current||j.current)return;V("info",`Transport connection closed (${te.current||"unknown"} type).`);const ee=L.current,Oe=Q.current;if(ee==="ready"&&Oe){const Fe=typeof Oe=="number"?Oe:Z0;V("info",`Attempting to reconnect in ${Fe}ms...`),w("connecting"),setTimeout(()=>{K.current&&ge()},Fe)}else ee!=="failed"&&ee!=="authenticating"&&Te("Connection closed unexpectedly.")};try{V("info",`Connecting client via ${Y.toUpperCase()}...`),V("debug","About to call client.connect() with transport instance"),V("debug",`Transport instance type: ${ze.constructor.name}`),await _.current.connect(ze),V("info",`Client connected via ${Y.toUpperCase()}. Loading tools, resources, and prompts...`),te.current=Y,w("loading");const ee=await _.current.request({method:"tools/list"},Xv);let Oe={resources:[],resourceTemplates:[]};try{Oe=await _.current.request({method:"resources/list"},Zu)}catch(ke){V("debug","Server does not support resources/list method",ke)}let Fe={prompts:[]};try{Fe=await _.current.request({method:"prompts/list"},Yu)}catch(ke){V("debug","Server does not support prompts/list method",ke)}if(K.current){g(ee.tools),v(Oe.resources),S(Array.isArray(Oe.resourceTemplates)?Oe.resourceTemplates:[]),k(Fe.prompts);const ke=[`Loaded ${ee.tools.length} tools`];return(Oe.resources.length>0||Oe.resourceTemplates&&Oe.resourceTemplates.length>0)&&(ke.push(`${Oe.resources.length} resources`),Array.isArray(Oe.resourceTemplates)&&Oe.resourceTemplates.length>0&&ke.push(`${Oe.resourceTemplates.length} resource templates`)),Fe.prompts.length>0&&ke.push(`${Fe.prompts.length} prompts`),V("info",ke.join(", ")+"."),w("ready"),C.current=0,"success"}else return"failed"}catch(ee){V("debug",`Client connect error via ${Y.toUpperCase()}:`,ee),V("debug","Connect error details:",{message:ee instanceof Error?ee.message:String(ee),stack:ee instanceof Error?ee.stack:"N/A",name:ee instanceof Error?ee.name:"Unknown",cause:ee instanceof Error?ee.cause:void 0});const Oe=ee instanceof Error?ee:new Error(String(ee)),Fe=Oe.message,ke=Fe.includes("404")||Fe.includes("Not Found"),st=Fe.includes("405")||Fe.includes("Method Not Allowed"),vt=Fe==="Failed to fetch"||Fe==="NetworkError when attempting to fetch resource."||Fe==="Load failed";if(Y==="http"&&(ke||st||vt))return V("warn",`HTTP transport failed (${vt?"CORS":ke?"404":"405"}).`),"fallback";if(Oe instanceof Dr||Fe.includes("Unauthorized")||Fe.includes("401")){V("info","Authentication required."),zi(z.current,"Auth Provider not available for auth flow");const Hr=await z.current.tokens();if(f&&!Hr)return V("info","Authentication required but auto-auth prevented. User action needed."),w("pending_auth"),"auth_redirect";L.current!=="authenticating"&&L.current!=="pending_auth"&&(w("authenticating"),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{},rh));try{const zt=await Pn(z.current,{serverUrl:e});if(!K.current)return"failed";if(zt==="AUTHORIZED")return V("info","Authentication successful via existing token or refresh. Re-attempting connection..."),F.current&&clearTimeout(F.current),j.current=!1,ge(),"failed";if(zt==="REDIRECT")return V("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(zt){return K.current&&(F.current&&clearTimeout(F.current),Te(`Failed to initiate authentication: ${zt instanceof Error?zt.message:String(zt)}`,zt instanceof Error?zt:void 0)),"failed"}}return Te(`Failed to connect via ${Y.toUpperCase()}: ${Fe}`,Oe),"failed"}};let ie="failed";if(console.log({transportType:d}),d==="sse")V("debug","Using SSE-only transport mode"),ie=await J("sse");else if(d==="http")V("debug","Using HTTP-only transport mode"),ie=await J("http");else{V("debug","Using auto transport mode (HTTP with SSE fallback)");const Y=await J("http");if(Y==="fallback"&&K.current&&L.current!=="authenticating"){V("info","HTTP failed, attempting SSE fallback...");const ze=await J("sse");ie=ze,ze==="failed"&&K.current}else ie=Y}(ie==="success"||ie==="failed")&&(j.current=!1),V("debug",`Connection sequence finished with status: ${ie}`)},[V,Te,de,Pn,e,a,r,s,n,o.name,o.version]),X=x.useCallback(async(J,ie)=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot call tool "${J}".`);V("info",`Calling tool: ${J}`,ie);try{const Y=await _.current.request({method:"tools/call",params:{name:J,arguments:ie}},Qd);return V("info",`Tool "${J}" call successful:`,Y),Y}catch(Y){V("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")){V("warn","Tool call unauthorized, attempting re-authentication..."),w("authenticating"),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{},rh);try{zi(z.current,"Auth Provider not available for tool re-auth");const ee=await Pn(z.current,{serverUrl:e});if(!K.current)return;ee==="AUTHORIZED"?(V("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),F.current&&clearTimeout(F.current),j.current=!1,ge()):ee==="REDIRECT"&&V("info","Redirecting for re-authentication for tool call.")}catch(ee){if(!K.current)return;F.current&&clearTimeout(F.current),Te(`Re-authentication failed: ${ee instanceof Error?ee.message:String(ee)}`,ee instanceof Error?ee:void 0)}}if(L.current!=="authenticating")throw Y;return}},[h,e,V,Te,ge]),ve=x.useCallback(()=>{L.current==="failed"?(V("info","Retry requested..."),ge()):V("warn",`Retry called but state is not 'failed' (state: ${L.current}). Ignoring.`)},[V,ge]),he=x.useCallback(async()=>{var ie;V("info","Manual authentication requested...");const J=L.current;if(J==="failed")V("info","Attempting to reconnect and authenticate via retry..."),ve();else if(J==="pending_auth"){V("info","Proceeding with authentication from pending state..."),w("authenticating"),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{},rh);try{zi(z.current,"Auth Provider not available for manual auth");const Y=await Pn(z.current,{serverUrl:e});if(!K.current)return;Y==="AUTHORIZED"?(V("info","Manual authentication successful. Re-attempting connection..."),F.current&&clearTimeout(F.current),j.current=!1,ge()):Y==="REDIRECT"&&V("info","Redirecting for manual authentication. Waiting for callback...")}catch(Y){if(!K.current)return;F.current&&clearTimeout(F.current),Te(`Manual authentication failed: ${Y instanceof Error?Y.message:String(Y)}`,Y instanceof Error?Y:void 0)}}else if(J==="authenticating"){V("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const Y=(ie=z.current)==null?void 0:ie.getLastAttemptedAuthUrl();Y&&!R&&(A(Y),V("info","Manual authentication URL retrieved:",Y))}else V("info",`Client not in a state requiring manual authentication trigger (state: ${J}). If needed, try disconnecting and reconnecting.`)},[V,ve,R,e,Te,ge]),ye=x.useCallback(()=>{if(z.current){const J=z.current.clearStorage();V("info",`Cleared ${J} item(s) from localStorage for ${e}.`),A(void 0),de()}else V("warn","Auth provider not initialized, cannot clear storage.")},[e,V,de]),ue=x.useCallback(async()=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list resources.`);V("info","Listing resources...");try{const J=await _.current.request({method:"resources/list"},Zu);K.current&&(v(J.resources),S(Array.isArray(J.resourceTemplates)?J.resourceTemplates:[]),V("info",`Listed ${J.resources.length} resources, ${Array.isArray(J.resourceTemplates)?J.resourceTemplates.length:0} resource templates.`))}catch(J){throw V("error",`Error listing resources: ${J instanceof Error?J.message:String(J)}`,J),J}},[h,V]),Pe=x.useCallback(async J=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot read resource "${J}".`);V("info",`Reading resource: ${J}`);try{const ie=await _.current.request({method:"resources/read",params:{uri:J}},Qv);return V("info",`Resource "${J}" read successfully`),ie}catch(ie){throw V("error",`Error reading resource "${J}": ${ie instanceof Error?ie.message:String(ie)}`,ie),ie}},[h,V]),Ae=x.useCallback(async()=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list prompts.`);V("info","Listing prompts...");try{const J=await _.current.request({method:"prompts/list"},Yu);K.current&&(k(J.prompts),V("info",`Listed ${J.prompts.length} prompts.`))}catch(J){throw V("error",`Error listing prompts: ${J instanceof Error?J.message:String(J)}`,J),J}},[h,V]),De=x.useCallback(async(J,ie)=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot get prompt "${J}".`);V("info",`Getting prompt: ${J}`,ie);try{const Y=await _.current.request({method:"prompts/get",params:{name:J,arguments:ie}},Jv);return V("info",`Prompt "${J}" retrieved successfully`),Y}catch(Y){throw V("error",`Error getting prompt "${J}": ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[h,V]);return x.useEffect(()=>{const J=ie=>{var Y;ie.origin===window.location.origin&&((Y=ie.data)==null?void 0:Y.type)==="mcp_auth_callback"&&(V("info","Received auth callback message.",ie.data),F.current&&clearTimeout(F.current),ie.data.success?(V("info","Authentication successful via popup. Reconnecting client..."),j.current=!1,ge()):Te(`Authentication failed in callback: ${ie.data.error||"Unknown reason."}`))};return window.addEventListener("message",J),V("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",J),V("debug","Auth callback message listener removed."),F.current&&clearTimeout(F.current)}},[V,Te,ge]),x.useEffect(()=>(K.current=!0,V("debug","useMcp mounted, initiating connection."),C.current=0,(!z.current||z.current.serverUrl!==e)&&(z.current=new E0(e,{storageKeyPrefix:a,clientName:r,clientUri:s,callbackUrl:n,preventAutoAuth:f,onPopupWindow:m}),V("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),ge(),()=>{K.current=!1,V("debug","useMcp unmounting, disconnecting."),de(!0)}),[e,a,n,r,s,o.name,o.version,ge,de]),x.useEffect(()=>{let J=null;if(h==="failed"&&c&&C.current>0){const ie=typeof c=="number"?c:rF;V("info",`Connection failed, auto-retrying in ${ie}ms...`),J=setTimeout(()=>{K.current&&L.current==="failed"&&ve()},ie)}return()=>{J&&clearTimeout(J)}},[h,c,ve,V]),{state:h,tools:p,resources:y,resourceTemplates:b,prompts:E,error:N,log:D,authUrl:R,callTool:X,listResources:ue,readResource:Pe,listPrompts:Ae,getPrompt:De,retry:ve,disconnect:de,authenticate:he,clearStorage:ye}}function sF({service:t,autoConnect:e=!1,onConnected:r,onError:s}){const{toast:n}=gr(),{state:a,tools:o,resources:i,prompts:c,error:u,authUrl:d,callTool:f,readResource:m,listResources:h,getPrompt:w,listPrompts:p,retry:g,disconnect:y,authenticate:v,clearStorage:b}=nF({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",k=a==="authenticating"||a==="pending_auth",N=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(()=>{N&&u&&s&&(s(u),n({title:"MCP connection failed",description:u,variant:"destructive"}))},[N,u,s,n]),{isConnected:S,isConnecting:E,isAuthenticating:k,hasError:N,error:u,tools:o,resources:i,prompts:c,connect:()=>{g()},disconnect:y,retry:g,authenticate:v,callTool:async(_,O)=>{try{return await f(_,O)}catch(z){const j=z instanceof Error?z.message:"Unknown error";throw n({title:"Tool call failed",description:j,variant:"destructive"}),z}},readResource:async _=>{try{return await m(_)}catch(O){const z=O instanceof Error?O.message:"Unknown error";throw n({title:"Resource read failed",description:z,variant:"destructive"}),O}},listResources:async()=>{try{await h()}catch(_){const O=_ instanceof Error?_.message:"Unknown error";throw n({title:"Resource listing failed",description:O,variant:"destructive"}),_}},getPrompt:async(_,O)=>{try{return await w(_,O)}catch(z){const j=z instanceof Error?z.message:"Unknown error";throw n({title:"Prompt retrieval failed",description:j,variant:"destructive"}),z}},listPrompts:async()=>{try{await p()}catch(_){const O=_ instanceof Error?_.message:"Unknown error";throw n({title:"Prompt listing failed",description:O,variant:"destructive"}),_}},authUrl:d,clearStorage:b}}function aF(){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:f,hasError:m,error:h,tools:w,resources:p,prompts:g,connect:y,disconnect:v,retry:b,authenticate:S,callTool:E,authUrl:k,clearStorage:N}=sF({service:c,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:R=>{console.error("Test MCP service error:",R)}}),D=d?{status:"connecting",icon:Yy,color:"text-yellow-500"}:f?{status:"authenticating",icon:Cc,color:"text-blue-500"}:u?{status:"connected",icon:fp,color:"text-green-500"}:m?{status:"error",icon:Gy,color:"text-red-500"}:{status:"disconnected",icon:Gy,color:"text-gray-500"},U=async()=>{try{let R={};n.trim()&&(R=JSON.parse(n));const A=await E(r,R);i(JSON.stringify(A,null,2))}catch(R){i(`Error: ${R instanceof Error?R.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(D.icon,{className:`w-5 h-5 ${D.color}`}),"Connection Status: ",D.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(Ge,{children:"Service URL"}),l.jsx(ut,{value:t,onChange:R=>e(R.target.value),placeholder:"Enter MCP service URL"})]}),l.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&l.jsx(me,{onClick:y,children:"Connect"}),u&&l.jsx(me,{onClick:v,variant:"outline",children:"Disconnect"}),m&&l.jsxs(me,{onClick:b,variant:"outline",children:[l.jsx(Yy,{className:"w-4 h-4 mr-1"}),"Retry"]}),k&&!u&&l.jsxs(me,{onClick:S,variant:"outline",children:[l.jsx(Cc,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),h&&l.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[l.jsx(_S,{className:"w-4 h-4 text-destructive"}),l.jsx("span",{className:"text-sm text-destructive",children:h})]})]})]}),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((R,A)=>l.jsx("div",{className:"text-sm",children:l.jsx(hn,{variant:"outline",className:"text-xs",children:R.name})},A)),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 (",g.length,")"]})}),l.jsx(Ps,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${g.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(Ge,{htmlFor:"toolName",children:"Tool Name"}),l.jsx(ut,{id:"toolName",value:r,onChange:R=>s(R.target.value),placeholder:"e.g., get_me"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),l.jsx(ut,{id:"toolArgs",value:n,onChange:R=>a(R.target.value),placeholder:'{"key": "value"}'})]})]}),l.jsxs(me,{onClick:U,disabled:!u,children:[l.jsx(l2,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),o&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{children:"Result"}),l.jsx(Gn,{value:o,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),k&&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(me,{onClick:S,variant:"outline",children:[l.jsx(Cc,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),l.jsx(me,{onClick:N,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function oF(){return l.jsxs(bN,{children:[l.jsx(bc,{path:"/",component:mI}),l.jsx(bc,{path:"/oauth/callback",component:yI}),l.jsx(bc,{path:"/mcp-test",component:aF}),l.jsx(bc,{component:gI})]})}function iF(){return l.jsx(VN,{client:nj,children:l.jsxs(TT,{children:[l.jsx(K2,{}),l.jsx(oF,{})]})})}xb(document.getElementById("root")).render(l.jsx(x.StrictMode,{children:l.jsx(iF,{})}));
|
|
339
|
+
`&&s++}}return[e,r]}class I0 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(D0(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(D0(this),r)}}function BD(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Lp(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Lp).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Lp(t.cause)}`:t.message:`${t}`}function D0(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var DE=t=>{throw TypeError(t)},eg=(t,e,r)=>e.has(t)||DE("Cannot "+r),Ve=(t,e,r)=>(eg(t,e,"read from private field"),r?r.call(t):e.get(t)),Rt=(t,e,r)=>e.has(t)?DE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),pt=(t,e,r,s)=>(eg(t,e,"write to private field"),e.set(t,r),r),qn=(t,e,r)=>(eg(t,e,"access private method"),r),ur,Ca,go,tu,Ju,ll,Io,cl,Rs,yo,Bo,xo,Zi,Gr,Up,zp,Vp,$0,qp,Hp,Yi,Bp,Kp;class ru extends EventTarget{constructor(e,r){var s,n;super(),Rt(this,Gr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Rt(this,ur),Rt(this,Ca),Rt(this,go),Rt(this,tu),Rt(this,Ju),Rt(this,ll),Rt(this,Io),Rt(this,cl,null),Rt(this,Rs),Rt(this,yo),Rt(this,Bo,null),Rt(this,xo,null),Rt(this,Zi,null),Rt(this,zp,async a=>{var o;Ve(this,yo).reset();const{body:i,redirected:c,status:u,headers:d}=a;if(u===204){qn(this,Gr,Yi).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?pt(this,go,new URL(a.url)):pt(this,go,void 0),u!==200){qn(this,Gr,Yi).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){qn(this,Gr,Yi).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ve(this,ur)===this.CLOSED)return;pt(this,ur,this.OPEN);const f=new Event("open");if((o=Ve(this,Zi))==null||o.call(this,f),this.dispatchEvent(f),typeof i!="object"||!i||!("getReader"in i)){qn(this,Gr,Yi).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const m=new TextDecoder,h=i.getReader();let w=!0;do{const{done:p,value:g}=await h.read();g&&Ve(this,yo).feed(m.decode(g,{stream:!p})),p&&(w=!1,Ve(this,yo).reset(),qn(this,Gr,Bp).call(this))}while(w)}),Rt(this,Vp,a=>{pt(this,Rs,void 0),!(a.name==="AbortError"||a.type==="aborted")&&qn(this,Gr,Bp).call(this,Lp(a))}),Rt(this,qp,a=>{typeof a.id=="string"&&pt(this,cl,a.id);const o=new MessageEvent(a.event||"message",{data:a.data,origin:Ve(this,go)?Ve(this,go).origin:Ve(this,Ca).origin,lastEventId:a.id||""});Ve(this,xo)&&(!a.event||a.event==="message")&&Ve(this,xo).call(this,o),this.dispatchEvent(o)}),Rt(this,Hp,a=>{pt(this,ll,a)}),Rt(this,Kp,()=>{pt(this,Io,void 0),Ve(this,ur)===this.CONNECTING&&qn(this,Gr,Up).call(this)});try{if(e instanceof URL)pt(this,Ca,e);else if(typeof e=="string")pt(this,Ca,new URL(e,KD()));else throw new Error("Invalid URL")}catch{throw BD("An invalid or illegal string was specified")}pt(this,yo,IE({onEvent:Ve(this,qp),onRetry:Ve(this,Hp)})),pt(this,ur,this.CONNECTING),pt(this,ll,3e3),pt(this,Ju,(s=r==null?void 0:r.fetch)!=null?s:globalThis.fetch),pt(this,tu,(n=r==null?void 0:r.withCredentials)!=null?n:!1),qn(this,Gr,Up).call(this)}get readyState(){return Ve(this,ur)}get url(){return Ve(this,Ca).href}get withCredentials(){return Ve(this,tu)}get onerror(){return Ve(this,Bo)}set onerror(e){pt(this,Bo,e)}get onmessage(){return Ve(this,xo)}set onmessage(e){pt(this,xo,e)}get onopen(){return Ve(this,Zi)}set onopen(e){pt(this,Zi,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,Io)&&clearTimeout(Ve(this,Io)),Ve(this,ur)!==this.CLOSED&&(Ve(this,Rs)&&Ve(this,Rs).abort(),pt(this,ur,this.CLOSED),pt(this,Rs,void 0))}}ur=new WeakMap,Ca=new WeakMap,go=new WeakMap,tu=new WeakMap,Ju=new WeakMap,ll=new WeakMap,Io=new WeakMap,cl=new WeakMap,Rs=new WeakMap,yo=new WeakMap,Bo=new WeakMap,xo=new WeakMap,Zi=new WeakMap,Gr=new WeakSet,Up=function(){pt(this,ur,this.CONNECTING),pt(this,Rs,new AbortController),Ve(this,Ju)(Ve(this,Ca),qn(this,Gr,$0).call(this)).then(Ve(this,zp)).catch(Ve(this,Vp))},zp=new WeakMap,Vp=new WeakMap,$0=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},qp=new WeakMap,Hp=new WeakMap,Yi=function(t,e){var r;Ve(this,ur)!==this.CLOSED&&pt(this,ur,this.CLOSED);const s=new I0("error",{code:e,message:t});(r=Ve(this,Bo))==null||r.call(this,s),this.dispatchEvent(s)},Bp=function(t,e){var r;if(Ve(this,ur)===this.CLOSED)return;pt(this,ur,this.CONNECTING);const s=new I0("error",{code:e,message:t});(r=Ve(this,Bo))==null||r.call(this,s),this.dispatchEvent(s),pt(this,Io,setTimeout(Ve(this,Kp),Ve(this,ll)))},Kp=new WeakMap,ru.CONNECTING=0,ru.OPEN=1,ru.CLOSED=2;function KD(){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 tg;tg=globalThis.crypto;async function WD(t){return(await tg).getRandomValues(new Uint8Array(t))}async function QD(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const s=await WD(t);for(let n=0;n<t;n++){const a=s[n]%e.length;r+=e[a]}return r}async function GD(t){return await QD(t)}async function ZD(t){const e=await(await tg).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function YD(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await GD(t),r=await ZD(e);return{code_verifier:e,code_challenge:r}}const Ft=q().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Z.custom,message:"URL must be parseable",fatal:!0}),KI}).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"}),JD=se({resource:q().url(),authorization_servers:fe(Ft).optional(),jwks_uri:q().url().optional(),scopes_supported:fe(q()).optional(),bearer_methods_supported:fe(q()).optional(),resource_signing_alg_values_supported:fe(q()).optional(),resource_name:q().optional(),resource_documentation:q().optional(),resource_policy_uri:q().url().optional(),resource_tos_uri:q().url().optional(),tls_client_certificate_bound_access_tokens:Dt().optional(),authorization_details_types_supported:fe(q()).optional(),dpop_signing_alg_values_supported:fe(q()).optional(),dpop_bound_access_tokens_required:Dt().optional()}).passthrough(),$E=se({issuer:q(),authorization_endpoint:Ft,token_endpoint:Ft,registration_endpoint:Ft.optional(),scopes_supported:fe(q()).optional(),response_types_supported:fe(q()),response_modes_supported:fe(q()).optional(),grant_types_supported:fe(q()).optional(),token_endpoint_auth_methods_supported:fe(q()).optional(),token_endpoint_auth_signing_alg_values_supported:fe(q()).optional(),service_documentation:Ft.optional(),revocation_endpoint:Ft.optional(),revocation_endpoint_auth_methods_supported:fe(q()).optional(),revocation_endpoint_auth_signing_alg_values_supported:fe(q()).optional(),introspection_endpoint:q().optional(),introspection_endpoint_auth_methods_supported:fe(q()).optional(),introspection_endpoint_auth_signing_alg_values_supported:fe(q()).optional(),code_challenge_methods_supported:fe(q()).optional()}).passthrough(),XD=se({issuer:q(),authorization_endpoint:Ft,token_endpoint:Ft,userinfo_endpoint:Ft.optional(),jwks_uri:Ft,registration_endpoint:Ft.optional(),scopes_supported:fe(q()).optional(),response_types_supported:fe(q()),response_modes_supported:fe(q()).optional(),grant_types_supported:fe(q()).optional(),acr_values_supported:fe(q()).optional(),subject_types_supported:fe(q()),id_token_signing_alg_values_supported:fe(q()),id_token_encryption_alg_values_supported:fe(q()).optional(),id_token_encryption_enc_values_supported:fe(q()).optional(),userinfo_signing_alg_values_supported:fe(q()).optional(),userinfo_encryption_alg_values_supported:fe(q()).optional(),userinfo_encryption_enc_values_supported:fe(q()).optional(),request_object_signing_alg_values_supported:fe(q()).optional(),request_object_encryption_alg_values_supported:fe(q()).optional(),request_object_encryption_enc_values_supported:fe(q()).optional(),token_endpoint_auth_methods_supported:fe(q()).optional(),token_endpoint_auth_signing_alg_values_supported:fe(q()).optional(),display_values_supported:fe(q()).optional(),claim_types_supported:fe(q()).optional(),claims_supported:fe(q()).optional(),service_documentation:q().optional(),claims_locales_supported:fe(q()).optional(),ui_locales_supported:fe(q()).optional(),claims_parameter_supported:Dt().optional(),request_parameter_supported:Dt().optional(),request_uri_parameter_supported:Dt().optional(),require_request_uri_registration:Dt().optional(),op_policy_uri:Ft.optional(),op_tos_uri:Ft.optional()}).passthrough(),e4=XD.merge($E.pick({code_challenge_methods_supported:!0})),ME=se({access_token:q(),id_token:q().optional(),token_type:q(),expires_in:Ut().optional(),scope:q().optional(),refresh_token:q().optional()}).strip(),t4=se({error:q(),error_description:q().optional(),error_uri:q().optional()}),r4=se({redirect_uris:fe(Ft),token_endpoint_auth_method:q().optional(),grant_types:fe(q()).optional(),response_types:fe(q()).optional(),client_name:q().optional(),client_uri:Ft.optional(),logo_uri:Ft.optional(),scope:q().optional(),contacts:fe(q()).optional(),tos_uri:Ft.optional(),policy_uri:q().optional(),jwks_uri:Ft.optional(),jwks:HI().optional(),software_id:q().optional(),software_version:q().optional(),software_statement:q().optional()}).strip(),n4=se({client_id:q(),client_secret:q().optional(),client_id_issued_at:Ut().optional(),client_secret_expires_at:Ut().optional()}).strip(),s4=r4.merge(n4);se({error:q(),error_description:q().optional()}).strip();se({token:q(),token_type_hint:q().optional()}).strip();function a4(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function o4({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 Wp extends Kt{}Wp.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 Qp extends Kt{}Qp.errorCode="unsupported_grant_type";class Gp extends Kt{}Gp.errorCode="invalid_scope";class Zp extends Kt{}Zp.errorCode="access_denied";class yi extends Kt{}yi.errorCode="server_error";class Yp extends Kt{}Yp.errorCode="temporarily_unavailable";class Jp extends Kt{}Jp.errorCode="unsupported_response_type";class Xp extends Kt{}Xp.errorCode="unsupported_token_type";class em extends Kt{}em.errorCode="invalid_token";class tm extends Kt{}tm.errorCode="method_not_allowed";class rm extends Kt{}rm.errorCode="too_many_requests";class nm extends Kt{}nm.errorCode="invalid_client_metadata";class sm extends Kt{}sm.errorCode="insufficient_scope";const i4={[Wp.errorCode]:Wp,[Xu.errorCode]:Xu,[ed.errorCode]:ed,[td.errorCode]:td,[Qp.errorCode]:Qp,[Gp.errorCode]:Gp,[Zp.errorCode]:Zp,[yi.errorCode]:yi,[Yp.errorCode]:Yp,[Jp.errorCode]:Jp,[Xp.errorCode]:Xp,[em.errorCode]:em,[tm.errorCode]:tm,[rm.errorCode]:rm,[nm.errorCode]:nm,[sm.errorCode]:sm};class Dr extends Error{constructor(e){super(e??"Unauthorized")}}function FE(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 LE(t,e,r,s){const{client_id:n,client_secret:a}=e;switch(t){case"client_secret_basic":l4(n,a,r);return;case"client_secret_post":c4(n,a,s);return;case"none":u4(n,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function l4(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 c4(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function u4(t,e){e.set("client_id",t)}async function rg(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const s=t4.parse(JSON.parse(r)),{error:n,error_description:a,error_uri:o}=s,i=i4[n]||yi;return new i(a||"",o)}catch(s){const n=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${r}`;return new yi(n)}}async function Pn(t,e){var r,s;try{return await Yf(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 Yf(t,e);if(n instanceof ed)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await Yf(t,e);throw n}}async function Yf(t,{serverUrl:e,authorizationCode:r,scope:s,resourceMetadataUrl:n,fetchFn:a}){let o,i;try{o=await f4(e,{resourceMetadataUrl:n},a),o.authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch{}i||(i=e);const c=await d4(e,t,o),u=await g4(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 b4(i,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:a});await t.saveClientInformation(p),d=p}if(r!==void 0){const p=await t.codeVerifier(),g=await x4(i,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:p,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(g),"AUTHORIZED"}const f=await t.tokens();if(f!=null&&f.refresh_token)try{const p=await w4(i,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof Kt)||p instanceof yi))throw p}const m=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:w}=await y4(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(h),"REDIRECT"}async function d4(t,e,r){const s=a4(t);if(e.validateResourceURL)return await e.validateResourceURL(s,r==null?void 0:r.resource);if(r){if(!o4({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 am(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 f4(t,e,r=fetch){const s=await m4(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 JD.parse(await s.json())}async function ng(t,e,r=fetch){try{return await r(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?ng(t,void 0,r):void 0;throw s}}function h4(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function M0(t,e,r=fetch){return await ng(t,{"MCP-Protocol-Version":e},r)}function p4(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function m4(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=h4(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 M0(c,i,r);if(!(s!=null&&s.metadataUrl)&&p4(u,o.pathname)){const d=new URL(`/.well-known/${e}`,o);u=await M0(d,i,r)}return u}function v4(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 g4(t,{fetchFn:e=fetch,protocolVersion:r=qd}={}){var s;const n={"MCP-Protocol-Version":r},a=v4(t);for(const{url:o,type:i}of a){const c=await ng(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 $E.parse(await c.json());{const u=e4.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 y4(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 YD(),f=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:f}}async function x4(t,{metadata:e,clientInformation:r,authorizationCode:s,codeVerifier:n,redirectUri:a,resource:o,addClientAuthentication:i,fetchFn:c}){var u;const d="authorization_code",f=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"}),h=new URLSearchParams({grant_type:d,code:s,code_verifier:n,redirect_uri:String(a)});if(i)i(m,h,t,e);else{const p=(u=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],g=FE(r,p);LE(g,r,m,h)}o&&h.set("resource",o.href);const w=await(c??fetch)(f,{method:"POST",headers:m,body:h});if(!w.ok)throw await rg(w);return ME.parse(await w.json())}async function w4(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"}),f=new URLSearchParams({grant_type:c,refresh_token:s});if(a)a(d,f,t,e);else{const h=(i=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&i!==void 0?i:[],w=FE(r,h);LE(w,r,d,f)}n&&f.set("resource",n.href);const m=await(o??fetch)(u,{method:"POST",headers:d,body:f});if(!m.ok)throw await rg(m);return ME.parse({refresh_token:s,...await m.json()})}async function b4(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 rg(a);return s4.parse(await a.json())}class S4 extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class _4{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=am(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 S4(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 f;try{f=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,f)}})}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=am(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 E4 extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let n;super({start(a){n=IE({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 C4={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Jf extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class P4{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:C4}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 Jf(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,f;try{const m=e.pipeThrough(new TextDecoderStream).pipeThrough(new E4).getReader();for(;;){const{value:h,done:w}=await m.read();if(w)break;if(h.id&&(o=h.id,n==null||n(h.id)),!h.event||h.event==="message")try{const p=eu.parse(JSON.parse(h.data));a!==void 0&&Fp(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(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}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:xE(e)?e.id:void 0}).catch(g=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,g)});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},f=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,d),m=f.headers.get("mcp-session-id");if(m&&(this._sessionId=m),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=am(f),await Pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dr;return this.send(e)}const g=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${g}`)}if(f.status===202){eD(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(g=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,g)});return}const w=(Array.isArray(e)?e:[e]).filter(g=>"method"in g&&"id"in g&&g.id!==void 0).length>0,p=f.headers.get("content-type");if(w)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(p!=null&&p.includes("application/json")){const g=await f.json(),y=Array.isArray(g)?g.map(v=>eu.parse(v)):[eu.parse(g)];for(const v of y)(a=this.onmessage)===null||a===void 0||a.call(this,v)}else throw new Jf(-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 Jf(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 k4=6e4;class N4{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(Hv,r=>{const s=this._requestHandlerAbortControllers.get(r.params.requestId);s==null||s.abort(r.params.reason)}),this.setNotificationHandler(Kv,r=>{this._onprogress(r)}),this.setRequestHandler(Bv,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),Fp(c)||ZI(c)?this._onresponse(c):xE(c)?this._onrequest(c,u):GI(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,f)=>this.request(u,d,{...f,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),Fp(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,f,m,h,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++,g={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),g.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._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(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`))),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 k=r.parse(S.result);i(k)}catch(k){c(k)}}}),(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 v=(h=s==null?void 0:s.timeout)!==null&&h!==void 0?h:k4,b=()=>y(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(g,{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 j4(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 om={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)})(yC,function(r){function s(){for(var $=arguments.length,P=Array($),M=0;M<$;M++)P[M]=arguments[M];if(P.length>1){P[0]=P[0].slice(0,-1);for(var B=P.length-1,H=1;H<B;++H)P[H]=P[H].slice(1,-1);return P[B]=P[B].slice(1),P.join("")}else return P[0]}function n($){return"(?:"+$+")"}function a($){return $===void 0?"undefined":$===null?"null":Object.prototype.toString.call($).split(" ").pop().split("]").shift().toLowerCase()}function o($){return $.toUpperCase()}function i($){return $!=null?$ instanceof Array?$:typeof $.length!="number"||$.split||$.setInterval||$.call?[$]:Array.prototype.slice.call($):[]}function c($,P){var M=$;if(P)for(var B in P)M[B]=P[B];return M}function u($){var P="[A-Za-z]",M="[0-9]",B=s(M,"[A-Fa-f]"),H=n(n("%[EFef]"+B+"%"+B+B+"%"+B+B)+"|"+n("%[89A-Fa-f]"+B+"%"+B+B)+"|"+n("%"+B+B)),xe="[\\:\\/\\?\\#\\[\\]\\@]",we="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Qe=s(xe,we),it=$?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",_t=$?"[\\uE000-\\uF8FF]":"[]",He=s(P,M,"[\\-\\.\\_\\~]",it);n(P+s(P,M,"[\\+\\-\\.]")+"*"),n(n(H+"|"+s(He,we,"[\\:]"))+"*");var at=n(n("25[0-5]")+"|"+n("2[0-4]"+M)+"|"+n("1"+M+M)+"|"+n("0?[1-9]"+M)+"|0?0?"+M),Et=n(at+"\\."+at+"\\."+at+"\\."+at),Ne=n(B+"{1,4}"),ft=n(n(Ne+"\\:"+Ne)+"|"+Et),kt=n(n(Ne+"\\:")+"{6}"+ft),ht=n("\\:\\:"+n(Ne+"\\:")+"{5}"+ft),gs=n(n(Ne)+"?\\:\\:"+n(Ne+"\\:")+"{4}"+ft),cn=n(n(n(Ne+"\\:")+"{0,1}"+Ne)+"?\\:\\:"+n(Ne+"\\:")+"{3}"+ft),un=n(n(n(Ne+"\\:")+"{0,2}"+Ne)+"?\\:\\:"+n(Ne+"\\:")+"{2}"+ft),io=n(n(n(Ne+"\\:")+"{0,3}"+Ne)+"?\\:\\:"+Ne+"\\:"+ft),xa=n(n(n(Ne+"\\:")+"{0,4}"+Ne)+"?\\:\\:"+ft),jr=n(n(n(Ne+"\\:")+"{0,5}"+Ne)+"?\\:\\:"+Ne),dn=n(n(n(Ne+"\\:")+"{0,6}"+Ne)+"?\\:\\:"),wa=n([kt,ht,gs,cn,un,io,xa,jr,dn].join("|")),Fn=n(n(He+"|"+H)+"+");n("[vV]"+B+"+\\."+s(He,we,"[\\:]")+"+"),n(n(H+"|"+s(He,we))+"*");var ji=n(H+"|"+s(He,we,"[\\:\\@]"));return n(n(H+"|"+s(He,we,"[\\@]"))+"+"),n(n(ji+"|"+s("[\\/\\?]",_t))+"*"),{NOT_SCHEME:new RegExp(s("[^]",P,M,"[\\+\\-\\.]"),"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,"[\\:\\@\\/\\?]",_t),"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(H,"g"),IPV4ADDRESS:new RegExp("^("+Et+")$"),IPV6ADDRESS:new RegExp("^\\[?("+wa+")"+n(n("\\%25|\\%(?!"+B+"{2})")+"("+Fn+")")+"?\\]?$")}}var d=u(!1),f=u(!0),m=function(){function $(P,M){var B=[],H=!0,xe=!1,we=void 0;try{for(var Qe=P[Symbol.iterator](),it;!(H=(it=Qe.next()).done)&&(B.push(it.value),!(M&&B.length===M));H=!0);}catch(_t){xe=!0,we=_t}finally{try{!H&&Qe.return&&Qe.return()}finally{if(xe)throw we}}return B}return function(P,M){if(Array.isArray(P))return P;if(Symbol.iterator in Object(P))return $(P,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function($){if(Array.isArray($)){for(var P=0,M=Array($.length);P<$.length;P++)M[P]=$[P];return M}else return Array.from($)},w=2147483647,p=36,g=1,y=26,v=38,b=700,S=72,E=128,k="-",N=/^xn--/,T=/[^\0-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,U={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=p-g,A=Math.floor,_=String.fromCharCode;function O($){throw new RangeError(U[$])}function z($,P){for(var M=[],B=$.length;B--;)M[B]=P($[B]);return M}function j($,P){var M=$.split("@"),B="";M.length>1&&(B=M[0]+"@",$=M[1]),$=$.replace(D,".");var H=$.split("."),xe=z(H,P).join(".");return B+xe}function K($){for(var P=[],M=0,B=$.length;M<B;){var H=$.charCodeAt(M++);if(H>=55296&&H<=56319&&M<B){var xe=$.charCodeAt(M++);(xe&64512)==56320?P.push(((H&1023)<<10)+(xe&1023)+65536):(P.push(H),M--)}else P.push(H)}return P}var C=function(P){return String.fromCodePoint.apply(String,h(P))},F=function(P){return P-48<10?P-22:P-65<26?P-65:P-97<26?P-97:p},L=function(P,M){return P+22+75*(P<26)-((M!=0)<<5)},Q=function(P,M,B){var H=0;for(P=B?A(P/b):P>>1,P+=A(P/M);P>R*y>>1;H+=p)P=A(P/R);return A(H+(R+1)*P/(P+v))},te=function(P){var M=[],B=P.length,H=0,xe=E,we=S,Qe=P.lastIndexOf(k);Qe<0&&(Qe=0);for(var it=0;it<Qe;++it)P.charCodeAt(it)>=128&&O("not-basic"),M.push(P.charCodeAt(it));for(var _t=Qe>0?Qe+1:0;_t<B;){for(var He=H,at=1,Et=p;;Et+=p){_t>=B&&O("invalid-input");var Ne=F(P.charCodeAt(_t++));(Ne>=p||Ne>A((w-H)/at))&&O("overflow"),H+=Ne*at;var ft=Et<=we?g:Et>=we+y?y:Et-we;if(Ne<ft)break;var kt=p-ft;at>A(w/kt)&&O("overflow"),at*=kt}var ht=M.length+1;we=Q(H-He,ht,He==0),A(H/ht)>w-xe&&O("overflow"),xe+=A(H/ht),H%=ht,M.splice(H++,0,xe)}return String.fromCodePoint.apply(String,M)},V=function(P){var M=[];P=K(P);var B=P.length,H=E,xe=0,we=S,Qe=!0,it=!1,_t=void 0;try{for(var He=P[Symbol.iterator](),at;!(Qe=(at=He.next()).done);Qe=!0){var Et=at.value;Et<128&&M.push(_(Et))}}catch(Ri){it=!0,_t=Ri}finally{try{!Qe&&He.return&&He.return()}finally{if(it)throw _t}}var Ne=M.length,ft=Ne;for(Ne&&M.push(k);ft<B;){var kt=w,ht=!0,gs=!1,cn=void 0;try{for(var un=P[Symbol.iterator](),io;!(ht=(io=un.next()).done);ht=!0){var xa=io.value;xa>=H&&xa<kt&&(kt=xa)}}catch(Ri){gs=!0,cn=Ri}finally{try{!ht&&un.return&&un.return()}finally{if(gs)throw cn}}var jr=ft+1;kt-H>A((w-xe)/jr)&&O("overflow"),xe+=(kt-H)*jr,H=kt;var dn=!0,wa=!1,Fn=void 0;try{for(var ji=P[Symbol.iterator](),pg;!(dn=(pg=ji.next()).done);dn=!0){var mg=pg.value;if(mg<H&&++xe>w&&O("overflow"),mg==H){for(var ec=xe,tc=p;;tc+=p){var rc=tc<=we?g:tc>=we+y?y:tc-we;if(ec<rc)break;var vg=ec-rc,gg=p-rc;M.push(_(L(rc+vg%gg,0))),ec=A(vg/gg)}M.push(_(L(ec,0))),we=Q(xe,jr,ft==Ne),xe=0,++ft}}}catch(Ri){wa=!0,Fn=Ri}finally{try{!dn&&ji.return&&ji.return()}finally{if(wa)throw Fn}}++xe,++H}return M.join("")},de=function(P){return j(P,function(M){return N.test(M)?te(M.slice(4).toLowerCase()):M})},Te=function(P){return j(P,function(M){return T.test(M)?"xn--"+V(M):M})},ge={version:"2.1.0",ucs2:{decode:K,encode:C},decode:te,encode:V,toASCII:Te,toUnicode:de},X={};function he($){var P=$.charCodeAt(0),M=void 0;return P<16?M="%0"+P.toString(16).toUpperCase():P<128?M="%"+P.toString(16).toUpperCase():P<2048?M="%"+(P>>6|192).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase():M="%"+(P>>12|224).toString(16).toUpperCase()+"%"+(P>>6&63|128).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase(),M}function pe($){for(var P="",M=0,B=$.length;M<B;){var H=parseInt($.substr(M+1,2),16);if(H<128)P+=String.fromCharCode(H),M+=3;else if(H>=194&&H<224){if(B-M>=6){var xe=parseInt($.substr(M+4,2),16);P+=String.fromCharCode((H&31)<<6|xe&63)}else P+=$.substr(M,6);M+=6}else if(H>=224){if(B-M>=9){var we=parseInt($.substr(M+4,2),16),Qe=parseInt($.substr(M+7,2),16);P+=String.fromCharCode((H&15)<<12|(we&63)<<6|Qe&63)}else P+=$.substr(M,9);M+=9}else P+=$.substr(M,3),M+=3}return P}function ye($,P){function M(B){var H=pe(B);return H.match(P.UNRESERVED)?H:B}return $.scheme&&($.scheme=String($.scheme).replace(P.PCT_ENCODED,M).toLowerCase().replace(P.NOT_SCHEME,"")),$.userinfo!==void 0&&($.userinfo=String($.userinfo).replace(P.PCT_ENCODED,M).replace(P.NOT_USERINFO,he).replace(P.PCT_ENCODED,o)),$.host!==void 0&&($.host=String($.host).replace(P.PCT_ENCODED,M).toLowerCase().replace(P.NOT_HOST,he).replace(P.PCT_ENCODED,o)),$.path!==void 0&&($.path=String($.path).replace(P.PCT_ENCODED,M).replace($.scheme?P.NOT_PATH:P.NOT_PATH_NOSCHEME,he).replace(P.PCT_ENCODED,o)),$.query!==void 0&&($.query=String($.query).replace(P.PCT_ENCODED,M).replace(P.NOT_QUERY,he).replace(P.PCT_ENCODED,o)),$.fragment!==void 0&&($.fragment=String($.fragment).replace(P.PCT_ENCODED,M).replace(P.NOT_FRAGMENT,he).replace(P.PCT_ENCODED,o)),$}function ue($){return $.replace(/^0*(.*)/,"$1")||"0"}function Pe($,P){var M=$.match(P.IPV4ADDRESS)||[],B=m(M,2),H=B[1];return H?H.split(".").map(ue).join("."):$}function Ae($,P){var M=$.match(P.IPV6ADDRESS)||[],B=m(M,3),H=B[1],xe=B[2];if(H){for(var we=H.toLowerCase().split("::").reverse(),Qe=m(we,2),it=Qe[0],_t=Qe[1],He=_t?_t.split(":").map(ue):[],at=it.split(":").map(ue),Et=P.IPV4ADDRESS.test(at[at.length-1]),Ne=Et?7:8,ft=at.length-Ne,kt=Array(Ne),ht=0;ht<Ne;++ht)kt[ht]=He[ht]||at[ft+ht]||"";Et&&(kt[Ne-1]=Pe(kt[Ne-1],P));var gs=kt.reduce(function(jr,dn,wa){if(!dn||dn==="0"){var Fn=jr[jr.length-1];Fn&&Fn.index+Fn.length===wa?Fn.length++:jr.push({index:wa,length:1})}return jr},[]),cn=gs.sort(function(jr,dn){return dn.length-jr.length})[0],un=void 0;if(cn&&cn.length>1){var io=kt.slice(0,cn.index),xa=kt.slice(cn.index+cn.length);un=io.join(":")+"::"+xa.join(":")}else un=kt.join(":");return xe&&(un+="%"+xe),un}else return $}var De=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,J="".match(/(){0}/)[1]===void 0;function ie($){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M={},B=P.iri!==!1?f:d;P.reference==="suffix"&&($=(P.scheme?P.scheme+":":"")+"//"+$);var H=$.match(De);if(H){J?(M.scheme=H[1],M.userinfo=H[3],M.host=H[4],M.port=parseInt(H[5],10),M.path=H[6]||"",M.query=H[7],M.fragment=H[8],isNaN(M.port)&&(M.port=H[5])):(M.scheme=H[1]||void 0,M.userinfo=$.indexOf("@")!==-1?H[3]:void 0,M.host=$.indexOf("//")!==-1?H[4]:void 0,M.port=parseInt(H[5],10),M.path=H[6]||"",M.query=$.indexOf("?")!==-1?H[7]:void 0,M.fragment=$.indexOf("#")!==-1?H[8]:void 0,isNaN(M.port)&&(M.port=$.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?H[4]:void 0)),M.host&&(M.host=Ae(Pe(M.host,B),B)),M.scheme===void 0&&M.userinfo===void 0&&M.host===void 0&&M.port===void 0&&!M.path&&M.query===void 0?M.reference="same-document":M.scheme===void 0?M.reference="relative":M.fragment===void 0?M.reference="absolute":M.reference="uri",P.reference&&P.reference!=="suffix"&&P.reference!==M.reference&&(M.error=M.error||"URI is not a "+P.reference+" reference.");var xe=X[(P.scheme||M.scheme||"").toLowerCase()];if(!P.unicodeSupport&&(!xe||!xe.unicodeSupport)){if(M.host&&(P.domainHost||xe&&xe.domainHost))try{M.host=ge.toASCII(M.host.replace(B.PCT_ENCODED,pe).toLowerCase())}catch(we){M.error=M.error||"Host's domain name can not be converted to ASCII via punycode: "+we}ye(M,d)}else ye(M,B);xe&&xe.parse&&xe.parse(M,P)}else M.error=M.error||"URI can not be parsed.";return M}function Y($,P){var M=P.iri!==!1?f:d,B=[];return $.userinfo!==void 0&&(B.push($.userinfo),B.push("@")),$.host!==void 0&&B.push(Ae(Pe(String($.host),M),M).replace(M.IPV6ADDRESS,function(H,xe,we){return"["+xe+(we?"%25"+we:"")+"]"})),(typeof $.port=="number"||typeof $.port=="string")&&(B.push(":"),B.push(String($.port))),B.length?B.join(""):void 0}var ze=/^\.\.?\//,ee=/^\/\.(\/|$)/,Oe=/^\/\.\.(\/|$)/,Fe=/^\/?(?:.|\n)*?(?=\/|$)/;function ke($){for(var P=[];$.length;)if($.match(ze))$=$.replace(ze,"");else if($.match(ee))$=$.replace(ee,"/");else if($.match(Oe))$=$.replace(Oe,"/"),P.pop();else if($==="."||$==="..")$="";else{var M=$.match(Fe);if(M){var B=M[0];$=$.slice(B.length),P.push(B)}else throw new Error("Unexpected dot segment condition")}return P.join("")}function st($){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=P.iri?f:d,B=[],H=X[(P.scheme||$.scheme||"").toLowerCase()];if(H&&H.serialize&&H.serialize($,P),$.host&&!M.IPV6ADDRESS.test($.host)){if(P.domainHost||H&&H.domainHost)try{$.host=P.iri?ge.toUnicode($.host):ge.toASCII($.host.replace(M.PCT_ENCODED,pe).toLowerCase())}catch(Qe){$.error=$.error||"Host's domain name can not be converted to "+(P.iri?"Unicode":"ASCII")+" via punycode: "+Qe}}ye($,M),P.reference!=="suffix"&&$.scheme&&(B.push($.scheme),B.push(":"));var xe=Y($,P);if(xe!==void 0&&(P.reference!=="suffix"&&B.push("//"),B.push(xe),$.path&&$.path.charAt(0)!=="/"&&B.push("/")),$.path!==void 0){var we=$.path;!P.absolutePath&&(!H||!H.absolutePath)&&(we=ke(we)),xe===void 0&&(we=we.replace(/^\/\//,"/%2F")),B.push(we)}return $.query!==void 0&&(B.push("?"),B.push($.query)),$.fragment!==void 0&&(B.push("#"),B.push($.fragment)),B.join("")}function vt($,P){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},B=arguments[3],H={};return B||($=ie(st($,M),M),P=ie(st(P,M),M)),M=M||{},!M.tolerant&&P.scheme?(H.scheme=P.scheme,H.userinfo=P.userinfo,H.host=P.host,H.port=P.port,H.path=ke(P.path||""),H.query=P.query):(P.userinfo!==void 0||P.host!==void 0||P.port!==void 0?(H.userinfo=P.userinfo,H.host=P.host,H.port=P.port,H.path=ke(P.path||""),H.query=P.query):(P.path?(P.path.charAt(0)==="/"?H.path=ke(P.path):(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path?H.path="/"+P.path:$.path?H.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+P.path:H.path=P.path,H.path=ke(H.path)),H.query=P.query):(H.path=$.path,P.query!==void 0?H.query=P.query:H.query=$.query),H.userinfo=$.userinfo,H.host=$.host,H.port=$.port),H.scheme=$.scheme),H.fragment=P.fragment,H}function Hr($,P,M){var B=c({scheme:"null"},M);return st(vt(ie($,B),ie(P,B),B,!0),B)}function zt($,P){return typeof $=="string"?$=st(ie($,P),P):a($)==="object"&&($=ie(st($,P),P)),$}function fs($,P,M){return typeof $=="string"?$=st(ie($,M),M):a($)==="object"&&($=st($,M)),typeof P=="string"?P=st(ie(P,M),M):a(P)==="object"&&(P=st(P,M)),$===P}function oo($,P){return $&&$.toString().replace(!P||!P.iri?d.ESCAPE:f.ESCAPE,he)}function Yt($,P){return $&&$.toString().replace(!P||!P.iri?d.PCT_ENCODED:f.PCT_ENCODED,pe)}var Br={scheme:"http",domainHost:!0,parse:function(P,M){return P.host||(P.error=P.error||"HTTP URIs must have a host."),P},serialize:function(P,M){var B=String(P.scheme).toLowerCase()==="https";return(P.port===(B?443:80)||P.port==="")&&(P.port=void 0),P.path||(P.path="/"),P}},hs={scheme:"https",domainHost:Br.domainHost,parse:Br.parse,serialize:Br.serialize};function Nr($){return typeof $.secure=="boolean"?$.secure:String($.scheme).toLowerCase()==="wss"}var Dn={scheme:"ws",domainHost:!0,parse:function(P,M){var B=P;return B.secure=Nr(B),B.resourceName=(B.path||"/")+(B.query?"?"+B.query:""),B.path=void 0,B.query=void 0,B},serialize:function(P,M){if((P.port===(Nr(P)?443:80)||P.port==="")&&(P.port=void 0),typeof P.secure=="boolean"&&(P.scheme=P.secure?"wss":"ws",P.secure=void 0),P.resourceName){var B=P.resourceName.split("?"),H=m(B,2),xe=H[0],we=H[1];P.path=xe&&xe!=="/"?xe:void 0,P.query=we,P.resourceName=void 0}return P.fragment=void 0,P}},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]",Pt=n(n("%[EFef]"+ne+"%"+ne+ne+"%"+ne+ne)+"|"+n("%[89A-Fa-f]"+ne+"%"+ne+ne)+"|"+n("%"+ne+ne)),$n="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Mn="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Yl=s(Mn,'[\\"\\\\]'),Jl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Xl=new RegExp(ms,"g"),re=new RegExp(Pt,"g"),Ee=new RegExp(s("[^]",$n,"[\\.]",'[\\"]',Yl),"g"),Ke=new RegExp(s("[^]",ms,Jl),"g"),Je=Ke;function Xe($){var P=pe($);return P.match(Xl)?P:$}var vs={scheme:"mailto",parse:function(P,M){var B=P,H=B.to=B.path?B.path.split(","):[];if(B.path=void 0,B.query){for(var xe=!1,we={},Qe=B.query.split("&"),it=0,_t=Qe.length;it<_t;++it){var He=Qe[it].split("=");switch(He[0]){case"to":for(var at=He[1].split(","),Et=0,Ne=at.length;Et<Ne;++Et)H.push(at[Et]);break;case"subject":B.subject=Yt(He[1],M);break;case"body":B.body=Yt(He[1],M);break;default:xe=!0,we[Yt(He[0],M)]=Yt(He[1],M);break}}xe&&(B.headers=we)}B.query=void 0;for(var ft=0,kt=H.length;ft<kt;++ft){var ht=H[ft].split("@");if(ht[0]=Yt(ht[0]),M.unicodeSupport)ht[1]=Yt(ht[1],M).toLowerCase();else try{ht[1]=ge.toASCII(Yt(ht[1],M).toLowerCase())}catch(gs){B.error=B.error||"Email address's domain name can not be converted to ASCII via punycode: "+gs}H[ft]=ht.join("@")}return B},serialize:function(P,M){var B=P,H=i(P.to);if(H){for(var xe=0,we=H.length;xe<we;++xe){var Qe=String(H[xe]),it=Qe.lastIndexOf("@"),_t=Qe.slice(0,it).replace(re,Xe).replace(re,o).replace(Ee,he),He=Qe.slice(it+1);try{He=M.iri?ge.toUnicode(He):ge.toASCII(Yt(He,M).toLowerCase())}catch(ft){B.error=B.error||"Email address's domain name can not be converted to "+(M.iri?"Unicode":"ASCII")+" via punycode: "+ft}H[xe]=_t+"@"+He}B.path=H.join(",")}var at=P.headers=P.headers||{};P.subject&&(at.subject=P.subject),P.body&&(at.body=P.body);var Et=[];for(var Ne in at)at[Ne]!==ya[Ne]&&Et.push(Ne.replace(re,Xe).replace(re,o).replace(Ke,he)+"="+at[Ne].replace(re,Xe).replace(re,o).replace(Je,he));return Et.length&&(B.query=Et.join("&")),B}},ef=/^([^\:]+)\:(.*)/,tf={scheme:"urn",parse:function(P,M){var B=P.path&&P.path.match(ef),H=P;if(B){var xe=M.scheme||H.scheme||"urn",we=B[1].toLowerCase(),Qe=B[2],it=xe+":"+(M.nid||we),_t=X[it];H.nid=we,H.nss=Qe,H.path=void 0,_t&&(H=_t.parse(H,M))}else H.error=H.error||"URN can not be parsed.";return H},serialize:function(P,M){var B=M.scheme||P.scheme||"urn",H=P.nid,xe=B+":"+(M.nid||H),we=X[xe];we&&(P=we.serialize(P,M));var Qe=P,it=P.nss;return Qe.path=(H||M.nid)+":"+it,Qe}},rf=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,hg={scheme:"urn:uuid",parse:function(P,M){var B=P;return B.uuid=B.nss,B.nss=void 0,!M.tolerant&&(!B.uuid||!B.uuid.match(rf))&&(B.error=B.error||"UUID is not valid."),B},serialize:function(P,M){var B=P;return B.nss=(P.uuid||"").toLowerCase(),B}};X[Br.scheme]=Br,X[hs.scheme]=hs,X[Dn.scheme]=Dn,X[ps.scheme]=ps,X[vs.scheme]=vs,X[tf.scheme]=tf,X[hg.scheme]=hg,r.SCHEMES=X,r.pctEncChar=he,r.pctDecChars=pe,r.parse=ie,r.removeDotSegments=ke,r.serialize=st,r.resolveComponents=vt,r.resolve=Hr,r.normalize=zt,r.equal=fs,r.escapeComponent=oo,r.unescapeComponent=Yt,Object.defineProperty(r,"__esModule",{value:!0})})})(om,om.exports);var R4=om.exports,sg=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},T4=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},Ni={copy:A4,checkDataType:im,checkDataTypes:O4,coerceToTypes:I4,toHash:ag,getProperty:og,escapeQuotes:ig,equal:sg,ucs2length:T4,varOccurences:M4,varReplace:F4,schemaHasRules:L4,schemaHasRulesExcept:U4,schemaUnknownRules:z4,toQuotedString:lm,getPathExpr:V4,getPath:q4,getData:K4,unescapeFragment:W4,unescapeJsonPointer:cg,escapeFragment:Q4,escapeJsonPointer:lg};function A4(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function im(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 O4(t,e,r){switch(t.length){case 1:return im(t[0],e,r,!0);default:var s="",n=ag(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?" && ":"")+im(a,e,r,!0);return s}}var F0=ag(["string","number","integer","boolean","null"]);function I4(t,e){if(Array.isArray(e)){for(var r=[],s=0;s<e.length;s++){var n=e[s];(F0[n]||t==="array"&&n==="array")&&(r[r.length]=n)}if(r.length)return r}else{if(F0[e])return[e];if(t==="array"&&e==="array")return["array"]}}function ag(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var D4=/^[a-z$_][a-z$_0-9]*$/i,$4=/'|\\/g;function og(t){return typeof t=="number"?"["+t+"]":D4.test(t)?"."+t:"['"+ig(t)+"']"}function ig(t){return t.replace($4,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function M4(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function F4(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function L4(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function U4(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var s in t)if(s!=r&&e[s])return!0}function z4(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function lm(t){return"'"+ig(t)+"'"}function V4(t,e,r,s){var n=r?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return UE(t,n)}function q4(t,e,r){var s=lm(r?"/"+lg(e):og(e));return UE(t,s)}var H4=/^\/(?:[^~]|~0|~1)*$/,B4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function K4(t,e,r){var s,n,a,o;if(t==="")return"rootData";if(t[0]=="/"){if(!H4.test(t))throw new Error("Invalid JSON-pointer: "+t);n=t,a="rootData"}else{if(o=t.match(B4),!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+=og(cg(d)),i+=" && "+a)}return i}function UE(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function W4(t){return cg(decodeURIComponent(t))}function Q4(t){return encodeURIComponent(lg(t))}function lg(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function cg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var G4=Ni,zE=Z4;function Z4(t){G4.copy(t,this)}var VE={exports:{}},Hs=VE.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 f=s[d];if(Array.isArray(f)){if(d in Hs.arrayKeywords)for(var m=0;m<f.length;m++)nu(t,e,r,f[m],n+"/"+d+"/"+m,a,n,d,s,m)}else if(d in Hs.propsKeywords){if(f&&typeof f=="object")for(var h in f)nu(t,e,r,f[h],n+"/"+d+"/"+Y4(h),a,n,d,s,h)}else(d in Hs.keywords||t.allKeys&&!(d in Hs.skipKeywords))&&nu(t,e,r,f,n+"/"+d,a,n,d,s)}r(s,n,a,o,i,c,u)}}function Y4(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var J4=VE.exports,Zl=R4,L0=sg,Gd=Ni,rd=zE,X4=J4,ug=ga;ga.normalizeId=ra;ga.fullPath=nd;ga.url=sd;ga.ids=s$;ga.inlineRef=cm;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 cm(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=cm(a,this._opts.inlineRefs)?a:t.call(this,a,e,void 0,i)),o}function Zd(t,e){var r=Zl.parse(e),s=HE(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 e$.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 qE.call(this,r,n,t.schema,t)}function e$(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)),qE.call(this,r,a,n,t)}}var t$=Gd.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function qE(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(!t$[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 r$=Gd.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function cm(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return um(t);if(e)return dm(t)<=e}function um(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!um(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!um(e)))return!1;return!0}function dm(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+=dm(r)),e==1/0)return 1/0}else for(var n in t){if(n=="$ref")return 1/0;if(r$[n])e++;else if(r=t[n],typeof r=="object"&&(e+=dm(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 HE(r)}function HE(t){return Zl.serialize(t).split("#")[0]+"#"}var n$=/#\/?$/;function ra(t){return t?t.replace(n$,""):""}function sd(t,e){return e=ra(e),Zl.resolve(t,e)}function s$(t){var e=ra(this._getId(t)),r={"":e},s={"":nd(e,!1)},n={},a=this;return X4(t,{allKeys:!0},function(o,i,c,u,d,f,m){if(i!==""){var h=a._getId(o),w=r[u],p=s[u]+"/"+d;if(m!==void 0&&(p+="/"+(typeof m=="number"?m:Gd.escapeFragment(m))),typeof h=="string"){h=w=ra(w?Zl.resolve(w,h):h);var g=a._refs[h];if(typeof g=="string"&&(g=a._refs[g]),g&&g.schema){if(!L0(o,g.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=ra(p))if(h[0]=="#"){if(n[h]&&!L0(o,n[h]))throw new Error('id "'+h+'" resolves to more than one schema');n[h]=o}else a._refs[h]=p}r[i]=w,s[i]=p}}),n}var Xf=ug,dg={Validation:U0(a$),MissingRef:U0(fg)};function a$(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}fg.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function fg(t,e,r){this.message=r||fg.message(t,e),this.missingRef=Xf.url(t,e),this.missingSchema=Xf.normalizeId(Xf.fullPath(this.missingRef))}function U0(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var BE=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 f=d[i],m=a(o[f]);m&&(c&&(c+=","),c+=JSON.stringify(f)+":"+m)}return n.splice(u,1),"{"+c+"}"}}(t)},KE=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,f=e.dataLevel,m=e.schema[r],h=e.schemaPath+e.util.getProperty(r),w=e.errSchemaPath+"/"+r,E=!e.opts.allErrors,T,p="data"+(f||""),S="valid"+d;if(e.schema===!1){e.isTop?E=!0:n+=" var "+S+" = false; ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(T||"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=g.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 v=e.isTop,d=e.level=0,f=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,f=e.dataLevel,p="data"+(f||"");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,k="",N="",T,D=e.schema.type,U=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(U?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],U=!0)),U&&D.length==1&&(D=D[0],U=!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")),D){if(e.opts.coerceTypes)var R=e.util.coerceToTypes(e.opts.coerceTypes,D);var A=e.RULES.types[D];if(R||U||A===!0||A&&!ee(A)){var h=e.schemaPath+".type",w=e.errSchemaPath+"/type",h=e.schemaPath+".type",w=e.errSchemaPath+"/type",_=U?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[_](D,p,e.opts.strictNumbers,!0)+") { ",R){var O="dataType"+d,z="coerced"+d;n+=" var "+O+" = typeof "+p+"; var "+z+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+O+" == 'object' && Array.isArray("+p+") && "+p+".length == 1) { "+p+" = "+p+"[0]; "+O+" = typeof "+p+"; if ("+e.util.checkDataType(e.schema.type,p,e.opts.strictNumbers)+") "+z+" = "+p+"; } "),n+=" if ("+z+" !== undefined) ; ";var j=R;if(j)for(var K,C=-1,F=j.length-1;C<F;)K=j[C+=1],K=="string"?n+=" else if ("+O+" == 'number' || "+O+" == 'boolean') "+z+" = '' + "+p+"; else if ("+p+" === null) "+z+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+O+" == 'boolean' || "+p+" === null || ("+O+" == '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 ("+O+" == 'string' || "+O+" == 'number' || "+O+" == 'boolean' || "+p+" == null) "+z+" = ["+p+"]; ");n+=" else { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(T||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",U?n+=""+D.join(","):n+=""+D,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",U?n+=""+D.join(","):n+=""+D,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=g.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=f?"data"+(f-1||""):"parentData",Q=f?e.dataPathArr[f]:"parentDataProperty";n+=" "+p+" = "+z+"; ",f||(n+="if ("+L+" !== undefined)"),n+=" "+L+"["+Q+"] = "+z+"; } "}else{var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(T||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",U?n+=""+D.join(","):n+=""+D,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",U?n+=""+D.join(","):n+=""+D,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=g.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 === ",v?n+="0":n+="errs_"+d,n+=") { ",N+="}");else{var te=e.RULES;if(te){for(var A,V=-1,de=te.length-1;V<de;)if(A=te[V+=1],ee(A)){if(A.type&&(n+=" if ("+e.util.checkDataType(A.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(A.type=="object"&&e.schema.properties){var m=e.schema.properties,Te=Object.keys(m),ge=Te;if(ge)for(var X,he=-1,pe=ge.length-1;he<pe;){X=ge[he+=1];var ye=m[X];if(ye.default!==void 0){var ue=p+e.util.getProperty(X);if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+ue;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else n+=" if ("+ue+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+ue+" === null || "+ue+" === '' "),n+=" ) "+ue+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(ye.default)+" ":n+=" "+JSON.stringify(ye.default)+" ",n+="; "}}}else if(A.type=="array"&&Array.isArray(e.schema.items)){var Pe=e.schema.items;if(Pe){for(var ye,C=-1,Ae=Pe.length-1;C<Ae;)if(ye=Pe[C+=1],ye.default!==void 0){var ue=p+"["+C+"]";if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+ue;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else n+=" if ("+ue+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+ue+" === null || "+ue+" === '' "),n+=" ) "+ue+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(ye.default)+" ":n+=" "+JSON.stringify(ye.default)+" ",n+="; "}}}}var De=A.rules;if(De){for(var J,ie=-1,Y=De.length-1;ie<Y;)if(J=De[ie+=1],Oe(J)){var ze=J.code(e,J.keyword,A.type);ze&&(n+=" "+ze+" ",E&&(k+="}"))}}if(E&&(n+=" "+k+" ",k=""),A.type&&(n+=" } ",D&&D===A.type&&!R)){n+=" else { ";var h=e.schemaPath+".type",w=e.errSchemaPath+"/type",g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(T||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(w)+" , params: { type: '",U?n+=""+D.join(","):n+=""+D,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",U?n+=""+D.join(","):n+=""+D,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;n=g.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 === ",v?n+="0":n+="errs_"+d,n+=") { ",N+="}")}}}E&&(n+=" "+N+" "),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 ee(ke){for(var st=ke.rules,vt=0;vt<st.length;vt++)if(Oe(st[vt]))return!0}function Oe(ke){return e.schema[ke.keyword]!==void 0||ke.implements&&Fe(ke)}function Fe(ke){for(var st=ke.implements,vt=0;vt<st.length;vt++)if(e.schema[st[vt]]!==void 0)return!0}return n},Tc=ug,ad=Ni,WE=dg,o$=BE,z0=KE,i$=ad.ucs2length,l$=sg,c$=WE.Validation,u$=fm;function fm(t,e,r,s){var n=this,a=this._opts,o=[void 0],i={},c=[],u={},d=[],f={},m=[];e=e||{schema:t,refVal:o,refs:i};var h=d$.call(this,t,e,s),w=this._compilations[h.index];if(h.compiling)return w.callValidate=b;var p=this._formats,g=this.RULES;try{var y=S(t,e,r,s);w.validate=y;var v=w.callValidate;return v&&(v.schema=y.schema,v.errors=null,v.refs=y.refs,v.refVal=y.refVal,v.root=y.root,v.$async=y.$async,a.sourceCode&&(v.source=y.source)),y}finally{f$.call(this,t,e,s)}function b(){var _=w.validate,O=_.apply(this,arguments);return b.errors=_.errors,O}function S(_,O,z,j){var K=!O||O&&O.schema==_;if(O.schema!=e.schema)return fm.call(n,_,O,z,j);var C=_.$async===!0,F=z0({isTop:!0,schema:_,isRoot:K,baseId:j,root:O,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:WE.MissingRef,RULES:g,validate:z0,util:ad,resolve:Tc,resolveRef:E,usePattern:U,useDefault:R,useCustomRule:A,opts:a,formats:p,logger:n.logger,self:n});F=Ac(o,m$)+Ac(c,h$)+Ac(d,p$)+Ac(m,v$)+F,a.processCode&&(F=a.processCode(F,_));var L;try{var Q=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",F);L=Q(n,g,p,e,o,d,m,l$,i$,c$),o[0]=L}catch(te){throw n.logger.error("Error compiling schema, function code:",F),te}return L.schema=_,L.errors=null,L.refs=i,L.refVal=o,L.root=K?L:O,C&&(L.$async=!0),a.sourceCode===!0&&(L.source={code:F,patterns:c,defaults:d}),L}function E(_,O,z){O=Tc.url(_,O);var j=i[O],K,C;if(j!==void 0)return K=o[j],C="refVal["+j+"]",D(K,C);if(!z&&e.refs){var F=e.refs[O];if(F!==void 0)return K=e.refVal[F],C=k(O,K),D(K,C)}C=k(O);var L=Tc.call(n,S,e,O);if(L===void 0){var Q=r&&r[O];Q&&(L=Tc.inlineRef(Q,a.inlineRefs)?Q:fm.call(n,Q,e,r,_))}if(L===void 0)N(O);else return T(O,L),D(L,C)}function k(_,O){var z=o.length;return o[z]=O,i[_]=z,"refVal"+z}function N(_){delete i[_]}function T(_,O){var z=i[_];o[z]=O}function D(_,O){return typeof _=="object"||typeof _=="boolean"?{code:O,schema:_,inline:!0}:{code:O,$async:_&&!!_.$async}}function U(_){var O=u[_];return O===void 0&&(O=u[_]=c.length,c[O]=_),"pattern"+O}function R(_){switch(typeof _){case"boolean":case"number":return""+_;case"string":return ad.toQuotedString(_);case"object":if(_===null)return"null";var O=o$(_),z=f[O];return z===void 0&&(z=f[O]=d.length,d[z]=_),"default"+z}}function A(_,O,z,j){if(n._opts.validateSchema!==!1){var K=_.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 C=_.definition.validateSchema;if(C){var F=C(O);if(!F){var L="keyword schema is invalid: "+n.errorsText(C.errors);if(n._opts.validateSchema=="log")n.logger.error(L);else throw new Error(L)}}}var Q=_.definition.compile,te=_.definition.inline,V=_.definition.macro,de;if(Q)de=Q.call(n,O,z,j);else if(V)de=V.call(n,O,z,j),a.validateSchema!==!1&&n.validateSchema(de,!0);else if(te)de=te.call(n,j,_.keyword,O,z);else if(de=_.definition.validate,!de)return;if(de===void 0)throw new Error('custom keyword "'+_.keyword+'"failed to compile');var Te=m.length;return m[Te]=de,{code:"customRule"+Te,validate:de}}}function d$(t,e,r){var s=QE.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 f$(t,e,r){var s=QE.call(this,t,e,r);s>=0&&this._compilations.splice(s,1)}function QE(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 h$(t,e){return"var pattern"+t+" = new RegExp("+ad.toQuotedString(e[t])+");"}function p$(t){return"var default"+t+" = defaults["+t+"];"}function m$(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function v$(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 GE={exports:{}},Yd=GE.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 g$=GE.exports,y$=Ni,x$=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,w$=[0,31,28,31,30,31,30,31,31,30,31,30,31],b$=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,ZE=/^(?=.{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,S$=/^(?:[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,_$=/^(?:[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,YE=/^(?:(?:[^\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,JE=/^(?:(?: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,XE=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,eC=/^(?:\/(?:[^~/]|~0|~1)*)*$/,tC=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,rC=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,E$=Jd;function Jd(t){return t=t=="full"?"full":"fast",y$.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":YE,url:JE,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:ZE,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:aC,uuid:XE,"json-pointer":eC,"json-pointer-uri-fragment":tC,"relative-json-pointer":rC};Jd.full={date:nC,time:sC,"date-time":k$,uri:j$,"uri-reference":_$,"uri-template":YE,url:JE,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:ZE,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:aC,uuid:XE,"json-pointer":eC,"json-pointer-uri-fragment":tC,"relative-json-pointer":rC};function C$(t){return t%4===0&&(t%100!==0||t%400===0)}function nC(t){var e=t.match(x$);if(!e)return!1;var r=+e[1],s=+e[2],n=+e[3];return s>=1&&s<=12&&n>=1&&n<=(s==2&&C$(r)?29:w$[s])}function sC(t,e){var r=t.match(b$);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 P$=/t|\s/i;function k$(t){var e=t.split(P$);return e.length==2&&nC(e[0])&&sC(e[1],!0)}var N$=/\/|:/;function j$(t){return N$.test(t)&&S$.test(t)}var R$=/[^\\]\\Z/;function aC(t){if(R$.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var T$=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||""),f="valid"+a,m,h;if(i=="#"||i=="#/")e.isRoot?(m=e.async,h="validate"):(m=e.root.schema.$async===!0,h="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 g=g||[];g.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=g.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 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,h=w.code}if(h){var g=g||[];g.push(n),n="",e.opts.passContext?n+=" "+h+".call(this, ":n+=" "+h+"( ",n+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var E=o?"data"+(o-1||""):"parentData",k=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+E+" , "+k+", rootData) ";var N=n;if(n=g.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+f+"; "),n+=" try { await "+N+"; ",u&&(n+=" "+f+" = 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+=" "+f+" = false; "),n+=" } ",u&&(n+=" if ("+f+") { ")}else n+=" if (!"+N+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n},A$=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 f="valid"+u.level,m=u.baseId,h=!0,w=a;if(w)for(var p,g=-1,y=w.length-1;g<y;)p=w[g+=1],(e.opts.strictKeywords?typeof p=="object"&&Object.keys(p).length>0||p===!1:e.util.schemaHasRules(p,e.RULES.all))&&(h=!1,u.schema=p,u.schemaPath=o+"["+g+"]",u.errSchemaPath=i+"/"+g,n+=" "+e.validate(u)+" ",u.baseId=m,c&&(n+=" if ("+f+") { ",d+="}"));return c&&(h?n+=" if (true) { ":n+=" "+d.slice(0,-1)+" "),n},O$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e),p="";w.level++;var g="valid"+w.level,y=i.every(function(T){return e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all)});if(y){var v=w.baseId;n+=" var "+h+" = errors; var "+m+" = false; ";var b=e.compositeRule;e.compositeRule=w.compositeRule=!0;var S=i;if(S)for(var E,k=-1,N=S.length-1;k<N;)E=S[k+=1],w.schema=E,w.schemaPath=c+"["+k+"]",w.errSchemaPath=u+"/"+k,n+=" "+e.validate(w)+" ",w.baseId=v,n+=" "+m+" = "+m+" || "+g+"; 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: "+f+" "),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 = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else d&&(n+=" if (true) { ");return n},I$=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},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,f="data"+(o||""),m="valid"+a,h=e.opts.$data&&i&&i.$data;h&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; "),h||(n+=" var schema"+a+" = validate.schema"+c+";"),n+="var "+m+" = equal("+f+", 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: "+f+" "),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},$$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e),p="";w.level++;var g="valid"+w.level,y="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 "+h+" = errors;var "+m+";",E){var k=e.compositeRule;e.compositeRule=w.compositeRule=!0,w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" var "+g+" = false; for (var "+y+" = 0; "+y+" < "+f+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var N=f+"["+y+"]";w.dataPathArr[v]=y;var T=e.validate(w);w.baseId=S,e.util.varOccurences(T,b)<2?n+=" "+e.util.varReplace(T,b,N)+" ":n+=" var "+b+" = "+N+"; "+T+" ",n+=" if ("+g+") break; } ",e.compositeRule=w.compositeRule=k,n+=" "+p+" if (!"+g+") {"}else n+=" if ("+f+".length == 0) {";var D=D||[];D.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: "+f+" "),n+=" } "):n+=" {} ";var U=n;return n=D.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++; ",n+=" } else { ",E&&(n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),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,f="data"+(o||""),m="errs__"+a,h=e.util.copy(e),w="";h.level++;var p="valid"+h.level,g={},y={},v=e.opts.ownProperties;for(k in i)if(k!="__proto__"){var b=i[k],S=Array.isArray(b)?y:g;S[k]=b}n+="var "+m+" = errors;";var E=e.errorPath;n+="var missing"+a+";";for(var k in y)if(S=y[k],S.length){if(n+=" if ( "+f+e.util.getProperty(k)+" !== undefined ",v&&(n+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(k)+"') "),d){n+=" && ( ";var N=S;if(N)for(var T,D=-1,U=N.length-1;D<U;){T=N[D+=1],D&&(n+=" || ");var R=e.util.getProperty(T),A=f+R;n+=" ( ( "+A+" === undefined ",v&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(T)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?T:R)+") ) "}n+=")) { ";var _="missing"+a,O="' + "+_+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,_,!0):E+" + "+_);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(k)+"', missingProperty: '"+O+"', 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(k)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var j=n;n=z.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=S;if(K)for(var T,C=-1,F=K.length-1;C<F;){T=K[C+=1];var R=e.util.getProperty(T),O=e.util.escapeQuotes(T),A=f+R;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,T,e.opts.jsonPointers)),n+=" if ( "+A+" === undefined ",v&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(T)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(k)+"', missingProperty: '"+O+"', 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(k)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",d&&(w+="}",n+=" else { ")}e.errorPath=E;var L=h.baseId;for(var k in g){var b=g[k];(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(n+=" "+p+" = true; if ( "+f+e.util.getProperty(k)+" !== undefined ",v&&(n+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(k)+"') "),n+=") { ",h.schema=b,h.schemaPath=c+e.util.getProperty(k),h.errSchemaPath=u+"/"+e.util.escapeFragment(k),n+=" "+e.validate(h)+" ",h.baseId=L,n+=" } ",d&&(n+=" if ("+p+") { ",w+="}"))}return d&&(n+=" "+w+" if ("+m+" == errors) {"),n},F$=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,f="data"+(o||""),m="valid"+a,h=e.opts.$data&&i&&i.$data;h&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var w="i"+a,p="schema"+a;h||(n+=" var "+p+" = validate.schema"+c+";"),n+="var "+m+";",h&&(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("+f+", "+p+"["+w+"])) { "+m+" = true; break; }",h&&(n+=" } "),n+=" if (!"+m+") { ";var g=g||[];g.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: "+f+" "),n+=" } "):n+=" {} ";var y=n;return n=g.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},L$=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,f="data"+(o||"");if(e.opts.format===!1)return d&&(n+=" if (true) { "),n;var m=e.opts.$data&&i&&i.$data,h;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i;var w=e.opts.unknownFormats,p=Array.isArray(w);if(m){var g="format"+a,y="isObject"+a,v="formatType"+a;n+=" var "+g+" = formats["+h+"]; var "+y+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+v+" = "+y+" && "+g+".type || 'string'; if ("+y+") { ",e.async&&(n+=" var async"+a+" = "+g+".async; "),n+=" "+g+" = "+g+".validate; } if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" (",w!="ignore"&&(n+=" ("+h+" && !"+g+" ",p&&(n+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),n+=") || "),n+=" ("+g+" && "+v+" == '"+s+"' && !(typeof "+g+" == 'function' ? ",e.async?n+=" (async"+a+" ? await "+g+"("+f+") : "+g+"("+f+")) ":n+=" "+g+"("+f+") ",n+=" : "+g+".test("+f+"))))) {"}else{var g=e.formats[i];if(!g){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 g=="object"&&!(g instanceof RegExp)&&g.validate,v=y&&g.type||"string";if(y){var b=g.async===!0;g=g.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+"("+f+"))) { "}else{n+=" if (! ";var S="formats"+e.util.getProperty(i);y&&(S+=".validate"),typeof g=="function"?n+=" "+S+"("+f+") ":n+=" "+S+".test("+f+") ",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+=""+h:n+=""+e.util.toQuotedString(i),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+h+" + '":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: "+f+" "),n+=" } "):n+=" {} ";var k=n;return n=E.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+k+"]); ":n+=" validate.errors = ["+k+"]; return false; ":n+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n},U$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e);w.level++;var p="valid"+w.level,g=e.schema.then,y=e.schema.else,v=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,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(v||b){var E;w.createErrors=!1,w.schema=i,w.schemaPath=c,w.errSchemaPath=u,n+=" var "+h+" = errors; var "+m+" = true; ";var k=e.compositeRule;e.compositeRule=w.compositeRule=!0,n+=" "+e.validate(w)+" ",w.baseId=S,w.createErrors=!0,n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=w.compositeRule=k,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: "+f+" "),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},z$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e),p="";w.level++;var g="valid"+w.level,y="i"+a,v=w.dataLevel=e.dataLevel+1,b="data"+v,S=e.baseId;if(n+="var "+h+" = errors;var "+m+";",Array.isArray(i)){var E=e.schema.additionalItems;if(E===!1){n+=" "+m+" = "+f+".length <= "+i.length+"; ";var k=u;u=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var N=N||[];N.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: "+f+" "),n+=" } "):n+=" {} ";var T=n;n=N.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u=k,d&&(p+="}",n+=" else { ")}var D=i;if(D){for(var U,R=-1,A=D.length-1;R<A;)if(U=D[R+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){n+=" "+g+" = true; if ("+f+".length > "+R+") { ";var _=f+"["+R+"]";w.schema=U,w.schemaPath=c+"["+R+"]",w.errSchemaPath=u+"/"+R,w.errorPath=e.util.getPathExpr(e.errorPath,R,e.opts.jsonPointers,!0),w.dataPathArr[v]=R;var O=e.validate(w);w.baseId=S,e.util.varOccurences(O,b)<2?n+=" "+e.util.varReplace(O,b,_)+" ":n+=" var "+b+" = "+_+"; "+O+" ",n+=" } ",d&&(n+=" if ("+g+") { ",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+=" "+g+" = true; if ("+f+".length > "+i.length+") { for (var "+y+" = "+i.length+"; "+y+" < "+f+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var _=f+"["+y+"]";w.dataPathArr[v]=y;var O=e.validate(w);w.baseId=S,e.util.varOccurences(O,b)<2?n+=" "+e.util.varReplace(O,b,_)+" ":n+=" var "+b+" = "+_+"; "+O+" ",d&&(n+=" if (!"+g+") break; "),n+=" } } ",d&&(n+=" if ("+g+") { ",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+" < "+f+".length; "+y+"++) { ",w.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var _=f+"["+y+"]";w.dataPathArr[v]=y;var O=e.validate(w);w.baseId=S,e.util.varOccurences(O,b)<2?n+=" "+e.util.varReplace(O,b,_)+" ":n+=" var "+b+" = "+_+"; "+O+" ",d&&(n+=" if (!"+g+") break; "),n+=" }"}return d&&(n+=" "+p+" if ("+h+" == errors) {"),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,S,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i;var w=r=="maximum",p=w?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[p],y=e.opts.$data&&g&&g.$data,v=w?"<":">",b=w?">":"<",S=void 0;if(!(m||typeof i=="number"||i===void 0))throw new Error(r+" must be number");if(!(y||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(p+" must be number or boolean");if(y){var E=e.util.getData(g.$data,o,e.dataPathArr),k="exclusive"+a,N="exclType"+a,T="exclIsNumber"+a,D="op"+a,U="' + "+D+" + '";n+=" var schemaExcl"+a+" = "+E+"; ",E="schemaExcl"+a,n+=" var "+k+"; var "+N+" = typeof "+E+"; if ("+N+" != 'boolean' && "+N+" != 'undefined' && "+N+" != 'number') { ";var S=p,R=R||[];R.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: "+f+" "),n+=" } "):n+=" {} ";var A=n;n=R.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+N+" == 'number' ? ( ("+k+" = "+h+" === undefined || "+E+" "+v+"= "+h+") ? "+f+" "+b+"= "+E+" : "+f+" "+b+" "+h+" ) : ( ("+k+" = "+E+" === true) ? "+f+" "+b+"= "+h+" : "+f+" "+b+" "+h+" ) || "+f+" !== "+f+") { var op"+a+" = "+k+" ? '"+v+"' : '"+v+"='; ",i===void 0&&(S=p,u=e.errSchemaPath+"/"+p,h=E,m=y)}else{var T=typeof g=="number",U=v;if(T&&m){var D="'"+U+"'";n+=" if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" ( "+h+" === undefined || "+g+" "+v+"= "+h+" ? "+f+" "+b+"= "+g+" : "+f+" "+b+" "+h+" ) || "+f+" !== "+f+") { "}else{T&&i===void 0?(k=!0,S=p,u=e.errSchemaPath+"/"+p,h=g,b+="="):(T&&(h=Math[w?"min":"max"](g,i)),g===(T?h:!0)?(k=!0,S=p,u=e.errSchemaPath+"/"+p,b+="="):(k=!1,U+="="));var D="'"+U+"'";n+=" if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+f+" "+b+" "+h+" || "+f+" !== "+f+") { "}}S=S||r;var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(S||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+D+", limit: "+h+", exclusive: "+k+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+U+" ",m?n+="' + "+h:n+=""+h+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var A=n;return n=R.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; 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,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+f+".length "+w+" "+h+") { ";var p=r,g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",r=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+h+" + '":n+=""+i,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var y=n;return n=g.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},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,p,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),e.opts.unicode===!1?n+=" "+f+".length ":n+=" ucs2length("+f+") ",n+=" "+w+" "+h+") { ";var p=r,g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",r=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+h+" + '":n+=""+i,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var y=n;return n=g.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},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,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i,!(m||typeof i=="number"))throw new Error(r+" must be number");var w=r=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" Object.keys("+f+").length "+w+" "+h+") { ";var p=r,g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",r=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+h+" + '":n+=""+i,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var y=n;return n=g.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},V$=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,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;if(m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i,!(m||typeof i=="number"))throw new Error(r+" must be number");n+="var division"+a+";if (",m&&(n+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),n+=" (division"+a+" = "+f+" / "+h+", ",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: "+h+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+h:n+=""+h+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),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},q$=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,f="data"+(o||""),m="errs__"+a,h=e.util.copy(e);h.level++;var w="valid"+h.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){h.schema=i,h.schemaPath=c,h.errSchemaPath=u,n+=" var "+m+" = errors; ";var p=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1;var g;h.opts.allErrors&&(g=h.opts.allErrors,h.opts.allErrors=!1),n+=" "+e.validate(h)+" ",h.createErrors=!0,g&&(h.opts.allErrors=g),e.compositeRule=h.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: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.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: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(n+=" if (false) { ");return n},H$=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,f="data"+(o||""),m="valid"+a,h="errs__"+a,w=e.util.copy(e),p="";w.level++;var g="valid"+w.level,y=w.baseId,v="prevValid"+a,b="passingSchemas"+a;n+="var "+h+" = errors , "+v+" = false , "+m+" = false , "+b+" = null; ";var S=e.compositeRule;e.compositeRule=w.compositeRule=!0;var E=i;if(E)for(var k,N=-1,T=E.length-1;N<T;)k=E[N+=1],(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))?(w.schema=k,w.schemaPath=c+"["+N+"]",w.errSchemaPath=u+"/"+N,n+=" "+e.validate(w)+" ",w.baseId=y):n+=" var "+g+" = true; ",N&&(n+=" if ("+g+" && "+v+") { "+m+" = false; "+b+" = ["+b+", "+N+"]; } else { ",p+="}"),n+=" if ("+g+") { "+m+" = "+v+" = true; "+b+" = "+N+"; }";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: "+f+" "),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 = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n},B$=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,f="data"+(o||""),m=e.opts.$data&&i&&i.$data,h;m?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+a):h=i;var w=m?"(new RegExp("+h+"))":e.usePattern(i);n+="if ( ",m&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" !"+w+".test("+f+") ) { ";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+=""+h:n+=""+e.util.toQuotedString(i),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+h+" + '":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: "+f+" "),n+=" } "):n+=" {} ";var g=n;return n=p.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},K$=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,f="data"+(o||""),m="errs__"+a,h=e.util.copy(e),w="";h.level++;var p="valid"+h.level,g="key"+a,y="idx"+a,v=h.dataLevel=e.dataLevel+1,b="data"+v,S="dataProperties"+a,E=Object.keys(i||{}).filter(C),k=e.schema.patternProperties||{},N=Object.keys(k).filter(C),T=e.schema.additionalProperties,D=E.length||N.length,U=T===!1,R=typeof T=="object"&&Object.keys(T).length,A=e.opts.removeAdditional,_=U||R||A,O=e.opts.ownProperties,z=e.baseId,j=e.schema.required;if(j&&!(e.opts.$data&&j.$data)&&j.length<e.opts.loopRequired)var K=e.util.toHash(j);function C(fs){return fs!=="__proto__"}if(n+="var "+m+" = errors;var "+p+" = true;",O&&(n+=" var "+S+" = undefined;"),_){if(O?n+=" "+S+" = "+S+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+S+".length; "+y+"++) { var "+g+" = "+S+"["+y+"]; ":n+=" for (var "+g+" in "+f+") { ",D){if(n+=" var isAdditional"+a+" = !(false ",E.length)if(E.length>8)n+=" || validate.schema"+c+".hasOwnProperty("+g+") ";else{var F=E;if(F)for(var L,Q=-1,te=F.length-1;Q<te;)L=F[Q+=1],n+=" || "+g+" == "+e.util.toQuotedString(L)+" "}if(N.length){var V=N;if(V)for(var de,Te=-1,ge=V.length-1;Te<ge;)de=V[Te+=1],n+=" || "+e.usePattern(de)+".test("+g+") "}n+=" ); if (isAdditional"+a+") { "}if(A=="all")n+=" delete "+f+"["+g+"]; ";else{var X=e.errorPath,he="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),U)if(A)n+=" delete "+f+"["+g+"]; ";else{n+=" "+p+" = false; ";var pe=u;u=e.errSchemaPath+"/additionalProperties";var ye=ye||[];ye.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+he+"' } ",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: "+f+" "),n+=" } "):n+=" {} ";var ue=n;n=ye.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+ue+"]); ":n+=" validate.errors = ["+ue+"]; return false; ":n+=" var err = "+ue+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=pe,d&&(n+=" break; ")}else if(R)if(A=="failing"){n+=" var "+m+" = errors; ";var Pe=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=T,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[v]=g;var De=e.validate(h);h.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Ae)+" ":n+=" var "+b+" = "+Ae+"; "+De+" ",n+=" if (!"+p+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+g+"]; } ",e.compositeRule=h.compositeRule=Pe}else{h.schema=T,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[v]=g;var De=e.validate(h);h.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Ae)+" ":n+=" var "+b+" = "+Ae+"; "+De+" ",d&&(n+=" if (!"+p+") break; ")}e.errorPath=X}D&&(n+=" } "),n+=" } ",d&&(n+=" if ("+p+") { ",w+="}")}var J=e.opts.useDefaults&&!e.compositeRule;if(E.length){var ie=E;if(ie)for(var L,Y=-1,ze=ie.length-1;Y<ze;){L=ie[Y+=1];var ee=i[L];if(e.opts.strictKeywords?typeof ee=="object"&&Object.keys(ee).length>0||ee===!1:e.util.schemaHasRules(ee,e.RULES.all)){var Oe=e.util.getProperty(L),Ae=f+Oe,Fe=J&&ee.default!==void 0;h.schema=ee,h.schemaPath=c+Oe,h.errSchemaPath=u+"/"+e.util.escapeFragment(L),h.errorPath=e.util.getPath(e.errorPath,L,e.opts.jsonPointers),h.dataPathArr[v]=e.util.toQuotedString(L);var De=e.validate(h);if(h.baseId=z,e.util.varOccurences(De,b)<2){De=e.util.varReplace(De,b,Ae);var ke=Ae}else{var ke=b;n+=" var "+b+" = "+Ae+"; "}if(Fe)n+=" "+De+" ";else{if(K&&K[L]){n+=" if ( "+ke+" === undefined ",O&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),n+=") { "+p+" = false; ";var X=e.errorPath,pe=u,st=e.util.escapeQuotes(L);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(X,L,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var ye=ye||[];ye.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+st+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+st+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var ue=n;n=ye.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+ue+"]); ":n+=" validate.errors = ["+ue+"]; return false; ":n+=" var err = "+ue+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=pe,e.errorPath=X,n+=" } else { "}else d?(n+=" if ( "+ke+" === undefined ",O&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),n+=") { "+p+" = true; } else { "):(n+=" if ("+ke+" !== undefined ",O&&(n+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),n+=" ) { ");n+=" "+De+" } "}}d&&(n+=" if ("+p+") { ",w+="}")}}if(N.length){var vt=N;if(vt)for(var de,Hr=-1,zt=vt.length-1;Hr<zt;){de=vt[Hr+=1];var ee=k[de];if(e.opts.strictKeywords?typeof ee=="object"&&Object.keys(ee).length>0||ee===!1:e.util.schemaHasRules(ee,e.RULES.all)){h.schema=ee,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(de),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(de),O?n+=" "+S+" = "+S+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+S+".length; "+y+"++) { var "+g+" = "+S+"["+y+"]; ":n+=" for (var "+g+" in "+f+") { ",n+=" if ("+e.usePattern(de)+".test("+g+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[v]=g;var De=e.validate(h);h.baseId=z,e.util.varOccurences(De,b)<2?n+=" "+e.util.varReplace(De,b,Ae)+" ":n+=" var "+b+" = "+Ae+"; "+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},W$=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,f="data"+(o||""),m="errs__"+a,h=e.util.copy(e),w="";h.level++;var p="valid"+h.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)){h.schema=i,h.schemaPath=c,h.errSchemaPath=u;var g="key"+a,y="idx"+a,v="i"+a,b="' + "+g+" + '",S=h.dataLevel=e.dataLevel+1,E="data"+S,k="dataProperties"+a,N=e.opts.ownProperties,T=e.baseId;N&&(n+=" var "+k+" = undefined; "),N?n+=" "+k+" = "+k+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+k+".length; "+y+"++) { var "+g+" = "+k+"["+y+"]; ":n+=" for (var "+g+" in "+f+") { ",n+=" var startErrs"+a+" = errors; ";var D=g,U=e.compositeRule;e.compositeRule=h.compositeRule=!0;var R=e.validate(h);h.baseId=T,e.util.varOccurences(R,E)<2?n+=" "+e.util.varReplace(R,E,D)+" ":n+=" var "+E+" = "+D+"; "+R+" ",e.compositeRule=h.compositeRule=U,n+=" if (!"+p+") { for (var "+v+"=startErrs"+a+"; "+v+"<errors; "+v+"++) { vErrors["+v+"].propertyName = "+g+"; } 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: "+f+" "),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},Q$=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,f="data"+(o||""),m="valid"+a,h=e.opts.$data&&i&&i.$data;h&&(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var w="schema"+a;if(!h)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],g=i;if(g)for(var y,v=-1,b=g.length-1;v<b;){y=g[v+=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(h||p.length){var E=e.errorPath,k=h||p.length>=e.opts.loopRequired,N=e.opts.ownProperties;if(d)if(n+=" var missing"+a+"; ",k){h||(n+=" var "+w+" = validate.schema"+c+"; ");var T="i"+a,D="schema"+a+"["+T+"]",U="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,D,e.opts.jsonPointers)),n+=" var "+m+" = true; ",h&&(n+=" if (schema"+a+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+a+")) "+m+" = false; else {"),n+=" for (var "+T+" = 0; "+T+" < "+w+".length; "+T+"++) { "+m+" = "+f+"["+w+"["+T+"]] !== undefined ",N&&(n+=" && Object.prototype.hasOwnProperty.call("+f+", "+w+"["+T+"]) "),n+="; if (!"+m+") break; } ",h&&(n+=" } "),n+=" if (!"+m+") { ";var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var A=n;n=R.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var _=p;if(_)for(var O,T=-1,z=_.length-1;T<z;){O=_[T+=1],T&&(n+=" || ");var j=e.util.getProperty(O),K=f+j;n+=" ( ( "+K+" === undefined ",N&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(O)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?O:j)+") ) "}n+=") { ";var D="missing"+a,U="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,D,!0):E+" + "+D);var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var A=n;n=R.pop(),!e.compositeRule&&d?e.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(k){h||(n+=" var "+w+" = validate.schema"+c+"; ");var T="i"+a,D="schema"+a+"["+T+"]",U="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,D,e.opts.jsonPointers)),h&&(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: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+w+" !== undefined) { "),n+=" for (var "+T+" = 0; "+T+" < "+w+".length; "+T+"++) { if ("+f+"["+w+"["+T+"]] === undefined ",N&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+w+"["+T+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(n+=" } ")}else{var C=p;if(C)for(var O,F=-1,L=C.length-1;F<L;){O=C[F+=1];var j=e.util.getProperty(O),U=e.util.escapeQuotes(O),K=f+j;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,O,e.opts.jsonPointers)),n+=" if ( "+K+" === undefined ",N&&(n+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(O)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=E}else d&&(n+=" if (true) {");return n},G$=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,f="data"+(o||""),m="valid"+a,h=e.opts.$data&&i&&i.$data,w;if(h?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",w="schema"+a):w=i,(i||h)&&e.opts.uniqueItems!==!1){h&&(n+=" var "+m+"; if ("+w+" === false || "+w+" === undefined) "+m+" = true; else if (typeof "+w+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+f+".length , "+m+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,g=Array.isArray(p);if(!p||p=="object"||p=="array"||g&&(p.indexOf("object")>=0||p.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var y="checkDataType"+(g?"s":"");n+=" if ("+e.util[y](p,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",h&&(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: ",h?n+="validate.schema"+c:n+=""+i,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),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},Z$={$ref:T$,allOf:A$,anyOf:O$,$comment:I$,const:D$,contains:$$,dependencies:M$,enum:F$,format:L$,if:U$,items:z$,maximum:V0,minimum:V0,maxItems:q0,minItems:q0,maxLength:H0,minLength:H0,maxProperties:B0,minProperties:B0,multipleOf:V$,not:q$,oneOf:H$,pattern:B$,properties:K$,propertyNames:W$,required:Q$,uniqueItems:G$,validate:KE},K0=Z$,eh=Ni.toHash,Y$=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=eh(r),e.types=eh(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:K0[o],implements:i};return u}),e.all.$comment={keyword:"$comment",code:K0.$comment},a.type&&(e.types[a.type]=a)}),e.keywords=eh(r.concat(s)),e.custom={},e},W0=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],J$=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<W0.length;a++){var o=W0[a],i=n[o];i&&(n[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},X$=dg.MissingRef,eM=oC;function oC(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)?oC.call(s,{$ref:c},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(u){if(u instanceof X$)return c(u);throw u}function c(u){var d=u.missingSchema;if(h(d))throw new Error("Schema "+d+" is loaded but "+u.missingRef+" cannot be resolved");var f=s._loadingSchemas[d];return f||(f=s._loadingSchemas[d]=s._opts.loadSchema(d),f.then(m,m)),f.then(function(w){if(!h(d))return a(w).then(function(){h(d)||s.addSchema(w,d,void 0,e)})}).then(function(){return o(i)});function m(){delete s._loadingSchemas[d]}function h(w){return s._refs[w]||s._schemas[w]}}}}var tM=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,f,m="data"+(o||""),h="valid"+a,w="errs__"+a,p=e.opts.$data&&i&&i.$data,g;p?(n+=" var schema"+a+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+a):g=i;var y=this,v="definition"+a,b=y.definition,S="",E,k,N,T,D;if(p&&b.$data){D="keywordValidate"+a;var U=b.validateSchema;n+=" var "+v+" = RULES.custom['"+r+"'].definition; var "+D+" = "+v+".validate;"}else{if(T=e.useCustomRule(y,i,e.schema,e),!T)return;g="validate.schema"+c,D=T.code,E=b.compile,k=b.inline,N=b.macro}var R=D+".errors",A="i"+a,_="ruleErr"+a,O=b.async;if(O&&!e.async)throw new Error("async keyword in sync schema");if(k||N||(n+=""+R+" = null;"),n+="var "+w+" = errors;var "+h+";",p&&b.$data&&(S+="}",n+=" if ("+g+" === undefined) { "+h+" = true; } else { ",U&&(S+="}",n+=" "+h+" = "+v+".validateSchema("+g+"); if ("+h+") { ")),k)b.statements?n+=" "+T.validate+" ":n+=" "+h+" = "+T.validate+"; ";else if(N){var z=e.util.copy(e),S="";z.level++;var j="valid"+z.level;z.schema=T.validate,z.schemaPath="";var K=e.compositeRule;e.compositeRule=z.compositeRule=!0;var C=e.validate(z).replace(/validate\.schema/g,D);e.compositeRule=z.compositeRule=K,n+=" "+C}else{var F=F||[];F.push(n),n="",n+=" "+D+".call( ",e.opts.passContext?n+="this":n+="self",E||b.schema===!1?n+=" , "+m+" ":n+=" , "+g+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var L=o?"data"+(o-1||""):"parentData",Q=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+L+" , "+Q+" , rootData ) ";var te=n;n=F.pop(),b.errors===!1?(n+=" "+h+" = ",O&&(n+="await "),n+=""+te+"; "):O?(R="customErrors"+a,n+=" var "+R+" = null; try { "+h+" = await "+te+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+R+" = e.errors; else throw e; } "):n+=" "+R+" = null; "+h+" = "+te+"; "}if(b.modifying&&(n+=" if ("+L+") "+m+" = "+L+"["+Q+"];"),n+=""+S,b.valid)d&&(n+=" if (true) { ");else{n+=" if ( ",b.valid===void 0?(n+=" !",N?n+=""+j:n+=""+h):n+=" "+!b.valid+" ",n+=") { ",f=y.keyword;var F=F||[];F.push(n),n="";var F=F||[];F.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"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 V=n;n=F.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++; ";var de=n;n=F.pop(),k?b.errors?b.errors!="full"&&(n+=" for (var "+A+"="+w+"; "+A+"<errors; "+A+"++) { var "+_+" = vErrors["+A+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+_+".schema = "+g+"; "+_+".data = "+m+"; "),n+=" } "):b.errors===!1?n+=" "+de+" ":(n+=" if ("+w+" == errors) { "+de+" } else { for (var "+A+"="+w+"; "+A+"<errors; "+A+"++) { var "+_+" = vErrors["+A+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+_+".schema = "+g+"; "+_+".data = "+m+"; "),n+=" } } "):N?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(f||"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+=" "+de+" ":(n+=" if (Array.isArray("+R+")) { if (vErrors === null) vErrors = "+R+"; else vErrors = vErrors.concat("+R+"); errors = vErrors.length; for (var "+A+"="+w+"; "+A+"<errors; "+A+"++) { var "+_+" = vErrors["+A+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+e.errorPath+"; "+_+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(n+=" "+_+".schema = "+g+"; "+_+".data = "+m+"; "),n+=" } } else { "+de+" } "),n+=" } ",d&&(n+=" else { ")}return n};const rM="http://json-schema.org/draft-07/schema#",nM="http://json-schema.org/draft-07/schema#",sM="Core schema meta-schema",aM={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:[]}},oM=["object","boolean"],iM={$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:"#"}},iC={$schema:rM,$id:nM,title:sM,definitions:aM,type:oM,properties:iM,default:!0};var Q0=iC,lM={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Q0.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Q0.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"}]}}},cM=/^[a-z_$][a-z0-9_$-]*$/i,uM=tM,dM=lM,fM={add:hM,get:pM,remove:mM,validate:hm};function hM(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!cM.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,f=0;f<r.length;f++){var m=r[f];if(m.type==c){d=m;break}}d||(d={type:c,rules:[]},r.push(d));var h={keyword:i,definition:u,custom:!0,code:uM,implements:u.implements};d.rules.push(h),r.custom[i]=h}return this}function pM(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function mM(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 hm(t,e){hm.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(dM,!0);if(r(t))return!0;if(hm.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}const vM="http://json-schema.org/draft-07/schema#",gM="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",yM="Meta-schema for $data reference (JSON Schema extension proposal)",xM="object",wM=["$data"],bM={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},SM=!1,_M={$schema:vM,$id:gM,description:yM,type:xM,required:wM,properties:bM,additionalProperties:SM};var lC=u$,La=ug,EM=g$,cC=zE,CM=BE,PM=E$,kM=Y$,uC=J$,dC=Ni,NM=St;St.prototype.validate=RM;St.prototype.compile=TM;St.prototype.addSchema=AM;St.prototype.addMetaSchema=OM;St.prototype.validateSchema=IM;St.prototype.getSchema=$M;St.prototype.removeSchema=FM;St.prototype.addFormat=KM;St.prototype.errorsText=BM;St.prototype._addSchema=LM;St.prototype._compile=UM;St.prototype.compileAsync=eM;var Xd=fM;St.prototype.addKeyword=Xd.add;St.prototype.getKeyword=Xd.get;St.prototype.removeKeyword=Xd.remove;St.prototype.validateKeyword=Xd.validate;var fC=dg;St.ValidationError=fC.Validation;St.MissingRefError=fC.MissingRef;St.$dataMetaSchema=uC;var od="http://json-schema.org/draft-07/schema",G0=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],jM=["/properties"];function St(t){if(!(this instanceof St))return new St(t);t=this._opts=dC.copy(t)||{},JM(this),this._schemas={},this._refs={},this._fragments={},this._formats=PM(t.format),this._cache=t.cache||new EM,this._loadingSchemas={},this._compilations=[],this.RULES=kM(),this._getId=zM(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=CM),this._metaOpts=YM(this),t.formats&&GM(this),t.keywords&&ZM(this),WM(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),QM(this)}function RM(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 TM(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function AM(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),pC(this,e),this._schemas[e]=this._addSchema(t,r,s,!0),this}function OM(t,e,r){return this.addSchema(t,e,r,!0),this}function IM(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||DM(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 DM(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 $M(t){var e=hC(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return MM(this,t)}}function MM(t,e){var r=La.schema.call(t,{schema:{}},e);if(r){var s=r.schema,n=r.root,a=r.baseId,o=lC.call(t,s,n,void 0,a);return t._fragments[e]=new cC({ref:e,fragment:!0,schema:s,root:n,baseId:a,validate:o}),o}}function hC(t,e){return e=La.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function FM(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=hC(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 LM(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&&pC(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),f=new cC({id:i,schema:t,localRefs:d,cacheKey:a,meta:r});return i[0]!="#"&&s&&(this._refs[i]=f),this._cache.put(a,f),c&&u&&this.validateSchema(t,!0),f}function UM(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=lC.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 zM(t){switch(t.schemaId){case"auto":return HM;case"id":return VM;default:return qM}}function VM(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function qM(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function HM(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 BM(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 KM(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function WM(t){var e;if(t._opts.$data&&(e=_M,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=iC;t._opts.$data&&(r=uC(r,jM)),t.addMetaSchema(r,od,!0),t._refs["http://json-schema.org/schema"]=od}}function QM(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 GM(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function ZM(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function pC(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function YM(t){for(var e=dC.copy(t._opts),r=0;r<G0.length;r++)delete e[G0[r]];return e}function JM(t){var e=t._opts.logger;if(e===!1)t.logger={log:th,warn:th,error:th};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 th(){}const XM=pm(NM);class eF extends N4{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 XM}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=j4(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}},EE,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!WI.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"},Oo,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},OE,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Oo,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Jv,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},RE,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Qv,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Oo,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Oo,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},Xv,r);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function zi(t,e){if(!t)throw new Error(e)}var Z0=3e3,tF=5e3,rh=5*60*1e3;function rF(t){const{url:e,clientName:r,clientUri:s,callbackUrl:n=typeof window<"u"?Ao(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:a="mcp:auth",clientConfig:o={},customHeaders:i={},autoRetry:c=!1,autoReconnect:u=Z0,transportType:d="auto",preventAutoAuth:f=!1,onPopupWindow:m}=t,[h,w]=x.useState("discovering"),[p,g]=x.useState([]),[y,v]=x.useState([]),[b,S]=x.useState([]),[E,k]=x.useState([]),[N,T]=x.useState(void 0),[D,U]=x.useState([]),[R,A]=x.useState(void 0),_=x.useRef(null),O=x.useRef(null),z=x.useRef(null),j=x.useRef(!1),K=x.useRef(!0),C=x.useRef(0),F=x.useRef(null),L=x.useRef(h),Q=x.useRef(u),te=x.useRef(null);x.useEffect(()=>{L.current=h,Q.current=u},[h,u]);const V=x.useCallback((J,ie,...Y)=>{const ze=Y.length>0?`${ie} ${Y.map(ee=>JSON.stringify(ee)).join(" ")}`:ie;console[J](`[useMcp] ${ze}`),K.current&&U(ee=>[...ee.slice(-100),{level:J,message:ze,timestamp:Date.now()}])},[]),de=x.useCallback(async(J=!1)=>{J||V("info","Disconnecting..."),j.current=!1,F.current&&clearTimeout(F.current),F.current=null;const ie=O.current;if(_.current=null,O.current=null,K.current&&!J&&(w("discovering"),g([]),v([]),S([]),k([]),T(void 0),A(void 0)),ie)try{await ie.close(),J||V("debug","Transport closed")}catch(Y){J||V("warn","Error closing transport:",Y)}},[V]),Te=x.useCallback((J,ie)=>{var Y;if(V("error",J,ie??""),K.current){w("failed"),T(J);const ze=(Y=z.current)==null?void 0:Y.getLastAttemptedAuthUrl();ze&&(A(ze),V("info","Manual authentication URL may be available.",ze))}j.current=!1},[V]),ge=x.useCallback(async()=>{if(j.current){V("debug","Connection attempt already in progress.");return}if(!K.current){V("debug","Connect called after unmount, aborting.");return}j.current=!0,C.current+=1,T(void 0),A(void 0),te.current=null,w("discovering"),V("info",`Connecting attempt #${C.current} to ${e}...`),z.current||(z.current=new E0(e,{storageKeyPrefix:a,clientName:r,clientUri:s,callbackUrl:n,preventAutoAuth:f,onPopupWindow:m}),V("debug","BrowserOAuthClientProvider initialized in connect.")),_.current||(_.current=new eF({name:o.name||"use-mcp-react-client",version:o.version||"0.1.0"},{capabilities:{}}),V("debug","MCP Client initialized in connect."));const J=async Y=>{V("info",`Attempting connection with ${Y.toUpperCase()} transport...`),L.current!=="authenticating"&&w("connecting");let ze;try{zi(z.current,"Auth Provider must be initialized"),zi(_.current,"Client must be initialized"),O.current&&(await O.current.close().catch(ke=>V("warn",`Error closing previous transport: ${ke.message}`)),O.current=null);const ee={authProvider:z.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...i}}},Oe=Ao(e),Fe=new URL(Oe);V("debug",`Creating ${Y.toUpperCase()} transport for URL: ${Fe.toString()}`),V("debug","Transport options:",{authProvider:!!z.current,headers:i,url:Fe.toString()}),Y==="http"?(V("debug","Creating StreamableHTTPClientTransport..."),ze=new P4(Fe,ee),V("debug","StreamableHTTPClientTransport created successfully")):(V("debug","Creating SSEClientTransport..."),ze=new _4(Fe,ee),V("debug","SSEClientTransport created successfully")),O.current=ze,V("debug",`${Y.toUpperCase()} transport created and assigned to ref.`)}catch(ee){return Te(`Failed to create ${Y.toUpperCase()} transport: ${ee instanceof Error?ee.message:String(ee)}`,ee instanceof Error?ee:void 0),"failed"}ze.onmessage=ee=>{var Oe,Fe;V("debug",`[Transport] Received: ${JSON.stringify(ee)}`),(Fe=(Oe=_.current)==null?void 0:Oe.handleMessage)==null||Fe.call(Oe,ee)},ze.onerror=ee=>{V("warn",`Transport error event (${Y.toUpperCase()}):`,ee),V("debug","Error details:",{message:ee.message,stack:ee.stack,name:ee.name,cause:ee.cause}),Te(`Transport error (${Y.toUpperCase()}): ${ee.message}`,ee)},ze.onclose=()=>{if(!K.current||j.current)return;V("info",`Transport connection closed (${te.current||"unknown"} type).`);const ee=L.current,Oe=Q.current;if(ee==="ready"&&Oe){const Fe=typeof Oe=="number"?Oe:Z0;V("info",`Attempting to reconnect in ${Fe}ms...`),w("connecting"),setTimeout(()=>{K.current&&ge()},Fe)}else ee!=="failed"&&ee!=="authenticating"&&Te("Connection closed unexpectedly.")};try{V("info",`Connecting client via ${Y.toUpperCase()}...`),V("debug","About to call client.connect() with transport instance"),V("debug",`Transport instance type: ${ze.constructor.name}`),await _.current.connect(ze),V("info",`Client connected via ${Y.toUpperCase()}. Loading tools, resources, and prompts...`),te.current=Y,w("loading");const ee=await _.current.request({method:"tools/list"},Xv);let Oe={resources:[],resourceTemplates:[]};try{Oe=await _.current.request({method:"resources/list"},Zu)}catch(ke){V("debug","Server does not support resources/list method",ke)}let Fe={prompts:[]};try{Fe=await _.current.request({method:"prompts/list"},Yu)}catch(ke){V("debug","Server does not support prompts/list method",ke)}if(K.current){g(ee.tools),v(Oe.resources),S(Array.isArray(Oe.resourceTemplates)?Oe.resourceTemplates:[]),k(Fe.prompts);const ke=[`Loaded ${ee.tools.length} tools`];return(Oe.resources.length>0||Oe.resourceTemplates&&Oe.resourceTemplates.length>0)&&(ke.push(`${Oe.resources.length} resources`),Array.isArray(Oe.resourceTemplates)&&Oe.resourceTemplates.length>0&&ke.push(`${Oe.resourceTemplates.length} resource templates`)),Fe.prompts.length>0&&ke.push(`${Fe.prompts.length} prompts`),V("info",ke.join(", ")+"."),w("ready"),C.current=0,"success"}else return"failed"}catch(ee){V("debug",`Client connect error via ${Y.toUpperCase()}:`,ee),V("debug","Connect error details:",{message:ee instanceof Error?ee.message:String(ee),stack:ee instanceof Error?ee.stack:"N/A",name:ee instanceof Error?ee.name:"Unknown",cause:ee instanceof Error?ee.cause:void 0});const Oe=ee instanceof Error?ee:new Error(String(ee)),Fe=Oe.message,ke=Fe.includes("404")||Fe.includes("Not Found"),st=Fe.includes("405")||Fe.includes("Method Not Allowed"),vt=Fe==="Failed to fetch"||Fe==="NetworkError when attempting to fetch resource."||Fe==="Load failed";if(Y==="http"&&(ke||st||vt))return V("warn",`HTTP transport failed (${vt?"CORS":ke?"404":"405"}).`),"fallback";if(Oe instanceof Dr||Fe.includes("Unauthorized")||Fe.includes("401")){V("info","Authentication required."),zi(z.current,"Auth Provider not available for auth flow");const Hr=await z.current.tokens();if(f&&!Hr)return V("info","Authentication required but auto-auth prevented. User action needed."),w("pending_auth"),"auth_redirect";L.current!=="authenticating"&&L.current!=="pending_auth"&&(w("authenticating"),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{},rh));try{const zt=await Pn(z.current,{serverUrl:e});if(!K.current)return"failed";if(zt==="AUTHORIZED")return V("info","Authentication successful via existing token or refresh. Re-attempting connection..."),F.current&&clearTimeout(F.current),j.current=!1,ge(),"failed";if(zt==="REDIRECT")return V("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(zt){return K.current&&(F.current&&clearTimeout(F.current),Te(`Failed to initiate authentication: ${zt instanceof Error?zt.message:String(zt)}`,zt instanceof Error?zt:void 0)),"failed"}}return Te(`Failed to connect via ${Y.toUpperCase()}: ${Fe}`,Oe),"failed"}};let ie="failed";if(console.log({transportType:d}),d==="sse")V("debug","Using SSE-only transport mode"),ie=await J("sse");else if(d==="http")V("debug","Using HTTP-only transport mode"),ie=await J("http");else{V("debug","Using auto transport mode (HTTP with SSE fallback)");const Y=await J("http");if(Y==="fallback"&&K.current&&L.current!=="authenticating"){V("info","HTTP failed, attempting SSE fallback...");const ze=await J("sse");ie=ze,ze==="failed"&&K.current}else ie=Y}(ie==="success"||ie==="failed")&&(j.current=!1),V("debug",`Connection sequence finished with status: ${ie}`)},[V,Te,de,Pn,e,a,r,s,n,o.name,o.version]),X=x.useCallback(async(J,ie)=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot call tool "${J}".`);V("info",`Calling tool: ${J}`,ie);try{const Y=await _.current.request({method:"tools/call",params:{name:J,arguments:ie}},Qd);return V("info",`Tool "${J}" call successful:`,Y),Y}catch(Y){V("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")){V("warn","Tool call unauthorized, attempting re-authentication..."),w("authenticating"),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{},rh);try{zi(z.current,"Auth Provider not available for tool re-auth");const ee=await Pn(z.current,{serverUrl:e});if(!K.current)return;ee==="AUTHORIZED"?(V("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),F.current&&clearTimeout(F.current),j.current=!1,ge()):ee==="REDIRECT"&&V("info","Redirecting for re-authentication for tool call.")}catch(ee){if(!K.current)return;F.current&&clearTimeout(F.current),Te(`Re-authentication failed: ${ee instanceof Error?ee.message:String(ee)}`,ee instanceof Error?ee:void 0)}}if(L.current!=="authenticating")throw Y;return}},[h,e,V,Te,ge]),he=x.useCallback(()=>{L.current==="failed"?(V("info","Retry requested..."),ge()):V("warn",`Retry called but state is not 'failed' (state: ${L.current}). Ignoring.`)},[V,ge]),pe=x.useCallback(async()=>{var ie;V("info","Manual authentication requested...");const J=L.current;if(J==="failed")V("info","Attempting to reconnect and authenticate via retry..."),he();else if(J==="pending_auth"){V("info","Proceeding with authentication from pending state..."),w("authenticating"),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{},rh);try{zi(z.current,"Auth Provider not available for manual auth");const Y=await Pn(z.current,{serverUrl:e});if(!K.current)return;Y==="AUTHORIZED"?(V("info","Manual authentication successful. Re-attempting connection..."),F.current&&clearTimeout(F.current),j.current=!1,ge()):Y==="REDIRECT"&&V("info","Redirecting for manual authentication. Waiting for callback...")}catch(Y){if(!K.current)return;F.current&&clearTimeout(F.current),Te(`Manual authentication failed: ${Y instanceof Error?Y.message:String(Y)}`,Y instanceof Error?Y:void 0)}}else if(J==="authenticating"){V("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const Y=(ie=z.current)==null?void 0:ie.getLastAttemptedAuthUrl();Y&&!R&&(A(Y),V("info","Manual authentication URL retrieved:",Y))}else V("info",`Client not in a state requiring manual authentication trigger (state: ${J}). If needed, try disconnecting and reconnecting.`)},[V,he,R,e,Te,ge]),ye=x.useCallback(()=>{if(z.current){const J=z.current.clearStorage();V("info",`Cleared ${J} item(s) from localStorage for ${e}.`),A(void 0),de()}else V("warn","Auth provider not initialized, cannot clear storage.")},[e,V,de]),ue=x.useCallback(async()=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list resources.`);V("info","Listing resources...");try{const J=await _.current.request({method:"resources/list"},Zu);K.current&&(v(J.resources),S(Array.isArray(J.resourceTemplates)?J.resourceTemplates:[]),V("info",`Listed ${J.resources.length} resources, ${Array.isArray(J.resourceTemplates)?J.resourceTemplates.length:0} resource templates.`))}catch(J){throw V("error",`Error listing resources: ${J instanceof Error?J.message:String(J)}`,J),J}},[h,V]),Pe=x.useCallback(async J=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot read resource "${J}".`);V("info",`Reading resource: ${J}`);try{const ie=await _.current.request({method:"resources/read",params:{uri:J}},Qv);return V("info",`Resource "${J}" read successfully`),ie}catch(ie){throw V("error",`Error reading resource "${J}": ${ie instanceof Error?ie.message:String(ie)}`,ie),ie}},[h,V]),Ae=x.useCallback(async()=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list prompts.`);V("info","Listing prompts...");try{const J=await _.current.request({method:"prompts/list"},Yu);K.current&&(k(J.prompts),V("info",`Listed ${J.prompts.length} prompts.`))}catch(J){throw V("error",`Error listing prompts: ${J instanceof Error?J.message:String(J)}`,J),J}},[h,V]),De=x.useCallback(async(J,ie)=>{if(L.current!=="ready"||!_.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot get prompt "${J}".`);V("info",`Getting prompt: ${J}`,ie);try{const Y=await _.current.request({method:"prompts/get",params:{name:J,arguments:ie}},Jv);return V("info",`Prompt "${J}" retrieved successfully`),Y}catch(Y){throw V("error",`Error getting prompt "${J}": ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[h,V]);return x.useEffect(()=>{const J=ie=>{var Y;ie.origin===window.location.origin&&((Y=ie.data)==null?void 0:Y.type)==="mcp_auth_callback"&&(V("info","Received auth callback message.",ie.data),F.current&&clearTimeout(F.current),ie.data.success?(V("info","Authentication successful via popup. Reconnecting client..."),j.current=!1,ge()):Te(`Authentication failed in callback: ${ie.data.error||"Unknown reason."}`))};return window.addEventListener("message",J),V("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",J),V("debug","Auth callback message listener removed."),F.current&&clearTimeout(F.current)}},[V,Te,ge]),x.useEffect(()=>(K.current=!0,V("debug","useMcp mounted, initiating connection."),C.current=0,(!z.current||z.current.serverUrl!==e)&&(z.current=new E0(e,{storageKeyPrefix:a,clientName:r,clientUri:s,callbackUrl:n,preventAutoAuth:f,onPopupWindow:m}),V("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),ge(),()=>{K.current=!1,V("debug","useMcp unmounting, disconnecting."),de(!0)}),[e,a,n,r,s,o.name,o.version,ge,de]),x.useEffect(()=>{let J=null;if(h==="failed"&&c&&C.current>0){const ie=typeof c=="number"?c:tF;V("info",`Connection failed, auto-retrying in ${ie}ms...`),J=setTimeout(()=>{K.current&&L.current==="failed"&&he()},ie)}return()=>{J&&clearTimeout(J)}},[h,c,he,V]),{state:h,tools:p,resources:y,resourceTemplates:b,prompts:E,error:N,log:D,authUrl:R,callTool:X,listResources:ue,readResource:Pe,listPrompts:Ae,getPrompt:De,retry:he,disconnect:de,authenticate:pe,clearStorage:ye}}function nF({service:t,autoConnect:e=!1,onConnected:r,onError:s}){const{toast:n}=gr(),{state:a,tools:o,resources:i,prompts:c,error:u,authUrl:d,callTool:f,readResource:m,listResources:h,getPrompt:w,listPrompts:p,retry:g,disconnect:y,authenticate:v,clearStorage:b}=rF({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",k=a==="authenticating"||a==="pending_auth",N=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(()=>{N&&u&&s&&(s(u),n({title:"MCP connection failed",description:u,variant:"destructive"}))},[N,u,s,n]),{isConnected:S,isConnecting:E,isAuthenticating:k,hasError:N,error:u,tools:o,resources:i,prompts:c,connect:()=>{g()},disconnect:y,retry:g,authenticate:v,callTool:async(_,O)=>{try{return await f(_,O)}catch(z){const j=z instanceof Error?z.message:"Unknown error";throw n({title:"Tool call failed",description:j,variant:"destructive"}),z}},readResource:async _=>{try{return await m(_)}catch(O){const z=O instanceof Error?O.message:"Unknown error";throw n({title:"Resource read failed",description:z,variant:"destructive"}),O}},listResources:async()=>{try{await h()}catch(_){const O=_ instanceof Error?_.message:"Unknown error";throw n({title:"Resource listing failed",description:O,variant:"destructive"}),_}},getPrompt:async(_,O)=>{try{return await w(_,O)}catch(z){const j=z instanceof Error?z.message:"Unknown error";throw n({title:"Prompt retrieval failed",description:j,variant:"destructive"}),z}},listPrompts:async()=>{try{await p()}catch(_){const O=_ instanceof Error?_.message:"Unknown error";throw n({title:"Prompt listing failed",description:O,variant:"destructive"}),_}},authUrl:d,clearStorage:b}}function sF(){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:f,hasError:m,error:h,tools:w,resources:p,prompts:g,connect:y,disconnect:v,retry:b,authenticate:S,callTool:E,authUrl:k,clearStorage:N}=nF({service:c,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:R=>{console.error("Test MCP service error:",R)}}),D=d?{status:"connecting",icon:Yy,color:"text-yellow-500"}:f?{status:"authenticating",icon:Cc,color:"text-blue-500"}:u?{status:"connected",icon:fp,color:"text-green-500"}:m?{status:"error",icon:Gy,color:"text-red-500"}:{status:"disconnected",icon:Gy,color:"text-gray-500"},U=async()=>{try{let R={};n.trim()&&(R=JSON.parse(n));const A=await E(r,R);i(JSON.stringify(A,null,2))}catch(R){i(`Error: ${R instanceof Error?R.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(D.icon,{className:`w-5 h-5 ${D.color}`}),"Connection Status: ",D.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(Ge,{children:"Service URL"}),l.jsx(ut,{value:t,onChange:R=>e(R.target.value),placeholder:"Enter MCP service URL"})]}),l.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&l.jsx(ve,{onClick:y,children:"Connect"}),u&&l.jsx(ve,{onClick:v,variant:"outline",children:"Disconnect"}),m&&l.jsxs(ve,{onClick:b,variant:"outline",children:[l.jsx(Yy,{className:"w-4 h-4 mr-1"}),"Retry"]}),k&&!u&&l.jsxs(ve,{onClick:S,variant:"outline",children:[l.jsx(Cc,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),h&&l.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[l.jsx(_1,{className:"w-4 h-4 text-destructive"}),l.jsx("span",{className:"text-sm text-destructive",children:h})]})]})]}),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((R,A)=>l.jsx("div",{className:"text-sm",children:l.jsx(hn,{variant:"outline",className:"text-xs",children:R.name})},A)),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 (",g.length,")"]})}),l.jsx(Ps,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${g.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(Ge,{htmlFor:"toolName",children:"Tool Name"}),l.jsx(ut,{id:"toolName",value:r,onChange:R=>s(R.target.value),placeholder:"e.g., get_me"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),l.jsx(ut,{id:"toolArgs",value:n,onChange:R=>a(R.target.value),placeholder:'{"key": "value"}'})]})]}),l.jsxs(ve,{onClick:U,disabled:!u,children:[l.jsx(c2,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),o&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ge,{children:"Result"}),l.jsx(Gn,{value:o,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),k&&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(ve,{onClick:S,variant:"outline",children:[l.jsx(Cc,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),l.jsx(ve,{onClick:N,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function aF(){return l.jsxs(bN,{children:[l.jsx(bc,{path:"/",component:pI}),l.jsx(bc,{path:"/oauth/callback",component:gI}),l.jsx(bc,{path:"/mcp-test",component:sF}),l.jsx(bc,{component:vI})]})}function oF(){return l.jsx(VN,{client:nj,children:l.jsxs(AT,{children:[l.jsx(W2,{}),l.jsx(aF,{})]})})}xb(document.getElementById("root")).render(l.jsx(x.StrictMode,{children:l.jsx(oF,{})}));
|