nowaikit 4.19.0 → 4.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,55 +0,0 @@
1
- (function(){const d=document.createElement("link").relList;if(d&&d.supports&&d.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))u(h);new MutationObserver(h=>{for(const v of h)if(v.type==="childList")for(const C of v.addedNodes)C.tagName==="LINK"&&C.rel==="modulepreload"&&u(C)}).observe(document,{childList:!0,subtree:!0});function c(h){const v={};return h.integrity&&(v.integrity=h.integrity),h.referrerPolicy&&(v.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?v.credentials="include":h.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function u(h){if(h.ep)return;h.ep=!0;const v=c(h);fetch(h.href,v)}})();function gp(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Go={exports:{}},Mi={},Ho={exports:{}},be={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Qc;function hu(){if(Qc)return be;Qc=1;var l=Symbol.for("react.element"),d=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),C=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),q=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),B=Symbol.iterator;function V(g){return g===null||typeof g!="object"?null:(g=B&&g[B]||g["@@iterator"],typeof g=="function"?g:null)}var fe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ne=Object.assign,K={};function D(g,A,ge){this.props=g,this.context=A,this.refs=K,this.updater=ge||fe}D.prototype.isReactComponent={},D.prototype.setState=function(g,A){if(typeof g!="object"&&typeof g!="function"&&g!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,g,A,"setState")},D.prototype.forceUpdate=function(g){this.updater.enqueueForceUpdate(this,g,"forceUpdate")};function W(){}W.prototype=D.prototype;function Z(g,A,ge){this.props=g,this.context=A,this.refs=K,this.updater=ge||fe}var j=Z.prototype=new W;j.constructor=Z,ne(j,D.prototype),j.isPureReactComponent=!0;var M=Array.isArray,m=Object.prototype.hasOwnProperty,N={current:null},ee={key:!0,ref:!0,__self:!0,__source:!0};function w(g,A,ge){var I,Y={},$=null,ve=null;if(A!=null)for(I in A.ref!==void 0&&(ve=A.ref),A.key!==void 0&&($=""+A.key),A)m.call(A,I)&&!ee.hasOwnProperty(I)&&(Y[I]=A[I]);var _e=arguments.length-2;if(_e===1)Y.children=ge;else if(1<_e){for(var E=Array(_e),oe=0;oe<_e;oe++)E[oe]=arguments[oe+2];Y.children=E}if(g&&g.defaultProps)for(I in _e=g.defaultProps,_e)Y[I]===void 0&&(Y[I]=_e[I]);return{$$typeof:l,type:g,key:$,ref:ve,props:Y,_owner:N.current}}function G(g,A){return{$$typeof:l,type:g.type,key:A,ref:g.ref,props:g.props,_owner:g._owner}}function F(g){return typeof g=="object"&&g!==null&&g.$$typeof===l}function X(g){var A={"=":"=0",":":"=2"};return"$"+g.replace(/[=:]/g,function(ge){return A[ge]})}var ae=/\/+/g;function he(g,A){return typeof g=="object"&&g!==null&&g.key!=null?X(""+g.key):A.toString(36)}function ke(g,A,ge,I,Y){var $=typeof g;($==="undefined"||$==="boolean")&&(g=null);var ve=!1;if(g===null)ve=!0;else switch($){case"string":case"number":ve=!0;break;case"object":switch(g.$$typeof){case l:case d:ve=!0}}if(ve)return ve=g,Y=Y(ve),g=I===""?"."+he(ve,0):I,M(Y)?(ge="",g!=null&&(ge=g.replace(ae,"$&/")+"/"),ke(Y,A,ge,"",function(oe){return oe})):Y!=null&&(F(Y)&&(Y=G(Y,ge+(!Y.key||ve&&ve.key===Y.key?"":(""+Y.key).replace(ae,"$&/")+"/")+g)),A.push(Y)),1;if(ve=0,I=I===""?".":I+":",M(g))for(var _e=0;_e<g.length;_e++){$=g[_e];var E=I+he($,_e);ve+=ke($,A,ge,E,Y)}else if(E=V(g),typeof E=="function")for(g=E.call(g),_e=0;!($=g.next()).done;)$=$.value,E=I+he($,_e++),ve+=ke($,A,ge,E,Y);else if($==="object")throw A=String(g),Error("Objects are not valid as a React child (found: "+(A==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":A)+"). If you meant to render a collection of children, use an array instead.");return ve}function Le(g,A,ge){if(g==null)return g;var I=[],Y=0;return ke(g,I,"","",function($){return A.call(ge,$,Y++)}),I}function Ee(g){if(g._status===-1){var A=g._result;A=A(),A.then(function(ge){(g._status===0||g._status===-1)&&(g._status=1,g._result=ge)},function(ge){(g._status===0||g._status===-1)&&(g._status=2,g._result=ge)}),g._status===-1&&(g._status=0,g._result=A)}if(g._status===1)return g._result.default;throw g._result}var le={current:null},U={transition:null},se={ReactCurrentDispatcher:le,ReactCurrentBatchConfig:U,ReactCurrentOwner:N};function H(){throw Error("act(...) is not supported in production builds of React.")}return be.Children={map:Le,forEach:function(g,A,ge){Le(g,function(){A.apply(this,arguments)},ge)},count:function(g){var A=0;return Le(g,function(){A++}),A},toArray:function(g){return Le(g,function(A){return A})||[]},only:function(g){if(!F(g))throw Error("React.Children.only expected to receive a single React element child.");return g}},be.Component=D,be.Fragment=c,be.Profiler=h,be.PureComponent=Z,be.StrictMode=u,be.Suspense=k,be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=se,be.act=H,be.cloneElement=function(g,A,ge){if(g==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+g+".");var I=ne({},g.props),Y=g.key,$=g.ref,ve=g._owner;if(A!=null){if(A.ref!==void 0&&($=A.ref,ve=N.current),A.key!==void 0&&(Y=""+A.key),g.type&&g.type.defaultProps)var _e=g.type.defaultProps;for(E in A)m.call(A,E)&&!ee.hasOwnProperty(E)&&(I[E]=A[E]===void 0&&_e!==void 0?_e[E]:A[E])}var E=arguments.length-2;if(E===1)I.children=ge;else if(1<E){_e=Array(E);for(var oe=0;oe<E;oe++)_e[oe]=arguments[oe+2];I.children=_e}return{$$typeof:l,type:g.type,key:Y,ref:$,props:I,_owner:ve}},be.createContext=function(g){return g={$$typeof:C,_currentValue:g,_currentValue2:g,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},g.Provider={$$typeof:v,_context:g},g.Consumer=g},be.createElement=w,be.createFactory=function(g){var A=w.bind(null,g);return A.type=g,A},be.createRef=function(){return{current:null}},be.forwardRef=function(g){return{$$typeof:b,render:g}},be.isValidElement=F,be.lazy=function(g){return{$$typeof:T,_payload:{_status:-1,_result:g},_init:Ee}},be.memo=function(g,A){return{$$typeof:q,type:g,compare:A===void 0?null:A}},be.startTransition=function(g){var A=U.transition;U.transition={};try{g()}finally{U.transition=A}},be.unstable_act=H,be.useCallback=function(g,A){return le.current.useCallback(g,A)},be.useContext=function(g){return le.current.useContext(g)},be.useDebugValue=function(){},be.useDeferredValue=function(g){return le.current.useDeferredValue(g)},be.useEffect=function(g,A){return le.current.useEffect(g,A)},be.useId=function(){return le.current.useId()},be.useImperativeHandle=function(g,A,ge){return le.current.useImperativeHandle(g,A,ge)},be.useInsertionEffect=function(g,A){return le.current.useInsertionEffect(g,A)},be.useLayoutEffect=function(g,A){return le.current.useLayoutEffect(g,A)},be.useMemo=function(g,A){return le.current.useMemo(g,A)},be.useReducer=function(g,A,ge){return le.current.useReducer(g,A,ge)},be.useRef=function(g){return le.current.useRef(g)},be.useState=function(g){return le.current.useState(g)},be.useSyncExternalStore=function(g,A,ge){return le.current.useSyncExternalStore(g,A,ge)},be.useTransition=function(){return le.current.useTransition()},be.version="18.3.1",be}var Xc;function na(){return Xc||(Xc=1,Ho.exports=hu()),Ho.exports}/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Jc;function _u(){if(Jc)return Mi;Jc=1;var l=na(),d=Symbol.for("react.element"),c=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,h=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v={key:!0,ref:!0,__self:!0,__source:!0};function C(b,k,q){var T,B={},V=null,fe=null;q!==void 0&&(V=""+q),k.key!==void 0&&(V=""+k.key),k.ref!==void 0&&(fe=k.ref);for(T in k)u.call(k,T)&&!v.hasOwnProperty(T)&&(B[T]=k[T]);if(b&&b.defaultProps)for(T in k=b.defaultProps,k)B[T]===void 0&&(B[T]=k[T]);return{$$typeof:d,type:b,key:V,ref:fe,props:B,_owner:h.current}}return Mi.Fragment=c,Mi.jsx=C,Mi.jsxs=C,Mi}var Zc;function vu(){return Zc||(Zc=1,Go.exports=_u()),Go.exports}var s=vu(),z=na();const sa=gp(z);var Qn={},$o={exports:{}},nt={},Vo={exports:{}},Ko={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var ep;function bu(){return ep||(ep=1,(function(l){function d(U,se){var H=U.length;U.push(se);e:for(;0<H;){var g=H-1>>>1,A=U[g];if(0<h(A,se))U[g]=se,U[H]=A,H=g;else break e}}function c(U){return U.length===0?null:U[0]}function u(U){if(U.length===0)return null;var se=U[0],H=U.pop();if(H!==se){U[0]=H;e:for(var g=0,A=U.length,ge=A>>>1;g<ge;){var I=2*(g+1)-1,Y=U[I],$=I+1,ve=U[$];if(0>h(Y,H))$<A&&0>h(ve,Y)?(U[g]=ve,U[$]=H,g=$):(U[g]=Y,U[I]=H,g=I);else if($<A&&0>h(ve,H))U[g]=ve,U[$]=H,g=$;else break e}}return se}function h(U,se){var H=U.sortIndex-se.sortIndex;return H!==0?H:U.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var v=performance;l.unstable_now=function(){return v.now()}}else{var C=Date,b=C.now();l.unstable_now=function(){return C.now()-b}}var k=[],q=[],T=1,B=null,V=3,fe=!1,ne=!1,K=!1,D=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,Z=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(U){for(var se=c(q);se!==null;){if(se.callback===null)u(q);else if(se.startTime<=U)u(q),se.sortIndex=se.expirationTime,d(k,se);else break;se=c(q)}}function M(U){if(K=!1,j(U),!ne)if(c(k)!==null)ne=!0,Ee(m);else{var se=c(q);se!==null&&le(M,se.startTime-U)}}function m(U,se){ne=!1,K&&(K=!1,W(w),w=-1),fe=!0;var H=V;try{for(j(se),B=c(k);B!==null&&(!(B.expirationTime>se)||U&&!X());){var g=B.callback;if(typeof g=="function"){B.callback=null,V=B.priorityLevel;var A=g(B.expirationTime<=se);se=l.unstable_now(),typeof A=="function"?B.callback=A:B===c(k)&&u(k),j(se)}else u(k);B=c(k)}if(B!==null)var ge=!0;else{var I=c(q);I!==null&&le(M,I.startTime-se),ge=!1}return ge}finally{B=null,V=H,fe=!1}}var N=!1,ee=null,w=-1,G=5,F=-1;function X(){return!(l.unstable_now()-F<G)}function ae(){if(ee!==null){var U=l.unstable_now();F=U;var se=!0;try{se=ee(!0,U)}finally{se?he():(N=!1,ee=null)}}else N=!1}var he;if(typeof Z=="function")he=function(){Z(ae)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,Le=ke.port2;ke.port1.onmessage=ae,he=function(){Le.postMessage(null)}}else he=function(){D(ae,0)};function Ee(U){ee=U,N||(N=!0,he())}function le(U,se){w=D(function(){U(l.unstable_now())},se)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(U){U.callback=null},l.unstable_continueExecution=function(){ne||fe||(ne=!0,Ee(m))},l.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<U?Math.floor(1e3/U):5},l.unstable_getCurrentPriorityLevel=function(){return V},l.unstable_getFirstCallbackNode=function(){return c(k)},l.unstable_next=function(U){switch(V){case 1:case 2:case 3:var se=3;break;default:se=V}var H=V;V=se;try{return U()}finally{V=H}},l.unstable_pauseExecution=function(){},l.unstable_requestPaint=function(){},l.unstable_runWithPriority=function(U,se){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var H=V;V=U;try{return se()}finally{V=H}},l.unstable_scheduleCallback=function(U,se,H){var g=l.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?g+H:g):H=g,U){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=H+A,U={id:T++,callback:se,priorityLevel:U,startTime:H,expirationTime:A,sortIndex:-1},H>g?(U.sortIndex=H,d(q,U),c(k)===null&&U===c(q)&&(K?(W(w),w=-1):K=!0,le(M,H-g))):(U.sortIndex=A,d(k,U),ne||fe||(ne=!0,Ee(m))),U},l.unstable_shouldYield=X,l.unstable_wrapCallback=function(U){var se=V;return function(){var H=V;V=se;try{return U.apply(this,arguments)}finally{V=H}}}})(Ko)),Ko}var tp;function Su(){return tp||(tp=1,Vo.exports=bu()),Vo.exports}/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var rp;function xu(){if(rp)return nt;rp=1;var l=na(),d=Su();function c(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var u=new Set,h={};function v(e,t){C(e,t),C(e+"Capture",t)}function C(e,t){for(h[e]=t,e=0;e<t.length;e++)u.add(t[e])}var b=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),k=Object.prototype.hasOwnProperty,q=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,T={},B={};function V(e){return k.call(B,e)?!0:k.call(T,e)?!1:q.test(e)?B[e]=!0:(T[e]=!0,!1)}function fe(e,t,r,i){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return i?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ne(e,t,r,i){if(t===null||typeof t>"u"||fe(e,t,r,i))return!0;if(i)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function K(e,t,r,i,n,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=n,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var D={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){D[e]=new K(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];D[t]=new K(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){D[e]=new K(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){D[e]=new K(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){D[e]=new K(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){D[e]=new K(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){D[e]=new K(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){D[e]=new K(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){D[e]=new K(e,5,!1,e.toLowerCase(),null,!1,!1)});var W=/[\-:]([a-z])/g;function Z(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(W,Z);D[t]=new K(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(W,Z);D[t]=new K(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(W,Z);D[t]=new K(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){D[e]=new K(e,1,!1,e.toLowerCase(),null,!1,!1)}),D.xlinkHref=new K("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){D[e]=new K(e,1,!1,e.toLowerCase(),null,!0,!0)});function j(e,t,r,i){var n=D.hasOwnProperty(t)?D[t]:null;(n!==null?n.type!==0:i||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(ne(t,r,n,i)&&(r=null),i||n===null?V(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):n.mustUseProperty?e[n.propertyName]=r===null?n.type===3?!1:"":r:(t=n.attributeName,i=n.attributeNamespace,r===null?e.removeAttribute(t):(n=n.type,r=n===3||n===4&&r===!0?"":""+r,i?e.setAttributeNS(i,t,r):e.setAttribute(t,r))))}var M=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,m=Symbol.for("react.element"),N=Symbol.for("react.portal"),ee=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),X=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),he=Symbol.for("react.suspense"),ke=Symbol.for("react.suspense_list"),Le=Symbol.for("react.memo"),Ee=Symbol.for("react.lazy"),le=Symbol.for("react.offscreen"),U=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=U&&e[U]||e["@@iterator"],typeof e=="function"?e:null)}var H=Object.assign,g;function A(e){if(g===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);g=t&&t[1]||""}return`
34
- `+g+e}var ge=!1;function I(e,t){if(!e||ge)return"";ge=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(x){var i=x}Reflect.construct(e,[],t)}else{try{t.call()}catch(x){i=x}e.call(t.prototype)}else{try{throw Error()}catch(x){i=x}e()}}catch(x){if(x&&i&&typeof x.stack=="string"){for(var n=x.stack.split(`
35
- `),o=i.stack.split(`
36
- `),a=n.length-1,p=o.length-1;1<=a&&0<=p&&n[a]!==o[p];)p--;for(;1<=a&&0<=p;a--,p--)if(n[a]!==o[p]){if(a!==1||p!==1)do if(a--,p--,0>p||n[a]!==o[p]){var y=`
37
- `+n[a].replace(" at new "," at ");return e.displayName&&y.includes("<anonymous>")&&(y=y.replace("<anonymous>",e.displayName)),y}while(1<=a&&0<=p);break}}}finally{ge=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?A(e):""}function Y(e){switch(e.tag){case 5:return A(e.type);case 16:return A("Lazy");case 13:return A("Suspense");case 19:return A("SuspenseList");case 0:case 2:case 15:return e=I(e.type,!1),e;case 11:return e=I(e.type.render,!1),e;case 1:return e=I(e.type,!0),e;default:return""}}function $(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ee:return"Fragment";case N:return"Portal";case G:return"Profiler";case w:return"StrictMode";case he:return"Suspense";case ke:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case X:return(e.displayName||"Context")+".Consumer";case F:return(e._context.displayName||"Context")+".Provider";case ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Le:return t=e.displayName||null,t!==null?t:$(e.type)||"Memo";case Ee:t=e._payload,e=e._init;try{return $(e(t))}catch{}}return null}function ve(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return $(t);case 8:return t===w?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function _e(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function E(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function oe(e){var t=E(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var n=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(a){i=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return i},setValue:function(a){i=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function me(e){e._valueTracker||(e._valueTracker=oe(e))}function Pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i="";return e&&(i=E(e)?e.checked?"true":"false":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function ue(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function de(e,t){var r=t.checked;return H({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function nr(e,t){var r=t.defaultValue==null?"":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;r=_e(t.value!=null?t.value:r),e._wrapperState={initialChecked:i,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Xr(e,t){t=t.checked,t!=null&&j(e,"checked",t,!1)}function Se(e,t){Xr(e,t);var r=_e(t.value),i=t.type;if(r!=null)i==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?zt(e,t.type,r):t.hasOwnProperty("defaultValue")&&zt(e,t.type,_e(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Be(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!(i!=="submit"&&i!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function zt(e,t,r){(t!=="number"||ue(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var sr=Array.isArray;function kr(e,t,r,i){if(e=e.options,t){t={};for(var n=0;n<r.length;n++)t["$"+r[n]]=!0;for(r=0;r<e.length;r++)n=t.hasOwnProperty("$"+e[r].value),e[r].selected!==n&&(e[r].selected=n),n&&i&&(e[r].defaultSelected=!0)}else{for(r=""+_e(r),t=null,n=0;n<e.length;n++){if(e[n].value===r){e[n].selected=!0,i&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function Zn(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(c(91));return H({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function oa(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(c(92));if(sr(r)){if(1<r.length)throw Error(c(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:_e(r)}}function aa(e,t){var r=_e(t.value),i=_e(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),i!=null&&(e.defaultValue=""+i)}function la(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function ca(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function es(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?ca(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Oi,pa=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,i,n){MSApp.execUnsafeLocalFunction(function(){return e(t,r,i,n)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Oi=Oi||document.createElement("div"),Oi.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Oi.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Jr(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Zr={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},Sp=["Webkit","ms","Moz","O"];Object.keys(Zr).forEach(function(e){Sp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Zr[t]=Zr[e]})});function da(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Zr.hasOwnProperty(e)&&Zr[e]?(""+t).trim():t+"px"}function ua(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var i=r.indexOf("--")===0,n=da(r,t[r],i);r==="float"&&(r="cssFloat"),i?e.setProperty(r,n):e[r]=n}}var xp=H({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 ts(e,t){if(t){if(xp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(c(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(c(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(c(61))}if(t.style!=null&&typeof t.style!="object")throw Error(c(62))}}function rs(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var is=null;function ns(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ss=null,jr=null,Er=null;function ya(e){if(e=Si(e)){if(typeof ss!="function")throw Error(c(280));var t=e.stateNode;t&&(t=dn(t),ss(e.stateNode,e.type,t))}}function ma(e){jr?Er?Er.push(e):Er=[e]:jr=e}function fa(){if(jr){var e=jr,t=Er;if(Er=jr=null,ya(e),t)for(e=0;e<t.length;e++)ya(t[e])}}function ga(e,t){return e(t)}function ha(){}var os=!1;function _a(e,t,r){if(os)return e(t,r);os=!0;try{return ga(e,t,r)}finally{os=!1,(jr!==null||Er!==null)&&(ha(),fa())}}function ei(e,t){var r=e.stateNode;if(r===null)return null;var i=dn(r);if(i===null)return null;r=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(c(231,t,typeof r));return r}var as=!1;if(b)try{var ti={};Object.defineProperty(ti,"passive",{get:function(){as=!0}}),window.addEventListener("test",ti,ti),window.removeEventListener("test",ti,ti)}catch{as=!1}function wp(e,t,r,i,n,o,a,p,y){var x=Array.prototype.slice.call(arguments,3);try{t.apply(r,x)}catch(R){this.onError(R)}}var ri=!1,Wi=null,Ui=!1,ls=null,kp={onError:function(e){ri=!0,Wi=e}};function jp(e,t,r,i,n,o,a,p,y){ri=!1,Wi=null,wp.apply(kp,arguments)}function Ep(e,t,r,i,n,o,a,p,y){if(jp.apply(this,arguments),ri){if(ri){var x=Wi;ri=!1,Wi=null}else throw Error(c(198));Ui||(Ui=!0,ls=x)}}function or(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function va(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function ba(e){if(or(e)!==e)throw Error(c(188))}function Cp(e){var t=e.alternate;if(!t){if(t=or(e),t===null)throw Error(c(188));return t!==e?null:e}for(var r=e,i=t;;){var n=r.return;if(n===null)break;var o=n.alternate;if(o===null){if(i=n.return,i!==null){r=i;continue}break}if(n.child===o.child){for(o=n.child;o;){if(o===r)return ba(n),e;if(o===i)return ba(n),t;o=o.sibling}throw Error(c(188))}if(r.return!==i.return)r=n,i=o;else{for(var a=!1,p=n.child;p;){if(p===r){a=!0,r=n,i=o;break}if(p===i){a=!0,i=n,r=o;break}p=p.sibling}if(!a){for(p=o.child;p;){if(p===r){a=!0,r=o,i=n;break}if(p===i){a=!0,i=o,r=n;break}p=p.sibling}if(!a)throw Error(c(189))}}if(r.alternate!==i)throw Error(c(190))}if(r.tag!==3)throw Error(c(188));return r.stateNode.current===r?e:t}function Sa(e){return e=Cp(e),e!==null?xa(e):null}function xa(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=xa(e);if(t!==null)return t;e=e.sibling}return null}var wa=d.unstable_scheduleCallback,ka=d.unstable_cancelCallback,qp=d.unstable_shouldYield,Ip=d.unstable_requestPaint,Me=d.unstable_now,Ap=d.unstable_getCurrentPriorityLevel,cs=d.unstable_ImmediatePriority,ja=d.unstable_UserBlockingPriority,Gi=d.unstable_NormalPriority,Lp=d.unstable_LowPriority,Ea=d.unstable_IdlePriority,Hi=null,wt=null;function Tp(e){if(wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(Hi,e,void 0,(e.current.flags&128)===128)}catch{}}var gt=Math.clz32?Math.clz32:Pp,Rp=Math.log,Np=Math.LN2;function Pp(e){return e>>>=0,e===0?32:31-(Rp(e)/Np|0)|0}var $i=64,Vi=4194304;function ii(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ki(e,t){var r=e.pendingLanes;if(r===0)return 0;var i=0,n=e.suspendedLanes,o=e.pingedLanes,a=r&268435455;if(a!==0){var p=a&~n;p!==0?i=ii(p):(o&=a,o!==0&&(i=ii(o)))}else a=r&~n,a!==0?i=ii(a):o!==0&&(i=ii(o));if(i===0)return 0;if(t!==0&&t!==i&&(t&n)===0&&(n=i&-i,o=t&-t,n>=o||n===16&&(o&4194240)!==0))return t;if((i&4)!==0&&(i|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0<t;)r=31-gt(t),n=1<<r,i|=e[r],t&=~n;return i}function Mp(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Dp(e,t){for(var r=e.suspendedLanes,i=e.pingedLanes,n=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-gt(o),p=1<<a,y=n[a];y===-1?((p&r)===0||(p&i)!==0)&&(n[a]=Mp(p,t)):y<=t&&(e.expiredLanes|=p),o&=~p}}function ps(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ca(){var e=$i;return $i<<=1,($i&4194240)===0&&($i=64),e}function ds(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function ni(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-gt(t),e[t]=r}function zp(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0<r;){var n=31-gt(r),o=1<<n;t[n]=0,i[n]=-1,e[n]=-1,r&=~o}}function us(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var i=31-gt(r),n=1<<i;n&t|e[i]&t&&(e[i]|=t),r&=~n}}var je=0;function qa(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var Ia,ys,Aa,La,Ta,ms=!1,Yi=[],Bt=null,Ft=null,Ot=null,si=new Map,oi=new Map,Wt=[],Bp="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 Ra(e,t){switch(e){case"focusin":case"focusout":Bt=null;break;case"dragenter":case"dragleave":Ft=null;break;case"mouseover":case"mouseout":Ot=null;break;case"pointerover":case"pointerout":si.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":oi.delete(t.pointerId)}}function ai(e,t,r,i,n,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:r,eventSystemFlags:i,nativeEvent:o,targetContainers:[n]},t!==null&&(t=Si(t),t!==null&&ys(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function Fp(e,t,r,i,n){switch(t){case"focusin":return Bt=ai(Bt,e,t,r,i,n),!0;case"dragenter":return Ft=ai(Ft,e,t,r,i,n),!0;case"mouseover":return Ot=ai(Ot,e,t,r,i,n),!0;case"pointerover":var o=n.pointerId;return si.set(o,ai(si.get(o)||null,e,t,r,i,n)),!0;case"gotpointercapture":return o=n.pointerId,oi.set(o,ai(oi.get(o)||null,e,t,r,i,n)),!0}return!1}function Na(e){var t=ar(e.target);if(t!==null){var r=or(t);if(r!==null){if(t=r.tag,t===13){if(t=va(r),t!==null){e.blockedOn=t,Ta(e.priority,function(){Aa(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qi(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=gs(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);is=i,r.target.dispatchEvent(i),is=null}else return t=Si(r),t!==null&&ys(t),e.blockedOn=r,!1;t.shift()}return!0}function Pa(e,t,r){Qi(e)&&r.delete(t)}function Op(){ms=!1,Bt!==null&&Qi(Bt)&&(Bt=null),Ft!==null&&Qi(Ft)&&(Ft=null),Ot!==null&&Qi(Ot)&&(Ot=null),si.forEach(Pa),oi.forEach(Pa)}function li(e,t){e.blockedOn===t&&(e.blockedOn=null,ms||(ms=!0,d.unstable_scheduleCallback(d.unstable_NormalPriority,Op)))}function ci(e){function t(n){return li(n,e)}if(0<Yi.length){li(Yi[0],e);for(var r=1;r<Yi.length;r++){var i=Yi[r];i.blockedOn===e&&(i.blockedOn=null)}}for(Bt!==null&&li(Bt,e),Ft!==null&&li(Ft,e),Ot!==null&&li(Ot,e),si.forEach(t),oi.forEach(t),r=0;r<Wt.length;r++)i=Wt[r],i.blockedOn===e&&(i.blockedOn=null);for(;0<Wt.length&&(r=Wt[0],r.blockedOn===null);)Na(r),r.blockedOn===null&&Wt.shift()}var Cr=M.ReactCurrentBatchConfig,Xi=!0;function Wp(e,t,r,i){var n=je,o=Cr.transition;Cr.transition=null;try{je=1,fs(e,t,r,i)}finally{je=n,Cr.transition=o}}function Up(e,t,r,i){var n=je,o=Cr.transition;Cr.transition=null;try{je=4,fs(e,t,r,i)}finally{je=n,Cr.transition=o}}function fs(e,t,r,i){if(Xi){var n=gs(e,t,r,i);if(n===null)Rs(e,t,i,Ji,r),Ra(e,i);else if(Fp(n,e,t,r,i))i.stopPropagation();else if(Ra(e,i),t&4&&-1<Bp.indexOf(e)){for(;n!==null;){var o=Si(n);if(o!==null&&Ia(o),o=gs(e,t,r,i),o===null&&Rs(e,t,i,Ji,r),o===n)break;n=o}n!==null&&i.stopPropagation()}else Rs(e,t,i,null,r)}}var Ji=null;function gs(e,t,r,i){if(Ji=null,e=ns(i),e=ar(e),e!==null)if(t=or(e),t===null)e=null;else if(r=t.tag,r===13){if(e=va(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ji=e,null}function Ma(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Ap()){case cs:return 1;case ja:return 4;case Gi:case Lp:return 16;case Ea:return 536870912;default:return 16}default:return 16}}var Ut=null,hs=null,Zi=null;function Da(){if(Zi)return Zi;var e,t=hs,r=t.length,i,n="value"in Ut?Ut.value:Ut.textContent,o=n.length;for(e=0;e<r&&t[e]===n[e];e++);var a=r-e;for(i=1;i<=a&&t[r-i]===n[o-i];i++);return Zi=n.slice(e,1<i?1-i:void 0)}function en(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function tn(){return!0}function za(){return!1}function st(e){function t(r,i,n,o,a){this._reactName=r,this._targetInst=n,this.type=i,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(r=e[p],this[p]=r?r(o):o[p]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?tn:za,this.isPropagationStopped=za,this}return H(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=tn)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=tn)},persist:function(){},isPersistent:tn}),t}var qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_s=st(qr),pi=H({},qr,{view:0,detail:0}),Gp=st(pi),vs,bs,di,rn=H({},pi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xs,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==di&&(di&&e.type==="mousemove"?(vs=e.screenX-di.screenX,bs=e.screenY-di.screenY):bs=vs=0,di=e),vs)},movementY:function(e){return"movementY"in e?e.movementY:bs}}),Ba=st(rn),Hp=H({},rn,{dataTransfer:0}),$p=st(Hp),Vp=H({},pi,{relatedTarget:0}),Ss=st(Vp),Kp=H({},qr,{animationName:0,elapsedTime:0,pseudoElement:0}),Yp=st(Kp),Qp=H({},qr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Xp=st(Qp),Jp=H({},qr,{data:0}),Fa=st(Jp),Zp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ed={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"},td={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rd(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=td[e])?!!t[e]:!1}function xs(){return rd}var id=H({},pi,{key:function(e){if(e.key){var t=Zp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=en(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ed[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xs,charCode:function(e){return e.type==="keypress"?en(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?en(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),nd=st(id),sd=H({},rn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oa=st(sd),od=H({},pi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xs}),ad=st(od),ld=H({},qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),cd=st(ld),pd=H({},rn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),dd=st(pd),ud=[9,13,27,32],ws=b&&"CompositionEvent"in window,ui=null;b&&"documentMode"in document&&(ui=document.documentMode);var yd=b&&"TextEvent"in window&&!ui,Wa=b&&(!ws||ui&&8<ui&&11>=ui),Ua=" ",Ga=!1;function Ha(e,t){switch(e){case"keyup":return ud.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $a(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ir=!1;function md(e,t){switch(e){case"compositionend":return $a(t);case"keypress":return t.which!==32?null:(Ga=!0,Ua);case"textInput":return e=t.data,e===Ua&&Ga?null:e;default:return null}}function fd(e,t){if(Ir)return e==="compositionend"||!ws&&Ha(e,t)?(e=Da(),Zi=hs=Ut=null,Ir=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Wa&&t.locale!=="ko"?null:t.data;default:return null}}var gd={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 Va(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!gd[e.type]:t==="textarea"}function Ka(e,t,r,i){ma(i),t=ln(t,"onChange"),0<t.length&&(r=new _s("onChange","change",null,r,i),e.push({event:r,listeners:t}))}var yi=null,mi=null;function hd(e){ul(e,0)}function nn(e){var t=Nr(e);if(Pe(t))return e}function _d(e,t){if(e==="change")return t}var Ya=!1;if(b){var ks;if(b){var js="oninput"in document;if(!js){var Qa=document.createElement("div");Qa.setAttribute("oninput","return;"),js=typeof Qa.oninput=="function"}ks=js}else ks=!1;Ya=ks&&(!document.documentMode||9<document.documentMode)}function Xa(){yi&&(yi.detachEvent("onpropertychange",Ja),mi=yi=null)}function Ja(e){if(e.propertyName==="value"&&nn(mi)){var t=[];Ka(t,mi,e,ns(e)),_a(hd,t)}}function vd(e,t,r){e==="focusin"?(Xa(),yi=t,mi=r,yi.attachEvent("onpropertychange",Ja)):e==="focusout"&&Xa()}function bd(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return nn(mi)}function Sd(e,t){if(e==="click")return nn(t)}function xd(e,t){if(e==="input"||e==="change")return nn(t)}function wd(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ht=typeof Object.is=="function"?Object.is:wd;function fi(e,t){if(ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var n=r[i];if(!k.call(t,n)||!ht(e[n],t[n]))return!1}return!0}function Za(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function el(e,t){var r=Za(e);e=0;for(var i;r;){if(r.nodeType===3){if(i=e+r.textContent.length,e<=t&&i>=t)return{node:r,offset:t-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Za(r)}}function tl(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?tl(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function rl(){for(var e=window,t=ue();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ue(e.document)}return t}function Es(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function kd(e){var t=rl(),r=e.focusedElem,i=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&tl(r.ownerDocument.documentElement,r)){if(i!==null&&Es(r)){if(t=i.start,e=i.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var n=r.textContent.length,o=Math.min(i.start,n);i=i.end===void 0?o:Math.min(i.end,n),!e.extend&&o>i&&(n=i,i=o,o=n),n=el(r,o);var a=el(r,i);n&&a&&(e.rangeCount!==1||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(n.node,n.offset),e.removeAllRanges(),o>i?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var jd=b&&"documentMode"in document&&11>=document.documentMode,Ar=null,Cs=null,gi=null,qs=!1;function il(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;qs||Ar==null||Ar!==ue(i)||(i=Ar,"selectionStart"in i&&Es(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),gi&&fi(gi,i)||(gi=i,i=ln(Cs,"onSelect"),0<i.length&&(t=new _s("onSelect","select",null,t,r),e.push({event:t,listeners:i}),t.target=Ar)))}function sn(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Lr={animationend:sn("Animation","AnimationEnd"),animationiteration:sn("Animation","AnimationIteration"),animationstart:sn("Animation","AnimationStart"),transitionend:sn("Transition","TransitionEnd")},Is={},nl={};b&&(nl=document.createElement("div").style,"AnimationEvent"in window||(delete Lr.animationend.animation,delete Lr.animationiteration.animation,delete Lr.animationstart.animation),"TransitionEvent"in window||delete Lr.transitionend.transition);function on(e){if(Is[e])return Is[e];if(!Lr[e])return e;var t=Lr[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in nl)return Is[e]=t[r];return e}var sl=on("animationend"),ol=on("animationiteration"),al=on("animationstart"),ll=on("transitionend"),cl=new Map,pl="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 Gt(e,t){cl.set(e,t),v(t,[e])}for(var As=0;As<pl.length;As++){var Ls=pl[As],Ed=Ls.toLowerCase(),Cd=Ls[0].toUpperCase()+Ls.slice(1);Gt(Ed,"on"+Cd)}Gt(sl,"onAnimationEnd"),Gt(ol,"onAnimationIteration"),Gt(al,"onAnimationStart"),Gt("dblclick","onDoubleClick"),Gt("focusin","onFocus"),Gt("focusout","onBlur"),Gt(ll,"onTransitionEnd"),C("onMouseEnter",["mouseout","mouseover"]),C("onMouseLeave",["mouseout","mouseover"]),C("onPointerEnter",["pointerout","pointerover"]),C("onPointerLeave",["pointerout","pointerover"]),v("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),v("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),v("onBeforeInput",["compositionend","keypress","textInput","paste"]),v("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),v("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),v("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),qd=new Set("cancel close invalid load scroll toggle".split(" ").concat(hi));function dl(e,t,r){var i=e.type||"unknown-event";e.currentTarget=r,Ep(i,t,void 0,e),e.currentTarget=null}function ul(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],n=i.event;i=i.listeners;e:{var o=void 0;if(t)for(var a=i.length-1;0<=a;a--){var p=i[a],y=p.instance,x=p.currentTarget;if(p=p.listener,y!==o&&n.isPropagationStopped())break e;dl(n,p,x),o=y}else for(a=0;a<i.length;a++){if(p=i[a],y=p.instance,x=p.currentTarget,p=p.listener,y!==o&&n.isPropagationStopped())break e;dl(n,p,x),o=y}}}if(Ui)throw e=ls,Ui=!1,ls=null,e}function qe(e,t){var r=t[Bs];r===void 0&&(r=t[Bs]=new Set);var i=e+"__bubble";r.has(i)||(yl(t,e,2,!1),r.add(i))}function Ts(e,t,r){var i=0;t&&(i|=4),yl(r,e,i,t)}var an="_reactListening"+Math.random().toString(36).slice(2);function _i(e){if(!e[an]){e[an]=!0,u.forEach(function(r){r!=="selectionchange"&&(qd.has(r)||Ts(r,!1,e),Ts(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[an]||(t[an]=!0,Ts("selectionchange",!1,t))}}function yl(e,t,r,i){switch(Ma(t)){case 1:var n=Wp;break;case 4:n=Up;break;default:n=fs}r=n.bind(null,t,r,e),n=void 0,!as||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),i?n!==void 0?e.addEventListener(t,r,{capture:!0,passive:n}):e.addEventListener(t,r,!0):n!==void 0?e.addEventListener(t,r,{passive:n}):e.addEventListener(t,r,!1)}function Rs(e,t,r,i,n){var o=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var a=i.tag;if(a===3||a===4){var p=i.stateNode.containerInfo;if(p===n||p.nodeType===8&&p.parentNode===n)break;if(a===4)for(a=i.return;a!==null;){var y=a.tag;if((y===3||y===4)&&(y=a.stateNode.containerInfo,y===n||y.nodeType===8&&y.parentNode===n))return;a=a.return}for(;p!==null;){if(a=ar(p),a===null)return;if(y=a.tag,y===5||y===6){i=o=a;continue e}p=p.parentNode}}i=i.return}_a(function(){var x=o,R=ns(r),P=[];e:{var L=cl.get(e);if(L!==void 0){var Q=_s,te=e;switch(e){case"keypress":if(en(r)===0)break e;case"keydown":case"keyup":Q=nd;break;case"focusin":te="focus",Q=Ss;break;case"focusout":te="blur",Q=Ss;break;case"beforeblur":case"afterblur":Q=Ss;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":Q=Ba;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=$p;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=ad;break;case sl:case ol:case al:Q=Yp;break;case ll:Q=cd;break;case"scroll":Q=Gp;break;case"wheel":Q=dd;break;case"copy":case"cut":case"paste":Q=Xp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Oa}var re=(t&4)!==0,De=!re&&e==="scroll",_=re?L!==null?L+"Capture":null:L;re=[];for(var f=x,S;f!==null;){S=f;var O=S.stateNode;if(S.tag===5&&O!==null&&(S=O,_!==null&&(O=ei(f,_),O!=null&&re.push(vi(f,O,S)))),De)break;f=f.return}0<re.length&&(L=new Q(L,te,null,r,R),P.push({event:L,listeners:re}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",L&&r!==is&&(te=r.relatedTarget||r.fromElement)&&(ar(te)||te[At]))break e;if((Q||L)&&(L=R.window===R?R:(L=R.ownerDocument)?L.defaultView||L.parentWindow:window,Q?(te=r.relatedTarget||r.toElement,Q=x,te=te?ar(te):null,te!==null&&(De=or(te),te!==De||te.tag!==5&&te.tag!==6)&&(te=null)):(Q=null,te=x),Q!==te)){if(re=Ba,O="onMouseLeave",_="onMouseEnter",f="mouse",(e==="pointerout"||e==="pointerover")&&(re=Oa,O="onPointerLeave",_="onPointerEnter",f="pointer"),De=Q==null?L:Nr(Q),S=te==null?L:Nr(te),L=new re(O,f+"leave",Q,r,R),L.target=De,L.relatedTarget=S,O=null,ar(R)===x&&(re=new re(_,f+"enter",te,r,R),re.target=S,re.relatedTarget=De,O=re),De=O,Q&&te)t:{for(re=Q,_=te,f=0,S=re;S;S=Tr(S))f++;for(S=0,O=_;O;O=Tr(O))S++;for(;0<f-S;)re=Tr(re),f--;for(;0<S-f;)_=Tr(_),S--;for(;f--;){if(re===_||_!==null&&re===_.alternate)break t;re=Tr(re),_=Tr(_)}re=null}else re=null;Q!==null&&ml(P,L,Q,re,!1),te!==null&&De!==null&&ml(P,De,te,re,!0)}}e:{if(L=x?Nr(x):window,Q=L.nodeName&&L.nodeName.toLowerCase(),Q==="select"||Q==="input"&&L.type==="file")var ie=_d;else if(Va(L))if(Ya)ie=xd;else{ie=bd;var ce=vd}else(Q=L.nodeName)&&Q.toLowerCase()==="input"&&(L.type==="checkbox"||L.type==="radio")&&(ie=Sd);if(ie&&(ie=ie(e,x))){Ka(P,ie,r,R);break e}ce&&ce(e,L,x),e==="focusout"&&(ce=L._wrapperState)&&ce.controlled&&L.type==="number"&&zt(L,"number",L.value)}switch(ce=x?Nr(x):window,e){case"focusin":(Va(ce)||ce.contentEditable==="true")&&(Ar=ce,Cs=x,gi=null);break;case"focusout":gi=Cs=Ar=null;break;case"mousedown":qs=!0;break;case"contextmenu":case"mouseup":case"dragend":qs=!1,il(P,r,R);break;case"selectionchange":if(jd)break;case"keydown":case"keyup":il(P,r,R)}var pe;if(ws)e:{switch(e){case"compositionstart":var ye="onCompositionStart";break e;case"compositionend":ye="onCompositionEnd";break e;case"compositionupdate":ye="onCompositionUpdate";break e}ye=void 0}else Ir?Ha(e,r)&&(ye="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(ye="onCompositionStart");ye&&(Wa&&r.locale!=="ko"&&(Ir||ye!=="onCompositionStart"?ye==="onCompositionEnd"&&Ir&&(pe=Da()):(Ut=R,hs="value"in Ut?Ut.value:Ut.textContent,Ir=!0)),ce=ln(x,ye),0<ce.length&&(ye=new Fa(ye,e,null,r,R),P.push({event:ye,listeners:ce}),pe?ye.data=pe:(pe=$a(r),pe!==null&&(ye.data=pe)))),(pe=yd?md(e,r):fd(e,r))&&(x=ln(x,"onBeforeInput"),0<x.length&&(R=new Fa("onBeforeInput","beforeinput",null,r,R),P.push({event:R,listeners:x}),R.data=pe))}ul(P,t)})}function vi(e,t,r){return{instance:e,listener:t,currentTarget:r}}function ln(e,t){for(var r=t+"Capture",i=[];e!==null;){var n=e,o=n.stateNode;n.tag===5&&o!==null&&(n=o,o=ei(e,r),o!=null&&i.unshift(vi(e,o,n)),o=ei(e,t),o!=null&&i.push(vi(e,o,n))),e=e.return}return i}function Tr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ml(e,t,r,i,n){for(var o=t._reactName,a=[];r!==null&&r!==i;){var p=r,y=p.alternate,x=p.stateNode;if(y!==null&&y===i)break;p.tag===5&&x!==null&&(p=x,n?(y=ei(r,o),y!=null&&a.unshift(vi(r,y,p))):n||(y=ei(r,o),y!=null&&a.push(vi(r,y,p)))),r=r.return}a.length!==0&&e.push({event:t,listeners:a})}var Id=/\r\n?/g,Ad=/\u0000|\uFFFD/g;function fl(e){return(typeof e=="string"?e:""+e).replace(Id,`
38
- `).replace(Ad,"")}function cn(e,t,r){if(t=fl(t),fl(e)!==t&&r)throw Error(c(425))}function pn(){}var Ns=null,Ps=null;function Ms(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ds=typeof setTimeout=="function"?setTimeout:void 0,Ld=typeof clearTimeout=="function"?clearTimeout:void 0,gl=typeof Promise=="function"?Promise:void 0,Td=typeof queueMicrotask=="function"?queueMicrotask:typeof gl<"u"?function(e){return gl.resolve(null).then(e).catch(Rd)}:Ds;function Rd(e){setTimeout(function(){throw e})}function zs(e,t){var r=t,i=0;do{var n=r.nextSibling;if(e.removeChild(r),n&&n.nodeType===8)if(r=n.data,r==="/$"){if(i===0){e.removeChild(n),ci(t);return}i--}else r!=="$"&&r!=="$?"&&r!=="$!"||i++;r=n}while(r);ci(t)}function Ht(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function hl(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Rr=Math.random().toString(36).slice(2),kt="__reactFiber$"+Rr,bi="__reactProps$"+Rr,At="__reactContainer$"+Rr,Bs="__reactEvents$"+Rr,Nd="__reactListeners$"+Rr,Pd="__reactHandles$"+Rr;function ar(e){var t=e[kt];if(t)return t;for(var r=e.parentNode;r;){if(t=r[At]||r[kt]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=hl(e);e!==null;){if(r=e[kt])return r;e=hl(e)}return t}e=r,r=e.parentNode}return null}function Si(e){return e=e[kt]||e[At],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Nr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(c(33))}function dn(e){return e[bi]||null}var Fs=[],Pr=-1;function $t(e){return{current:e}}function Ie(e){0>Pr||(e.current=Fs[Pr],Fs[Pr]=null,Pr--)}function Ce(e,t){Pr++,Fs[Pr]=e.current,e.current=t}var Vt={},Ve=$t(Vt),Ze=$t(!1),lr=Vt;function Mr(e,t){var r=e.type.contextTypes;if(!r)return Vt;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var n={},o;for(o in r)n[o]=t[o];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function et(e){return e=e.childContextTypes,e!=null}function un(){Ie(Ze),Ie(Ve)}function _l(e,t,r){if(Ve.current!==Vt)throw Error(c(168));Ce(Ve,t),Ce(Ze,r)}function vl(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!="function")return r;i=i.getChildContext();for(var n in i)if(!(n in t))throw Error(c(108,ve(e)||"Unknown",n));return H({},r,i)}function yn(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vt,lr=Ve.current,Ce(Ve,e),Ce(Ze,Ze.current),!0}function bl(e,t,r){var i=e.stateNode;if(!i)throw Error(c(169));r?(e=vl(e,t,lr),i.__reactInternalMemoizedMergedChildContext=e,Ie(Ze),Ie(Ve),Ce(Ve,e)):Ie(Ze),Ce(Ze,r)}var Lt=null,mn=!1,Os=!1;function Sl(e){Lt===null?Lt=[e]:Lt.push(e)}function Md(e){mn=!0,Sl(e)}function Kt(){if(!Os&&Lt!==null){Os=!0;var e=0,t=je;try{var r=Lt;for(je=1;e<r.length;e++){var i=r[e];do i=i(!0);while(i!==null)}Lt=null,mn=!1}catch(n){throw Lt!==null&&(Lt=Lt.slice(e+1)),wa(cs,Kt),n}finally{je=t,Os=!1}}return null}var Dr=[],zr=0,fn=null,gn=0,pt=[],dt=0,cr=null,Tt=1,Rt="";function pr(e,t){Dr[zr++]=gn,Dr[zr++]=fn,fn=e,gn=t}function xl(e,t,r){pt[dt++]=Tt,pt[dt++]=Rt,pt[dt++]=cr,cr=e;var i=Tt;e=Rt;var n=32-gt(i)-1;i&=~(1<<n),r+=1;var o=32-gt(t)+n;if(30<o){var a=n-n%5;o=(i&(1<<a)-1).toString(32),i>>=a,n-=a,Tt=1<<32-gt(t)+n|r<<n|i,Rt=o+e}else Tt=1<<o|r<<n|i,Rt=e}function Ws(e){e.return!==null&&(pr(e,1),xl(e,1,0))}function Us(e){for(;e===fn;)fn=Dr[--zr],Dr[zr]=null,gn=Dr[--zr],Dr[zr]=null;for(;e===cr;)cr=pt[--dt],pt[dt]=null,Rt=pt[--dt],pt[dt]=null,Tt=pt[--dt],pt[dt]=null}var ot=null,at=null,Ae=!1,_t=null;function wl(e,t){var r=ft(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function kl(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,ot=e,at=Ht(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ot=e,at=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=cr!==null?{id:Tt,overflow:Rt}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=ft(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,ot=e,at=null,!0):!1;default:return!1}}function Gs(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Hs(e){if(Ae){var t=at;if(t){var r=t;if(!kl(e,t)){if(Gs(e))throw Error(c(418));t=Ht(r.nextSibling);var i=ot;t&&kl(e,t)?wl(i,r):(e.flags=e.flags&-4097|2,Ae=!1,ot=e)}}else{if(Gs(e))throw Error(c(418));e.flags=e.flags&-4097|2,Ae=!1,ot=e}}}function jl(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ot=e}function hn(e){if(e!==ot)return!1;if(!Ae)return jl(e),Ae=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ms(e.type,e.memoizedProps)),t&&(t=at)){if(Gs(e))throw El(),Error(c(418));for(;t;)wl(e,t),t=Ht(t.nextSibling)}if(jl(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){at=Ht(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}at=null}}else at=ot?Ht(e.stateNode.nextSibling):null;return!0}function El(){for(var e=at;e;)e=Ht(e.nextSibling)}function Br(){at=ot=null,Ae=!1}function $s(e){_t===null?_t=[e]:_t.push(e)}var Dd=M.ReactCurrentBatchConfig;function xi(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(c(309));var i=r.stateNode}if(!i)throw Error(c(147,e));var n=i,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(a){var p=n.refs;a===null?delete p[o]:p[o]=a},t._stringRef=o,t)}if(typeof e!="string")throw Error(c(284));if(!r._owner)throw Error(c(290,e))}return e}function _n(e,t){throw e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Cl(e){var t=e._init;return t(e._payload)}function ql(e){function t(_,f){if(e){var S=_.deletions;S===null?(_.deletions=[f],_.flags|=16):S.push(f)}}function r(_,f){if(!e)return null;for(;f!==null;)t(_,f),f=f.sibling;return null}function i(_,f){for(_=new Map;f!==null;)f.key!==null?_.set(f.key,f):_.set(f.index,f),f=f.sibling;return _}function n(_,f){return _=rr(_,f),_.index=0,_.sibling=null,_}function o(_,f,S){return _.index=S,e?(S=_.alternate,S!==null?(S=S.index,S<f?(_.flags|=2,f):S):(_.flags|=2,f)):(_.flags|=1048576,f)}function a(_){return e&&_.alternate===null&&(_.flags|=2),_}function p(_,f,S,O){return f===null||f.tag!==6?(f=zo(S,_.mode,O),f.return=_,f):(f=n(f,S),f.return=_,f)}function y(_,f,S,O){var ie=S.type;return ie===ee?R(_,f,S.props.children,O,S.key):f!==null&&(f.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===Ee&&Cl(ie)===f.type)?(O=n(f,S.props),O.ref=xi(_,f,S),O.return=_,O):(O=Wn(S.type,S.key,S.props,null,_.mode,O),O.ref=xi(_,f,S),O.return=_,O)}function x(_,f,S,O){return f===null||f.tag!==4||f.stateNode.containerInfo!==S.containerInfo||f.stateNode.implementation!==S.implementation?(f=Bo(S,_.mode,O),f.return=_,f):(f=n(f,S.children||[]),f.return=_,f)}function R(_,f,S,O,ie){return f===null||f.tag!==7?(f=_r(S,_.mode,O,ie),f.return=_,f):(f=n(f,S),f.return=_,f)}function P(_,f,S){if(typeof f=="string"&&f!==""||typeof f=="number")return f=zo(""+f,_.mode,S),f.return=_,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case m:return S=Wn(f.type,f.key,f.props,null,_.mode,S),S.ref=xi(_,null,f),S.return=_,S;case N:return f=Bo(f,_.mode,S),f.return=_,f;case Ee:var O=f._init;return P(_,O(f._payload),S)}if(sr(f)||se(f))return f=_r(f,_.mode,S,null),f.return=_,f;_n(_,f)}return null}function L(_,f,S,O){var ie=f!==null?f.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return ie!==null?null:p(_,f,""+S,O);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case m:return S.key===ie?y(_,f,S,O):null;case N:return S.key===ie?x(_,f,S,O):null;case Ee:return ie=S._init,L(_,f,ie(S._payload),O)}if(sr(S)||se(S))return ie!==null?null:R(_,f,S,O,null);_n(_,S)}return null}function Q(_,f,S,O,ie){if(typeof O=="string"&&O!==""||typeof O=="number")return _=_.get(S)||null,p(f,_,""+O,ie);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case m:return _=_.get(O.key===null?S:O.key)||null,y(f,_,O,ie);case N:return _=_.get(O.key===null?S:O.key)||null,x(f,_,O,ie);case Ee:var ce=O._init;return Q(_,f,S,ce(O._payload),ie)}if(sr(O)||se(O))return _=_.get(S)||null,R(f,_,O,ie,null);_n(f,O)}return null}function te(_,f,S,O){for(var ie=null,ce=null,pe=f,ye=f=0,Ge=null;pe!==null&&ye<S.length;ye++){pe.index>ye?(Ge=pe,pe=null):Ge=pe.sibling;var we=L(_,pe,S[ye],O);if(we===null){pe===null&&(pe=Ge);break}e&&pe&&we.alternate===null&&t(_,pe),f=o(we,f,ye),ce===null?ie=we:ce.sibling=we,ce=we,pe=Ge}if(ye===S.length)return r(_,pe),Ae&&pr(_,ye),ie;if(pe===null){for(;ye<S.length;ye++)pe=P(_,S[ye],O),pe!==null&&(f=o(pe,f,ye),ce===null?ie=pe:ce.sibling=pe,ce=pe);return Ae&&pr(_,ye),ie}for(pe=i(_,pe);ye<S.length;ye++)Ge=Q(pe,_,ye,S[ye],O),Ge!==null&&(e&&Ge.alternate!==null&&pe.delete(Ge.key===null?ye:Ge.key),f=o(Ge,f,ye),ce===null?ie=Ge:ce.sibling=Ge,ce=Ge);return e&&pe.forEach(function(ir){return t(_,ir)}),Ae&&pr(_,ye),ie}function re(_,f,S,O){var ie=se(S);if(typeof ie!="function")throw Error(c(150));if(S=ie.call(S),S==null)throw Error(c(151));for(var ce=ie=null,pe=f,ye=f=0,Ge=null,we=S.next();pe!==null&&!we.done;ye++,we=S.next()){pe.index>ye?(Ge=pe,pe=null):Ge=pe.sibling;var ir=L(_,pe,we.value,O);if(ir===null){pe===null&&(pe=Ge);break}e&&pe&&ir.alternate===null&&t(_,pe),f=o(ir,f,ye),ce===null?ie=ir:ce.sibling=ir,ce=ir,pe=Ge}if(we.done)return r(_,pe),Ae&&pr(_,ye),ie;if(pe===null){for(;!we.done;ye++,we=S.next())we=P(_,we.value,O),we!==null&&(f=o(we,f,ye),ce===null?ie=we:ce.sibling=we,ce=we);return Ae&&pr(_,ye),ie}for(pe=i(_,pe);!we.done;ye++,we=S.next())we=Q(pe,_,ye,we.value,O),we!==null&&(e&&we.alternate!==null&&pe.delete(we.key===null?ye:we.key),f=o(we,f,ye),ce===null?ie=we:ce.sibling=we,ce=we);return e&&pe.forEach(function(gu){return t(_,gu)}),Ae&&pr(_,ye),ie}function De(_,f,S,O){if(typeof S=="object"&&S!==null&&S.type===ee&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case m:e:{for(var ie=S.key,ce=f;ce!==null;){if(ce.key===ie){if(ie=S.type,ie===ee){if(ce.tag===7){r(_,ce.sibling),f=n(ce,S.props.children),f.return=_,_=f;break e}}else if(ce.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===Ee&&Cl(ie)===ce.type){r(_,ce.sibling),f=n(ce,S.props),f.ref=xi(_,ce,S),f.return=_,_=f;break e}r(_,ce);break}else t(_,ce);ce=ce.sibling}S.type===ee?(f=_r(S.props.children,_.mode,O,S.key),f.return=_,_=f):(O=Wn(S.type,S.key,S.props,null,_.mode,O),O.ref=xi(_,f,S),O.return=_,_=O)}return a(_);case N:e:{for(ce=S.key;f!==null;){if(f.key===ce)if(f.tag===4&&f.stateNode.containerInfo===S.containerInfo&&f.stateNode.implementation===S.implementation){r(_,f.sibling),f=n(f,S.children||[]),f.return=_,_=f;break e}else{r(_,f);break}else t(_,f);f=f.sibling}f=Bo(S,_.mode,O),f.return=_,_=f}return a(_);case Ee:return ce=S._init,De(_,f,ce(S._payload),O)}if(sr(S))return te(_,f,S,O);if(se(S))return re(_,f,S,O);_n(_,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,f!==null&&f.tag===6?(r(_,f.sibling),f=n(f,S),f.return=_,_=f):(r(_,f),f=zo(S,_.mode,O),f.return=_,_=f),a(_)):r(_,f)}return De}var Fr=ql(!0),Il=ql(!1),vn=$t(null),bn=null,Or=null,Vs=null;function Ks(){Vs=Or=bn=null}function Ys(e){var t=vn.current;Ie(vn),e._currentValue=t}function Qs(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function Wr(e,t){bn=e,Vs=Or=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(tt=!0),e.firstContext=null)}function ut(e){var t=e._currentValue;if(Vs!==e)if(e={context:e,memoizedValue:t,next:null},Or===null){if(bn===null)throw Error(c(308));Or=e,bn.dependencies={lanes:0,firstContext:e}}else Or=Or.next=e;return t}var dr=null;function Xs(e){dr===null?dr=[e]:dr.push(e)}function Al(e,t,r,i){var n=t.interleaved;return n===null?(r.next=r,Xs(t)):(r.next=n.next,n.next=r),t.interleaved=r,Nt(e,i)}function Nt(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Yt=!1;function Js(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ll(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Pt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Qt(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(xe&2)!==0){var n=i.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),i.pending=t,Nt(e,r)}return n=i.interleaved,n===null?(t.next=t,Xs(i)):(t.next=n.next,n.next=t),i.interleaved=t,Nt(e,r)}function Sn(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,us(e,r)}}function Tl(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var n=null,o=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};o===null?n=o=a:o=o.next=a,r=r.next}while(r!==null);o===null?n=o=t:o=o.next=t}else n=o=t;r={baseState:i.baseState,firstBaseUpdate:n,lastBaseUpdate:o,shared:i.shared,effects:i.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function xn(e,t,r,i){var n=e.updateQueue;Yt=!1;var o=n.firstBaseUpdate,a=n.lastBaseUpdate,p=n.shared.pending;if(p!==null){n.shared.pending=null;var y=p,x=y.next;y.next=null,a===null?o=x:a.next=x,a=y;var R=e.alternate;R!==null&&(R=R.updateQueue,p=R.lastBaseUpdate,p!==a&&(p===null?R.firstBaseUpdate=x:p.next=x,R.lastBaseUpdate=y))}if(o!==null){var P=n.baseState;a=0,R=x=y=null,p=o;do{var L=p.lane,Q=p.eventTime;if((i&L)===L){R!==null&&(R=R.next={eventTime:Q,lane:0,tag:p.tag,payload:p.payload,callback:p.callback,next:null});e:{var te=e,re=p;switch(L=t,Q=r,re.tag){case 1:if(te=re.payload,typeof te=="function"){P=te.call(Q,P,L);break e}P=te;break e;case 3:te.flags=te.flags&-65537|128;case 0:if(te=re.payload,L=typeof te=="function"?te.call(Q,P,L):te,L==null)break e;P=H({},P,L);break e;case 2:Yt=!0}}p.callback!==null&&p.lane!==0&&(e.flags|=64,L=n.effects,L===null?n.effects=[p]:L.push(p))}else Q={eventTime:Q,lane:L,tag:p.tag,payload:p.payload,callback:p.callback,next:null},R===null?(x=R=Q,y=P):R=R.next=Q,a|=L;if(p=p.next,p===null){if(p=n.shared.pending,p===null)break;L=p,p=L.next,L.next=null,n.lastBaseUpdate=L,n.shared.pending=null}}while(!0);if(R===null&&(y=P),n.baseState=y,n.firstBaseUpdate=x,n.lastBaseUpdate=R,t=n.shared.interleaved,t!==null){n=t;do a|=n.lane,n=n.next;while(n!==t)}else o===null&&(n.shared.lanes=0);mr|=a,e.lanes=a,e.memoizedState=P}}function Rl(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],n=i.callback;if(n!==null){if(i.callback=null,i=r,typeof n!="function")throw Error(c(191,n));n.call(i)}}}var wi={},jt=$t(wi),ki=$t(wi),ji=$t(wi);function ur(e){if(e===wi)throw Error(c(174));return e}function Zs(e,t){switch(Ce(ji,t),Ce(ki,e),Ce(jt,wi),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:es(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=es(t,e)}Ie(jt),Ce(jt,t)}function Ur(){Ie(jt),Ie(ki),Ie(ji)}function Nl(e){ur(ji.current);var t=ur(jt.current),r=es(t,e.type);t!==r&&(Ce(ki,e),Ce(jt,r))}function eo(e){ki.current===e&&(Ie(jt),Ie(ki))}var Te=$t(0);function wn(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var to=[];function ro(){for(var e=0;e<to.length;e++)to[e]._workInProgressVersionPrimary=null;to.length=0}var kn=M.ReactCurrentDispatcher,io=M.ReactCurrentBatchConfig,yr=0,Re=null,Fe=null,We=null,jn=!1,Ei=!1,Ci=0,zd=0;function Ke(){throw Error(c(321))}function no(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!ht(e[r],t[r]))return!1;return!0}function so(e,t,r,i,n,o){if(yr=o,Re=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,kn.current=e===null||e.memoizedState===null?Wd:Ud,e=r(i,n),Ei){o=0;do{if(Ei=!1,Ci=0,25<=o)throw Error(c(301));o+=1,We=Fe=null,t.updateQueue=null,kn.current=Gd,e=r(i,n)}while(Ei)}if(kn.current=qn,t=Fe!==null&&Fe.next!==null,yr=0,We=Fe=Re=null,jn=!1,t)throw Error(c(300));return e}function oo(){var e=Ci!==0;return Ci=0,e}function Et(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return We===null?Re.memoizedState=We=e:We=We.next=e,We}function yt(){if(Fe===null){var e=Re.alternate;e=e!==null?e.memoizedState:null}else e=Fe.next;var t=We===null?Re.memoizedState:We.next;if(t!==null)We=t,Fe=e;else{if(e===null)throw Error(c(310));Fe=e,e={memoizedState:Fe.memoizedState,baseState:Fe.baseState,baseQueue:Fe.baseQueue,queue:Fe.queue,next:null},We===null?Re.memoizedState=We=e:We=We.next=e}return We}function qi(e,t){return typeof t=="function"?t(e):t}function ao(e){var t=yt(),r=t.queue;if(r===null)throw Error(c(311));r.lastRenderedReducer=e;var i=Fe,n=i.baseQueue,o=r.pending;if(o!==null){if(n!==null){var a=n.next;n.next=o.next,o.next=a}i.baseQueue=n=o,r.pending=null}if(n!==null){o=n.next,i=i.baseState;var p=a=null,y=null,x=o;do{var R=x.lane;if((yr&R)===R)y!==null&&(y=y.next={lane:0,action:x.action,hasEagerState:x.hasEagerState,eagerState:x.eagerState,next:null}),i=x.hasEagerState?x.eagerState:e(i,x.action);else{var P={lane:R,action:x.action,hasEagerState:x.hasEagerState,eagerState:x.eagerState,next:null};y===null?(p=y=P,a=i):y=y.next=P,Re.lanes|=R,mr|=R}x=x.next}while(x!==null&&x!==o);y===null?a=i:y.next=p,ht(i,t.memoizedState)||(tt=!0),t.memoizedState=i,t.baseState=a,t.baseQueue=y,r.lastRenderedState=i}if(e=r.interleaved,e!==null){n=e;do o=n.lane,Re.lanes|=o,mr|=o,n=n.next;while(n!==e)}else n===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function lo(e){var t=yt(),r=t.queue;if(r===null)throw Error(c(311));r.lastRenderedReducer=e;var i=r.dispatch,n=r.pending,o=t.memoizedState;if(n!==null){r.pending=null;var a=n=n.next;do o=e(o,a.action),a=a.next;while(a!==n);ht(o,t.memoizedState)||(tt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),r.lastRenderedState=o}return[o,i]}function Pl(){}function Ml(e,t){var r=Re,i=yt(),n=t(),o=!ht(i.memoizedState,n);if(o&&(i.memoizedState=n,tt=!0),i=i.queue,co(Bl.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||We!==null&&We.memoizedState.tag&1){if(r.flags|=2048,Ii(9,zl.bind(null,r,i,n,t),void 0,null),Ue===null)throw Error(c(349));(yr&30)!==0||Dl(r,t,n)}return n}function Dl(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Re.updateQueue,t===null?(t={lastEffect:null,stores:null},Re.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function zl(e,t,r,i){t.value=r,t.getSnapshot=i,Fl(t)&&Ol(e)}function Bl(e,t,r){return r(function(){Fl(t)&&Ol(e)})}function Fl(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!ht(e,r)}catch{return!0}}function Ol(e){var t=Nt(e,1);t!==null&&xt(t,e,1,-1)}function Wl(e){var t=Et();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:e},t.queue=e,e=e.dispatch=Od.bind(null,Re,e),[t.memoizedState,e]}function Ii(e,t,r,i){return e={tag:e,create:t,destroy:r,deps:i,next:null},t=Re.updateQueue,t===null?(t={lastEffect:null,stores:null},Re.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,t.lastEffect=e)),e}function Ul(){return yt().memoizedState}function En(e,t,r,i){var n=Et();Re.flags|=e,n.memoizedState=Ii(1|t,r,void 0,i===void 0?null:i)}function Cn(e,t,r,i){var n=yt();i=i===void 0?null:i;var o=void 0;if(Fe!==null){var a=Fe.memoizedState;if(o=a.destroy,i!==null&&no(i,a.deps)){n.memoizedState=Ii(t,r,o,i);return}}Re.flags|=e,n.memoizedState=Ii(1|t,r,o,i)}function Gl(e,t){return En(8390656,8,e,t)}function co(e,t){return Cn(2048,8,e,t)}function Hl(e,t){return Cn(4,2,e,t)}function $l(e,t){return Cn(4,4,e,t)}function Vl(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Kl(e,t,r){return r=r!=null?r.concat([e]):null,Cn(4,4,Vl.bind(null,t,e),r)}function po(){}function Yl(e,t){var r=yt();t=t===void 0?null:t;var i=r.memoizedState;return i!==null&&t!==null&&no(t,i[1])?i[0]:(r.memoizedState=[e,t],e)}function Ql(e,t){var r=yt();t=t===void 0?null:t;var i=r.memoizedState;return i!==null&&t!==null&&no(t,i[1])?i[0]:(e=e(),r.memoizedState=[e,t],e)}function Xl(e,t,r){return(yr&21)===0?(e.baseState&&(e.baseState=!1,tt=!0),e.memoizedState=r):(ht(r,t)||(r=Ca(),Re.lanes|=r,mr|=r,e.baseState=!0),t)}function Bd(e,t){var r=je;je=r!==0&&4>r?r:4,e(!0);var i=io.transition;io.transition={};try{e(!1),t()}finally{je=r,io.transition=i}}function Jl(){return yt().memoizedState}function Fd(e,t,r){var i=er(e);if(r={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null},Zl(e))ec(t,r);else if(r=Al(e,t,r,i),r!==null){var n=Je();xt(r,e,i,n),tc(r,t,i)}}function Od(e,t,r){var i=er(e),n={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null};if(Zl(e))ec(t,n);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,p=o(a,r);if(n.hasEagerState=!0,n.eagerState=p,ht(p,a)){var y=t.interleaved;y===null?(n.next=n,Xs(t)):(n.next=y.next,y.next=n),t.interleaved=n;return}}catch{}finally{}r=Al(e,t,n,i),r!==null&&(n=Je(),xt(r,e,i,n),tc(r,t,i))}}function Zl(e){var t=e.alternate;return e===Re||t!==null&&t===Re}function ec(e,t){Ei=jn=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function tc(e,t,r){if((r&4194240)!==0){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,us(e,r)}}var qn={readContext:ut,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useInsertionEffect:Ke,useLayoutEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useMutableSource:Ke,useSyncExternalStore:Ke,useId:Ke,unstable_isNewReconciler:!1},Wd={readContext:ut,useCallback:function(e,t){return Et().memoizedState=[e,t===void 0?null:t],e},useContext:ut,useEffect:Gl,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,En(4194308,4,Vl.bind(null,t,e),r)},useLayoutEffect:function(e,t){return En(4194308,4,e,t)},useInsertionEffect:function(e,t){return En(4,2,e,t)},useMemo:function(e,t){var r=Et();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var i=Et();return t=r!==void 0?r(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=Fd.bind(null,Re,e),[i.memoizedState,e]},useRef:function(e){var t=Et();return e={current:e},t.memoizedState=e},useState:Wl,useDebugValue:po,useDeferredValue:function(e){return Et().memoizedState=e},useTransition:function(){var e=Wl(!1),t=e[0];return e=Bd.bind(null,e[1]),Et().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=Re,n=Et();if(Ae){if(r===void 0)throw Error(c(407));r=r()}else{if(r=t(),Ue===null)throw Error(c(349));(yr&30)!==0||Dl(i,t,r)}n.memoizedState=r;var o={value:r,getSnapshot:t};return n.queue=o,Gl(Bl.bind(null,i,o,e),[e]),i.flags|=2048,Ii(9,zl.bind(null,i,o,r,t),void 0,null),r},useId:function(){var e=Et(),t=Ue.identifierPrefix;if(Ae){var r=Rt,i=Tt;r=(i&~(1<<32-gt(i)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ci++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=zd++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Ud={readContext:ut,useCallback:Yl,useContext:ut,useEffect:co,useImperativeHandle:Kl,useInsertionEffect:Hl,useLayoutEffect:$l,useMemo:Ql,useReducer:ao,useRef:Ul,useState:function(){return ao(qi)},useDebugValue:po,useDeferredValue:function(e){var t=yt();return Xl(t,Fe.memoizedState,e)},useTransition:function(){var e=ao(qi)[0],t=yt().memoizedState;return[e,t]},useMutableSource:Pl,useSyncExternalStore:Ml,useId:Jl,unstable_isNewReconciler:!1},Gd={readContext:ut,useCallback:Yl,useContext:ut,useEffect:co,useImperativeHandle:Kl,useInsertionEffect:Hl,useLayoutEffect:$l,useMemo:Ql,useReducer:lo,useRef:Ul,useState:function(){return lo(qi)},useDebugValue:po,useDeferredValue:function(e){var t=yt();return Fe===null?t.memoizedState=e:Xl(t,Fe.memoizedState,e)},useTransition:function(){var e=lo(qi)[0],t=yt().memoizedState;return[e,t]},useMutableSource:Pl,useSyncExternalStore:Ml,useId:Jl,unstable_isNewReconciler:!1};function vt(e,t){if(e&&e.defaultProps){t=H({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function uo(e,t,r,i){t=e.memoizedState,r=r(i,t),r=r==null?t:H({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var In={isMounted:function(e){return(e=e._reactInternals)?or(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var i=Je(),n=er(e),o=Pt(i,n);o.payload=t,r!=null&&(o.callback=r),t=Qt(e,o,n),t!==null&&(xt(t,e,n,i),Sn(t,e,n))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var i=Je(),n=er(e),o=Pt(i,n);o.tag=1,o.payload=t,r!=null&&(o.callback=r),t=Qt(e,o,n),t!==null&&(xt(t,e,n,i),Sn(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Je(),i=er(e),n=Pt(r,i);n.tag=2,t!=null&&(n.callback=t),t=Qt(e,n,i),t!==null&&(xt(t,e,i,r),Sn(t,e,i))}};function rc(e,t,r,i,n,o,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,o,a):t.prototype&&t.prototype.isPureReactComponent?!fi(r,i)||!fi(n,o):!0}function ic(e,t,r){var i=!1,n=Vt,o=t.contextType;return typeof o=="object"&&o!==null?o=ut(o):(n=et(t)?lr:Ve.current,i=t.contextTypes,o=(i=i!=null)?Mr(e,n):Vt),t=new t(r,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=In,e.stateNode=t,t._reactInternals=e,i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=o),t}function nc(e,t,r,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,i),t.state!==e&&In.enqueueReplaceState(t,t.state,null)}function yo(e,t,r,i){var n=e.stateNode;n.props=r,n.state=e.memoizedState,n.refs={},Js(e);var o=t.contextType;typeof o=="object"&&o!==null?n.context=ut(o):(o=et(t)?lr:Ve.current,n.context=Mr(e,o)),n.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(uo(e,t,o,r),n.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(t=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),t!==n.state&&In.enqueueReplaceState(n,n.state,null),xn(e,r,n,i),n.state=e.memoizedState),typeof n.componentDidMount=="function"&&(e.flags|=4194308)}function Gr(e,t){try{var r="",i=t;do r+=Y(i),i=i.return;while(i);var n=r}catch(o){n=`
39
- Error generating stack: `+o.message+`
40
- `+o.stack}return{value:e,source:t,stack:n,digest:null}}function mo(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function fo(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Hd=typeof WeakMap=="function"?WeakMap:Map;function sc(e,t,r){r=Pt(-1,r),r.tag=3,r.payload={element:null};var i=t.value;return r.callback=function(){Mn||(Mn=!0,Ao=i),fo(e,t)},r}function oc(e,t,r){r=Pt(-1,r),r.tag=3;var i=e.type.getDerivedStateFromError;if(typeof i=="function"){var n=t.value;r.payload=function(){return i(n)},r.callback=function(){fo(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(r.callback=function(){fo(e,t),typeof i!="function"&&(Jt===null?Jt=new Set([this]):Jt.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),r}function ac(e,t,r){var i=e.pingCache;if(i===null){i=e.pingCache=new Hd;var n=new Set;i.set(t,n)}else n=i.get(t),n===void 0&&(n=new Set,i.set(t,n));n.has(r)||(n.add(r),e=su.bind(null,e,t,r),t.then(e,e))}function lc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function cc(e,t,r,i,n){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Pt(-1,1),t.tag=2,Qt(r,t,1))),r.lanes|=1),e):(e.flags|=65536,e.lanes=n,e)}var $d=M.ReactCurrentOwner,tt=!1;function Xe(e,t,r,i){t.child=e===null?Il(t,null,r,i):Fr(t,e.child,r,i)}function pc(e,t,r,i,n){r=r.render;var o=t.ref;return Wr(t,n),i=so(e,t,r,i,o,n),r=oo(),e!==null&&!tt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,Mt(e,t,n)):(Ae&&r&&Ws(t),t.flags|=1,Xe(e,t,i,n),t.child)}function dc(e,t,r,i,n){if(e===null){var o=r.type;return typeof o=="function"&&!Do(o)&&o.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=o,uc(e,t,o,i,n)):(e=Wn(r.type,null,i,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,(e.lanes&n)===0){var a=o.memoizedProps;if(r=r.compare,r=r!==null?r:fi,r(a,i)&&e.ref===t.ref)return Mt(e,t,n)}return t.flags|=1,e=rr(o,i),e.ref=t.ref,e.return=t,t.child=e}function uc(e,t,r,i,n){if(e!==null){var o=e.memoizedProps;if(fi(o,i)&&e.ref===t.ref)if(tt=!1,t.pendingProps=i=o,(e.lanes&n)!==0)(e.flags&131072)!==0&&(tt=!0);else return t.lanes=e.lanes,Mt(e,t,n)}return go(e,t,r,i,n)}function yc(e,t,r){var i=t.pendingProps,n=i.children,o=e!==null?e.memoizedState:null;if(i.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ce($r,lt),lt|=r;else{if((r&1073741824)===0)return e=o!==null?o.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ce($r,lt),lt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=o!==null?o.baseLanes:r,Ce($r,lt),lt|=i}else o!==null?(i=o.baseLanes|r,t.memoizedState=null):i=r,Ce($r,lt),lt|=i;return Xe(e,t,n,r),t.child}function mc(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function go(e,t,r,i,n){var o=et(r)?lr:Ve.current;return o=Mr(t,o),Wr(t,n),r=so(e,t,r,i,o,n),i=oo(),e!==null&&!tt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,Mt(e,t,n)):(Ae&&i&&Ws(t),t.flags|=1,Xe(e,t,r,n),t.child)}function fc(e,t,r,i,n){if(et(r)){var o=!0;yn(t)}else o=!1;if(Wr(t,n),t.stateNode===null)Ln(e,t),ic(t,r,i),yo(t,r,i,n),i=!0;else if(e===null){var a=t.stateNode,p=t.memoizedProps;a.props=p;var y=a.context,x=r.contextType;typeof x=="object"&&x!==null?x=ut(x):(x=et(r)?lr:Ve.current,x=Mr(t,x));var R=r.getDerivedStateFromProps,P=typeof R=="function"||typeof a.getSnapshotBeforeUpdate=="function";P||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(p!==i||y!==x)&&nc(t,a,i,x),Yt=!1;var L=t.memoizedState;a.state=L,xn(t,i,a,n),y=t.memoizedState,p!==i||L!==y||Ze.current||Yt?(typeof R=="function"&&(uo(t,r,R,i),y=t.memoizedState),(p=Yt||rc(t,r,p,i,L,y,x))?(P||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=y),a.props=i,a.state=y,a.context=x,i=p):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{a=t.stateNode,Ll(e,t),p=t.memoizedProps,x=t.type===t.elementType?p:vt(t.type,p),a.props=x,P=t.pendingProps,L=a.context,y=r.contextType,typeof y=="object"&&y!==null?y=ut(y):(y=et(r)?lr:Ve.current,y=Mr(t,y));var Q=r.getDerivedStateFromProps;(R=typeof Q=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(p!==P||L!==y)&&nc(t,a,i,y),Yt=!1,L=t.memoizedState,a.state=L,xn(t,i,a,n);var te=t.memoizedState;p!==P||L!==te||Ze.current||Yt?(typeof Q=="function"&&(uo(t,r,Q,i),te=t.memoizedState),(x=Yt||rc(t,r,x,i,L,te,y)||!1)?(R||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(i,te,y),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(i,te,y)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=te),a.props=i,a.state=te,a.context=y,i=x):(typeof a.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),i=!1)}return ho(e,t,r,i,o,n)}function ho(e,t,r,i,n,o){mc(e,t);var a=(t.flags&128)!==0;if(!i&&!a)return n&&bl(t,r,!1),Mt(e,t,o);i=t.stateNode,$d.current=t;var p=a&&typeof r.getDerivedStateFromError!="function"?null:i.render();return t.flags|=1,e!==null&&a?(t.child=Fr(t,e.child,null,o),t.child=Fr(t,null,p,o)):Xe(e,t,p,o),t.memoizedState=i.state,n&&bl(t,r,!0),t.child}function gc(e){var t=e.stateNode;t.pendingContext?_l(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_l(e,t.context,!1),Zs(e,t.containerInfo)}function hc(e,t,r,i,n){return Br(),$s(n),t.flags|=256,Xe(e,t,r,i),t.child}var _o={dehydrated:null,treeContext:null,retryLane:0};function vo(e){return{baseLanes:e,cachePool:null,transitions:null}}function _c(e,t,r){var i=t.pendingProps,n=Te.current,o=!1,a=(t.flags&128)!==0,p;if((p=a)||(p=e!==null&&e.memoizedState===null?!1:(n&2)!==0),p?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(n|=1),Ce(Te,n&1),e===null)return Hs(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(a=i.children,e=i.fallback,o?(i=t.mode,o=t.child,a={mode:"hidden",children:a},(i&1)===0&&o!==null?(o.childLanes=0,o.pendingProps=a):o=Un(a,i,0,null),e=_r(e,i,r,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=vo(r),t.memoizedState=_o,e):bo(t,a));if(n=e.memoizedState,n!==null&&(p=n.dehydrated,p!==null))return Vd(e,t,a,i,p,n,r);if(o){o=i.fallback,a=t.mode,n=e.child,p=n.sibling;var y={mode:"hidden",children:i.children};return(a&1)===0&&t.child!==n?(i=t.child,i.childLanes=0,i.pendingProps=y,t.deletions=null):(i=rr(n,y),i.subtreeFlags=n.subtreeFlags&14680064),p!==null?o=rr(p,o):(o=_r(o,a,r,null),o.flags|=2),o.return=t,i.return=t,i.sibling=o,t.child=i,i=o,o=t.child,a=e.child.memoizedState,a=a===null?vo(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~r,t.memoizedState=_o,i}return o=e.child,e=o.sibling,i=rr(o,{mode:"visible",children:i.children}),(t.mode&1)===0&&(i.lanes=r),i.return=t,i.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=i,t.memoizedState=null,i}function bo(e,t){return t=Un({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function An(e,t,r,i){return i!==null&&$s(i),Fr(t,e.child,null,r),e=bo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Vd(e,t,r,i,n,o,a){if(r)return t.flags&256?(t.flags&=-257,i=mo(Error(c(422))),An(e,t,a,i)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=i.fallback,n=t.mode,i=Un({mode:"visible",children:i.children},n,0,null),o=_r(o,n,a,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,(t.mode&1)!==0&&Fr(t,e.child,null,a),t.child.memoizedState=vo(a),t.memoizedState=_o,o);if((t.mode&1)===0)return An(e,t,a,null);if(n.data==="$!"){if(i=n.nextSibling&&n.nextSibling.dataset,i)var p=i.dgst;return i=p,o=Error(c(419)),i=mo(o,i,void 0),An(e,t,a,i)}if(p=(a&e.childLanes)!==0,tt||p){if(i=Ue,i!==null){switch(a&-a){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&(i.suspendedLanes|a))!==0?0:n,n!==0&&n!==o.retryLane&&(o.retryLane=n,Nt(e,n),xt(i,e,n,-1))}return Mo(),i=mo(Error(c(421))),An(e,t,a,i)}return n.data==="$?"?(t.flags|=128,t.child=e.child,t=ou.bind(null,e),n._reactRetry=t,null):(e=o.treeContext,at=Ht(n.nextSibling),ot=t,Ae=!0,_t=null,e!==null&&(pt[dt++]=Tt,pt[dt++]=Rt,pt[dt++]=cr,Tt=e.id,Rt=e.overflow,cr=t),t=bo(t,i.children),t.flags|=4096,t)}function vc(e,t,r){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Qs(e.return,t,r)}function So(e,t,r,i,n){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:n}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=i,o.tail=r,o.tailMode=n)}function bc(e,t,r){var i=t.pendingProps,n=i.revealOrder,o=i.tail;if(Xe(e,t,i.children,r),i=Te.current,(i&2)!==0)i=i&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vc(e,r,t);else if(e.tag===19)vc(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}i&=1}if(Ce(Te,i),(t.mode&1)===0)t.memoizedState=null;else switch(n){case"forwards":for(r=t.child,n=null;r!==null;)e=r.alternate,e!==null&&wn(e)===null&&(n=r),r=r.sibling;r=n,r===null?(n=t.child,t.child=null):(n=r.sibling,r.sibling=null),So(t,!1,n,r,o);break;case"backwards":for(r=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&wn(e)===null){t.child=n;break}e=n.sibling,n.sibling=r,r=n,n=e}So(t,!0,r,null,o);break;case"together":So(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ln(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mt(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),mr|=t.lanes,(r&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,r=rr(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=rr(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Kd(e,t,r){switch(t.tag){case 3:gc(t),Br();break;case 5:Nl(t);break;case 1:et(t.type)&&yn(t);break;case 4:Zs(t,t.stateNode.containerInfo);break;case 10:var i=t.type._context,n=t.memoizedProps.value;Ce(vn,i._currentValue),i._currentValue=n;break;case 13:if(i=t.memoizedState,i!==null)return i.dehydrated!==null?(Ce(Te,Te.current&1),t.flags|=128,null):(r&t.child.childLanes)!==0?_c(e,t,r):(Ce(Te,Te.current&1),e=Mt(e,t,r),e!==null?e.sibling:null);Ce(Te,Te.current&1);break;case 19:if(i=(r&t.childLanes)!==0,(e.flags&128)!==0){if(i)return bc(e,t,r);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),Ce(Te,Te.current),i)break;return null;case 22:case 23:return t.lanes=0,yc(e,t,r)}return Mt(e,t,r)}var Sc,xo,xc,wc;Sc=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},xo=function(){},xc=function(e,t,r,i){var n=e.memoizedProps;if(n!==i){e=t.stateNode,ur(jt.current);var o=null;switch(r){case"input":n=de(e,n),i=de(e,i),o=[];break;case"select":n=H({},n,{value:void 0}),i=H({},i,{value:void 0}),o=[];break;case"textarea":n=Zn(e,n),i=Zn(e,i),o=[];break;default:typeof n.onClick!="function"&&typeof i.onClick=="function"&&(e.onclick=pn)}ts(r,i);var a;r=null;for(x in n)if(!i.hasOwnProperty(x)&&n.hasOwnProperty(x)&&n[x]!=null)if(x==="style"){var p=n[x];for(a in p)p.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else x!=="dangerouslySetInnerHTML"&&x!=="children"&&x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(h.hasOwnProperty(x)?o||(o=[]):(o=o||[]).push(x,null));for(x in i){var y=i[x];if(p=n!=null?n[x]:void 0,i.hasOwnProperty(x)&&y!==p&&(y!=null||p!=null))if(x==="style")if(p){for(a in p)!p.hasOwnProperty(a)||y&&y.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in y)y.hasOwnProperty(a)&&p[a]!==y[a]&&(r||(r={}),r[a]=y[a])}else r||(o||(o=[]),o.push(x,r)),r=y;else x==="dangerouslySetInnerHTML"?(y=y?y.__html:void 0,p=p?p.__html:void 0,y!=null&&p!==y&&(o=o||[]).push(x,y)):x==="children"?typeof y!="string"&&typeof y!="number"||(o=o||[]).push(x,""+y):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&(h.hasOwnProperty(x)?(y!=null&&x==="onScroll"&&qe("scroll",e),o||p===y||(o=[])):(o=o||[]).push(x,y))}r&&(o=o||[]).push("style",r);var x=o;(t.updateQueue=x)&&(t.flags|=4)}},wc=function(e,t,r,i){r!==i&&(t.flags|=4)};function Ai(e,t){if(!Ae)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(t)for(var n=e.child;n!==null;)r|=n.lanes|n.childLanes,i|=n.subtreeFlags&14680064,i|=n.flags&14680064,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)r|=n.lanes|n.childLanes,i|=n.subtreeFlags,i|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=i,e.childLanes=r,t}function Yd(e,t,r){var i=t.pendingProps;switch(Us(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return et(t.type)&&un(),Ye(t),null;case 3:return i=t.stateNode,Ur(),Ie(Ze),Ie(Ve),ro(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(hn(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,_t!==null&&(Ro(_t),_t=null))),xo(e,t),Ye(t),null;case 5:eo(t);var n=ur(ji.current);if(r=t.type,e!==null&&t.stateNode!=null)xc(e,t,r,i,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(c(166));return Ye(t),null}if(e=ur(jt.current),hn(t)){i=t.stateNode,r=t.type;var o=t.memoizedProps;switch(i[kt]=t,i[bi]=o,e=(t.mode&1)!==0,r){case"dialog":qe("cancel",i),qe("close",i);break;case"iframe":case"object":case"embed":qe("load",i);break;case"video":case"audio":for(n=0;n<hi.length;n++)qe(hi[n],i);break;case"source":qe("error",i);break;case"img":case"image":case"link":qe("error",i),qe("load",i);break;case"details":qe("toggle",i);break;case"input":nr(i,o),qe("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!o.multiple},qe("invalid",i);break;case"textarea":oa(i,o),qe("invalid",i)}ts(r,o),n=null;for(var a in o)if(o.hasOwnProperty(a)){var p=o[a];a==="children"?typeof p=="string"?i.textContent!==p&&(o.suppressHydrationWarning!==!0&&cn(i.textContent,p,e),n=["children",p]):typeof p=="number"&&i.textContent!==""+p&&(o.suppressHydrationWarning!==!0&&cn(i.textContent,p,e),n=["children",""+p]):h.hasOwnProperty(a)&&p!=null&&a==="onScroll"&&qe("scroll",i)}switch(r){case"input":me(i),Be(i,o,!0);break;case"textarea":me(i),la(i);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(i.onclick=pn)}i=n,t.updateQueue=i,i!==null&&(t.flags|=4)}else{a=n.nodeType===9?n:n.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=ca(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=a.createElement(r,{is:i.is}):(e=a.createElement(r),r==="select"&&(a=e,i.multiple?a.multiple=!0:i.size&&(a.size=i.size))):e=a.createElementNS(e,r),e[kt]=t,e[bi]=i,Sc(e,t,!1,!1),t.stateNode=e;e:{switch(a=rs(r,i),r){case"dialog":qe("cancel",e),qe("close",e),n=i;break;case"iframe":case"object":case"embed":qe("load",e),n=i;break;case"video":case"audio":for(n=0;n<hi.length;n++)qe(hi[n],e);n=i;break;case"source":qe("error",e),n=i;break;case"img":case"image":case"link":qe("error",e),qe("load",e),n=i;break;case"details":qe("toggle",e),n=i;break;case"input":nr(e,i),n=de(e,i),qe("invalid",e);break;case"option":n=i;break;case"select":e._wrapperState={wasMultiple:!!i.multiple},n=H({},i,{value:void 0}),qe("invalid",e);break;case"textarea":oa(e,i),n=Zn(e,i),qe("invalid",e);break;default:n=i}ts(r,n),p=n;for(o in p)if(p.hasOwnProperty(o)){var y=p[o];o==="style"?ua(e,y):o==="dangerouslySetInnerHTML"?(y=y?y.__html:void 0,y!=null&&pa(e,y)):o==="children"?typeof y=="string"?(r!=="textarea"||y!=="")&&Jr(e,y):typeof y=="number"&&Jr(e,""+y):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(h.hasOwnProperty(o)?y!=null&&o==="onScroll"&&qe("scroll",e):y!=null&&j(e,o,y,a))}switch(r){case"input":me(e),Be(e,i,!1);break;case"textarea":me(e),la(e);break;case"option":i.value!=null&&e.setAttribute("value",""+_e(i.value));break;case"select":e.multiple=!!i.multiple,o=i.value,o!=null?kr(e,!!i.multiple,o,!1):i.defaultValue!=null&&kr(e,!!i.multiple,i.defaultValue,!0);break;default:typeof n.onClick=="function"&&(e.onclick=pn)}switch(r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ye(t),null;case 6:if(e&&t.stateNode!=null)wc(e,t,e.memoizedProps,i);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(r=ur(ji.current),ur(jt.current),hn(t)){if(i=t.stateNode,r=t.memoizedProps,i[kt]=t,(o=i.nodeValue!==r)&&(e=ot,e!==null))switch(e.tag){case 3:cn(i.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&cn(i.nodeValue,r,(e.mode&1)!==0)}o&&(t.flags|=4)}else i=(r.nodeType===9?r:r.ownerDocument).createTextNode(i),i[kt]=t,t.stateNode=i}return Ye(t),null;case 13:if(Ie(Te),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ae&&at!==null&&(t.mode&1)!==0&&(t.flags&128)===0)El(),Br(),t.flags|=98560,o=!1;else if(o=hn(t),i!==null&&i.dehydrated!==null){if(e===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[kt]=t}else Br(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),o=!1}else _t!==null&&(Ro(_t),_t=null),o=!0;if(!o)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=r,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(Te.current&1)!==0?Oe===0&&(Oe=3):Mo())),t.updateQueue!==null&&(t.flags|=4),Ye(t),null);case 4:return Ur(),xo(e,t),e===null&&_i(t.stateNode.containerInfo),Ye(t),null;case 10:return Ys(t.type._context),Ye(t),null;case 17:return et(t.type)&&un(),Ye(t),null;case 19:if(Ie(Te),o=t.memoizedState,o===null)return Ye(t),null;if(i=(t.flags&128)!==0,a=o.rendering,a===null)if(i)Ai(o,!1);else{if(Oe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(a=wn(e),a!==null){for(t.flags|=128,Ai(o,!1),i=a.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=r,r=t.child;r!==null;)o=r,e=i,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,e=a.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ce(Te,Te.current&1|2),t.child}e=e.sibling}o.tail!==null&&Me()>Vr&&(t.flags|=128,i=!0,Ai(o,!1),t.lanes=4194304)}else{if(!i)if(e=wn(a),e!==null){if(t.flags|=128,i=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ai(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!Ae)return Ye(t),null}else 2*Me()-o.renderingStartTime>Vr&&r!==1073741824&&(t.flags|=128,i=!0,Ai(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(r=o.last,r!==null?r.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Me(),t.sibling=null,r=Te.current,Ce(Te,i?r&1|2:r&1),t):(Ye(t),null);case 22:case 23:return Po(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&(t.mode&1)!==0?(lt&1073741824)!==0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),null;case 24:return null;case 25:return null}throw Error(c(156,t.tag))}function Qd(e,t){switch(Us(t),t.tag){case 1:return et(t.type)&&un(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ur(),Ie(Ze),Ie(Ve),ro(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return eo(t),null;case 13:if(Ie(Te),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Br()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ie(Te),null;case 4:return Ur(),null;case 10:return Ys(t.type._context),null;case 22:case 23:return Po(),null;case 24:return null;default:return null}}var Tn=!1,Qe=!1,Xd=typeof WeakSet=="function"?WeakSet:Set,J=null;function Hr(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(i){Ne(e,t,i)}else r.current=null}function wo(e,t,r){try{r()}catch(i){Ne(e,t,i)}}var kc=!1;function Jd(e,t){if(Ns=Xi,e=rl(),Es(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var n=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var a=0,p=-1,y=-1,x=0,R=0,P=e,L=null;t:for(;;){for(var Q;P!==r||n!==0&&P.nodeType!==3||(p=a+n),P!==o||i!==0&&P.nodeType!==3||(y=a+i),P.nodeType===3&&(a+=P.nodeValue.length),(Q=P.firstChild)!==null;)L=P,P=Q;for(;;){if(P===e)break t;if(L===r&&++x===n&&(p=a),L===o&&++R===i&&(y=a),(Q=P.nextSibling)!==null)break;P=L,L=P.parentNode}P=Q}r=p===-1||y===-1?null:{start:p,end:y}}else r=null}r=r||{start:0,end:0}}else r=null;for(Ps={focusedElem:e,selectionRange:r},Xi=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var te=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(te!==null){var re=te.memoizedProps,De=te.memoizedState,_=t.stateNode,f=_.getSnapshotBeforeUpdate(t.elementType===t.type?re:vt(t.type,re),De);_.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(O){Ne(t,t.return,O)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return te=kc,kc=!1,te}function Li(e,t,r){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var n=i=i.next;do{if((n.tag&e)===e){var o=n.destroy;n.destroy=void 0,o!==void 0&&wo(t,r,o)}n=n.next}while(n!==i)}}function Rn(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var i=r.create;r.destroy=i()}r=r.next}while(r!==t)}}function ko(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function jc(e){var t=e.alternate;t!==null&&(e.alternate=null,jc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kt],delete t[bi],delete t[Bs],delete t[Nd],delete t[Pd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Cc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function jo(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=pn));else if(i!==4&&(e=e.child,e!==null))for(jo(e,t,r),e=e.sibling;e!==null;)jo(e,t,r),e=e.sibling}function Eo(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(Eo(e,t,r),e=e.sibling;e!==null;)Eo(e,t,r),e=e.sibling}var He=null,bt=!1;function Xt(e,t,r){for(r=r.child;r!==null;)qc(e,t,r),r=r.sibling}function qc(e,t,r){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Hi,r)}catch{}switch(r.tag){case 5:Qe||Hr(r,t);case 6:var i=He,n=bt;He=null,Xt(e,t,r),He=i,bt=n,He!==null&&(bt?(e=He,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):He.removeChild(r.stateNode));break;case 18:He!==null&&(bt?(e=He,r=r.stateNode,e.nodeType===8?zs(e.parentNode,r):e.nodeType===1&&zs(e,r),ci(e)):zs(He,r.stateNode));break;case 4:i=He,n=bt,He=r.stateNode.containerInfo,bt=!0,Xt(e,t,r),He=i,bt=n;break;case 0:case 11:case 14:case 15:if(!Qe&&(i=r.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){n=i=i.next;do{var o=n,a=o.destroy;o=o.tag,a!==void 0&&((o&2)!==0||(o&4)!==0)&&wo(r,t,a),n=n.next}while(n!==i)}Xt(e,t,r);break;case 1:if(!Qe&&(Hr(r,t),i=r.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=r.memoizedProps,i.state=r.memoizedState,i.componentWillUnmount()}catch(p){Ne(r,t,p)}Xt(e,t,r);break;case 21:Xt(e,t,r);break;case 22:r.mode&1?(Qe=(i=Qe)||r.memoizedState!==null,Xt(e,t,r),Qe=i):Xt(e,t,r);break;default:Xt(e,t,r)}}function Ic(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Xd),t.forEach(function(i){var n=au.bind(null,e,i);r.has(i)||(r.add(i),i.then(n,n))})}}function St(e,t){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var n=r[i];try{var o=e,a=t,p=a;e:for(;p!==null;){switch(p.tag){case 5:He=p.stateNode,bt=!1;break e;case 3:He=p.stateNode.containerInfo,bt=!0;break e;case 4:He=p.stateNode.containerInfo,bt=!0;break e}p=p.return}if(He===null)throw Error(c(160));qc(o,a,n),He=null,bt=!1;var y=n.alternate;y!==null&&(y.return=null),n.return=null}catch(x){Ne(n,t,x)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ac(t,e),t=t.sibling}function Ac(e,t){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(St(t,e),Ct(e),i&4){try{Li(3,e,e.return),Rn(3,e)}catch(re){Ne(e,e.return,re)}try{Li(5,e,e.return)}catch(re){Ne(e,e.return,re)}}break;case 1:St(t,e),Ct(e),i&512&&r!==null&&Hr(r,r.return);break;case 5:if(St(t,e),Ct(e),i&512&&r!==null&&Hr(r,r.return),e.flags&32){var n=e.stateNode;try{Jr(n,"")}catch(re){Ne(e,e.return,re)}}if(i&4&&(n=e.stateNode,n!=null)){var o=e.memoizedProps,a=r!==null?r.memoizedProps:o,p=e.type,y=e.updateQueue;if(e.updateQueue=null,y!==null)try{p==="input"&&o.type==="radio"&&o.name!=null&&Xr(n,o),rs(p,a);var x=rs(p,o);for(a=0;a<y.length;a+=2){var R=y[a],P=y[a+1];R==="style"?ua(n,P):R==="dangerouslySetInnerHTML"?pa(n,P):R==="children"?Jr(n,P):j(n,R,P,x)}switch(p){case"input":Se(n,o);break;case"textarea":aa(n,o);break;case"select":var L=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!o.multiple;var Q=o.value;Q!=null?kr(n,!!o.multiple,Q,!1):L!==!!o.multiple&&(o.defaultValue!=null?kr(n,!!o.multiple,o.defaultValue,!0):kr(n,!!o.multiple,o.multiple?[]:"",!1))}n[bi]=o}catch(re){Ne(e,e.return,re)}}break;case 6:if(St(t,e),Ct(e),i&4){if(e.stateNode===null)throw Error(c(162));n=e.stateNode,o=e.memoizedProps;try{n.nodeValue=o}catch(re){Ne(e,e.return,re)}}break;case 3:if(St(t,e),Ct(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{ci(t.containerInfo)}catch(re){Ne(e,e.return,re)}break;case 4:St(t,e),Ct(e);break;case 13:St(t,e),Ct(e),n=e.child,n.flags&8192&&(o=n.memoizedState!==null,n.stateNode.isHidden=o,!o||n.alternate!==null&&n.alternate.memoizedState!==null||(Io=Me())),i&4&&Ic(e);break;case 22:if(R=r!==null&&r.memoizedState!==null,e.mode&1?(Qe=(x=Qe)||R,St(t,e),Qe=x):St(t,e),Ct(e),i&8192){if(x=e.memoizedState!==null,(e.stateNode.isHidden=x)&&!R&&(e.mode&1)!==0)for(J=e,R=e.child;R!==null;){for(P=J=R;J!==null;){switch(L=J,Q=L.child,L.tag){case 0:case 11:case 14:case 15:Li(4,L,L.return);break;case 1:Hr(L,L.return);var te=L.stateNode;if(typeof te.componentWillUnmount=="function"){i=L,r=L.return;try{t=i,te.props=t.memoizedProps,te.state=t.memoizedState,te.componentWillUnmount()}catch(re){Ne(i,r,re)}}break;case 5:Hr(L,L.return);break;case 22:if(L.memoizedState!==null){Rc(P);continue}}Q!==null?(Q.return=L,J=Q):Rc(P)}R=R.sibling}e:for(R=null,P=e;;){if(P.tag===5){if(R===null){R=P;try{n=P.stateNode,x?(o=n.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(p=P.stateNode,y=P.memoizedProps.style,a=y!=null&&y.hasOwnProperty("display")?y.display:null,p.style.display=da("display",a))}catch(re){Ne(e,e.return,re)}}}else if(P.tag===6){if(R===null)try{P.stateNode.nodeValue=x?"":P.memoizedProps}catch(re){Ne(e,e.return,re)}}else if((P.tag!==22&&P.tag!==23||P.memoizedState===null||P===e)&&P.child!==null){P.child.return=P,P=P.child;continue}if(P===e)break e;for(;P.sibling===null;){if(P.return===null||P.return===e)break e;R===P&&(R=null),P=P.return}R===P&&(R=null),P.sibling.return=P.return,P=P.sibling}}break;case 19:St(t,e),Ct(e),i&4&&Ic(e);break;case 21:break;default:St(t,e),Ct(e)}}function Ct(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(Ec(r)){var i=r;break e}r=r.return}throw Error(c(160))}switch(i.tag){case 5:var n=i.stateNode;i.flags&32&&(Jr(n,""),i.flags&=-33);var o=Cc(e);Eo(e,o,n);break;case 3:case 4:var a=i.stateNode.containerInfo,p=Cc(e);jo(e,p,a);break;default:throw Error(c(161))}}catch(y){Ne(e,e.return,y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Zd(e,t,r){J=e,Lc(e)}function Lc(e,t,r){for(var i=(e.mode&1)!==0;J!==null;){var n=J,o=n.child;if(n.tag===22&&i){var a=n.memoizedState!==null||Tn;if(!a){var p=n.alternate,y=p!==null&&p.memoizedState!==null||Qe;p=Tn;var x=Qe;if(Tn=a,(Qe=y)&&!x)for(J=n;J!==null;)a=J,y=a.child,a.tag===22&&a.memoizedState!==null?Nc(n):y!==null?(y.return=a,J=y):Nc(n);for(;o!==null;)J=o,Lc(o),o=o.sibling;J=n,Tn=p,Qe=x}Tc(e)}else(n.subtreeFlags&8772)!==0&&o!==null?(o.return=n,J=o):Tc(e)}}function Tc(e){for(;J!==null;){var t=J;if((t.flags&8772)!==0){var r=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:Qe||Rn(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!Qe)if(r===null)i.componentDidMount();else{var n=t.elementType===t.type?r.memoizedProps:vt(t.type,r.memoizedProps);i.componentDidUpdate(n,r.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&Rl(t,o,i);break;case 3:var a=t.updateQueue;if(a!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}Rl(t,a,r)}break;case 5:var p=t.stateNode;if(r===null&&t.flags&4){r=p;var y=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":y.autoFocus&&r.focus();break;case"img":y.src&&(r.src=y.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var x=t.alternate;if(x!==null){var R=x.memoizedState;if(R!==null){var P=R.dehydrated;P!==null&&ci(P)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(c(163))}Qe||t.flags&512&&ko(t)}catch(L){Ne(t,t.return,L)}}if(t===e){J=null;break}if(r=t.sibling,r!==null){r.return=t.return,J=r;break}J=t.return}}function Rc(e){for(;J!==null;){var t=J;if(t===e){J=null;break}var r=t.sibling;if(r!==null){r.return=t.return,J=r;break}J=t.return}}function Nc(e){for(;J!==null;){var t=J;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Rn(4,t)}catch(y){Ne(t,r,y)}break;case 1:var i=t.stateNode;if(typeof i.componentDidMount=="function"){var n=t.return;try{i.componentDidMount()}catch(y){Ne(t,n,y)}}var o=t.return;try{ko(t)}catch(y){Ne(t,o,y)}break;case 5:var a=t.return;try{ko(t)}catch(y){Ne(t,a,y)}}}catch(y){Ne(t,t.return,y)}if(t===e){J=null;break}var p=t.sibling;if(p!==null){p.return=t.return,J=p;break}J=t.return}}var eu=Math.ceil,Nn=M.ReactCurrentDispatcher,Co=M.ReactCurrentOwner,mt=M.ReactCurrentBatchConfig,xe=0,Ue=null,ze=null,$e=0,lt=0,$r=$t(0),Oe=0,Ti=null,mr=0,Pn=0,qo=0,Ri=null,rt=null,Io=0,Vr=1/0,Dt=null,Mn=!1,Ao=null,Jt=null,Dn=!1,Zt=null,zn=0,Ni=0,Lo=null,Bn=-1,Fn=0;function Je(){return(xe&6)!==0?Me():Bn!==-1?Bn:Bn=Me()}function er(e){return(e.mode&1)===0?1:(xe&2)!==0&&$e!==0?$e&-$e:Dd.transition!==null?(Fn===0&&(Fn=Ca()),Fn):(e=je,e!==0||(e=window.event,e=e===void 0?16:Ma(e.type)),e)}function xt(e,t,r,i){if(50<Ni)throw Ni=0,Lo=null,Error(c(185));ni(e,r,i),((xe&2)===0||e!==Ue)&&(e===Ue&&((xe&2)===0&&(Pn|=r),Oe===4&&tr(e,$e)),it(e,i),r===1&&xe===0&&(t.mode&1)===0&&(Vr=Me()+500,mn&&Kt()))}function it(e,t){var r=e.callbackNode;Dp(e,t);var i=Ki(e,e===Ue?$e:0);if(i===0)r!==null&&ka(r),e.callbackNode=null,e.callbackPriority=0;else if(t=i&-i,e.callbackPriority!==t){if(r!=null&&ka(r),t===1)e.tag===0?Md(Mc.bind(null,e)):Sl(Mc.bind(null,e)),Td(function(){(xe&6)===0&&Kt()}),r=null;else{switch(qa(i)){case 1:r=cs;break;case 4:r=ja;break;case 16:r=Gi;break;case 536870912:r=Ea;break;default:r=Gi}r=Gc(r,Pc.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Pc(e,t){if(Bn=-1,Fn=0,(xe&6)!==0)throw Error(c(327));var r=e.callbackNode;if(Kr()&&e.callbackNode!==r)return null;var i=Ki(e,e===Ue?$e:0);if(i===0)return null;if((i&30)!==0||(i&e.expiredLanes)!==0||t)t=On(e,i);else{t=i;var n=xe;xe|=2;var o=zc();(Ue!==e||$e!==t)&&(Dt=null,Vr=Me()+500,gr(e,t));do try{iu();break}catch(p){Dc(e,p)}while(!0);Ks(),Nn.current=o,xe=n,ze!==null?t=0:(Ue=null,$e=0,t=Oe)}if(t!==0){if(t===2&&(n=ps(e),n!==0&&(i=n,t=To(e,n))),t===1)throw r=Ti,gr(e,0),tr(e,i),it(e,Me()),r;if(t===6)tr(e,i);else{if(n=e.current.alternate,(i&30)===0&&!tu(n)&&(t=On(e,i),t===2&&(o=ps(e),o!==0&&(i=o,t=To(e,o))),t===1))throw r=Ti,gr(e,0),tr(e,i),it(e,Me()),r;switch(e.finishedWork=n,e.finishedLanes=i,t){case 0:case 1:throw Error(c(345));case 2:hr(e,rt,Dt);break;case 3:if(tr(e,i),(i&130023424)===i&&(t=Io+500-Me(),10<t)){if(Ki(e,0)!==0)break;if(n=e.suspendedLanes,(n&i)!==i){Je(),e.pingedLanes|=e.suspendedLanes&n;break}e.timeoutHandle=Ds(hr.bind(null,e,rt,Dt),t);break}hr(e,rt,Dt);break;case 4:if(tr(e,i),(i&4194240)===i)break;for(t=e.eventTimes,n=-1;0<i;){var a=31-gt(i);o=1<<a,a=t[a],a>n&&(n=a),i&=~o}if(i=n,i=Me()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*eu(i/1960))-i,10<i){e.timeoutHandle=Ds(hr.bind(null,e,rt,Dt),i);break}hr(e,rt,Dt);break;case 5:hr(e,rt,Dt);break;default:throw Error(c(329))}}}return it(e,Me()),e.callbackNode===r?Pc.bind(null,e):null}function To(e,t){var r=Ri;return e.current.memoizedState.isDehydrated&&(gr(e,t).flags|=256),e=On(e,t),e!==2&&(t=rt,rt=r,t!==null&&Ro(t)),e}function Ro(e){rt===null?rt=e:rt.push.apply(rt,e)}function tu(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var i=0;i<r.length;i++){var n=r[i],o=n.getSnapshot;n=n.value;try{if(!ht(o(),n))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function tr(e,t){for(t&=~qo,t&=~Pn,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-gt(t),i=1<<r;e[r]=-1,t&=~i}}function Mc(e){if((xe&6)!==0)throw Error(c(327));Kr();var t=Ki(e,0);if((t&1)===0)return it(e,Me()),null;var r=On(e,t);if(e.tag!==0&&r===2){var i=ps(e);i!==0&&(t=i,r=To(e,i))}if(r===1)throw r=Ti,gr(e,0),tr(e,t),it(e,Me()),r;if(r===6)throw Error(c(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hr(e,rt,Dt),it(e,Me()),null}function No(e,t){var r=xe;xe|=1;try{return e(t)}finally{xe=r,xe===0&&(Vr=Me()+500,mn&&Kt())}}function fr(e){Zt!==null&&Zt.tag===0&&(xe&6)===0&&Kr();var t=xe;xe|=1;var r=mt.transition,i=je;try{if(mt.transition=null,je=1,e)return e()}finally{je=i,mt.transition=r,xe=t,(xe&6)===0&&Kt()}}function Po(){lt=$r.current,Ie($r)}function gr(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Ld(r)),ze!==null)for(r=ze.return;r!==null;){var i=r;switch(Us(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&un();break;case 3:Ur(),Ie(Ze),Ie(Ve),ro();break;case 5:eo(i);break;case 4:Ur();break;case 13:Ie(Te);break;case 19:Ie(Te);break;case 10:Ys(i.type._context);break;case 22:case 23:Po()}r=r.return}if(Ue=e,ze=e=rr(e.current,null),$e=lt=t,Oe=0,Ti=null,qo=Pn=mr=0,rt=Ri=null,dr!==null){for(t=0;t<dr.length;t++)if(r=dr[t],i=r.interleaved,i!==null){r.interleaved=null;var n=i.next,o=r.pending;if(o!==null){var a=o.next;o.next=n,i.next=a}r.pending=i}dr=null}return e}function Dc(e,t){do{var r=ze;try{if(Ks(),kn.current=qn,jn){for(var i=Re.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}jn=!1}if(yr=0,We=Fe=Re=null,Ei=!1,Ci=0,Co.current=null,r===null||r.return===null){Oe=1,Ti=t,ze=null;break}e:{var o=e,a=r.return,p=r,y=t;if(t=$e,p.flags|=32768,y!==null&&typeof y=="object"&&typeof y.then=="function"){var x=y,R=p,P=R.tag;if((R.mode&1)===0&&(P===0||P===11||P===15)){var L=R.alternate;L?(R.updateQueue=L.updateQueue,R.memoizedState=L.memoizedState,R.lanes=L.lanes):(R.updateQueue=null,R.memoizedState=null)}var Q=lc(a);if(Q!==null){Q.flags&=-257,cc(Q,a,p,o,t),Q.mode&1&&ac(o,x,t),t=Q,y=x;var te=t.updateQueue;if(te===null){var re=new Set;re.add(y),t.updateQueue=re}else te.add(y);break e}else{if((t&1)===0){ac(o,x,t),Mo();break e}y=Error(c(426))}}else if(Ae&&p.mode&1){var De=lc(a);if(De!==null){(De.flags&65536)===0&&(De.flags|=256),cc(De,a,p,o,t),$s(Gr(y,p));break e}}o=y=Gr(y,p),Oe!==4&&(Oe=2),Ri===null?Ri=[o]:Ri.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var _=sc(o,y,t);Tl(o,_);break e;case 1:p=y;var f=o.type,S=o.stateNode;if((o.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Jt===null||!Jt.has(S)))){o.flags|=65536,t&=-t,o.lanes|=t;var O=oc(o,p,t);Tl(o,O);break e}}o=o.return}while(o!==null)}Fc(r)}catch(ie){t=ie,ze===r&&r!==null&&(ze=r=r.return);continue}break}while(!0)}function zc(){var e=Nn.current;return Nn.current=qn,e===null?qn:e}function Mo(){(Oe===0||Oe===3||Oe===2)&&(Oe=4),Ue===null||(mr&268435455)===0&&(Pn&268435455)===0||tr(Ue,$e)}function On(e,t){var r=xe;xe|=2;var i=zc();(Ue!==e||$e!==t)&&(Dt=null,gr(e,t));do try{ru();break}catch(n){Dc(e,n)}while(!0);if(Ks(),xe=r,Nn.current=i,ze!==null)throw Error(c(261));return Ue=null,$e=0,Oe}function ru(){for(;ze!==null;)Bc(ze)}function iu(){for(;ze!==null&&!qp();)Bc(ze)}function Bc(e){var t=Uc(e.alternate,e,lt);e.memoizedProps=e.pendingProps,t===null?Fc(e):ze=t,Co.current=null}function Fc(e){var t=e;do{var r=t.alternate;if(e=t.return,(t.flags&32768)===0){if(r=Yd(r,t,lt),r!==null){ze=r;return}}else{if(r=Qd(r,t),r!==null){r.flags&=32767,ze=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Oe=6,ze=null;return}}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);Oe===0&&(Oe=5)}function hr(e,t,r){var i=je,n=mt.transition;try{mt.transition=null,je=1,nu(e,t,r,i)}finally{mt.transition=n,je=i}return null}function nu(e,t,r,i){do Kr();while(Zt!==null);if((xe&6)!==0)throw Error(c(327));r=e.finishedWork;var n=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(c(177));e.callbackNode=null,e.callbackPriority=0;var o=r.lanes|r.childLanes;if(zp(e,o),e===Ue&&(ze=Ue=null,$e=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||Dn||(Dn=!0,Gc(Gi,function(){return Kr(),null})),o=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||o){o=mt.transition,mt.transition=null;var a=je;je=1;var p=xe;xe|=4,Co.current=null,Jd(e,r),Ac(r,e),kd(Ps),Xi=!!Ns,Ps=Ns=null,e.current=r,Zd(r),Ip(),xe=p,je=a,mt.transition=o}else e.current=r;if(Dn&&(Dn=!1,Zt=e,zn=n),o=e.pendingLanes,o===0&&(Jt=null),Tp(r.stateNode),it(e,Me()),t!==null)for(i=e.onRecoverableError,r=0;r<t.length;r++)n=t[r],i(n.value,{componentStack:n.stack,digest:n.digest});if(Mn)throw Mn=!1,e=Ao,Ao=null,e;return(zn&1)!==0&&e.tag!==0&&Kr(),o=e.pendingLanes,(o&1)!==0?e===Lo?Ni++:(Ni=0,Lo=e):Ni=0,Kt(),null}function Kr(){if(Zt!==null){var e=qa(zn),t=mt.transition,r=je;try{if(mt.transition=null,je=16>e?16:e,Zt===null)var i=!1;else{if(e=Zt,Zt=null,zn=0,(xe&6)!==0)throw Error(c(331));var n=xe;for(xe|=4,J=e.current;J!==null;){var o=J,a=o.child;if((J.flags&16)!==0){var p=o.deletions;if(p!==null){for(var y=0;y<p.length;y++){var x=p[y];for(J=x;J!==null;){var R=J;switch(R.tag){case 0:case 11:case 15:Li(8,R,o)}var P=R.child;if(P!==null)P.return=R,J=P;else for(;J!==null;){R=J;var L=R.sibling,Q=R.return;if(jc(R),R===x){J=null;break}if(L!==null){L.return=Q,J=L;break}J=Q}}}var te=o.alternate;if(te!==null){var re=te.child;if(re!==null){te.child=null;do{var De=re.sibling;re.sibling=null,re=De}while(re!==null)}}J=o}}if((o.subtreeFlags&2064)!==0&&a!==null)a.return=o,J=a;else e:for(;J!==null;){if(o=J,(o.flags&2048)!==0)switch(o.tag){case 0:case 11:case 15:Li(9,o,o.return)}var _=o.sibling;if(_!==null){_.return=o.return,J=_;break e}J=o.return}}var f=e.current;for(J=f;J!==null;){a=J;var S=a.child;if((a.subtreeFlags&2064)!==0&&S!==null)S.return=a,J=S;else e:for(a=f;J!==null;){if(p=J,(p.flags&2048)!==0)try{switch(p.tag){case 0:case 11:case 15:Rn(9,p)}}catch(ie){Ne(p,p.return,ie)}if(p===a){J=null;break e}var O=p.sibling;if(O!==null){O.return=p.return,J=O;break e}J=p.return}}if(xe=n,Kt(),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(Hi,e)}catch{}i=!0}return i}finally{je=r,mt.transition=t}}return!1}function Oc(e,t,r){t=Gr(r,t),t=sc(e,t,1),e=Qt(e,t,1),t=Je(),e!==null&&(ni(e,1,t),it(e,t))}function Ne(e,t,r){if(e.tag===3)Oc(e,e,r);else for(;t!==null;){if(t.tag===3){Oc(t,e,r);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Jt===null||!Jt.has(i))){e=Gr(r,e),e=oc(t,e,1),t=Qt(t,e,1),e=Je(),t!==null&&(ni(t,1,e),it(t,e));break}}t=t.return}}function su(e,t,r){var i=e.pingCache;i!==null&&i.delete(t),t=Je(),e.pingedLanes|=e.suspendedLanes&r,Ue===e&&($e&r)===r&&(Oe===4||Oe===3&&($e&130023424)===$e&&500>Me()-Io?gr(e,0):qo|=r),it(e,t)}function Wc(e,t){t===0&&((e.mode&1)===0?t=1:(t=Vi,Vi<<=1,(Vi&130023424)===0&&(Vi=4194304)));var r=Je();e=Nt(e,t),e!==null&&(ni(e,t,r),it(e,r))}function ou(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Wc(e,r)}function au(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,n=e.memoizedState;n!==null&&(r=n.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(c(314))}i!==null&&i.delete(t),Wc(e,r)}var Uc;Uc=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ze.current)tt=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return tt=!1,Kd(e,t,r);tt=(e.flags&131072)!==0}else tt=!1,Ae&&(t.flags&1048576)!==0&&xl(t,gn,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;Ln(e,t),e=t.pendingProps;var n=Mr(t,Ve.current);Wr(t,r),n=so(null,t,i,e,n,r);var o=oo();return t.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,et(i)?(o=!0,yn(t)):o=!1,t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,Js(t),n.updater=In,t.stateNode=n,n._reactInternals=t,yo(t,i,e,r),t=ho(null,t,i,!0,o,r)):(t.tag=0,Ae&&o&&Ws(t),Xe(null,t,n,r),t=t.child),t;case 16:i=t.elementType;e:{switch(Ln(e,t),e=t.pendingProps,n=i._init,i=n(i._payload),t.type=i,n=t.tag=cu(i),e=vt(i,e),n){case 0:t=go(null,t,i,e,r);break e;case 1:t=fc(null,t,i,e,r);break e;case 11:t=pc(null,t,i,e,r);break e;case 14:t=dc(null,t,i,vt(i.type,e),r);break e}throw Error(c(306,i,""))}return t;case 0:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:vt(i,n),go(e,t,i,n,r);case 1:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:vt(i,n),fc(e,t,i,n,r);case 3:e:{if(gc(t),e===null)throw Error(c(387));i=t.pendingProps,o=t.memoizedState,n=o.element,Ll(e,t),xn(t,i,null,r);var a=t.memoizedState;if(i=a.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){n=Gr(Error(c(423)),t),t=hc(e,t,i,r,n);break e}else if(i!==n){n=Gr(Error(c(424)),t),t=hc(e,t,i,r,n);break e}else for(at=Ht(t.stateNode.containerInfo.firstChild),ot=t,Ae=!0,_t=null,r=Il(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Br(),i===n){t=Mt(e,t,r);break e}Xe(e,t,i,r)}t=t.child}return t;case 5:return Nl(t),e===null&&Hs(t),i=t.type,n=t.pendingProps,o=e!==null?e.memoizedProps:null,a=n.children,Ms(i,n)?a=null:o!==null&&Ms(i,o)&&(t.flags|=32),mc(e,t),Xe(e,t,a,r),t.child;case 6:return e===null&&Hs(t),null;case 13:return _c(e,t,r);case 4:return Zs(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Fr(t,null,i,r):Xe(e,t,i,r),t.child;case 11:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:vt(i,n),pc(e,t,i,n,r);case 7:return Xe(e,t,t.pendingProps,r),t.child;case 8:return Xe(e,t,t.pendingProps.children,r),t.child;case 12:return Xe(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(i=t.type._context,n=t.pendingProps,o=t.memoizedProps,a=n.value,Ce(vn,i._currentValue),i._currentValue=a,o!==null)if(ht(o.value,a)){if(o.children===n.children&&!Ze.current){t=Mt(e,t,r);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var p=o.dependencies;if(p!==null){a=o.child;for(var y=p.firstContext;y!==null;){if(y.context===i){if(o.tag===1){y=Pt(-1,r&-r),y.tag=2;var x=o.updateQueue;if(x!==null){x=x.shared;var R=x.pending;R===null?y.next=y:(y.next=R.next,R.next=y),x.pending=y}}o.lanes|=r,y=o.alternate,y!==null&&(y.lanes|=r),Qs(o.return,r,t),p.lanes|=r;break}y=y.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(c(341));a.lanes|=r,p=a.alternate,p!==null&&(p.lanes|=r),Qs(a,r,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Xe(e,t,n.children,r),t=t.child}return t;case 9:return n=t.type,i=t.pendingProps.children,Wr(t,r),n=ut(n),i=i(n),t.flags|=1,Xe(e,t,i,r),t.child;case 14:return i=t.type,n=vt(i,t.pendingProps),n=vt(i.type,n),dc(e,t,i,n,r);case 15:return uc(e,t,t.type,t.pendingProps,r);case 17:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:vt(i,n),Ln(e,t),t.tag=1,et(i)?(e=!0,yn(t)):e=!1,Wr(t,r),ic(t,i,n),yo(t,i,n,r),ho(null,t,i,!0,e,r);case 19:return bc(e,t,r);case 22:return yc(e,t,r)}throw Error(c(156,t.tag))};function Gc(e,t){return wa(e,t)}function lu(e,t,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ft(e,t,r,i){return new lu(e,t,r,i)}function Do(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cu(e){if(typeof e=="function")return Do(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ae)return 11;if(e===Le)return 14}return 2}function rr(e,t){var r=e.alternate;return r===null?(r=ft(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Wn(e,t,r,i,n,o){var a=2;if(i=e,typeof e=="function")Do(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case ee:return _r(r.children,n,o,t);case w:a=8,n|=8;break;case G:return e=ft(12,r,t,n|2),e.elementType=G,e.lanes=o,e;case he:return e=ft(13,r,t,n),e.elementType=he,e.lanes=o,e;case ke:return e=ft(19,r,t,n),e.elementType=ke,e.lanes=o,e;case le:return Un(r,n,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F:a=10;break e;case X:a=9;break e;case ae:a=11;break e;case Le:a=14;break e;case Ee:a=16,i=null;break e}throw Error(c(130,e==null?e:typeof e,""))}return t=ft(a,r,t,n),t.elementType=e,t.type=i,t.lanes=o,t}function _r(e,t,r,i){return e=ft(7,e,i,t),e.lanes=r,e}function Un(e,t,r,i){return e=ft(22,e,i,t),e.elementType=le,e.lanes=r,e.stateNode={isHidden:!1},e}function zo(e,t,r){return e=ft(6,e,null,t),e.lanes=r,e}function Bo(e,t,r){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function pu(e,t,r,i,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ds(0),this.expirationTimes=ds(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ds(0),this.identifierPrefix=i,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function Fo(e,t,r,i,n,o,a,p,y){return e=new pu(e,t,r,p,y),t===1?(t=1,o===!0&&(t|=8)):t=0,o=ft(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:i,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Js(o),e}function du(e,t,r){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:i==null?null:""+i,children:e,containerInfo:t,implementation:r}}function Hc(e){if(!e)return Vt;e=e._reactInternals;e:{if(or(e)!==e||e.tag!==1)throw Error(c(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(et(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(c(171))}if(e.tag===1){var r=e.type;if(et(r))return vl(e,r,t)}return t}function $c(e,t,r,i,n,o,a,p,y){return e=Fo(r,i,!0,e,n,o,a,p,y),e.context=Hc(null),r=e.current,i=Je(),n=er(r),o=Pt(i,n),o.callback=t??null,Qt(r,o,n),e.current.lanes=n,ni(e,n,i),it(e,i),e}function Gn(e,t,r,i){var n=t.current,o=Je(),a=er(n);return r=Hc(r),t.context===null?t.context=r:t.pendingContext=r,t=Pt(o,a),t.payload={element:e},i=i===void 0?null:i,i!==null&&(t.callback=i),e=Qt(n,t,a),e!==null&&(xt(e,n,a,o),Sn(e,n,a)),a}function Hn(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Vc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Oo(e,t){Vc(e,t),(e=e.alternate)&&Vc(e,t)}function uu(){return null}var Kc=typeof reportError=="function"?reportError:function(e){console.error(e)};function Wo(e){this._internalRoot=e}$n.prototype.render=Wo.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));Gn(e,t,null,null)},$n.prototype.unmount=Wo.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fr(function(){Gn(null,e,null,null)}),t[At]=null}};function $n(e){this._internalRoot=e}$n.prototype.unstable_scheduleHydration=function(e){if(e){var t=La();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Wt.length&&t!==0&&t<Wt[r].priority;r++);Wt.splice(r,0,e),r===0&&Na(e)}};function Uo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Vn(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Yc(){}function yu(e,t,r,i,n){if(n){if(typeof i=="function"){var o=i;i=function(){var x=Hn(a);o.call(x)}}var a=$c(t,i,e,0,null,!1,!1,"",Yc);return e._reactRootContainer=a,e[At]=a.current,_i(e.nodeType===8?e.parentNode:e),fr(),a}for(;n=e.lastChild;)e.removeChild(n);if(typeof i=="function"){var p=i;i=function(){var x=Hn(y);p.call(x)}}var y=Fo(e,0,!1,null,null,!1,!1,"",Yc);return e._reactRootContainer=y,e[At]=y.current,_i(e.nodeType===8?e.parentNode:e),fr(function(){Gn(t,y,r,i)}),y}function Kn(e,t,r,i,n){var o=r._reactRootContainer;if(o){var a=o;if(typeof n=="function"){var p=n;n=function(){var y=Hn(a);p.call(y)}}Gn(t,a,e,n)}else a=yu(r,t,e,n,i);return Hn(a)}Ia=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=ii(t.pendingLanes);r!==0&&(us(t,r|1),it(t,Me()),(xe&6)===0&&(Vr=Me()+500,Kt()))}break;case 13:fr(function(){var i=Nt(e,1);if(i!==null){var n=Je();xt(i,e,1,n)}}),Oo(e,1)}},ys=function(e){if(e.tag===13){var t=Nt(e,134217728);if(t!==null){var r=Je();xt(t,e,134217728,r)}Oo(e,134217728)}},Aa=function(e){if(e.tag===13){var t=er(e),r=Nt(e,t);if(r!==null){var i=Je();xt(r,e,t,i)}Oo(e,t)}},La=function(){return je},Ta=function(e,t){var r=je;try{return je=e,t()}finally{je=r}},ss=function(e,t,r){switch(t){case"input":if(Se(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var i=r[t];if(i!==e&&i.form===e.form){var n=dn(i);if(!n)throw Error(c(90));Pe(i),Se(i,n)}}}break;case"textarea":aa(e,r);break;case"select":t=r.value,t!=null&&kr(e,!!r.multiple,t,!1)}},ga=No,ha=fr;var mu={usingClientEntryPoint:!1,Events:[Si,Nr,dn,ma,fa,No]},Pi={findFiberByHostInstance:ar,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},fu={bundleType:Pi.bundleType,version:Pi.version,rendererPackageName:Pi.rendererPackageName,rendererConfig:Pi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Sa(e),e===null?null:e.stateNode},findFiberByHostInstance:Pi.findFiberByHostInstance||uu,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 Yn=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yn.isDisabled&&Yn.supportsFiber)try{Hi=Yn.inject(fu),wt=Yn}catch{}}return nt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mu,nt.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Uo(t))throw Error(c(200));return du(e,t,null,r)},nt.createRoot=function(e,t){if(!Uo(e))throw Error(c(299));var r=!1,i="",n=Kc;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(n=t.onRecoverableError)),t=Fo(e,1,!1,null,null,r,!1,i,n),e[At]=t.current,_i(e.nodeType===8?e.parentNode:e),new Wo(t)},nt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=Sa(t),e=e===null?null:e.stateNode,e},nt.flushSync=function(e){return fr(e)},nt.hydrate=function(e,t,r){if(!Vn(t))throw Error(c(200));return Kn(null,e,t,!0,r)},nt.hydrateRoot=function(e,t,r){if(!Uo(e))throw Error(c(405));var i=r!=null&&r.hydratedSources||null,n=!1,o="",a=Kc;if(r!=null&&(r.unstable_strictMode===!0&&(n=!0),r.identifierPrefix!==void 0&&(o=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),t=$c(t,null,e,1,r??null,n,!1,o,a),e[At]=t.current,_i(e),i)for(e=0;e<i.length;e++)r=i[e],n=r._getVersion,n=n(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,n]:t.mutableSourceEagerHydrationData.push(r,n);return new $n(t)},nt.render=function(e,t,r){if(!Vn(t))throw Error(c(200));return Kn(null,e,t,!1,r)},nt.unmountComponentAtNode=function(e){if(!Vn(e))throw Error(c(40));return e._reactRootContainer?(fr(function(){Kn(null,null,e,!1,function(){e._reactRootContainer=null,e[At]=null})}),!0):!1},nt.unstable_batchedUpdates=No,nt.unstable_renderSubtreeIntoContainer=function(e,t,r,i){if(!Vn(r))throw Error(c(200));if(e==null||e._reactInternals===void 0)throw Error(c(38));return Kn(e,t,r,!1,i)},nt.version="18.3.1-next-f1338f8080-20240426",nt}var ip;function wu(){if(ip)return $o.exports;ip=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(d){console.error(d)}}return l(),$o.exports=xu(),$o.exports}var np;function ku(){if(np)return Qn;np=1;var l=wu();return Qn.createRoot=l.createRoot,Qn.hydrateRoot=l.hydrateRoot,Qn}var ju=ku();const Eu=gp(ju),sp=[{name:"search_tools",description:"Search the full NowAIKit tool catalog (400+ tools) by keyword to discover the right tool without loading every definition. Returns matching tool names + descriptions ranked by relevance. Use this FIRST when you are unsure which tool to call. Especially useful with MCP_TOOL_DISCOVERY=lean, which exposes only a small core set plus this search.",inputSchema:{type:"object",properties:{query:{type:"string",description:'Keywords to match against tool names and descriptions, e.g. "create incident", "cmdb health", "run atf"'},limit:{type:"number",description:"Max results to return (default 25)"}},required:["query"]}},{name:"query_records",description:"Query ServiceNow records with filtering, field selection, pagination, and sorting",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g., "incident", "change_request")'},query:{type:"string",description:'Encoded query string (e.g., "active=true^priority=1")'},fields:{type:"string",description:"Comma-separated fields to return"},limit:{type:"number",description:"Max records (default: 10, max: 1000)"},orderBy:{type:"string",description:'Field to sort by. Prefix with "-" for descending'}},required:["table"]}},{name:"get_table_schema",description:"Get the structure and field information for a ServiceNow table",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table name to inspect"}},required:["table"]}},{name:"get_record",description:"Retrieve complete details of a specific record by sys_id",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table name"},sys_id:{type:"string",description:"32-character system ID"},fields:{type:"string",description:"Optional comma-separated fields"}},required:["table","sys_id"]}},{name:"create_record",description:"Create a new record in any ServiceNow table (requires WRITE_ENABLED=true). Pass dry_run=true to preview the resolved payload without writing.",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g., "incident", "sys_user_preference")'},fields:{type:"object",description:"Key-value pairs for the new record fields"},dry_run:{type:"boolean",description:"Preview only — return the resolved payload without creating the record"}},required:["table","fields"]}},{name:"update_record",description:"Update an existing record in any ServiceNow table (requires WRITE_ENABLED=true). Pass dry_run=true to preview a before→after field diff without writing.",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g., "incident", "sys_user_preference")'},sys_id:{type:"string",description:"32-character system ID of the record to update"},fields:{type:"object",description:"Key-value pairs of fields to update"},dry_run:{type:"boolean",description:"Preview only — return a before→after diff without updating the record"}},required:["table","sys_id","fields"]}},{name:"delete_record",description:"Delete a record from any ServiceNow table (requires WRITE_ENABLED=true). Pass dry_run=true to preview the record that would be deleted without deleting it.",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table name"},sys_id:{type:"string",description:"32-character system ID of the record to delete"},dry_run:{type:"boolean",description:"Preview only — return the record that would be deleted without deleting it"}},required:["table","sys_id"]}},{name:"validate_query",description:"Lint-check a ServiceNow encoded query BEFORE running it: validates javascript: expressions against the safe function allowlist, length limits, and common mistakes (e.g. using = instead of ^, raw spaces). Returns { valid, issues, suggestions }.",inputSchema:{type:"object",properties:{query:{type:"string",description:'The encoded query to validate, e.g. "active=true^priority=1^ORDERBYDESCsys_created_on"'}},required:["query"]}},{name:"get_user",description:"Look up user details by email or username",inputSchema:{type:"object",properties:{user_identifier:{type:"string",description:"Email address or username"}},required:["user_identifier"]}},{name:"get_group",description:"Find assignment group details by name or sys_id",inputSchema:{type:"object",properties:{group_identifier:{type:"string",description:"Group name or sys_id"}},required:["group_identifier"]}},{name:"search_cmdb_ci",description:"Search for configuration items (CIs) in the CMDB",inputSchema:{type:"object",properties:{query:{type:"string",description:'Encoded query (e.g., "sys_class_name=cmdb_ci_server")'},limit:{type:"number",description:"Max CIs (default: 10, max: 100)"}},required:[]}},{name:"get_cmdb_ci",description:"Get complete information about a specific configuration item",inputSchema:{type:"object",properties:{ci_sys_id:{type:"string",description:"System ID of the CI"},fields:{type:"string",description:"Optional comma-separated fields"}},required:["ci_sys_id"]}},{name:"list_relationships",description:"Show parent and child relationships for a CI",inputSchema:{type:"object",properties:{ci_sys_id:{type:"string",description:"System ID of the CI"}},required:["ci_sys_id"]}},{name:"list_discovery_schedules",description:"List discovery schedules and their run status",inputSchema:{type:"object",properties:{active_only:{type:"boolean",description:"Only show active schedules"}},required:[]}},{name:"list_mid_servers",description:"List MID servers and verify they are healthy",inputSchema:{type:"object",properties:{active_only:{type:"boolean",description:'Only show servers with status "Up"'}},required:[]}},{name:"list_active_events",description:"Monitor critical infrastructure events",inputSchema:{type:"object",properties:{query:{type:"string",description:'Filter events (e.g., "severity=1")'},limit:{type:"number",description:"Max events (default: 10)"}},required:[]}},{name:"cmdb_health_dashboard",description:"Get CMDB data quality metrics (completeness of server and network CI data)",inputSchema:{type:"object",properties:{},required:[]}},{name:"service_mapping_summary",description:"View service dependencies and related CIs for impact analysis",inputSchema:{type:"object",properties:{service_sys_id:{type:"string",description:"System ID of the business service"}},required:["service_sys_id"]}},{name:"natural_language_search",description:"Search ServiceNow using plain English",inputSchema:{type:"object",properties:{query:{type:"string",description:"Plain English query"},limit:{type:"number",description:"Max results (default: 10)"}},required:["query"]}},{name:"natural_language_update",description:"Update a record using natural language (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{instruction:{type:"string",description:"Natural language update instruction"},table:{type:"string",description:"Table name"}},required:["instruction","table"]}},{name:"list_instances",description:"List all configured ServiceNow instances (multi-instance / multi-customer support)",inputSchema:{type:"object",properties:{},required:[]}},{name:"switch_instance",description:"Switch the active ServiceNow instance for this session",inputSchema:{type:"object",properties:{name:{type:"string",description:'Instance name as configured (e.g. "prod", "dev", "customer_a")'}},required:["name"]}},{name:"get_current_instance",description:"Get the currently active ServiceNow instance name and URL",inputSchema:{type:"object",properties:{},required:[]}},{name:"create_ci_relationship",description:"[Write] Create a relationship between two CMDB Configuration Items",inputSchema:{type:"object",properties:{parent:{type:"string",description:"Parent CI sys_id"},child:{type:"string",description:"Child CI sys_id"},type:{type:"string",description:'Relationship type (e.g. "Runs on::Runs")'}},required:["parent","child","type"]}},{name:"cmdb_impact_analysis",description:"Analyze the downstream impact of a Configuration Item change or outage",inputSchema:{type:"object",properties:{ci_sys_id:{type:"string",description:"CI sys_id to analyze"},depth:{type:"number",description:"Relationship depth to traverse (default: 2)"}},required:["ci_sys_id"]}},{name:"run_discovery_scan",description:"[Write] Trigger a ServiceNow Discovery scan for network/infrastructure",inputSchema:{type:"object",properties:{schedule_id:{type:"string",description:"Discovery schedule sys_id to run"},mid_server:{type:"string",description:"Optional MID server name"}},required:["schedule_id"]}},{name:"bulk_create_records",description:"Create many records in one table in a single call, tracking every created sys_id and returning a rollback_token. With rollback_on_error=true, a mid-way failure deletes everything already created so the batch is all-or-nothing. Supports dry_run. Requires WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{table:{type:"string",description:"Target table"},records:{type:"array",items:{type:"object"},description:"Array of field key-value objects to create"},rollback_on_error:{type:"boolean",description:"If a create fails, delete the ones already created (default false)"},dry_run:{type:"boolean",description:"Preview the resolved payloads without creating anything"}},required:["table","records"]}},{name:"rollback_changes",description:"Delete a set of previously-created records, e.g. the rollback_token returned by bulk_create_records. Requires WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{changes:{type:"array",description:"Array of { table, sys_id } to delete",items:{type:"object",properties:{table:{type:"string"},sys_id:{type:"string"}},required:["table","sys_id"]}}},required:["changes"]}},{name:"compare_instances",description:"Compare two configured ServiceNow instances: record counts for a table (with optional query) and/or a specific system property value. Useful for dev→prod drift detection and governance.",inputSchema:{type:"object",properties:{instance_a:{type:"string",description:"First instance name (as configured)"},instance_b:{type:"string",description:"Second instance name (as configured)"},table:{type:"string",description:"Table to compare record counts for (optional)"},query:{type:"string",description:"Encoded query to scope the count (optional)"},property:{type:"string",description:"A sys_properties name to compare values for (optional)"}},required:["instance_a","instance_b"]}},{name:"create_incident",description:"Create a new incident record (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Brief description of the issue"},urgency:{type:"number",description:"1=High, 2=Medium, 3=Low"},impact:{type:"number",description:"1=High, 2=Medium, 3=Low"},priority:{type:"number",description:"1=Critical, 2=High, 3=Moderate, 4=Low"},description:{type:"string",description:"Detailed description"},assignment_group:{type:"string",description:"Assignment group name or sys_id"},caller_id:{type:"string",description:"Caller user name or sys_id"},category:{type:"string",description:"Incident category"},subcategory:{type:"string",description:"Incident subcategory"}},required:["short_description"]}},{name:"get_incident",description:"Get full details of an incident by number (e.g. INC0012345) or sys_id",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Incident number (INC...) or sys_id"}},required:["number_or_sysid"]}},{name:"update_incident",description:"Update fields on an existing incident (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the incident"},fields:{type:"object",description:'Key-value pairs to update (e.g., {"state": "2", "urgency": "1"})'}},required:["sys_id","fields"]}},{name:"resolve_incident",description:"Resolve an incident with resolution code and notes (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the incident"},resolution_code:{type:"string",description:'Resolution code (e.g., "Solved (Permanently)")'},resolution_notes:{type:"string",description:"Details of how the incident was resolved"}},required:["sys_id","resolution_code","resolution_notes"]}},{name:"close_incident",description:"Close a resolved incident (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the incident"}},required:["sys_id"]}},{name:"add_work_note",description:"Add an internal work note to any ITSM record (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g., "incident", "change_request")'},sys_id:{type:"string",description:"System ID of the record"},note:{type:"string",description:"Work note text (internal, not visible to end user)"}},required:["table","sys_id","note"]}},{name:"add_comment",description:"Add a customer-visible comment to any ITSM record (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g., "incident")'},sys_id:{type:"string",description:"System ID of the record"},comment:{type:"string",description:"Comment text (visible to end user/caller)"}},required:["table","sys_id","comment"]}},{name:"create_problem",description:"Create a new problem record (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Brief description of the problem"},description:{type:"string",description:"Detailed description"},assignment_group:{type:"string",description:"Assignment group name or sys_id"},priority:{type:"number",description:"1=Critical, 2=High, 3=Moderate, 4=Low"}},required:["short_description"]}},{name:"get_problem",description:"Get full details of a problem by number (PRB...) or sys_id",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Problem number (PRB...) or sys_id"}},required:["number_or_sysid"]}},{name:"update_problem",description:"Update fields on an existing problem (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the problem"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"resolve_problem",description:"Resolve a problem with root cause and resolution notes (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the problem"},root_cause:{type:"string",description:"Root cause of the problem"},resolution_notes:{type:"string",description:"How the problem was resolved"}},required:["sys_id","root_cause","resolution_notes"]}},{name:"create_change_request",description:"Create a new change request (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Brief description of the change"},description:{type:"string",description:"Detailed description and justification"},type:{type:"string",description:'Change type: "normal", "standard", "emergency"'},category:{type:"string",description:'Change category (e.g. "Software", "Hardware", "Network")'},risk:{type:"string",description:'Risk level: "1"=High, "2"=Medium, "3"=Low, "4"=Very Low'},impact:{type:"string",description:'Impact: "1"=High, "2"=Medium, "3"=Low'},priority:{type:"string",description:'Priority: "1"=Critical, "2"=High, "3"=Moderate, "4"=Low'},assignment_group:{type:"string",description:"Assignment group name or sys_id"},assigned_to:{type:"string",description:"Assignee username or sys_id"},start_date:{type:"string",description:"Planned start date (ISO: YYYY-MM-DD HH:MM:SS)"},end_date:{type:"string",description:"Planned end date (ISO: YYYY-MM-DD HH:MM:SS)"},implementation_plan:{type:"string",description:"Step-by-step implementation plan"},backout_plan:{type:"string",description:"Rollback plan if change fails"},test_plan:{type:"string",description:"Testing and validation steps"},cmdb_ci:{type:"string",description:"Affected CI sys_id"}},required:["short_description","type"]}},{name:"get_change_request",description:"Get full details of a change request by number (CHG...) or sys_id",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Change number (CHG...) or sys_id"}},required:["number_or_sysid"]}},{name:"update_change_request",description:"Update fields on a change request (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the change request"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_change_requests",description:"List change requests with optional filtering by state or query",inputSchema:{type:"object",properties:{query:{type:"string",description:"Encoded query filter"},state:{type:"string",description:'Change state (e.g., "-5"=Requested, "-4"=Draft, "0"=Open)'},limit:{type:"number",description:"Max records (default: 10)"}},required:[]}},{name:"submit_change_for_approval",description:'Move a change request to "Requested" state for approval (requires WRITE_ENABLED=true)',inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the change request"}},required:["sys_id"]}},{name:"close_change_request",description:"Close a change request with close code and notes (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the change request"},close_code:{type:"string",description:'Close code (e.g., "successful", "unsuccessful")'},close_notes:{type:"string",description:"Closure notes"}},required:["sys_id","close_code","close_notes"]}},{name:"schedule_cab_meeting",description:"[Write] Schedule a Change Advisory Board (CAB) meeting",inputSchema:{type:"object",properties:{change_id:{type:"string",description:"Change request number (CHG...) or sys_id"},date:{type:"string",description:"ISO date for the CAB meeting"},duration_minutes:{type:"number",description:"Meeting duration in minutes"},attendees:{type:"string",description:"Comma-separated group names"}},required:["change_id","date"]}},{name:"get_task",description:"Get details of any task record by number or sys_id",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Task number or sys_id"}},required:["number_or_sysid"]}},{name:"update_task",description:"Update fields on a task record (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the task"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_my_tasks",description:"List tasks assigned to the currently configured user",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max tasks to return (default: 10)"}},required:[]}},{name:"complete_task",description:"Mark a task as complete (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the task"},close_notes:{type:"string",description:"Optional closure notes"}},required:["sys_id"]}},{name:"list_knowledge_bases",description:"List all knowledge bases available in the instance",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"search_knowledge",description:"Search knowledge base articles by keyword",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search keywords or phrase"},limit:{type:"number",description:"Max articles (default: 10)"},knowledge_base:{type:"string",description:"Optional: filter by knowledge base sys_id or name"}},required:["query"]}},{name:"get_knowledge_article",description:"Get the full content of a knowledge article by number (KB...) or sys_id",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Article number (KB...) or sys_id"}},required:["number_or_sysid"]}},{name:"create_knowledge_article",description:"Create a new knowledge article (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Article title"},text:{type:"string",description:"Article body (HTML or plain text)"},knowledge_base_sys_id:{type:"string",description:"sys_id of the target knowledge base"},category:{type:"string",description:"Article category"}},required:["short_description","text","knowledge_base_sys_id"]}},{name:"update_knowledge_article",description:"Update a knowledge article (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the article"},fields:{type:"object",description:'Key-value pairs to update (e.g., {"text": "...updated content..."})'}},required:["sys_id","fields"]}},{name:"publish_knowledge_article",description:"Publish a draft knowledge article (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the article to publish"}},required:["sys_id"]}},{name:"retire_knowledge_article",description:"[Write] Retire a knowledge article (mark as outdated)",inputSchema:{type:"object",properties:{article_id:{type:"string",description:"Article number (KB...) or sys_id"}},required:["article_id"]}},{name:"list_catalog_items",description:"List available service catalog items",inputSchema:{type:"object",properties:{category:{type:"string",description:"Filter by category name or sys_id"},limit:{type:"number",description:"Max items (default: 20)"}},required:[]}},{name:"search_catalog",description:"Search the service catalog for items matching a keyword",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search keywords"},limit:{type:"number",description:"Max results (default: 10)"}},required:["query"]}},{name:"get_catalog_item",description:"Get full details of a catalog item including its variables",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Catalog item sys_id or name"}},required:["sys_id_or_name"]}},{name:"create_catalog_item",description:"Create a new service catalog item (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Catalog item display name"},short_description:{type:"string",description:"One-line summary shown in search results"},description:{type:"string",description:"Full HTML description of the item"},category:{type:"string",description:"sys_id of the catalog category (sc_category)"},price:{type:"string",description:'Price (e.g. "0", "99.99")'},delivery_time:{type:"string",description:'Estimated delivery time ISO 8601 duration (e.g. "1 08:00:00" for 1 day 8 hours)'},active:{type:"boolean",description:"Make the item available in the catalog (default: true)"},roles:{type:"string",description:"Comma-separated roles that can see the item"}},required:["name","short_description"]}},{name:"update_catalog_item",description:"Update an existing catalog item (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Catalog item sys_id"},fields:{type:"object",description:"Fields to update (name, short_description, price, active, category, etc.)"}},required:["sys_id","fields"]}},{name:"order_catalog_item",description:"Order a service catalog item (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the catalog item"},quantity:{type:"number",description:"Quantity to order (default: 1)"},variables:{type:"object",description:"Catalog item variables as key-value pairs"}},required:["sys_id"]}},{name:"create_approval_rule",description:"Create an approval rule that automatically generates approval requests when a record matches given conditions (requires WRITE_ENABLED=true). Uses the sysapproval_rule table.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Rule name"},table:{type:"string",description:'Table this rule applies to (e.g. "sc_request", "change_request")'},approver_type:{type:"string",description:'"user" | "group" — whether the approver is a user or a group'},approver:{type:"string",description:"sys_id of the approving user or group"},condition:{type:"string",description:"Encoded query that determines when the rule fires (leave blank for always)"},active:{type:"boolean",description:"Activate the rule immediately (default: true)"},order:{type:"number",description:"Execution order relative to other rules (default: 100)"}},required:["name","table","approver_type","approver"]}},{name:"get_my_approvals",description:"List approvals pending for the currently configured user",inputSchema:{type:"object",properties:{state:{type:"string",description:'Filter by state: "requested", "approved", "rejected" (default: "requested")'}},required:[]}},{name:"list_approvals",description:"List approval requests with optional filters",inputSchema:{type:"object",properties:{query:{type:"string",description:"Encoded query filter"},state:{type:"string",description:"Approval state filter"},limit:{type:"number",description:"Max results (default: 10)"}},required:[]}},{name:"approve_request",description:"Approve a pending approval request (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the approval record"},comments:{type:"string",description:"Optional approval comments"}},required:["sys_id"]}},{name:"reject_request",description:"Reject a pending approval request (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the approval record"},comments:{type:"string",description:"Reason for rejection (required)"}},required:["sys_id","comments"]}},{name:"get_sla_details",description:"Get SLA breach status for a specific task or incident",inputSchema:{type:"object",properties:{task_sys_id:{type:"string",description:"System ID of the task/incident"}},required:["task_sys_id"]}},{name:"list_active_slas",description:"List active SLA records with optional filters",inputSchema:{type:"object",properties:{query:{type:"string",description:"Encoded query filter"},limit:{type:"number",description:"Max results (default: 10)"}},required:[]}},{name:"create_catalog_variable",description:"[Write] Add a form variable to a service catalog item",inputSchema:{type:"object",properties:{cat_item_id:{type:"string",description:"Catalog item sys_id"},name:{type:"string",description:"Variable name"},question_text:{type:"string",description:"Label shown to user"},type:{type:"string",description:"Variable type: string/reference/select_box/checkbox/date/date_time/integer/multi_line_text/email"},order:{type:"number",description:"Display order (default: 100)"},mandatory:{type:"boolean",description:"Required field"}},required:["cat_item_id","name","question_text","type"]}},{name:"create_catalog_ui_policy",description:"[Write] Create a UI policy for a catalog item form",inputSchema:{type:"object",properties:{cat_item_id:{type:"string",description:"Catalog item sys_id"},short_description:{type:"string",description:"UI policy description"},conditions:{type:"string",description:"Encoded condition query"},reverse_if_false:{type:"boolean",description:"Reverse actions when condition is false"}},required:["cat_item_id","short_description"]}},{name:"list_users",description:"List users with optional search filter",inputSchema:{type:"object",properties:{query:{type:"string",description:'Filter (e.g., "active=true^departmentLIKEIT")'},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"create_user",description:"Create a new user account (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{user_name:{type:"string",description:"Unique username (login name)"},email:{type:"string",description:"Email address"},first_name:{type:"string",description:"First name"},last_name:{type:"string",description:"Last name"},title:{type:"string",description:"Job title"},department:{type:"string",description:"Department name or sys_id"}},required:["user_name","email","first_name","last_name"]}},{name:"update_user",description:"Update a user account (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the user"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_groups",description:"List groups with optional search filter",inputSchema:{type:"object",properties:{query:{type:"string",description:'Filter (e.g., "active=true^typeLIKEitil")'},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"create_group",description:"Create a new assignment group (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Group name"},description:{type:"string",description:"Group description"},manager:{type:"string",description:"Manager user_name or sys_id"}},required:["name"]}},{name:"update_group",description:"Update a group (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the group"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"add_user_to_group",description:"Add a user to a group (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{user_sys_id:{type:"string",description:"System ID of the user"},group_sys_id:{type:"string",description:"System ID of the group"}},required:["user_sys_id","group_sys_id"]}},{name:"remove_user_from_group",description:"Remove a user from a group (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{member_sys_id:{type:"string",description:"System ID of the sys_user_grmember record"}},required:["member_sys_id"]}},{name:"list_reports",description:"List saved reports in the instance (latest release: /api/now/reporting)",inputSchema:{type:"object",properties:{search:{type:"string",description:"Search reports by name (uses sysparm_contains)"},category:{type:"string",description:"Filter by report category"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_report",description:"Get the definition and metadata of a saved report",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Report sys_id or exact name"}},required:["sys_id_or_name"]}},{name:"run_aggregate_query",description:"Run a grouped aggregate (COUNT, SUM, AVG) query on any table (latest release: /api/now/stats/{table})",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table to query (e.g., "incident", "task_sla")'},group_by:{type:"string",description:'Field to group results by (e.g., "priority", "state", "assignment_group")'},aggregate:{type:"string",description:"Aggregate function: COUNT (default), SUM, AVG, MIN, MAX"},query:{type:"string",description:"Optional encoded query filter"},limit:{type:"number",description:"Max groups (default: 20)"}},required:["table","group_by"]}},{name:"trend_query",description:"Get time-bucketed trend data for a table (useful for monthly/weekly trend charts)",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g., "incident")'},date_field:{type:"string",description:'Date field to bucket by (e.g., "opened_at", "sys_created_on")'},group_by:{type:"string",description:'Secondary grouping field (e.g., "priority", "state")'},query:{type:"string",description:"Optional encoded query filter"},periods:{type:"number",description:"Number of months to look back (default: 6)"}},required:["table","date_field","group_by"]}},{name:"get_performance_analytics",description:"Read Performance Analytics scorecard/indicator data (requires PA plugin; GET /api/now/pa/scorecards). Pass an indicator sys_id, or a PA widget sys_id to resolve its indicator.",inputSchema:{type:"object",properties:{indicator_sys_id:{type:"string",description:"sys_id of the PA indicator (pa_indicators)"},widget_sys_id:{type:"string",description:"sys_id of a PA widget (pa_widgets); its indicator is resolved automatically"},from:{type:"string",description:"Optional score-series start date (YYYY-MM-DD)"},to:{type:"string",description:"Optional score-series end date (YYYY-MM-DD)"}},required:[]}},{name:"export_report_data",description:"Export raw table data as structured JSON for use in external reports",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table to export from"},query:{type:"string",description:"Encoded query filter"},fields:{type:"string",description:"Comma-separated fields to include"},limit:{type:"number",description:"Max records (default: 100, max: 1000)"}},required:["table"]}},{name:"get_sys_log",description:"Retrieve system log entries for debugging or auditing. Set app_scope=true to read the scoped-application log (syslog_app_scope), where scoped gs.info()/gs.log() output lands, instead of the global syslog.",inputSchema:{type:"object",properties:{query:{type:"string",description:'Filter (e.g., "level=error^sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()")'},app_scope:{type:"boolean",description:"Read syslog_app_scope (scoped-app log output) instead of the global syslog."},limit:{type:"number",description:"Max entries (default: 20)"}},required:[]}},{name:"list_scheduled_jobs",description:"List scheduled jobs and their run schedules",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter to active jobs only (default: true)"},query:{type:"string",description:"Additional filter"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_scheduled_job",description:"Get full details of a scheduled job by sys_id or name",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Job sys_id or exact name"}},required:["sys_id_or_name"]}},{name:"create_scheduled_job",description:"Create a new scheduled script execution job (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Job name"},script:{type:"string",description:"Server-side JavaScript to run on schedule"},run_type:{type:"string",description:'Schedule type: "daily", "weekly", "monthly", "once", "periodically"'},run_time:{type:"string",description:"Time to run (HH:MM:SS format for daily/weekly/monthly)"},run_period:{type:"string",description:'Period interval for "periodically" type (e.g. "00:15:00" for 15 minutes)'},active:{type:"boolean",description:"Whether to activate immediately (default: true)"}},required:["name","script","run_type"]}},{name:"update_scheduled_job",description:"Update a scheduled job (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Scheduled job sys_id"},fields:{type:"object",description:"Fields to update (name, script, active, run_type, run_time, etc.)"}},required:["sys_id","fields"]}},{name:"trigger_scheduled_job",description:"Immediately execute a scheduled job on-demand (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Scheduled job sys_id to trigger"}},required:["sys_id"]}},{name:"create_report",description:"Create a new saved report on any table (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{title:{type:"string",description:"Report title displayed in the list"},table:{type:"string",description:'Table to report on (e.g. "incident", "change_request")'},type:{type:"string",description:'Report type: "bar", "column", "pie", "line", "list", "gauge", "single_score", "trend", "pivot", "calHeatmap"'},field:{type:"string",description:"Primary grouping field for the report"},query:{type:"string",description:"Encoded query to filter report data"},aggregate:{type:"string",description:"Aggregate function: COUNT (default), SUM, AVG, MIN, MAX"},group_by:{type:"string",description:"Secondary grouping field (stacked charts)"},roles:{type:"string",description:"Comma-separated roles that can view the report"}},required:["title","table","type"]}},{name:"update_report",description:"Update an existing saved report definition (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Report sys_id"},fields:{type:"object",description:"Fields to update (title, type, query, field, aggregate, etc.)"}},required:["sys_id","fields"]}},{name:"list_job_run_history",description:"List recent run history for scheduled jobs (success/failure log)",inputSchema:{type:"object",properties:{job_sys_id:{type:"string",description:"Filter by specific job sys_id"},status:{type:"string",description:"Filter by run status: success, error, canceled"},limit:{type:"number",description:"Max results (default: 25)"}},required:[]}},{name:"create_scheduled_report",description:"[Write] Schedule a report for recurring email delivery",inputSchema:{type:"object",properties:{report_id:{type:"string",description:"Report sys_id"},frequency:{type:"string",description:"Frequency: daily/weekly/monthly"},recipients:{type:"string",description:"Email addresses"},day_of_week:{type:"string",description:"Day of week (for weekly frequency)"},day_of_month:{type:"number",description:"Day of month (for monthly frequency)"},format:{type:"string",description:"Export format: pdf/csv/xlsx"}},required:["report_id","frequency","recipients"]}},{name:"create_kpi",description:"[Write] Create a Key Performance Indicator from ServiceNow data",inputSchema:{type:"object",properties:{name:{type:"string",description:"KPI name"},table:{type:"string",description:"Source table"},field:{type:"string",description:"Aggregate field"},aggregate:{type:"string",description:"Aggregate function: COUNT/AVG/SUM/MIN/MAX"},conditions:{type:"string",description:"Encoded query filter"},unit:{type:"string",description:"Display unit"}},required:["name","table","aggregate"]}},{name:"generate_report",description:"Generate a branded PDF or PPTX report from capability analysis results. Call this after completing a scan, review, or audit to create a management-ready document with charts, tables, and ServiceNow links. Supports single capability (content) or multiple capabilities (sections) in one combined report.",inputSchema:{type:"object",properties:{content:{type:"string",description:"Full markdown analysis to convert into a branded report (for single capability)"},sections:{type:"array",description:"Multiple capability analyses to combine into one report. Each section becomes a chapter. Use this instead of content for multi-capability reports.",items:{type:"object",properties:{content:{type:"string",description:"Markdown analysis for this capability"},title:{type:"string",description:'Section title (e.g. "Instance Health Scan")'},capability:{type:"string",description:'Capability name (e.g. "scan-health")'}},required:["content","title"]}},format:{type:"string",enum:["pdf","pptx"],description:"Output format: pdf (branded document) or pptx (slide deck)"},title:{type:"string",description:'Report title (e.g. "Instance Health Scan", "Comprehensive Instance Audit")'},capability:{type:"string",description:'Capability name that produced the analysis (e.g. "scan-health", "review-code", "combined-audit")'}},required:["format","title"]}},{name:"list_atf_suites",description:"List ATF test suites in the instance",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter to active suites only"},query:{type:"string",description:"Additional filter"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_atf_suite",description:"Get details of a test suite including test count",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Test suite sys_id or name"}},required:["sys_id_or_name"]}},{name:"run_atf_suite",description:"Execute an ATF test suite (requires ATF_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the test suite"}},required:["sys_id"]}},{name:"list_atf_tests",description:"List ATF test cases, optionally filtered by suite",inputSchema:{type:"object",properties:{suite_sys_id:{type:"string",description:"Filter by test suite sys_id"},active:{type:"boolean",description:"Filter to active tests only"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_atf_test",description:"Get details of a specific test case",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the test"}},required:["sys_id"]}},{name:"run_atf_test",description:"Execute a single ATF test (requires ATF_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the test"}},required:["sys_id"]}},{name:"get_atf_suite_result",description:"Get the results of a test suite run",inputSchema:{type:"object",properties:{result_sys_id:{type:"string",description:"System ID of the suite result record"}},required:["result_sys_id"]}},{name:"list_atf_test_results",description:"List individual test results within a suite run",inputSchema:{type:"object",properties:{suite_result_sys_id:{type:"string",description:"Filter by suite result sys_id"},limit:{type:"number",description:"Max results (default: 50)"}},required:[]}},{name:"get_atf_failure_insight",description:"Get ATF Failure Insight data — metadata changes between last successful and failed run (role changes, field value changes)",inputSchema:{type:"object",properties:{result_sys_id:{type:"string",description:"System ID of the failed suite result"}},required:["result_sys_id"]}},{name:"nlq_query",description:"Ask a natural language question and get structured ServiceNow data (ServiceNow NLQ API)",inputSchema:{type:"object",properties:{question:{type:"string",description:'Plain English question (e.g., "How many P1 incidents were opened this week?")'},table:{type:"string",description:"Optional target table hint"},limit:{type:"number",description:"Max results (default: 10)"}},required:["question"]}},{name:"ai_search",description:"Semantic AI-powered search across KB, catalog, incidents (ServiceNow AI Search)",inputSchema:{type:"object",properties:{query:{type:"string",description:"Natural language search query"},sources:{type:"array",items:{type:"string"},description:'Sources to search: ["kb", "catalog", "incident"] (default: all)'},limit:{type:"number",description:"Max results (default: 10)"}},required:["query"]}},{name:"categorize_incident",description:"Suggest category, assignment group, and priority for an incident by analysing similar resolved incidents (Table API). Predictive Intelligence has no public REST prediction endpoint; for model-based scoring run PI on-record and read the predicted field.",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Incident short description"},description:{type:"string",description:"Optional full description (not required for the heuristic)"}},required:["short_description"]}},{name:"get_virtual_agent_topics",description:"List Virtual Agent topics available in the instance (sys_cs_topic)",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter to active topics only"},category:{type:"string",description:"Filter by topic category"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_ms_copilot_topics",description:"List the Virtual Agent topics (sys_cs_topic) that back a Microsoft Copilot integration. Copilot topic mapping itself is configured in Copilot Studio on the Microsoft side, not exposed via ServiceNow REST.",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_pi_models",description:"List available Predictive Intelligence solutions (classification/similarity models)",inputSchema:{type:"object",properties:{},required:[]}},{name:"list_business_rules",description:"List business rules (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{table:{type:"string",description:"Filter by table name"},active:{type:"boolean",description:"Filter to active rules only"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_business_rule",description:"Get full details and script body of a business rule (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the business rule"}},required:["sys_id"]}},{name:"create_business_rule",description:"Create a new business rule (requires SCRIPTING_ENABLED=true). ServiceNow supports ES2021 async/await in scripts.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Rule name"},table:{type:"string",description:"Table this rule applies to"},when:{type:"string",description:'"before" | "after" | "async" | "display"'},script:{type:"string",description:"Server-side JavaScript. ServiceNow supports ES2021 (async/await, ?., ??)."},condition:{type:"string",description:"Optional condition script"},active:{type:"boolean",description:"Whether to activate the rule (default: true)"},order:{type:"number",description:"Execution order (default: 100)"}},required:["name","table","when","script"]}},{name:"update_business_rule",description:"Update a business rule (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the rule"},fields:{type:"object",description:"Key-value pairs to update (name, script, active, condition, etc.)"}},required:["sys_id","fields"]}},{name:"list_script_includes",description:"List script includes (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{query:{type:"string",description:'Filter (e.g., "nameLIKEUtil")'},active:{type:"boolean",description:"Filter to active includes"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_script_include",description:"Get full script body of a script include (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Script include sys_id or api_name"}},required:["sys_id_or_name"]}},{name:"create_script_include",description:"Create a new script include (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Script include name"},script:{type:"string",description:"Script body (class definition). ServiceNow supports ES2021."},api_name:{type:"string",description:"API name used to call this from other scripts"},access:{type:"string",description:'"public" or "package_private" (default: "public")'},active:{type:"boolean",description:"Whether to activate (default: true)"},client_callable:{type:"boolean",description:"Client callable, for GlideAjax use (default: false)"},scope:{type:"string",description:'Target application scope: a sys_scope sys_id, or "global" for the global scope. Default: your current application. Overriding scope needs cross-scope create rights.'}},required:["name","script"]}},{name:"update_script_include",description:"Update a script include (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the script include"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_client_scripts",description:"List client scripts (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{table:{type:"string",description:"Filter by table name"},type:{type:"string",description:'"onLoad" | "onChange" | "onSubmit" | "onCellEdit"'},active:{type:"boolean",description:"Filter to active scripts"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_client_script",description:"Get full details and script body of a client script (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the client script"}},required:["sys_id"]}},{name:"list_changesets",description:"List update sets (changesets) (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{state:{type:"string",description:'Filter by state: "in progress", "complete", "ignore"'},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"get_changeset",description:"Get details of an update set (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Update set sys_id or name"}},required:["sys_id_or_name"]}},{name:"commit_changeset",description:"Commit an update set (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the update set"}},required:["sys_id"]}},{name:"publish_changeset",description:"Publish/export an update set to XML for deployment (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the update set"}},required:["sys_id"]}},{name:"create_client_script",description:"Create a new client script (onLoad, onChange, onSubmit, onCellEdit) (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Script name"},table:{type:"string",description:"Table this client script applies to"},type:{type:"string",description:'"onLoad" | "onChange" | "onSubmit" | "onCellEdit"'},script:{type:"string",description:"Client-side JavaScript. Use g_form, g_user, etc."},field_name:{type:"string",description:"Field name (required for onChange/onCellEdit)"},active:{type:"boolean",description:"Whether to activate the script (default: true)"},global:{type:"boolean",description:"Run script globally (default: false)"}},required:["name","table","type","script"]}},{name:"update_client_script",description:"Update an existing client script (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Client script sys_id"},fields:{type:"object",description:"Fields to update (script, active, name, type, etc.)"}},required:["sys_id","fields"]}},{name:"list_ui_policies",description:"List UI Policies for a table (field visibility, mandatory, read-only rules) (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{table:{type:"string",description:"Filter by table name"},active:{type:"boolean",description:"Filter to active policies only"},limit:{type:"number",description:"Max results (default: 25)"}},required:[]}},{name:"get_ui_policy",description:"Get full details and conditions of a UI Policy (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"UI Policy sys_id"}},required:["sys_id"]}},{name:"create_ui_policy",description:"Create a new UI Policy to control field behavior dynamically (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Policy description"},table:{type:"string",description:"Table to apply this policy on"},conditions:{type:"string",description:"Encoded query conditions that trigger the policy"},script:{type:"string",description:"Optional script to run when conditions are met"},active:{type:"boolean",description:"Whether to activate immediately (default: true)"},run_scripts:{type:"boolean",description:"Run script in addition to UI actions (default: false)"}},required:["short_description","table"]}},{name:"list_ui_actions",description:"List UI Actions (buttons, context menus, related links) for a table (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{table:{type:"string",description:"Filter by table name"},type:{type:"string",description:"Filter by type: button, context_menu, related_link, list_link, list_button, list_context_menu"},active:{type:"boolean",description:"Filter to active actions only"},limit:{type:"number",description:"Max results (default: 25)"}},required:[]}},{name:"get_ui_action",description:"Get full details and script of a UI Action (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"UI Action sys_id"}},required:["sys_id"]}},{name:"create_ui_action",description:"Create a new UI Action (button or link) on a form (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Button/link label visible to users"},table:{type:"string",description:"Table to add this action on"},action_name:{type:"string",description:"Internal action name (no spaces)"},script:{type:"string",description:"Server-side script to execute when clicked"},type:{type:"string",description:'"button" | "context_menu" | "related_link" | "list_button"'},condition:{type:"string",description:"Condition to show/hide the action"},active:{type:"boolean",description:"Whether to activate immediately (default: true)"},form_button:{type:"boolean",description:"Show on form (default: true)"},list_button:{type:"boolean",description:"Show on list (default: false)"}},required:["name","table","action_name"]}},{name:"update_ui_action",description:"Update an existing UI Action (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"UI Action sys_id"},fields:{type:"object",description:"Fields to update (name, script, active, condition, etc.)"}},required:["sys_id","fields"]}},{name:"list_acls",description:"List Access Control rules (ACLs) — who can read/write/create/delete records (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{table:{type:"string",description:"Filter ACLs by table name"},operation:{type:"string",description:"Filter by operation: read, write, create, delete, execute"},active:{type:"boolean",description:"Filter to active ACLs only"},limit:{type:"number",description:"Max results (default: 25)"}},required:[]}},{name:"get_acl",description:"Get full details of an ACL rule including its script and role requirements (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"ACL sys_id"}},required:["sys_id"]}},{name:"create_acl",description:"Create a new ACL rule to control access to a table or field (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:'ACL name (typically "table.field" or "table.*")'},type:{type:"string",description:'"record" | "field" | "rest_endpoint" | "soap_endpoint"'},operation:{type:"string",description:'"read" | "write" | "create" | "delete" | "execute"'},admin_overrides:{type:"boolean",description:"Allow admin to override (default: true)"},active:{type:"boolean",description:"Whether to activate immediately (default: true)"},script:{type:"string",description:"Optional condition script (return true to allow)"},roles:{type:"string",description:'Comma-separated roles required (e.g. "admin,itil")'},description:{type:"string",description:"Description of this access rule"}},required:["name","operation"]}},{name:"update_acl",description:"Update an existing ACL rule (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"ACL sys_id"},fields:{type:"object",description:"Fields to update (active, script, roles, condition, etc.)"}},required:["sys_id","fields"]}},{name:"create_story",description:"Create a new agile story/user story (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Story title"},story_points:{type:"number",description:"Story point estimate"},sprint:{type:"string",description:"Sprint sys_id or name"},epic:{type:"string",description:"Epic sys_id"},description:{type:"string",description:"Story description and acceptance criteria"},assigned_to:{type:"string",description:"User sys_id or username"}},required:["short_description"]}},{name:"update_story",description:"Update an agile story (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the story"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_stories",description:"List agile stories with optional sprint or state filter",inputSchema:{type:"object",properties:{sprint:{type:"string",description:"Filter by sprint sys_id"},state:{type:"string",description:'Filter by state (e.g., "1"=Open, "2"=Work in Progress, "3"=Complete)'},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"create_epic",description:"Create a new epic (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Epic title"},description:{type:"string",description:"Epic description and goals"},project:{type:"string",description:"Project sys_id"}},required:["short_description"]}},{name:"update_epic",description:"Update an epic (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the epic"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_epics",description:"List epics with optional project or state filter",inputSchema:{type:"object",properties:{project:{type:"string",description:"Filter by project sys_id"},state:{type:"string",description:"Filter by state"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"create_scrum_task",description:"Create a scrum task (sub-task of a story) (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Task title"},story_sys_id:{type:"string",description:"Parent story sys_id"},assigned_to:{type:"string",description:"Assignee user_name or sys_id"}},required:["short_description"]}},{name:"update_scrum_task",description:"Update a scrum task (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the scrum task"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_scrum_tasks",description:"List scrum tasks, optionally filtered by story",inputSchema:{type:"object",properties:{story_sys_id:{type:"string",description:"Filter by parent story sys_id"},assigned_to:{type:"string",description:"Filter by assignee"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"create_story_dependency",description:"Link one agile story as dependent on another (m2m_story_dependencies). Requires WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{story:{type:"string",description:"The dependent story sys_id (the one that is blocked)"},dependent_story:{type:"string",description:"The story it depends on (the blocker) sys_id"}},required:["story","dependent_story"]}},{name:"list_story_dependencies",description:"List dependency links for a story (m2m_story_dependencies).",inputSchema:{type:"object",properties:{story:{type:"string",description:"Story sys_id to list dependencies for"},limit:{type:"number",description:"Max results (default: 50)"}},required:["story"]}},{name:"delete_story_dependency",description:"Remove a story dependency link by its m2m_story_dependencies sys_id. Requires WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"The m2m_story_dependencies record sys_id"}},required:["sys_id"]}},{name:"create_project",description:"Create a PPM project (pm_project). Requires WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Project name / short description"},description:{type:"string",description:"Project description"},state:{type:"string",description:"Project state (e.g. pending, open, work in progress)"},priority:{type:"string",description:"Priority (1-5)"},fields:{type:"object",description:"Additional pm_project fields (start_date, end_date, project_manager, etc.)"}},required:["short_description"]}},{name:"update_project",description:"Update a PPM project (pm_project). Requires WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Project sys_id"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_projects",description:"List PPM projects (pm_project).",inputSchema:{type:"object",properties:{query:{type:"string",description:"Encoded query filter (e.g. state=open)"},limit:{type:"number",description:"Max results (default: 20)"}},required:[]}},{name:"create_hr_case",description:"Create a new HR Service Delivery case (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Brief description of the HR request"},hr_service:{type:"string",description:'HR service sys_id or name (e.g. "Onboarding", "Offboarding")'},subject_person:{type:"string",description:"User sys_id or username the case is about"},description:{type:"string",description:"Full details of the HR request"},assignment_group:{type:"string",description:"HR assignment group name or sys_id"},priority:{type:"number",description:"1=Critical, 2=High, 3=Moderate, 4=Low"}},required:["short_description","hr_service"]}},{name:"get_hr_case",description:"Get full details of an HR case by number (e.g. HRCS0001234) or sys_id",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"HR case number (HRCS...) or sys_id"}},required:["number_or_sysid"]}},{name:"update_hr_case",description:"Update fields on an existing HR case (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the HR case"},fields:{type:"object",description:"Key-value pairs to update"}},required:["sys_id","fields"]}},{name:"list_hr_cases",description:"List HR cases with optional filters (status, subject person, service)",inputSchema:{type:"object",properties:{state:{type:"string",description:"Filter by state: open, work_in_progress, closed_complete, closed_incomplete"},subject_person:{type:"string",description:"User sys_id or username to filter by"},hr_service:{type:"string",description:"HR service name or sys_id"},limit:{type:"number",description:"Max records to return (default 25)"},query:{type:"string",description:"Additional encoded query string"}},required:[]}},{name:"close_hr_case",description:"Close an HR case with resolution notes (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the HR case"},close_notes:{type:"string",description:"Resolution or closure notes"},close_code:{type:"string",description:'Closure code (e.g., "Resolved", "Withdrawn")'}},required:["sys_id","close_notes"]}},{name:"list_hr_services",description:"List available HR services (Onboarding, Offboarding, Benefits, Payroll, etc.)",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter to active services only (default true)"},query:{type:"string",description:"Filter by name or description"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_hr_service",description:"Get details of a specific HR service including its tasks and SLAs",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"HR service sys_id or exact name"}},required:["sys_id_or_name"]}},{name:"get_hr_profile",description:"Get the HR profile for a user (employment details, department, manager)",inputSchema:{type:"object",properties:{user_identifier:{type:"string",description:"Username, email, or sys_id of the user"}},required:["user_identifier"]}},{name:"update_hr_profile",description:"Update HR profile fields for a user (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{user_sys_id:{type:"string",description:"sys_id of the user whose profile to update"},fields:{type:"object",description:'HR profile fields to update (e.g., {"department": "Engineering"})'}},required:["user_sys_id","fields"]}},{name:"list_hr_tasks",description:"List HR tasks associated with an HR case",inputSchema:{type:"object",properties:{hr_case_sysid:{type:"string",description:"sys_id of the parent HR case"},state:{type:"string",description:"Filter by task state (open, closed)"}},required:["hr_case_sysid"]}},{name:"create_hr_task",description:"Create a task within an HR case (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{hr_case_sysid:{type:"string",description:"sys_id of the parent HR case"},short_description:{type:"string",description:"Brief description of the task"},assigned_to:{type:"string",description:"User sys_id or username to assign the task to"},due_date:{type:"string",description:"Due date in ISO 8601 format"}},required:["hr_case_sysid","short_description"]}},{name:"get_hr_case_activity",description:"Get the full activity log and journal entries for an HR case",inputSchema:{type:"object",properties:{hr_case_sysid:{type:"string",description:"sys_id of the HR case"}},required:["hr_case_sysid"]}},{name:"create_onboarding_case",description:"Create an employee onboarding case with all standard tasks. **[Write]**",inputSchema:{type:"object",properties:{employee_sys_id:{type:"string",description:"New employee user sys_id"},start_date:{type:"string",description:"Start date (ISO 8601)"},department:{type:"string",description:"Department name or sys_id"},manager:{type:"string",description:"Manager user sys_id"},location:{type:"string",description:"Office location"},job_title:{type:"string",description:"Job title"}},required:["employee_sys_id","start_date"]}},{name:"create_offboarding_case",description:"Create an employee offboarding case with exit tasks. **[Write]**",inputSchema:{type:"object",properties:{employee_sys_id:{type:"string",description:"Departing employee user sys_id"},last_day:{type:"string",description:"Last working day (ISO 8601)"},reason:{type:"string",description:"Offboarding reason (resignation, termination, retirement)"},manager:{type:"string",description:"Manager user sys_id"}},required:["employee_sys_id","last_day"]}},{name:"get_hr_lifecycle_events",description:"Get HR lifecycle events for an employee (promotions, transfers, leaves)",inputSchema:{type:"object",properties:{employee_sys_id:{type:"string",description:"Employee user sys_id"},event_type:{type:"string",description:"Filter by type: promotion, transfer, leave, onboarding, offboarding"},limit:{type:"number",description:"Max records (default 25)"}},required:["employee_sys_id"]}},{name:"list_hr_document_templates",description:"List available HR document templates (offer letters, contracts, policies)",inputSchema:{type:"object",properties:{category:{type:"string",description:"Filter by category: onboarding, offboarding, benefits, policy"},active:{type:"boolean",description:"Filter active only (default true)"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"create_csm_case",description:"Create a new Customer Service case (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Brief summary of the customer issue"},account:{type:"string",description:"Account name or sys_id"},contact:{type:"string",description:"Contact name or sys_id (the person raising the case)"},category:{type:"string",description:'Case category (e.g., "Product", "Billing", "Technical")'},subcategory:{type:"string",description:"Case subcategory"},priority:{type:"number",description:"1=Critical, 2=High, 3=Moderate, 4=Low"},description:{type:"string",description:"Detailed description of the customer issue"},product:{type:"string",description:"Product or service sys_id related to the case"},assignment_group:{type:"string",description:"CSM assignment group"}},required:["short_description"]}},{name:"get_csm_case",description:"Get full details of a CSM case by number (e.g. CS0001234) or sys_id",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Case number (CS...) or sys_id"}},required:["number_or_sysid"]}},{name:"update_csm_case",description:"Update fields on an existing CSM case (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the CSM case"},fields:{type:"object",description:"Key-value pairs of fields to update"}},required:["sys_id","fields"]}},{name:"list_csm_cases",description:"List CSM cases with optional filters (account, contact, state, priority)",inputSchema:{type:"object",properties:{account:{type:"string",description:"Filter by account name or sys_id"},contact:{type:"string",description:"Filter by contact name or sys_id"},state:{type:"string",description:"Filter by state (open, resolved, closed)"},priority:{type:"number",description:"Filter by priority (1-4)"},limit:{type:"number",description:"Max records to return (default 25)"},query:{type:"string",description:"Additional encoded query"}},required:[]}},{name:"close_csm_case",description:"Close a CSM case with resolution details (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the CSM case"},resolution_code:{type:"string",description:"How the case was resolved"},resolution_notes:{type:"string",description:"Detailed resolution notes"}},required:["sys_id","resolution_notes"]}},{name:"get_csm_account",description:"Get details of a customer account including contacts and open cases count",inputSchema:{type:"object",properties:{name_or_sysid:{type:"string",description:"Account name or sys_id"}},required:["name_or_sysid"]}},{name:"list_csm_accounts",description:"List customer accounts with optional search filter",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search accounts by name"},active:{type:"boolean",description:"Filter to active accounts only (default true)"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_csm_contact",description:"Get details of a customer contact (name, account, phone, email)",inputSchema:{type:"object",properties:{name_or_sysid:{type:"string",description:"Contact name, email, or sys_id"}},required:["name_or_sysid"]}},{name:"list_csm_contacts",description:"List contacts for an account or search across all contacts",inputSchema:{type:"object",properties:{account_sysid:{type:"string",description:"Filter contacts by account sys_id"},query:{type:"string",description:"Search by name or email"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_csm_case_sla",description:"Get SLA details and remaining time for a CSM case",inputSchema:{type:"object",properties:{case_sysid:{type:"string",description:"sys_id of the CSM case"}},required:["case_sysid"]}},{name:"list_csm_products",description:"List products and services available in the CSM catalog",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search products by name"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"create_security_incident",description:"Create a Security Operations incident (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Brief description of the security event"},category:{type:"string",description:'Incident category (e.g., "Malware", "Phishing", "Data Breach", "Unauthorized Access")'},subcategory:{type:"string",description:"Incident subcategory"},severity:{type:"number",description:"1=High, 2=Medium, 3=Low"},description:{type:"string",description:"Detailed description of the security incident"},affected_cis:{type:"array",items:{type:"string"},description:"List of affected CI sys_ids"},assignment_group:{type:"string",description:"SOC team or assignment group"}},required:["short_description","category"]}},{name:"get_security_incident",description:"Get full details of a security incident by number or sys_id",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Security incident number (SIR...) or sys_id"}},required:["number_or_sysid"]}},{name:"update_security_incident",description:"Update a security incident record (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the security incident"},fields:{type:"object",description:"Fields to update (state, severity, containment_status, etc.)"}},required:["sys_id","fields"]}},{name:"list_security_incidents",description:"List security incidents with filters (severity, state, category)",inputSchema:{type:"object",properties:{state:{type:"string",description:"Filter by state (open, analysis, contain, eradicate, recover, review, closed)"},severity:{type:"number",description:"Filter by severity (1=High, 2=Medium, 3=Low)"},category:{type:"string",description:"Filter by incident category"},limit:{type:"number",description:"Max records to return (default 25)"},query:{type:"string",description:"Additional encoded query string"}},required:[]}},{name:"list_vulnerabilities",description:"List vulnerability entries from the Vulnerability Response module",inputSchema:{type:"object",properties:{state:{type:"string",description:"Filter by state (open, in_review, risk_accepted, closed)"},severity:{type:"string",description:"Filter by CVSS severity (critical, high, medium, low)"},ci_sysid:{type:"string",description:"Filter by affected CI sys_id"},limit:{type:"number",description:"Max records to return (default 25)"},query:{type:"string",description:"Additional encoded query string"}},required:[]}},{name:"get_vulnerability",description:"Get details of a specific vulnerability entry including CVSS score and affected CIs",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Vulnerability number (VIT...) or sys_id"}},required:["number_or_sysid"]}},{name:"update_vulnerability",description:"Update a vulnerability entry (state, risk acceptance notes, remediation date) (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the vulnerability entry"},fields:{type:"object",description:"Fields to update (state, risk_acceptance_notes, remediation_date, etc.)"}},required:["sys_id","fields"]}},{name:"list_grc_risks",description:"List GRC (Governance, Risk, Compliance) risk entries",inputSchema:{type:"object",properties:{state:{type:"string",description:"Filter by risk state (draft, assess, review, accepted, closed)"},category:{type:"string",description:"Filter by risk category"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_grc_risk",description:"Get details of a GRC risk including impact, likelihood, and controls",inputSchema:{type:"object",properties:{number_or_sysid:{type:"string",description:"Risk number or sys_id"}},required:["number_or_sysid"]}},{name:"list_grc_controls",description:"List GRC controls with optional filter by risk or policy",inputSchema:{type:"object",properties:{risk_sysid:{type:"string",description:"Filter controls by related risk sys_id"},state:{type:"string",description:"Filter by control state (draft, attest, review, exception, compliant, non_compliant)"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_threat_intelligence",description:"Query threat intelligence data — IOCs, threat actors, and campaigns",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search term (IP, domain, hash, actor name)"},type:{type:"string",description:"Filter by IOC type: ip_address, domain, file_hash, url, email"},limit:{type:"number",description:"Max records to return (default 25)"}},required:["query"]}},{name:"list_security_playbooks",description:"List available security response playbooks",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter active only (default true)"},category:{type:"string",description:"Filter by category (incident_response, threat_hunting, compliance)"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"run_security_playbook",description:"Execute a security response playbook against an incident. **[Write]**",inputSchema:{type:"object",properties:{playbook_sys_id:{type:"string",description:"Playbook sys_id to execute"},incident_sys_id:{type:"string",description:"Security incident sys_id to run against"},parameters:{type:"object",description:"Optional playbook input parameters"}},required:["playbook_sys_id","incident_sys_id"]}},{name:"get_security_dashboard",description:"Get security posture dashboard — open incidents by severity, vulnerability counts, mean time to resolve",inputSchema:{type:"object",properties:{days:{type:"number",description:"Look-back period in days (default 30)"}},required:[]}},{name:"scan_vulnerabilities",description:"Trigger a vulnerability scan for specified CIs or groups. **[Write]**",inputSchema:{type:"object",properties:{ci_sys_ids:{type:"array",items:{type:"string"},description:"CI sys_ids to scan"},group:{type:"string",description:"CI group to scan (alternative to ci_sys_ids)"},scan_type:{type:"string",description:"Scan type: full, quick, compliance (default full)"}},required:[]}},{name:"create_grc_risk",description:"Create a new GRC risk entry. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Risk name"},category:{type:"string",description:"Risk category"},description:{type:"string",description:"Risk description"},impact:{type:"number",description:"Impact score (1-5)"},likelihood:{type:"number",description:"Likelihood score (1-5)"},owner:{type:"string",description:"Risk owner user sys_id"}},required:["name","category"]}},{name:"list_compliance_policies",description:"List GRC compliance policies and their current status",inputSchema:{type:"object",properties:{state:{type:"string",description:"Filter by state (draft, published, retired)"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"get_compliance_assessment",description:"Get compliance assessment results for a policy or control",inputSchema:{type:"object",properties:{policy_sys_id:{type:"string",description:"Policy sys_id"},control_sys_id:{type:"string",description:"Control sys_id (alternative to policy)"}},required:[]}},{name:"list_audit_results",description:"List audit results and findings",inputSchema:{type:"object",properties:{state:{type:"string",description:"Filter by state (open, in_progress, closed)"},severity:{type:"string",description:"Filter by severity (critical, high, medium, low)"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"list_flows",description:"List Flow Designer flows with optional filter by name, category, or active status",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search flows by name or description"},active:{type:"boolean",description:"Filter to active flows only (default true)"},category:{type:"string",description:'Filter by category (e.g., "ITSM", "HR", "Security")'},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_flow",description:"Get full details of a Flow Designer flow including its actions and trigger",inputSchema:{type:"object",properties:{name_or_sysid:{type:"string",description:"Flow name or sys_id"}},required:["name_or_sysid"]}},{name:"trigger_flow",description:"Trigger a Flow Designer flow with optional input parameters (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{flow_sys_id:{type:"string",description:"sys_id of the flow to trigger"},inputs:{type:"object",description:"Key-value pairs for flow input variables"}},required:["flow_sys_id"]}},{name:"get_flow_execution",description:"Get the status and details of a specific flow execution",inputSchema:{type:"object",properties:{execution_sysid:{type:"string",description:"sys_id of the flow execution to inspect"}},required:["execution_sysid"]}},{name:"list_flow_executions",description:"List recent executions of a flow with status (completed, error, running)",inputSchema:{type:"object",properties:{flow_sys_id:{type:"string",description:"sys_id of the parent flow"},status:{type:"string",description:"Filter by status: running, complete, error, cancelled"},limit:{type:"number",description:"Max records to return (default 25)"}},required:["flow_sys_id"]}},{name:"list_subflows",description:"List available subflows that can be reused across flows",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search subflows by name"},active:{type:"boolean",description:"Filter to active subflows only (default true)"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_subflow",description:"Get full details of a subflow including its inputs, outputs, and actions",inputSchema:{type:"object",properties:{name_or_sysid:{type:"string",description:"Subflow name or sys_id"}},required:["name_or_sysid"]}},{name:"list_action_instances",description:"List Flow Designer action instances. Pass flow_id to scope to a single flow's steps (recommended); otherwise lists across the environment.",inputSchema:{type:"object",properties:{flow_id:{type:"string",description:"Parent flow sys_id (sys_hub_flow). Returns only that flow's action instances."},query:{type:"string",description:"Search actions by name or category"},category:{type:"string",description:'Filter by action category (e.g., "ServiceNow Core", "Integrations")'},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_process_automation",description:"Get details of a Process Automation Designer playbook or process",inputSchema:{type:"object",properties:{name_or_sysid:{type:"string",description:"Playbook or process name or sys_id"}},required:["name_or_sysid"]}},{name:"list_process_automations",description:"List Process Automation Designer playbooks and processes",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search by name or description"},active:{type:"boolean",description:"Filter to active processes only (default true)"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"create_flow",description:"Create a new Flow Designer flow. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Flow name"},description:{type:"string",description:"Flow description"},trigger_type:{type:"string",description:"Trigger type: record, schedule, inbound_email, rest (default record)"},trigger_table:{type:"string",description:"Trigger table (for record triggers)"},scope:{type:"string",description:"Application scope"}},required:["name"]}},{name:"create_subflow",description:"Create a new reusable subflow. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Subflow name"},description:{type:"string",description:"Subflow description"},inputs:{type:"array",items:{type:"object"},description:"Input variable definitions [{name, type, mandatory}]"},scope:{type:"string",description:"Application scope"}},required:["name"]}},{name:"create_flow_action",description:"Create a custom Flow Designer action. **[Scripting]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Action name"},description:{type:"string",description:"Action description"},inputs:{type:"array",items:{type:"object"},description:"Input definitions [{name, type, mandatory}]"},outputs:{type:"array",items:{type:"object"},description:"Output definitions [{name, type}]"},script:{type:"string",description:"Action script body"}},required:["name"]}},{name:"publish_flow",description:"Publish (activate) a draft flow or subflow. **[Write]**",inputSchema:{type:"object",properties:{flow_sys_id:{type:"string",description:"Flow or subflow sys_id to publish"},type:{type:"string",description:"Type: flow or subflow (default flow)"}},required:["flow_sys_id"]}},{name:"update_flow",description:"Update a flow or subflow's METADATA only (activate/deactivate, name, description, run-as). **[Write]** NOTE: this cannot safely insert or edit flow STEPS. Flow Designer executes a compiled snapshot, and writing action-instance rows over REST does not recompile the flow, which would desync/corrupt it. Edit steps in the Flow Designer UI.",inputSchema:{type:"object",properties:{flow_sys_id:{type:"string",description:"Flow or subflow sys_id"},type:{type:"string",description:"Type: flow or subflow (default flow)"},active:{type:"boolean",description:"Activate (true) or deactivate (false)"},name:{type:"string",description:"New name"},description:{type:"string",description:"New description"},run_as:{type:"string",description:"run_as value (e.g. user_who_triggers, system_user)"}},required:["flow_sys_id"]}},{name:"test_flow",description:"Execute a flow in test mode with sample inputs. **[Write]**",inputSchema:{type:"object",properties:{flow_sys_id:{type:"string",description:"Flow sys_id to test"},test_inputs:{type:"object",description:"Test input values"}},required:["flow_sys_id"]}},{name:"get_flow_error_log",description:"Get detailed error logs for failed flow executions",inputSchema:{type:"object",properties:{flow_sys_id:{type:"string",description:"Flow sys_id"},days:{type:"number",description:"Look-back period in days (default 7)"},limit:{type:"number",description:"Max records (default 25)"}},required:["flow_sys_id"]}},{name:"list_decision_tables",description:"List Decision Builder decision tables (sys_decision), optionally filtered by name or active status",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search decision tables by name or description"},active:{type:"boolean",description:"Filter to active decision tables only"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_decision_table",description:"Get a decision table with its inputs and answer rows, by name or sys_id",inputSchema:{type:"object",properties:{name_or_sysid:{type:"string",description:"Decision table name or sys_id"}},required:["name_or_sysid"]}},{name:"list_decision_inputs",description:"List the inputs of a decision table",inputSchema:{type:"object",properties:{decision_sys_id:{type:"string",description:"sys_id of the decision table (sys_decision)"}},required:["decision_sys_id"]}},{name:"list_decision_answers",description:"List the answer/result rows of a decision table",inputSchema:{type:"object",properties:{decision_sys_id:{type:"string",description:"sys_id of the decision table (sys_decision)"},limit:{type:"number",description:"Max records to return (default 100)"}},required:["decision_sys_id"]}},{name:"create_decision_table",description:"Create a Decision Builder decision table (sys_decision). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"Decision table name"},description:{type:"string",description:"Description of what the decision returns"},active:{type:"boolean",description:"Whether the decision table is active (default true)"},fields:{type:"object",description:"Additional sys_decision field values to set"}},required:["name"]}},{name:"create_decision_input",description:"Add an input to a decision table (sys_decision_input). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{decision_sys_id:{type:"string",description:"sys_id of the parent decision table (sys_decision)"},name:{type:"string",description:"Input name/label"},type:{type:"string",description:"Input data type (e.g., string, integer, reference, boolean)"},order:{type:"number",description:"Display order of the input"},fields:{type:"object",description:"Additional sys_decision_input field values to set"}},required:["decision_sys_id","name"]}},{name:"list_sla_definitions",description:"List SLA/OLA definitions (contract_sla), optionally filtered by name, table, or active status",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search definitions by name"},table:{type:"string",description:'Filter to a collection/table (e.g. "incident")'},active:{type:"boolean",description:"Filter to active definitions only"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"create_sla_definition",description:"Create an SLA/OLA definition (contract_sla). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"SLA definition name"},collection:{type:"string",description:'Table the SLA applies to (e.g. "incident")'},duration_type:{type:"string",description:'Duration type (e.g. "User specified")'},duration:{type:"string",description:'Duration value (e.g. "1970-01-01 04:00:00" for 4h)'},start_condition:{type:"string",description:"Encoded start condition"},stop_condition:{type:"string",description:"Encoded stop condition"},schedule:{type:"string",description:"Schedule sys_id (business hours)"},type:{type:"string",description:'"SLA" or "OLA" (default SLA)'},fields:{type:"object",description:"Additional field values"}},required:["name","collection"]}},{name:"update_sla_definition",description:"Update an SLA/OLA definition (contract_sla). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"sys_id of the definition"},fields:{type:"object",description:"Field values to update"}},required:["sys_id","fields"]}},{name:"get_task_sla",description:"Get live SLA instances (task_sla) for a task — percent complete, breach status, stage, planned end",inputSchema:{type:"object",properties:{task:{type:"string",description:"sys_id of the task (incident/change/etc.)"},task_number:{type:"string",description:"Task number (e.g. INC0010001) if sys_id not known"},active_only:{type:"boolean",description:"Only in-progress SLAs (default true)"}},required:[]}},{name:"list_breached_slas",description:"List SLA instances that have breached or are at risk within a window (task_sla)",inputSchema:{type:"object",properties:{breached:{type:"boolean",description:"true = already breached; false = at-risk/in-progress (default true)"},min_percentage:{type:"number",description:"For at-risk: minimum business_percentage (e.g. 80)"},sla_table:{type:"string",description:'Filter to a task table (e.g. "incident") via task.sys_class_name'},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"get_on_call_now",description:"Find who is on call for a group right now. Returns the current roster members for the group's rotations",inputSchema:{type:"object",properties:{group:{type:"string",description:"Group name or sys_id"}},required:["group"]}},{name:"list_rotas",description:"List on-call rotations (cmn_rota), optionally filtered by group or name",inputSchema:{type:"object",properties:{group:{type:"string",description:"Filter by group sys_id"},query:{type:"string",description:"Search rotations by name"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"create_rota_schedule",description:"Create an on-call rotation (cmn_rota) for a group. Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"Rotation name"},group:{type:"string",description:"Group sys_id that owns the rotation"},time_zone:{type:"string",description:'Time zone (e.g. "US/Eastern")'},fields:{type:"object",description:"Additional field values"}},required:["name","group"]}},{name:"add_roster_member",description:"Add a member to an on-call roster (cmn_rota_member). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{roster:{type:"string",description:"sys_id of the roster (cmn_rota_roster)"},member:{type:"string",description:"sys_id of the group member (sys_user_grmember) or user"},order:{type:"number",description:"Rotation order"},fields:{type:"object",description:"Additional field values"}},required:["roster","member"]}},{name:"create_on_call_override",description:"Create an on-call coverage override for a date range (cmn_rota_override). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{roster:{type:"string",description:"sys_id of the roster being overridden"},member:{type:"string",description:"sys_id of the covering user/member"},start:{type:"string",description:"Override start (YYYY-MM-DD HH:MM:SS)"},end:{type:"string",description:"Override end (YYYY-MM-DD HH:MM:SS)"},fields:{type:"object",description:"Additional field values"}},required:["roster","member","start","end"]}},{name:"get_request_item",description:"Get a requested item (RITM) with its variables, by number or sys_id",inputSchema:{type:"object",properties:{number:{type:"string",description:"RITM number (e.g. RITM0010001)"},sys_id:{type:"string",description:"sys_id of the sc_req_item"}},required:[]}},{name:"update_request_item",description:"Update the state/stage or fields of a requested item (sc_req_item). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"sys_id of the RITM"},state:{type:"string",description:"New state value"},stage:{type:"string",description:"New stage value"},fields:{type:"object",description:"Additional field values"}},required:["sys_id"]}},{name:"list_catalog_tasks",description:"List catalog fulfillment tasks (SCTASK), optionally by request item, assignment group, or state",inputSchema:{type:"object",properties:{request_item:{type:"string",description:"Parent RITM sys_id"},assignment_group:{type:"string",description:"Assignment group sys_id"},active:{type:"boolean",description:"Filter to active tasks only"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"complete_catalog_task",description:"Close a catalog fulfillment task (sc_task) as complete. Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"sys_id of the SCTASK"},close_notes:{type:"string",description:"Closure notes"},state:{type:"string",description:"Closed state value (default 3 = Closed Complete)"}},required:["sys_id"]}},{name:"list_catalog_categories",description:"List catalog categories (sc_category), optionally filtered by catalog or title",inputSchema:{type:"object",properties:{catalog:{type:"string",description:"Catalog sys_id to filter by"},query:{type:"string",description:"Search categories by title"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"create_catalog_category",description:"Create a catalog category (sc_category). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{title:{type:"string",description:"Category title"},catalog:{type:"string",description:"Catalog sys_id (sc_catalog)"},description:{type:"string",description:"Category description"},parent:{type:"string",description:"Parent category sys_id (for sub-categories)"},fields:{type:"object",description:"Additional field values"}},required:["title"]}},{name:"create_user_criteria",description:"Create a user criteria record (user_criteria) for catalog entitlement/audience. Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"User criteria name"},roles:{type:"string",description:"Comma-separated role sys_ids"},groups:{type:"string",description:"Comma-separated group sys_ids"},users:{type:"string",description:"Comma-separated user sys_ids"},match_all:{type:"boolean",description:"Require all conditions to match"},fields:{type:"object",description:"Additional field values"}},required:["name"]}},{name:"assign_user_criteria",description:"Attach a user criteria to a catalog item as available-for (sc_cat_item_user_criteria_mtom). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{catalog_item:{type:"string",description:"sys_id of the catalog item (sc_cat_item)"},user_criteria:{type:"string",description:"sys_id of the user_criteria record"}},required:["catalog_item","user_criteria"]}},{name:"list_user_roles",description:"List roles granted to a user (sys_user_has_role), including inherited flag",inputSchema:{type:"object",properties:{user:{type:"string",description:"User sys_id, user_name, or email"}},required:["user"]}},{name:"grant_role",description:"Grant a role to a user (sys_user_has_role). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{user:{type:"string",description:"User sys_id, user_name, or email"},role:{type:"string",description:'Role sys_id or name (e.g. "itil")'}},required:["user","role"]}},{name:"revoke_role",description:"Revoke a directly-granted role from a user. Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{user:{type:"string",description:"User sys_id, user_name, or email"},role:{type:"string",description:"Role sys_id or name"}},required:["user","role"]}},{name:"create_role",description:"Create a new role (sys_user_role). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:'Role name (e.g. "x_acme.approver")'},description:{type:"string",description:"Role description"},fields:{type:"object",description:"Additional field values"}},required:["name"]}},{name:"deactivate_user",description:"Deactivate (offboard) a user by setting active=false. Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{user:{type:"string",description:"User sys_id, user_name, or email"}},required:["user"]}},{name:"create_delegation",description:"Create an approval/coverage delegation (sys_user_delegate). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{user:{type:"string",description:"User delegating (sys_id/user_name/email)"},delegate:{type:"string",description:"User receiving the delegation"},starts:{type:"string",description:"Start datetime (YYYY-MM-DD HH:MM:SS)"},ends:{type:"string",description:"End datetime (YYYY-MM-DD HH:MM:SS)"},approvals:{type:"boolean",description:"Delegate approvals (default true)"},assignments:{type:"boolean",description:"Delegate assignments"}},required:["user","delegate"]}},{name:"list_group_members",description:"List the members of a group (sys_user_grmember)",inputSchema:{type:"object",properties:{group:{type:"string",description:"Group sys_id or name"},limit:{type:"number",description:"Max records (default 100)"}},required:["group"]}},{name:"get_user_entitlements",description:"Summarize what a user can access: their roles, groups, and active status",inputSchema:{type:"object",properties:{user:{type:"string",description:"User sys_id, user_name, or email"}},required:["user"]}},{name:"create_survey",description:"Create a survey/assessment definition (asmt_metric_type). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"Survey name"},description:{type:"string",description:"Survey description"},type:{type:"string",description:'Metric type (e.g. "survey")'},fields:{type:"object",description:"Additional field values"}},required:["name"]}},{name:"send_survey",description:"Issue a survey/assessment instance to a user (asmt_assessment_instance). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{metric_type:{type:"string",description:"sys_id of the survey definition (asmt_metric_type)"},user:{type:"string",description:"Recipient user sys_id"},trigger_id:{type:"string",description:"Source record sys_id (e.g. the closed incident)"},trigger_table:{type:"string",description:"Source table name"},fields:{type:"object",description:"Additional field values"}},required:["metric_type","user"]}},{name:"get_survey_results",description:"Get responses/scores for a survey instance or definition (asmt_assessment_instance_question)",inputSchema:{type:"object",properties:{instance:{type:"string",description:"sys_id of a specific assessment instance"},metric_type:{type:"string",description:"sys_id of the survey definition (aggregate across instances)"},limit:{type:"number",description:"Max question rows (default 100)"}},required:[]}},{name:"list_assessments",description:"List survey/assessment instances (asmt_assessment_instance) by state or user",inputSchema:{type:"object",properties:{state:{type:"string",description:'Instance state (e.g. "ready", "complete")'},user:{type:"string",description:"Recipient user sys_id"},metric_type:{type:"string",description:"Survey definition sys_id"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"list_grc_issues",description:"List GRC issues/findings (sn_grc_issue), optionally by state or owner",inputSchema:{type:"object",properties:{state:{type:"string",description:"Issue state filter"},owner:{type:"string",description:"Owner/assigned user sys_id"},query:{type:"string",description:"Search issues by short description"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"create_grc_issue",description:"Raise a GRC issue/finding (sn_grc_issue). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Issue summary"},description:{type:"string",description:"Full description"},source:{type:"string",description:"Source record sys_id (control/risk/audit)"},fields:{type:"object",description:"Additional field values"}},required:["short_description"]}},{name:"create_grc_control",description:"Author a compliance control (sn_compliance_control). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"Control name"},description:{type:"string",description:"Control description"},profile:{type:"string",description:"Related profile/entity sys_id"},fields:{type:"object",description:"Additional field values"}},required:["name"]}},{name:"run_control_test",description:"Create/attest a control test (sn_compliance_control_test). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{control:{type:"string",description:"sys_id of the control (sn_compliance_control)"},result:{type:"string",description:'Test result/state (e.g. "pass", "fail")'},notes:{type:"string",description:"Test notes/evidence"},fields:{type:"object",description:"Additional field values"}},required:["control"]}},{name:"create_business_service",description:"Create a business service (cmdb_ci_service). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"Business service name"},owned_by:{type:"string",description:"Owner user sys_id"},support_group:{type:"string",description:"Support group sys_id"},fields:{type:"object",description:"Additional field values"}},required:["name"]}},{name:"create_service_offering",description:"Create a service offering under a business service (service_offering). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"Service offering name"},parent:{type:"string",description:"Parent business service sys_id (cmdb_ci_service)"},support_group:{type:"string",description:"Support group sys_id"},fields:{type:"object",description:"Additional field values"}},required:["name"]}},{name:"list_service_offerings",description:"List service offerings (service_offering), optionally by parent business service",inputSchema:{type:"object",properties:{parent:{type:"string",description:"Parent business service sys_id"},query:{type:"string",description:"Search offerings by name"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"list_scan_suites",description:"List Instance Scan suites (scan_suite) available to run",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search suites by name"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"get_instance_scan_findings",description:"List Instance Scan findings (scan_finding) — best-practice violations, optionally by check or suite result",inputSchema:{type:"object",properties:{check:{type:"string",description:"Filter by check name (contains)"},suite_result:{type:"string",description:"Filter by scan suite result sys_id"},table:{type:"string",description:"Filter by target table"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"get_ecc_queue",description:"Inspect the ECC queue (ecc_queue) — MID server probes/sensors, by state, agent, or topic",inputSchema:{type:"object",properties:{state:{type:"string",description:'Filter by state (e.g. "ready", "processed", "error")'},queue:{type:"string",description:'Direction: "input" or "output"'},agent:{type:"string",description:"MID server agent name (contains)"},topic:{type:"string",description:"Topic (contains)"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"resubmit_ecc_probe",description:"Re-queue an ECC probe/sensor by setting its state back to ready (ecc_queue). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"sys_id of the ecc_queue record"}},required:["sys_id"]}},{name:"run_fix_script",description:"Execute a fix script (sys_script_fix) by name or sys_id on the server. Requires WRITE_ENABLED=true and SCRIPTING_ENABLED=true",inputSchema:{type:"object",properties:{name:{type:"string",description:"Fix script name"},sys_id:{type:"string",description:"sys_id of the fix script"}},required:[]}},{name:"list_ai_agent_executions",description:"List recent Now Assist AI Agent execution plans (sn_aia_execution_plan)",inputSchema:{type:"object",properties:{status:{type:"string",description:"Filter by execution status"},query:{type:"string",description:"Encoded query for additional filtering"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"get_ai_agent_execution",description:"Get an AI Agent execution plan with its steps/tool calls (sn_aia_execution_plan + _step)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"sys_id of the execution plan"}},required:["sys_id"]}},{name:"list_agent_use_cases",description:"List AI Agent Studio use cases (sn_aia_usecase) and their configuration",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search use cases by name"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"list_application_services",description:"List discovered application services (cmdb_ci_service_auto), optionally by name or operational status. Parity with ServiceNow get_all_application_service_names",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search application services by name"},operational_status:{type:"string",description:"Filter by operational_status value"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"cmdb_services_for_ci",description:"Reverse lookup: which application services contain a given CI/server (svc_ci_assoc). Parity with ServiceNow get_all_application_services_for_a_server",inputSchema:{type:"object",properties:{ci:{type:"string",description:"sys_id of the CI/server"},ci_name:{type:"string",description:"CI name if sys_id not known"},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"cmdb_find_unmapped_cis",description:"Find operational CIs that have relationships but belong to no application service (mapping gaps). Parity with ServiceNow get_unmapped_topology",inputSchema:{type:"object",properties:{ci_class:{type:"string",description:"Restrict to a CI class/table (e.g. cmdb_ci_server)"},limit:{type:"number",description:"Max CIs to scan/return (default 100)"}},required:[]}},{name:"suggest_ci_class",description:"Suggest the correct CMDB CI class for a keyword before creating a CI (cmdb_class_info). Parity with ServiceNow Get_SimilarCI_Classes",inputSchema:{type:"object",properties:{keyword:{type:"string",description:'Device/technology keyword, e.g. "linux server", "load balancer"'},limit:{type:"number",description:"Max classes to return (default 10)"}},required:["keyword"]}},{name:"get_quote",description:"Get a CPQ/sales quote record by number or sys_id (tries known quote tables)",inputSchema:{type:"object",properties:{number:{type:"string",description:"Quote number"},sys_id:{type:"string",description:"Quote sys_id"},table:{type:"string",description:"Explicit quote table if you know it"}},required:[]}},{name:"list_quotes",description:"List CPQ/sales quotes with optional filters (state, account)",inputSchema:{type:"object",properties:{table:{type:"string",description:"Explicit quote table if you know it"},state:{type:"string",description:"Filter by state"},account:{type:"string",description:"Filter by account sys_id"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"get_approval_history",description:"Get the approval progression/history for any record (sysapproval_approver rows, ordered)",inputSchema:{type:"object",properties:{record:{type:"string",description:"sys_id of the record under approval (source record)"},limit:{type:"number",description:"Max approver rows (default 100)"}},required:["record"]}},{name:"preview_approval_routing",description:"Preview the planned approver path for a record before/after submission (existing sysapproval_approver rows + matching approval rules)",inputSchema:{type:"object",properties:{record:{type:"string",description:"sys_id of the record to preview routing for"},table:{type:"string",description:"Table of the record (to match approval rules)"}},required:["record"]}},{name:"add_adhoc_approver",description:"Add an ad-hoc approver to an in-flight approval on a record (inserts a sysapproval_approver row). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{record:{type:"string",description:"sys_id of the record under approval (sets sysapproval)"},approver:{type:"string",description:"sys_id of the user to add as approver"},source_table:{type:"string",description:"Table of the source record (source_table field)"}},required:["record","approver"]}},{name:"recall_approval_request",description:"Recall/withdraw approval requests on a record by cancelling pending approver rows (state → cancelled/no_longer_required). Requires WRITE_ENABLED=true",inputSchema:{type:"object",properties:{record:{type:"string",description:"sys_id of the record whose approvals to recall"}},required:["record"]}},{name:"submit_for_approval",description:'Submit any record for approval by setting its approval field to "requested" (generic, not just change). Requires WRITE_ENABLED=true',inputSchema:{type:"object",properties:{table:{type:"string",description:"Table of the record"},sys_id:{type:"string",description:"sys_id of the record"},approval_field:{type:"string",description:'Approval field name (default "approval")'}},required:["table","sys_id"]}},{name:"list_csm_case_tasks",description:'List the tasks on a CSM case (sn_customerservice_task). Parity with ServiceNow CSM "Get Case Tasks"',inputSchema:{type:"object",properties:{case:{type:"string",description:"CSM case number or sys_id"},active:{type:"boolean",description:"Only active tasks"},limit:{type:"number",description:"Max records (default 50)"}},required:["case"]}},{name:"advance_hr_case",description:'Advance an HR case to its next state/stage (sn_hr_core_case). Parity with ServiceNow HRSD "HR Case Advance". Requires WRITE_ENABLED=true',inputSchema:{type:"object",properties:{case:{type:"string",description:"HR case number or sys_id"},state:{type:"string",description:"Target state value (if known); otherwise increments the current state"},work_notes:{type:"string",description:"Optional work note to add on advance"}},required:["case"]}},{name:"search_hr_knowledge",description:'Search HR-scoped knowledge articles (kb_knowledge in HR knowledge bases). Parity with ServiceNow HRSD "HR Knowledge Search"',inputSchema:{type:"object",properties:{query:{type:"string",description:"Search text"},kb:{type:"string",description:"Optional specific HR knowledge base sys_id"},limit:{type:"number",description:"Max records (default 20)"}},required:["query"]}},{name:"mcp_health_check",description:'Health check: confirm the instance is reachable and the configured credentials resolve to a valid user. Parity with ServiceNow MCP "Health Check"',inputSchema:{type:"object",properties:{},required:[]}},{name:"summarize_record",description:"Summarize a record (incident/case/etc.) using the Now Assist summarization skill when available, otherwise return the assembled record + activity for the caller to summarize. Parity with ServiceNow Quickstart incident/case summarization",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table (e.g. incident, sn_customerservice_case, sn_hr_core_case)"},record:{type:"string",description:"Record number or sys_id"}},required:["table","record"]}},{name:"get_case_sentiment",description:'Assess customer sentiment on a CSM case via the Now Assist sentiment skill when available, else return the case + customer comments for sentiment analysis. Parity with ServiceNow CSM "Sentiment Analysis"',inputSchema:{type:"object",properties:{case:{type:"string",description:"CSM case number or sys_id"},table:{type:"string",description:"Case table (default sn_customerservice_case)"}},required:["case"]}},{name:"generate_case_activity_response",description:'Draft an agent reply for a CSM case activity stream via the Now Assist activity-response skill when available, else return the case context to draft from. Parity with ServiceNow CSM "Activity Response"',inputSchema:{type:"object",properties:{case:{type:"string",description:"CSM case number or sys_id"},table:{type:"string",description:"Case table (default sn_customerservice_case)"},instruction:{type:"string",description:"Optional tone/instruction for the reply"}},required:["case"]}},{name:"generate_csm_resolution_notes",description:'Generate CSM resolution notes via the Now Assist resolution-notes skill when available, else return the case + work notes to summarize. Parity with ServiceNow CSM "Generate Resolution Notes"',inputSchema:{type:"object",properties:{case:{type:"string",description:"CSM case number or sys_id"},table:{type:"string",description:"Case table (default sn_customerservice_case)"}},required:["case"]}},{name:"check_hr_eligibility",description:`Check an employee's eligibility for an HR service/policy via the Policy Based HR Case Evaluator skill when available, else return the employee + service context. Parity with ServiceNow HRSD "HR Eligibility Check"`,inputSchema:{type:"object",properties:{user:{type:"string",description:"Employee sys_id, user_name, or email"},hr_service:{type:"string",description:"HR service sys_id or name to check eligibility for"}},required:["user","hr_service"]}},{name:"list_portals",description:"List all Service Portal configurations available in the instance",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search portals by title or url_suffix"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"create_portal",description:"Create a new Service Portal configuration (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{title:{type:"string",description:"Human-readable portal title"},url_suffix:{type:"string",description:'URL path segment for the portal (e.g. "myportal" → /myportal)'},default_homepage:{type:"string",description:"sys_id of the default homepage sp_page record"},theme:{type:"string",description:"sys_id of the sp_theme to apply"},logo:{type:"string",description:"sys_id of the logo attachment record"},description:{type:"string",description:"Short description of the portal"}},required:["title","url_suffix"]}},{name:"create_portal_page",description:"Create a new page inside a Service Portal (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{title:{type:"string",description:"Page title"},id:{type:"string",description:'Unique page ID used in the URL (e.g. "my-page")'},portal_sys_id:{type:"string",description:"sys_id of the parent Service Portal"},description:{type:"string",description:"Brief description of the page purpose"}},required:["title","id","portal_sys_id"]}},{name:"get_portal",description:"Get full configuration details of a Service Portal by sys_id or URL suffix",inputSchema:{type:"object",properties:{id:{type:"string",description:'Portal sys_id or url_suffix (e.g. "sp", "itsm")'}},required:["id"]}},{name:"list_portal_pages",description:"List pages that belong to a Service Portal",inputSchema:{type:"object",properties:{portal_sys_id:{type:"string",description:"sys_id of the parent portal"},query:{type:"string",description:"Filter pages by title or id"},limit:{type:"number",description:"Max records to return (default 50)"}},required:["portal_sys_id"]}},{name:"get_portal_page",description:"Get details of a specific Service Portal page including its layout",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Page sys_id"}},required:["sys_id"]}},{name:"list_portal_widgets",description:"List Service Portal widgets with optional search by name or category",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search widgets by name or description"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_portal_widget",description:"Get full source code (HTML, CSS, client/server scripts) of a Service Portal widget",inputSchema:{type:"object",properties:{id_or_sysid:{type:"string",description:'Widget sys_id or id field (e.g. "widget-cool-clock")'}},required:["id_or_sysid"]}},{name:"create_portal_widget",description:"Create a new Service Portal widget with template, CSS, and scripts (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Human-readable widget name"},id:{type:"string",description:'Unique widget ID/handle (e.g. "my-custom-widget")'},template:{type:"string",description:"Angular HTML template"},css:{type:"string",description:"SCSS/CSS styles"},client_script:{type:"string",description:"Client-side controller JavaScript"},server_script:{type:"string",description:"Server-side script (GlideRecord calls)"},option_schema:{type:"string",description:"JSON array defining widget options"},demo_data:{type:"string",description:"JSON object with demo data for preview"}},required:["name","id"]}},{name:"update_portal_widget",description:"Update an existing Service Portal widget's source code (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Widget sys_id"},fields:{type:"object",description:"Fields to update: template, css, client_script, server_script, name, etc."}},required:["sys_id","fields"]}},{name:"list_widget_instances",description:"List instances of a specific widget placed on portal pages",inputSchema:{type:"object",properties:{widget_sys_id:{type:"string",description:"Widget sys_id to find instances of"},limit:{type:"number",description:"Max records to return (default 25)"}},required:["widget_sys_id"]}},{name:"list_ux_apps",description:"List Next Experience (UI Builder) applications",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search apps by name"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_ux_app",description:"Get configuration details of a Next Experience application",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"App sys_id or name"}},required:["sys_id_or_name"]}},{name:"list_ux_pages",description:"List pages within a Next Experience (UI Builder) application",inputSchema:{type:"object",properties:{app_sys_id:{type:"string",description:"Parent UX app sys_id"},query:{type:"string",description:"Filter pages by name"},limit:{type:"number",description:"Max records to return (default 50)"}},required:["app_sys_id"]}},{name:"list_portal_themes",description:"List Service Portal themes (color palettes, CSS variables)",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_portal_theme",description:"Get full details of a Service Portal theme including CSS variables",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Theme sys_id"}},required:["sys_id"]}},{name:"list_rest_messages",description:"List outbound REST Message configurations (integrations with external APIs)",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search by name or description"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_rest_message",description:"Get full configuration of an outbound REST Message including its endpoints",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"REST Message sys_id or name"}},required:["sys_id_or_name"]}},{name:"list_rest_message_functions",description:"List HTTP methods (functions) defined within a REST Message",inputSchema:{type:"object",properties:{rest_message_sys_id:{type:"string",description:"Parent REST Message sys_id"},limit:{type:"number",description:"Max records to return (default 25)"}},required:["rest_message_sys_id"]}},{name:"create_rest_message",description:"Create a new outbound REST Message definition (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Unique REST Message name"},endpoint:{type:"string",description:'Base URL endpoint (e.g. "https://api.example.com/v1")'},description:{type:"string",description:"Purpose/description of this integration"},use_mutual_auth:{type:"boolean",description:"Whether to use mutual TLS authentication"},authentication_type:{type:"string",description:'Auth type: "no_authentication", "basic", "oauth2"'}},required:["name","endpoint"]}},{name:"list_transform_maps",description:"List Transform Maps used for importing data into ServiceNow tables",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search by name or target table"},target_table:{type:"string",description:'Filter by target table name (e.g. "incident")'},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_transform_map",description:"Get details of a Transform Map including its field mappings",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Transform Map sys_id or name"}},required:["sys_id_or_name"]}},{name:"run_transform_map",description:"Execute a Transform Map on an Import Set to load data (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{transform_map_sys_id:{type:"string",description:"sys_id of the Transform Map to run"},import_set_sys_id:{type:"string",description:"sys_id of the Import Set containing source data"}},required:["transform_map_sys_id","import_set_sys_id"]}},{name:"list_transform_field_maps",description:"List field-level mappings within a Transform Map",inputSchema:{type:"object",properties:{transform_map_sys_id:{type:"string",description:"Parent Transform Map sys_id"},limit:{type:"number",description:"Max records to return (default 50)"}},required:["transform_map_sys_id"]}},{name:"list_import_sets",description:"List Import Sets with optional filter by state or staging table",inputSchema:{type:"object",properties:{state:{type:"string",description:"Filter by state: loaded, partial, transform_failed, complete"},query:{type:"string",description:"Additional encoded query string"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_import_set",description:"Get details of a specific Import Set including row count and transform status",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Import Set sys_id"}},required:["sys_id"]}},{name:"create_import_set_row",description:"Insert a row into an Import Set staging table for later transformation (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{staging_table:{type:"string",description:'Staging table name (e.g. "u_import_incident"). Must already exist.'},data:{type:"object",description:"Key-value pairs for the staging table row"}},required:["staging_table","data"]}},{name:"list_data_sources",description:"List Import Set data source definitions (file/JDBC/REST loaders)",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search by name"},type:{type:"string",description:"Filter by type: file, jdbc, ldap, rest"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"list_event_registry",description:"List registered event definitions in the ServiceNow event registry",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search events by name or description"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_event_registry_entry",description:"Get details of a specific registered event definition",inputSchema:{type:"object",properties:{name_or_sysid:{type:"string",description:'Event name (e.g. "incident.created") or sys_id'}},required:["name_or_sysid"]}},{name:"register_event",description:"Register a new custom event in the event registry (requires SCRIPTING_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:'Unique event name (e.g. "my_app.record_created")'},description:{type:"string",description:"Description of when this event fires"},table:{type:"string",description:'Table that fires this event (e.g. "incident")'}},required:["name","table"]}},{name:"fire_event",description:"Fire a custom ServiceNow event for a specific record (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{event_name:{type:"string",description:"Event name to fire (must be registered)"},table:{type:"string",description:"Table name of the target record"},record_sys_id:{type:"string",description:"sys_id of the record to fire the event on"},parm1:{type:"string",description:"Optional first parameter passed to event handlers"},parm2:{type:"string",description:"Optional second parameter passed to event handlers"}},required:["event_name","table","record_sys_id"]}},{name:"list_event_log",description:"List recent event log entries (fired events and their processing status)",inputSchema:{type:"object",properties:{event_name:{type:"string",description:"Filter by event name"},state:{type:"string",description:"Filter by state: ready, processing, processed, error, transferred"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"list_oauth_applications",description:"List OAuth application registry entries (client applications that can authenticate)",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search by name or client ID"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"list_credential_aliases",description:"List connection and credential aliases used by integrations",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search by name"},type:{type:"string",description:"Filter by type: basic, oauth2, api_key, certificate"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"list_notifications",description:"List email notification definitions (sysevent_email_action)",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search notifications by name"},table:{type:"string",description:'Filter by target table (e.g. "incident")'},event:{type:"string",description:"Filter by event trigger name"},active:{type:"boolean",description:"Filter to active notifications only"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_notification",description:"Get full details of an email notification definition including template and conditions",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Notification sys_id or name"}},required:["sys_id_or_name"]}},{name:"create_notification",description:"Create a new email notification definition (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Notification name"},table:{type:"string",description:'Table that triggers this notification (e.g. "incident")'},event:{type:"string",description:'Event name that fires this notification (e.g. "incident.commented")'},subject:{type:"string",description:"Email subject line (supports ${field} variables)"},message_html:{type:"string",description:"HTML body of the email notification"},recipients:{type:"string",description:'Who receives the email (e.g. "assigned_to", "watch_list")'},active:{type:"boolean",description:"Whether to activate immediately (default true)"},condition:{type:"string",description:"Additional filter condition script"}},required:["name","table"]}},{name:"update_notification",description:"Update an existing email notification (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Notification sys_id"},fields:{type:"object",description:"Fields to update: name, subject, message_html, active, condition, etc."}},required:["sys_id","fields"]}},{name:"list_email_logs",description:"List outbound email log entries to track sent/failed emails",inputSchema:{type:"object",properties:{state:{type:"string",description:"Filter by state: sent, failed, ready, sending, ignored"},recipient:{type:"string",description:"Filter by recipient email address"},subject:{type:"string",description:"Filter emails by subject (partial match)"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_email_log",description:"Get full details of an email log entry including body and headers",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Email log sys_id"}},required:["sys_id"]}},{name:"list_attachments",description:"List attachments associated with a specific record",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g. "incident")'},record_sys_id:{type:"string",description:"sys_id of the record whose attachments to list"},limit:{type:"number",description:"Max records to return (default 25)"}},required:["table","record_sys_id"]}},{name:"get_attachment_metadata",description:"Get metadata (name, type, size) of a specific attachment by its sys_id",inputSchema:{type:"object",properties:{attachment_sys_id:{type:"string",description:"Attachment sys_id"}},required:["attachment_sys_id"]}},{name:"delete_attachment",description:"Delete an attachment from a record (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{attachment_sys_id:{type:"string",description:"sys_id of the attachment to delete"}},required:["attachment_sys_id"]}},{name:"upload_attachment",description:"Upload a base64-encoded attachment to a ServiceNow record (requires WRITE_ENABLED=true). Useful for adding files, screenshots, or documents to incidents, changes, etc.",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g. "incident")'},record_sys_id:{type:"string",description:"sys_id of the record to attach the file to"},file_name:{type:"string",description:'File name including extension (e.g. "screenshot.png")'},content_type:{type:"string",description:'MIME type (e.g. "image/png", "application/pdf", "text/plain", "application/json")'},content_base64:{type:"string",description:"Base64-encoded file content (use standard base64 encoding)"}},required:["table","record_sys_id","file_name","content_type","content_base64"]}},{name:"list_email_templates",description:"List email notification templates used by notifications",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search templates by name"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"list_notification_subscriptions",description:"List user subscriptions to notifications (who has opted in/out)",inputSchema:{type:"object",properties:{user_sys_id:{type:"string",description:"User sys_id to list their subscriptions"},notification_sys_id:{type:"string",description:"Filter by specific notification"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"send_emergency_broadcast",description:"[Write] Send emergency broadcast notification to users or groups",inputSchema:{type:"object",properties:{subject:{type:"string",description:"Broadcast subject"},body:{type:"string",description:"Message body"},recipients:{type:"string",description:"Comma-separated user/group sys_ids"},channels:{type:"string",description:"Delivery channels: email,sms,push"}},required:["subject","body","recipients"]}},{name:"schedule_notification",description:"[Write] Schedule a notification for future delivery",inputSchema:{type:"object",properties:{notification_id:{type:"string",description:"Notification rule sys_id"},schedule:{type:"string",description:"Cron expression or ISO date"},active:{type:"boolean",description:"Whether the notification is active"}},required:["notification_id","schedule"]}},{name:"list_pa_indicators",description:"List Performance Analytics (PA) indicators (KPIs) available in the instance",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search indicators by name or description"},category:{type:"string",description:"Filter by indicator category"},active:{type:"boolean",description:"Filter to active indicators only (default true)"},limit:{type:"number",description:"Max records to return (default 50)"}},required:[]}},{name:"get_pa_indicator",description:"Get details of a specific Performance Analytics indicator including its formula",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Indicator sys_id or name"}},required:["sys_id_or_name"]}},{name:"get_pa_scorecard",description:"Get current scorecard data for a PA indicator — returns current value, target, trend direction",inputSchema:{type:"object",properties:{indicator_sys_id:{type:"string",description:"PA indicator sys_id"},breakdown_sys_id:{type:"string",description:"Optional breakdown (dimension) sys_id to segment data by group"},period:{type:"string",description:"Time period: last_7_days, last_30_days, last_quarter, last_year (default: last_30_days)"},include_scores:{type:"boolean",description:"Include individual score records (default false)"}},required:["indicator_sys_id"]}},{name:"get_pa_time_series",description:"Get historical time-series data for a PA indicator to identify trends",inputSchema:{type:"object",properties:{indicator_sys_id:{type:"string",description:"PA indicator sys_id"},start_date:{type:"string",description:"Start date in YYYY-MM-DD format (default: 30 days ago)"},end_date:{type:"string",description:"End date in YYYY-MM-DD format (default: today)"},limit:{type:"number",description:"Max data points to return (default 100)"}},required:["indicator_sys_id"]}},{name:"list_pa_breakdowns",description:"List PA breakdowns (dimensions) available for segmenting indicator data",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search breakdowns by name"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"list_pa_dashboards",description:"List Performance Analytics dashboards",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search dashboards by name"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_pa_dashboard",description:"Get details of a PA dashboard including its widgets/tabs",inputSchema:{type:"object",properties:{sys_id_or_name:{type:"string",description:"Dashboard sys_id or name"}},required:["sys_id_or_name"]}},{name:"list_homepages",description:"List homepage dashboards (CMS content pages used as homepages)",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search by title"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"list_pa_jobs",description:"List Performance Analytics data collection jobs and their schedules",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter to active jobs only (default true)"},query:{type:"string",description:"Search by name"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_pa_job",description:"Get details of a Performance Analytics collection job",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"PA job sys_id"}},required:["sys_id"]}},{name:"create_dashboard",description:"Create a new Performance Analytics dashboard (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Dashboard name"},description:{type:"string",description:"Brief description of the dashboard"},roles:{type:"string",description:"Comma-separated roles that can view this dashboard (leave blank for all)"},active:{type:"boolean",description:"Activate the dashboard immediately (default: true)"}},required:["name"]}},{name:"update_dashboard",description:"Update an existing PA dashboard (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Dashboard sys_id"},fields:{type:"object",description:"Fields to update (name, description, roles, active, etc.)"}},required:["sys_id","fields"]}},{name:"create_pa_indicator",description:"Create a Performance Analytics (PA) indicator / KPI on `pa_indicators` (requires WRITE_ENABLED=true). Define the source facts table, aggregation and conditions; collect data via a PA job afterward.",inputSchema:{type:"object",properties:{name:{type:"string",description:'Indicator name (e.g. "Open P1 incidents")'},description:{type:"string",description:"What the indicator measures"},facts_table:{type:"string",description:'Source/facts table the indicator counts (e.g. "incident")'},aggregate:{type:"string",description:"Aggregation function",enum:["count","sum","average","maximum","minimum"]},field:{type:"string",description:"Field to aggregate (required for sum/average/max/min; ignored for count)"},conditions:{type:"string",description:'Encoded query on the facts table (e.g. "active=true^priority=1")'},unit:{type:"string",description:"Unit (pa_units name or sys_id)"},direction:{type:"string",description:"Desired trend",enum:["maximize","minimize"]},active:{type:"boolean",description:"Activate immediately (default: true)"}},required:["name"]}},{name:"create_pa_breakdown",description:"Create a Performance Analytics (PA) breakdown on `pa_breakdowns` (requires WRITE_ENABLED=true). Breakdowns slice an indicator by a dimension (e.g. by Assignment group or Category).",inputSchema:{type:"object",properties:{name:{type:"string",description:'Breakdown name (e.g. "By Assignment group")'},description:{type:"string",description:"What this breakdown slices by"},related_field:{type:"string",description:'Optional dotted field path the breakdown maps to (e.g. "assignment_group")'},active:{type:"boolean",description:"Activate immediately (default: true)"}},required:["name"]}},{name:"check_table_completeness",description:"Analyze data quality and field completeness for a ServiceNow table — returns percentage of non-empty values per field",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name to analyze (e.g. "incident", "cmdb_ci_server")'},fields:{type:"string",description:'Comma-separated field names to check (e.g. "assigned_to,priority,category")'},query:{type:"string",description:'Optional encoded query to scope the analysis (e.g. "active=true")'},sample_size:{type:"number",description:"Number of records to sample (default 100, max 500)"}},required:["table","fields"]}},{name:"get_table_record_count",description:"Get total record count for a ServiceNow table with optional filters",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table name"},query:{type:"string",description:"Optional encoded query to count a subset"}},required:["table"]}},{name:"compare_record_counts",description:"Compare record counts across multiple ServiceNow tables or time periods — useful for capacity planning",inputSchema:{type:"object",properties:{tables:{type:"array",items:{type:"string"},description:'List of table names to compare (e.g. ["incident", "change_request", "problem"])'},query:{type:"string",description:"Optional query to apply to all tables"}},required:["tables"]}},{name:"get_system_property",description:"Get a ServiceNow system property value and metadata by name",inputSchema:{type:"object",properties:{name:{type:"string",description:'Property name (e.g. "glide.smtp.host")'}},required:["name"]}},{name:"set_system_property",description:"Create or update a ServiceNow system property value. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Property name"},value:{type:"string",description:"Property value"},description:{type:"string",description:"Optional description"},type:{type:"string",description:"Property type: string, integer, boolean, choice, password2, etc."}},required:["name","value"]}},{name:"list_system_properties",description:"List system properties with optional filtering",inputSchema:{type:"object",properties:{query:{type:"string",description:"Encoded query to filter properties"},category:{type:"string",description:'Filter by category (e.g. "email", "security")'},type:{type:"string",description:'Filter by type (e.g. "boolean", "string")'},limit:{type:"number",description:"Max records (default 50)"}},required:[]}},{name:"delete_system_property",description:"Delete a system property by name. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Property name to delete"}},required:["name"]}},{name:"search_system_properties",description:"Search system properties by name, value, or description",inputSchema:{type:"object",properties:{search:{type:"string",description:"Search text matched against name, value, and description"},limit:{type:"number",description:"Max results (default 20)"}},required:["search"]}},{name:"bulk_get_properties",description:"Retrieve multiple system property values in a single call",inputSchema:{type:"object",properties:{names:{type:"array",items:{type:"string"},description:"Array of property names to retrieve"}},required:["names"]}},{name:"bulk_set_properties",description:"Create or update multiple system properties in a single operation. **[Write]**",inputSchema:{type:"object",properties:{properties:{type:"array",description:"Array of {name, value, description?} objects",items:{type:"object",properties:{name:{type:"string"},value:{type:"string"},description:{type:"string"}},required:["name","value"]}}},required:["properties"]}},{name:"export_properties",description:"Export system properties matching a query to a JSON object (useful for environment snapshots)",inputSchema:{type:"object",properties:{category:{type:"string",description:"Filter by category"},query:{type:"string",description:"Encoded query filter"}},required:[]}},{name:"import_properties",description:"Import (create or update) system properties from a JSON object. **[Write]**",inputSchema:{type:"object",properties:{properties:{type:"object",description:'Key-value map of property names to values (e.g. {"glide.smtp.host": "smtp.example.com"})'},dry_run:{type:"boolean",description:"If true, show what would be changed without writing (default false)"}},required:["properties"]}},{name:"validate_property",description:"Validate a property value against its declared type constraints without saving",inputSchema:{type:"object",properties:{name:{type:"string",description:"Property name"},value:{type:"string",description:"Value to validate"}},required:["name","value"]}},{name:"list_property_categories",description:"List all unique property categories with their record counts",inputSchema:{type:"object",properties:{},required:[]}},{name:"get_property_history",description:"Get audit history of changes to a system property",inputSchema:{type:"object",properties:{name:{type:"string",description:"Property name"},limit:{type:"number",description:"Max audit records (default 20)"}},required:["name"]}},{name:"get_current_update_set",description:"Get the currently active Update Set for the session",inputSchema:{type:"object",properties:{},required:[]}},{name:"list_update_sets",description:"List Update Sets by state (in progress, complete, ignore)",inputSchema:{type:"object",properties:{state:{type:"string",description:'State filter: "in progress", "complete", "ignore"'},query:{type:"string",description:"Additional encoded query filter"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"create_update_set",description:"Create a new Update Set and optionally switch to it. **[Scripting]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Update Set name"},description:{type:"string",description:"Purpose or description"},release:{type:"string",description:"Target release label"},switch_to:{type:"boolean",description:"Switch to this Update Set after creation (default true)"}},required:["name"]}},{name:"switch_update_set",description:"Switch the active Update Set context to a specified Update Set. **[Scripting]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"sys_id of the target Update Set"}},required:["sys_id"]}},{name:"complete_update_set",description:"Mark an Update Set as complete (ready for migration). **[Scripting]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Update Set sys_id"}},required:["sys_id"]}},{name:"preview_update_set",description:"Preview all changes contained in an Update Set",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Update Set sys_id"},limit:{type:"number",description:"Max records to list (default 100)"}},required:["sys_id"]}},{name:"export_update_set",description:"Get the XML export payload for an Update Set (as used in migration). **[Scripting]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Update Set sys_id"}},required:["sys_id"]}},{name:"ensure_active_update_set",description:"Ensure an active Update Set exists; create one automatically if none is in progress. **[Scripting]**",inputSchema:{type:"object",properties:{default_name:{type:"string",description:'Name to use when auto-creating (default: "AI Session Update Set")'}},required:[]}},{name:"create_va_topic",description:"Create a new Virtual Agent conversation topic. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Topic name (display name)"},description:{type:"string",description:"What this topic handles"},category:{type:"string",description:"Topic category sys_id"},active:{type:"boolean",description:"Activate immediately (default true)"},fulfillment_type:{type:"string",description:'Fulfillment type: "itsm_integration", "custom", "web_service"'}},required:["name"]}},{name:"update_va_topic",description:"Update a Virtual Agent topic properties. **[Write]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Topic sys_id"},fields:{type:"object",description:"Fields to update (name, description, active, etc.)"}},required:["sys_id","fields"]}},{name:"get_va_topic",description:"Get Virtual Agent topic details including intent and trigger phrases",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Topic sys_id"}},required:["sys_id"]}},{name:"list_va_topics_full",description:"List all Virtual Agent topics with category and status details",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter to active topics only (default true)"},category:{type:"string",description:"Filter by category name"},query:{type:"string",description:"Additional encoded query"},limit:{type:"number",description:"Max results (default 50)"}},required:[]}},{name:"get_va_conversation",description:"Get conversation history for a Virtual Agent session",inputSchema:{type:"object",properties:{conversation_id:{type:"string",description:"Conversation sys_id or session ID"},limit:{type:"number",description:"Max messages (default 50)"}},required:["conversation_id"]}},{name:"list_va_conversations",description:"List recent Virtual Agent conversations",inputSchema:{type:"object",properties:{topic_sys_id:{type:"string",description:"Filter by topic"},user_sys_id:{type:"string",description:"Filter by user"},limit:{type:"number",description:"Max results (default 25)"}},required:[]}},{name:"list_va_categories",description:"List Virtual Agent topic categories",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max results (default 25)"}},required:[]}},{name:"list_assets",description:"List IT assets with optional filtering by state, class, or assigned user",inputSchema:{type:"object",properties:{asset_class:{type:"string",description:'Asset class: "alm_hardware", "alm_license", "alm_consumable"'},state:{type:"string",description:'Asset state: "in_use", "in_stock", "retired", "missing"'},assigned_to:{type:"string",description:"User sys_id to filter by assignee"},location:{type:"string",description:"Location name or sys_id"},query:{type:"string",description:"Additional encoded query"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"get_asset",description:"Get full details of an IT asset including financial and lifecycle data",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Asset sys_id"}},required:["sys_id"]}},{name:"create_asset",description:"Create a new IT asset record. **[Write]**",inputSchema:{type:"object",properties:{display_name:{type:"string",description:"Asset display name"},asset_tag:{type:"string",description:"Unique asset tag"},model_category:{type:"string",description:"Category sys_id (Hardware, Software, etc.)"},model:{type:"string",description:"Model sys_id"},serial_number:{type:"string",description:"Serial number"},assigned_to:{type:"string",description:"User sys_id"},location:{type:"string",description:"Location sys_id"},cost:{type:"number",description:"Purchase cost"},cost_center:{type:"string",description:"Cost center sys_id"},purchase_date:{type:"string",description:"Purchase date (YYYY-MM-DD)"}},required:["display_name"]}},{name:"update_asset",description:"Update an IT asset record. **[Write]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Asset sys_id"},fields:{type:"object",description:"Fields to update"}},required:["sys_id","fields"]}},{name:"retire_asset",description:"Retire an IT asset (mark as disposed/retired). **[Write]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Asset sys_id"},disposal_reason:{type:"string",description:"Reason for retirement"},disposal_date:{type:"string",description:"Disposal date (YYYY-MM-DD)"}},required:["sys_id"]}},{name:"list_software_licenses",description:"List software license records with compliance status",inputSchema:{type:"object",properties:{query:{type:"string",description:"Encoded query filter"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"get_license_compliance",description:"Get license compliance summary — purchased vs. installed vs. in use counts",inputSchema:{type:"object",properties:{license_sys_id:{type:"string",description:"Software license sys_id (optional — omit for all)"}},required:[]}},{name:"list_asset_contracts",description:"List asset maintenance and support contracts",inputSchema:{type:"object",properties:{asset_sys_id:{type:"string",description:"Filter by linked asset"},active:{type:"boolean",description:"Filter to active contracts (default true)"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"track_asset_lifecycle",description:"Track asset lifecycle events and stage transitions",inputSchema:{type:"object",properties:{asset_id:{type:"string",description:"Asset tag or sys_id"},new_stage:{type:"string",description:"Lifecycle stage: in_stock/in_use/in_maintenance/retired/disposed"},notes:{type:"string",description:"Transition notes"}},required:["asset_id","new_stage"]}},{name:"get_license_optimization",description:"Analyze software license usage and recommend optimizations",inputSchema:{type:"object",properties:{software_name:{type:"string",description:"Optional filter by software name"},threshold_pct:{type:"number",description:"Usage threshold percentage (default: 80)"}},required:[]}},{name:"list_devops_pipelines",description:"List DevOps pipeline configurations registered in ServiceNow",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter to active pipelines (default true)"},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"get_devops_pipeline",description:"Get details of a specific DevOps pipeline",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Pipeline sys_id"}},required:["sys_id"]}},{name:"list_deployments",description:"List recent application deployments tracked in ServiceNow",inputSchema:{type:"object",properties:{pipeline_sys_id:{type:"string",description:"Filter by pipeline"},environment:{type:"string",description:'Filter by environment (e.g. "prod", "staging")'},state:{type:"string",description:'Filter by state: "success", "failed", "in_progress"'},limit:{type:"number",description:"Max records (default 25)"}},required:[]}},{name:"get_deployment",description:"Get details and status of a specific deployment",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Deployment sys_id"}},required:["sys_id"]}},{name:"create_devops_change",description:"Create a change request linked to a DevOps deployment for change governance. **[Write]**",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Change short description"},pipeline:{type:"string",description:"Pipeline name or sys_id"},environment:{type:"string",description:"Target environment (prod, staging, dev)"},artifact:{type:"string",description:"Artifact name or version being deployed"},type:{type:"string",description:"Change type: normal, standard, emergency"},assigned_to:{type:"string",description:"User sys_id"},assignment_group:{type:"string",description:"Group sys_id"}},required:["short_description","environment"]}},{name:"track_deployment",description:"Record a deployment event in ServiceNow for audit and velocity tracking. **[Write]**",inputSchema:{type:"object",properties:{pipeline:{type:"string",description:"Pipeline sys_id or name"},environment:{type:"string",description:"Target environment"},artifact_name:{type:"string",description:"Artifact or application name"},artifact_version:{type:"string",description:"Version or build number"},status:{type:"string",description:"Deployment status: success, failed, rolled_back"},notes:{type:"string",description:"Deployment notes"}},required:["environment","artifact_name","status"]}},{name:"get_devops_insights",description:"Get deployment frequency, failure rate, and lead time metrics for a pipeline",inputSchema:{type:"object",properties:{pipeline_sys_id:{type:"string",description:"Pipeline sys_id (optional — all pipelines if omitted)"},days:{type:"number",description:"Number of days to analyse (default 30)"}},required:[]}},{name:"list_scoped_apps",description:"List scoped applications (custom apps) installed in the instance",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search apps by name or scope prefix"},active:{type:"boolean",description:"Filter to active apps only"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_scoped_app",description:"Get full details of a scoped application by sys_id or scope name",inputSchema:{type:"object",properties:{id:{type:"string",description:'App sys_id or scope name (e.g. "x_myco_myapp")'}},required:["id"]}},{name:"create_scoped_app",description:"Create a new scoped application in App Studio (requires WRITE_ENABLED=true). The scope prefix must be unique and follow the pattern x_<vendor>_<appname>.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Human-readable application name"},scope:{type:"string",description:'Unique scope prefix, e.g. "x_myco_myapp". Must start with "x_".'},version:{type:"string",description:'Application version string (e.g. "1.0.0"). Defaults to "1.0.0".'},short_description:{type:"string",description:"Short description shown in the app list"},description:{type:"string",description:"Full description of the application"},vendor:{type:"string",description:"Vendor or author name"},active:{type:"boolean",description:"Activate the app immediately (default: true)"},logo:{type:"string",description:"App logo attachment sys_id (optional)"}},required:["name","scope"]}},{name:"update_scoped_app",description:"Update an existing scoped application (requires WRITE_ENABLED=true)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"App sys_id"},fields:{type:"object",description:"Fields to update (name, version, short_description, description, active, vendor, etc.)"}},required:["sys_id","fields"]}},{name:"ml_predict_change_risk",description:"Predict the risk level of a change request using historical ML analysis",inputSchema:{type:"object",properties:{change_sys_id:{type:"string",description:"Change request sys_id to evaluate"},type:{type:"string",description:"Change type: normal, standard, emergency"},category:{type:"string",description:"Change category"}},required:[]}},{name:"ml_detect_anomalies",description:"Run anomaly detection on operational metrics (alert volume, incident trends, etc.)",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table to analyze (e.g. incident, sn_agent_alert)"},field:{type:"string",description:"Numeric field to analyse (e.g. priority, reassignment_count)"},days:{type:"number",description:"Look-back period in days (default 30)"},threshold:{type:"number",description:"Standard deviations for anomaly threshold (default 2)"}},required:["table","field"]}},{name:"ml_forecast_incidents",description:"Forecast incident volume for the next N days based on historical trends",inputSchema:{type:"object",properties:{days_ahead:{type:"number",description:"Number of days to forecast (default 7)"},category:{type:"string",description:"Filter by category (optional)"},priority:{type:"string",description:"Filter by priority (optional)"}},required:[]}},{name:"ml_train_incident_classifier",description:"Trigger training of the incident classification ML solution. **[Write]**",inputSchema:{type:"object",properties:{solution_name:{type:"string",description:"ML solution name (default auto-detect)"}},required:[]}},{name:"ml_train_change_risk",description:"Trigger training of the change risk prediction ML model. **[Write]**",inputSchema:{type:"object",properties:{solution_name:{type:"string",description:"ML solution name (default auto-detect)"}},required:[]}},{name:"ml_train_anomaly_detector",description:"Trigger training of an anomaly detection model for a specific table/field. **[Write]**",inputSchema:{type:"object",properties:{table:{type:"string",description:"Target table for anomaly detection"},field:{type:"string",description:"Numeric field to train on"}},required:["table","field"]}},{name:"ml_evaluate_model",description:"Get accuracy, training status, and metrics for a trained ML solution",inputSchema:{type:"object",properties:{model_sys_id:{type:"string",description:"ML solution sys_id"}},required:["model_sys_id"]}},{name:"ml_model_training_history",description:"Get training run history and accuracy trends for an ML solution over time",inputSchema:{type:"object",properties:{model_sys_id:{type:"string",description:"ML solution sys_id"},days:{type:"number",description:"Look-back period (default 90)"}},required:["model_sys_id"]}},{name:"ml_virtual_agent_nlu",description:"Analyse Virtual Agent NLU performance — conversation completion rates and fallback metrics",inputSchema:{type:"object",properties:{topic_sys_id:{type:"string",description:"VA topic sys_id (optional, all topics if omitted)"},days:{type:"number",description:"Analysis period in days (default 30)"}},required:[]}},{name:"ml_process_optimization",description:"Identify process bottlenecks using analysis of task durations and reassignment patterns",inputSchema:{type:"object",properties:{table:{type:"string",description:"Process table to analyse (e.g. incident, change_request, sc_task)"},days:{type:"number",description:"Analysis period (default 90)"}},required:["table"]}},{name:"ml_similar_incidents",description:"Find similar past incidents using keyword-based matching. Provide either an incident sys_id (to find similar incidents) or a short_description (for free-text matching). Returns resolved incidents ranked by keyword match count.",inputSchema:{type:"object",properties:{incident_sys_id:{type:"string",description:"Sys_id of an existing incident to find similar ones for"},short_description:{type:"string",description:"Free-text description to match against (required if no sys_id)"},limit:{type:"number",description:"Max results to return (default 10)"}},required:[]}},{name:"ml_auto_categorize",description:"Auto-categorize a record based on its description by analysing resolved records of the same table. Queries the last 500 resolved records, groups by category, and matches input keywords to suggest a category.",inputSchema:{type:"object",properties:{short_description:{type:"string",description:"Short description of the record to categorize"},description:{type:"string",description:"Full description (optional, improves accuracy)"},table:{type:"string",description:'Table to analyse (default "incident")'}},required:["short_description"]}},{name:"list_uib_pages",description:"List UI Builder pages and their route configurations",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max records (default 25)"},app:{type:"string",description:"Filter by UX app sys_id"}},required:[]}},{name:"get_uib_page",description:"Get details of a specific UI Builder page including layout and child elements",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"UIB page sys_id"}},required:["sys_id"]}},{name:"create_uib_page",description:"Create a new UI Builder page with route registration. **[Write]**",inputSchema:{type:"object",properties:{title:{type:"string",description:"Page title"},path:{type:"string",description:"URL path segment"},app:{type:"string",description:"Parent UX app sys_id"},layout:{type:"string",description:"Layout type: single, sidebar, tabbed (default single)"}},required:["title","path"]}},{name:"update_uib_page",description:"Update an existing UI Builder page. **[Write]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"UIB page sys_id"},title:{type:"string"},path:{type:"string"},layout:{type:"string"}},required:["sys_id"]}},{name:"delete_uib_page",description:"Delete a UI Builder page. **[Write]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"UIB page sys_id"}},required:["sys_id"]}},{name:"list_uib_components",description:"List available UI Builder components (macroponents) in the instance",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max records (default 50)"},scope:{type:"string",description:"Filter by scope/app"}},required:[]}},{name:"create_uib_component",description:"Create a custom UI Builder component (macroponent). **[Scripting]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Component name"},label:{type:"string",description:"Display label"},description:{type:"string"},category:{type:"string",description:"Component category"}},required:["name","label"]}},{name:"update_uib_component",description:"Update a UI Builder component. **[Scripting]**",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Component sys_id"},label:{type:"string"},description:{type:"string"}},required:["sys_id"]}},{name:"list_uib_data_brokers",description:"List UI Builder data brokers (data sources for pages)",inputSchema:{type:"object",properties:{page_sys_id:{type:"string",description:"Filter by page"},limit:{type:"number"}},required:[]}},{name:"create_uib_data_broker",description:"Create a UI Builder data broker to feed data to a page. **[Scripting]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Broker name"},table:{type:"string",description:"Source table"},query:{type:"string",description:"Encoded query filter"},page:{type:"string",description:"Target page sys_id"}},required:["name","table"]}},{name:"list_workspaces",description:"List all configurable agent workspaces",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter active (default true)"},limit:{type:"number"}},required:[]}},{name:"get_workspace",description:"Get details of a configurable agent workspace including tabs and lists",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Workspace sys_id"}},required:["sys_id"]}},{name:"create_workspace",description:"Create a new configurable agent workspace. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Workspace name"},description:{type:"string"},table:{type:"string",description:"Primary table (e.g. incident)"},icon:{type:"string",description:"Workspace icon name"}},required:["name","table"]}},{name:"configure_workspace_list",description:"Add or update a list view in an agent workspace. **[Write]**",inputSchema:{type:"object",properties:{workspace_sys_id:{type:"string",description:"Workspace sys_id"},table:{type:"string",description:"List table"},title:{type:"string",description:"List title"},query:{type:"string",description:"Encoded query filter"},columns:{type:"string",description:"Comma-separated field names"}},required:["workspace_sys_id","table","title"]}},{name:"create_ux_app_route",description:"Register a new route (URL path) in a UX app. **[Write]**",inputSchema:{type:"object",properties:{app_sys_id:{type:"string",description:"UX app sys_id"},path:{type:"string",description:"Route path"},page_sys_id:{type:"string",description:"Target UIB page sys_id"},title:{type:"string",description:"Route title"}},required:["app_sys_id","path","page_sys_id"]}},{name:"create_ux_experience",description:"Create a new UX Experience (app shell) configuration. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Experience name"},app_sys_id:{type:"string",description:"UX app sys_id"},landing_page:{type:"string",description:"Landing page sys_id"}},required:["name","app_sys_id"]}},{name:"list_mobile_app_configs",description:"List ServiceNow mobile app configurations",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter active (default true)"},limit:{type:"number"}},required:[]}},{name:"get_mobile_app_config",description:"Get details of a specific mobile app configuration",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"Mobile app config sys_id"}},required:["sys_id"]}},{name:"create_mobile_app_config",description:"Create a new mobile app configuration. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"App name"},description:{type:"string"},branding_color:{type:"string",description:"Primary colour hex"}},required:["name"]}},{name:"list_mobile_applets",description:"List mobile applets (mini-apps within the mobile experience)",inputSchema:{type:"object",properties:{app_config:{type:"string",description:"Filter by app config sys_id"},limit:{type:"number"}},required:[]}},{name:"create_mobile_applet",description:"Create a mobile applet in a mobile app. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Applet name"},table:{type:"string",description:"Applet data table"},icon:{type:"string",description:"Applet icon"},app_config:{type:"string",description:"Parent app config sys_id"}},required:["name","table"]}},{name:"list_mobile_layouts",description:"List mobile layout configurations",inputSchema:{type:"object",properties:{limit:{type:"number"}},required:[]}},{name:"create_mobile_layout",description:"Create a mobile layout for a specific view. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Layout name"},table:{type:"string",description:"Target table"},type:{type:"string",description:"Layout type: list, form, detail"}},required:["name","table"]}},{name:"configure_offline_sync",description:"Configure which tables/records are available offline in mobile. **[Write]**",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table to sync offline"},query:{type:"string",description:"Filter query for sync scope"},max_records:{type:"number",description:"Max offline records (default 500)"}},required:["table"]}},{name:"send_push_notification",description:"Send a push notification to mobile app users. **[Write]**",inputSchema:{type:"object",properties:{user:{type:"string",description:"Target user sys_id"},group:{type:"string",description:"Target group sys_id (alternative to user)"},title:{type:"string",description:"Notification title"},body:{type:"string",description:"Notification body text"},action_url:{type:"string",description:"Deep link URL on tap"}},required:["title","body"]}},{name:"get_mobile_analytics",description:"Get mobile app usage analytics — sessions, active users, popular applets",inputSchema:{type:"object",properties:{days:{type:"number",description:"Analysis period in days (default 30)"}},required:[]}},{name:"find_artifact",description:"Search for platform artifacts by name, type, or scope (business rules, scripts, widgets, etc.)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Artifact name or pattern"},type:{type:"string",description:"Artifact type: business_rule, script_include, client_script, ui_policy, ui_action, widget, flow, sys_properties"},scope:{type:"string",description:"Application scope name"},limit:{type:"number"}},required:["name"]}},{name:"validate_artifact",description:"Validate an artifact for best practices, security issues, and performance concerns",inputSchema:{type:"object",properties:{table:{type:"string",description:"Artifact table (e.g. sys_script, sys_script_include)"},sys_id:{type:"string",description:"Artifact sys_id"}},required:["table","sys_id"]}},{name:"clone_artifact",description:"Clone a platform artifact to a new name/scope. **[Scripting]**",inputSchema:{type:"object",properties:{table:{type:"string",description:"Source artifact table"},sys_id:{type:"string",description:"Source artifact sys_id"},new_name:{type:"string",description:"Name for the cloned artifact"},target_scope:{type:"string",description:"Target application scope (optional)"}},required:["table","sys_id","new_name"]}},{name:"validate_deployment",description:"Pre-validate an update set or app before deployment — check for conflicts and missing dependencies",inputSchema:{type:"object",properties:{update_set_sys_id:{type:"string",description:"Update set sys_id to validate"},app_sys_id:{type:"string",description:"Scoped app sys_id (alternative to update set)"}},required:[]}},{name:"rollback_deployment",description:"Rollback a deployment by reverting an update set. **[Write]**",inputSchema:{type:"object",properties:{update_set_sys_id:{type:"string",description:"Committed update set sys_id to rollback"},reason:{type:"string",description:"Reason for rollback"}},required:["update_set_sys_id"]}},{name:"list_deployment_history",description:"List deployment history — committed update sets and app installs over time",inputSchema:{type:"object",properties:{days:{type:"number",description:"Look-back period (default 30)"},limit:{type:"number"}},required:[]}},{name:"create_solution_package",description:"Create a solution package from selected update sets for distribution. **[Write]**",inputSchema:{type:"object",properties:{name:{type:"string",description:"Package name"},description:{type:"string"},update_sets:{type:"array",items:{type:"string"},description:"Array of update set sys_ids to include"}},required:["name","update_sets"]}},{name:"execute_background_script",description:"Execute a background script on the instance (server-side JavaScript). **[Scripting]**",inputSchema:{type:"object",properties:{script:{type:"string",description:"JavaScript code to execute"},scope:{type:"string",description:"Application scope (default global)"}},required:["script"]}},{name:"import_cmdb_data",description:"Import CI data into CMDB via import set. **[Write]**",inputSchema:{type:"object",properties:{table:{type:"string",description:"Target CMDB table (e.g. cmdb_ci_server)"},data:{type:"array",items:{type:"object"},description:"Array of records to import"}},required:["table","data"]}},{name:"analyze_data_quality",description:"Analyse data quality for a table — completeness, duplicates, stale records",inputSchema:{type:"object",properties:{table:{type:"string",description:"Table to analyse"},required_fields:{type:"string",description:"Comma-separated fields that should be populated"},days_stale:{type:"number",description:"Consider records stale after N days without update (default 180)"}},required:["table"]}},{name:"fluent_query",description:'GlideQuery-style fluent query builder. Supports select, where, aggregate (COUNT/AVG/SUM/MIN/MAX), orderBy, limit, and groupBy. Returns records or aggregate results. Example: { table: "incident", where: [["active","=",true],["priority","<",3]], select: ["number","short_description"], limit: 10 }',inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name (e.g., "incident")'},where:{type:"array",description:"Array of conditions: [field, operator, value]. Operators: =, !=, >, >=, <, <=, LIKE, STARTSWITH, CONTAINS, IN, NOT IN, ISEMPTY, ISNOTEMPTY",items:{type:"array",items:{},minItems:2,maxItems:3}},orWhere:{type:"array",description:"Array of OR conditions (same format as where)",items:{type:"array",items:{},minItems:2,maxItems:3}},select:{type:"array",description:'Fields to return. Supports dot-walking (e.g., "caller_id.email"). If omitted, returns all fields.',items:{type:"string"}},aggregate:{type:"string",description:"Aggregate operation: COUNT, AVG, SUM, MIN, MAX",enum:["COUNT","AVG","SUM","MIN","MAX"]},aggregateField:{type:"string",description:"Field to aggregate on (required for AVG, SUM, MIN, MAX)"},groupBy:{type:"string",description:"Field to group results by (for aggregate queries)"},orderBy:{type:"string",description:'Field to sort by. Prefix with "-" for descending.'},limit:{type:"number",description:"Max records to return (default: 20, max: 200)"},displayValue:{type:"boolean",description:"Return display values instead of internal values (default: false)"}},required:["table"]}},{name:"batch_request",description:"Execute multiple ServiceNow REST API operations in a single HTTP call. Reduces round-trips by 50-70%. Each operation specifies method, URL path, and optional body. Max 50 operations per batch.",inputSchema:{type:"object",properties:{operations:{type:"array",description:"Array of REST operations to execute",items:{type:"object",properties:{id:{type:"string",description:"Unique operation ID for correlating responses"},method:{type:"string",description:"HTTP method: GET, POST, PATCH, DELETE",enum:["GET","POST","PATCH","DELETE"]},url:{type:"string",description:'API URL path (e.g., "/api/now/table/incident?sysparm_limit=5")'},body:{type:"object",description:"Request body for POST/PATCH operations"}},required:["id","method","url"]},minItems:1,maxItems:50}},required:["operations"]}},{name:"execute_script",description:"Execute a server-side script on the ServiceNow instance (Background Script). Supports GlideRecord, GlideQuery, GlideAggregate, and all server-side APIs. Returns the script output. Use for complex queries that cannot be expressed via REST. REQUIRES WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{script:{type:"string",description:"Server-side JavaScript to execute. Use gs.print() or gs.info() for output."},scope:{type:"string",description:"Application scope to run in (default: global)"}},required:["script"]}},{name:"fluent_sdk_query",description:'Run `now-sdk query <table>` — a read-only Table REST API query executed via the ServiceNow SDK CLI against your authenticated instance (no browser). New in @servicenow/sdk 4.8. Ideal while authoring Fluent code: resolve sys_ids, inspect table schemas, check existing records, read choice values. Example: { table: "sys_user_role", query: "name=admin", fields: ["sys_id","name"], limit: 1 }',inputSchema:{type:"object",properties:{table:{type:"string",description:'Table to query (e.g., "incident", "sys_dictionary")'},query:{type:"string",description:'Encoded query string (e.g., "name=admin^active=true")'},fields:{type:"array",items:{type:"string"},description:'Fields to return (e.g., ["sys_id","name"])'},limit:{type:"number",description:"Max rows to return"}},required:["table"]}},{name:"fluent_version",description:"Report the installed `@servicenow/sdk` (now-sdk) version and whether it meets the version NowAIKit tracks features against (currently 4.10.1). Returns an upgrade hint when out of date.",inputSchema:{type:"object",properties:{},required:[]}},{name:"fluent_explain",description:"Run `npx @servicenow/sdk explain <topic>` to get live SDK documentation on a topic — always current API signatures, not training-data guesses. Returns explanations of Fluent APIs, types, patterns, and best practices. Known topics include: GlideQuery, table API, scoped app, now.config.json, keys.ts, metadata, Record, Now.del, Now.attach, DataLookup, RestMessage, Alias, AliasTemplate, RetryPolicy, Playbook, Flow, Subflow, CustomAction, TryCatch, DoInParallel, FlowStages, AiAgent, AiAgentWorkflow, roleMap, NowAssistSkillConfig, UiPolicy, DataPolicy, Form, InstanceScan, ServicePortal, ImportSet, override, StateModel, cicd.",inputSchema:{type:"object",properties:{topic:{type:"string",description:"Topic to explain. Examples: GlideQuery, table API, scoped app, now.config.json, keys.ts, metadata, Record, Now.del, etc."}},required:["topic"]}},{name:"fluent_init",description:"Initialize a new ServiceNow fluent/now-sdk project. Runs `npx @servicenow/sdk init`. REQUIRES FLUENT_ENABLED=true and WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Project name"},template:{type:"string",description:"Project template (optional)"},directory:{type:"string",description:"Target directory (optional, defaults to cwd)"}},required:["name"]}},{name:"fluent_build",description:"Build a ServiceNow fluent/now-sdk project. Runs `npx @servicenow/sdk build`. REQUIRES FLUENT_ENABLED=true and WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{directory:{type:"string",description:"Project directory (optional, defaults to cwd)"}},required:[]}},{name:"fluent_validate",description:"Validate a ServiceNow fluent/now-sdk project. Runs `npx @servicenow/sdk validate`. REQUIRES FLUENT_ENABLED=true.",inputSchema:{type:"object",properties:{directory:{type:"string",description:"Project directory (optional, defaults to cwd)"}},required:[]}},{name:"fluent_cicd",description:"Run ServiceNow CI/CD operations via the SDK (`now-sdk cicd`, new in @servicenow/sdk 4.10). Drive scoped-app install/publish and ATF test-suite runs from a promotion pipeline, outside the local build/install flow. REQUIRES FLUENT_ENABLED=true and WRITE_ENABLED=true.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["install","publish","testsuite"],description:"install a published app version, publish an app scope to the app repo, or run an ATF test suite"},appSysId:{type:"string",description:"App sys_id (required for action=install)"},scope:{type:"string",description:"App scope, e.g. x_acme_app (required for action=publish)"},appVersion:{type:"string",description:"App version, e.g. 1.0.0 (install/publish)"},testSuiteName:{type:"string",description:"ATF test suite name (required for action=testsuite)"}},required:["action"]}},{name:"search_servicenow_docs",description:"Search the official ServiceNow product documentation (servicenow.com/docs) — API references (GlideRecord, GlideSystem, GlideAjax…), admin & developer guides, encoded-query operators, release notes. Returns ranked results with title, breadcrumb, URL, snippet, and a `ref` to read the full page with fetch_servicenow_doc. Use this to ground answers in current ServiceNow docs rather than memory. Read-only; uses the public docs site, not your instance.",inputSchema:{type:"object",properties:{query:{type:"string",description:'What to look up (e.g., "GlideRecord addEncodedQuery", "flow designer rest step", "CSDM 4.0").'},limit:{type:"number",description:"Max results to return (default 6, max 20)."},product:{type:"string",description:'Optional product/area to bias the search (e.g., "ITSM", "CMDB", "Flow Designer", "Performance Analytics").'}},required:["query"]}},{name:"fetch_servicenow_doc",description:"Fetch the full readable text of a specific ServiceNow documentation page. Pass either the `ref` returned by search_servicenow_docs (fastest, exact) or a servicenow.com/docs page URL. Use after search_servicenow_docs to read a result in full. Read-only; only ServiceNow docs are reachable.",inputSchema:{type:"object",properties:{ref:{type:"string",description:"The `ref` from a search_servicenow_docs result (preferred — resolves directly to page content)."},url:{type:"string",description:"A servicenow.com/docs page URL (used when no ref is available; resolved via docs search)."},maxChars:{type:"number",description:"Truncate the returned text to this many characters (default 9000, max 30000)."}},required:[]}},{name:"create_now_assist_skill",description:"Create a Now Assist skill definition (requires NOW_ASSIST_ENABLED + WRITE_ENABLED)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Skill name"},description:{type:"string",description:"Skill description"},input_schema:{type:"string",description:"JSON schema string defining the skill input"},output_schema:{type:"string",description:"JSON schema string defining the skill output"},prompt_template:{type:"string",description:"Prompt template for the skill"},model:{type:"string",description:"Optional model identifier to use for this skill"}},required:["name","description","input_schema","output_schema","prompt_template"]}},{name:"list_now_assist_skills",description:"List Now Assist skill definitions (requires NOW_ASSIST_ENABLED)",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter by active status"},limit:{type:"number",description:"Max records to return (default 25)"},query:{type:"string",description:"Additional encoded query string"}},required:[]}},{name:"get_now_assist_skill",description:"Get a single Now Assist skill definition by sys_id (requires NOW_ASSIST_ENABLED)",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the skill"}},required:["sys_id"]}},{name:"test_now_assist_skill",description:"Invoke a Now Assist skill with test input to verify behavior (requires NOW_ASSIST_ENABLED)",inputSchema:{type:"object",properties:{skill_sys_id:{type:"string",description:"System ID of the skill to test"},test_input:{type:"object",description:"Test input payload to send to the skill"}},required:["skill_sys_id","test_input"]}},{name:"create_ai_agent",description:"Create an AI agent definition with optional auto-generated ACLs (requires NOW_ASSIST_ENABLED + WRITE_ENABLED)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Agent name"},description:{type:"string",description:"Agent description"},capabilities:{type:"array",items:{type:"string"},description:"List of capability identifiers the agent supports"},auto_generate_acls:{type:"boolean",description:"Automatically create ACL records for the agent (default true)"}},required:["name","description","capabilities"]}},{name:"list_ai_agents",description:"List AI agent definitions",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter by active status"},limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"get_ai_agent",description:"Get an AI agent definition and its related ACLs",inputSchema:{type:"object",properties:{sys_id:{type:"string",description:"System ID of the AI agent"}},required:["sys_id"]}},{name:"create_agentic_workflow",description:"Create an agentic workflow linked to an AI agent (requires NOW_ASSIST_ENABLED + WRITE_ENABLED)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Workflow name"},description:{type:"string",description:"Workflow description"},agent_sys_id:{type:"string",description:"System ID of the parent AI agent"},steps:{type:"array",description:"Ordered list of workflow steps",items:{type:"object",properties:{name:{type:"string",description:"Step name"},action:{type:"string",description:"Action identifier"},inputs:{type:"object",description:"Step input parameters"},condition:{type:"string",description:"Optional condition expression"}},required:["name","action"]}},trigger_conditions:{type:"string",description:"Optional trigger condition expression"}},required:["name","description","agent_sys_id","steps"]}},{name:"cmdb_find_duplicates",description:"Find duplicate CIs by matching on specified fields (in-memory grouping)",inputSchema:{type:"object",properties:{ci_class:{type:"string",description:"CI class table (default cmdb_ci)"},match_fields:{type:"array",items:{type:"string"},description:"Fields to match on for duplicate detection (default: name, serial_number, ip_address)"},limit:{type:"number",description:"Max CIs to scan (default 100)"}},required:[]}},{name:"cmdb_find_orphans",description:"Find CIs with no relationships in cmdb_rel_ci",inputSchema:{type:"object",properties:{ci_class:{type:"string",description:"CI class table (default cmdb_ci)"},limit:{type:"number",description:"Max orphan CIs to return (default 50)"}},required:[]}},{name:"cmdb_find_stale",description:"Find CIs not updated within a given number of days that are still operational",inputSchema:{type:"object",properties:{ci_class:{type:"string",description:"CI class table (default cmdb_ci)"},days_threshold:{type:"number",description:"Number of days since last update to consider stale (default 90)"},limit:{type:"number",description:"Max stale CIs to return (default 50)"}},required:[]}},{name:"cmdb_reconcile",description:"Act on duplicate, stale, or orphan CIs — merge, retire, or remove (requires CMDB_WRITE_ENABLED). Supports dry_run mode.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["merge_duplicates","retire_stale","remove_orphans"],description:"Reconciliation action to perform"},targets:{type:"array",items:{type:"string"},description:"Array of CI sys_ids to act on"},dry_run:{type:"boolean",description:"Preview changes without applying (default true)"}},required:["action","targets"]}},{name:"create_playbook",description:"Create a playbook definition with ordered steps that chain tool calls (requires NOW_ASSIST_ENABLED + WRITE_ENABLED)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Playbook name"},description:{type:"string",description:"Playbook description"},steps:{type:"array",description:"Ordered list of playbook steps",items:{type:"object",properties:{tool_name:{type:"string",description:"Name of the tool to invoke"},args_template:{type:"object",description:"Arguments template — can reference {{context.key}} or {{steps[N].result.key}}"},condition:{type:"string",description:"Optional JS-like condition expression. Step runs only when truthy."},on_error:{type:"string",enum:["stop","skip","continue"],description:"Error handling: stop (default), skip this step, or continue to next"}},required:["tool_name","args_template"]}}},required:["name","description","steps"]}},{name:"execute_playbook",description:"Execute a playbook step by step, passing results forward through context (requires NOW_ASSIST_ENABLED). Supports dry_run.",inputSchema:{type:"object",properties:{playbook:{type:"object",description:"Playbook object with name, description, and steps array",properties:{name:{type:"string"},description:{type:"string"},steps:{type:"array",items:{type:"object",properties:{tool_name:{type:"string"},args_template:{type:"object"},condition:{type:"string"},on_error:{type:"string",enum:["stop","skip","continue"]}},required:["tool_name","args_template"]}}},required:["steps"]},context:{type:"object",description:"Initial context key-value pairs available to all steps"},dry_run:{type:"boolean",description:"Preview execution plan without invoking tools (default true)"}},required:["playbook"]}},{name:"list_playbooks",description:"List stored playbook definitions from sys_hub_action_type_definition",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max records to return (default 25)"}},required:[]}},{name:"discover_table",description:"Discover a ServiceNow table schema and register dynamic CRUD tools for it. After discovery, new tools become available: dynamic_query_<table>, dynamic_get_<table>, dynamic_create_<table>, dynamic_update_<table>, dynamic_delete_<table>. Schemas are cached for 30 minutes.",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name to discover (e.g., "u_custom_table")'},operations:{type:"array",description:"Operations to enable: query, get, create, update, delete. Default: all.",items:{type:"string",enum:["query","get","create","update","delete"]}}},required:["table"]}},{name:"list_table_config",description:"List every configuration artifact on a table — business rules, client scripts, UI policies, ACLs, UI actions, data policies, and dictionary fields — with per-type counts. Use it to see what depends on a table before changing or removing it. This is config/metadata impact, not CMDB CI impact. Each lane returns {count, records} or {error} if that table/plugin is unavailable.",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name, e.g. "incident"'},limit:{type:"number",description:"Max records per artifact type (default 50)"}},required:["table"]}},{name:"find_field_references",description:"Find where a table field is used — its dictionary entry plus any scripts (business rules, script includes, client scripts, UI actions, widgets) that mention the field name. Use it before renaming or removing a field. Script matches are substring (LIKE) hits, so expect false positives (comments, similarly-named symbols) and misses for dynamically-built references; treat results as candidates to review, not a definitive list.",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table name, e.g. "incident"'},field:{type:"string",description:'Field (column) name, e.g. "u_custom_field"'},limit:{type:"number",description:"Max matches per source (default 50)"}},required:["table","field"]}},{name:"find_script_references",description:"Find what references a Script Include or named artifact — scans script-bearing config tables for textual use of the name. Use it before renaming or deleting a Script Include, Script Action, etc. Matches are substring (LIKE) hits, so treat them as candidates to review (false positives from comments/similar names; misses for dynamic references).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Artifact name to search for, e.g. a Script Include class name"},limit:{type:"number",description:"Max matches per source (default 50)"}},required:["name"]}},{name:"find_update_sets",description:"List the update sets that contain changes to an artifact (by name), so you know what is in-flight or already captured for promotion before you touch it.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Artifact name (or partial) to match against captured updates"},limit:{type:"number",description:"Max update records to scan (default 100)"}},required:["name"]}},{name:"find_property_usage",description:"Find scripts that read a system property (sys_properties) by name, plus the property record itself. Use it before changing or removing a property. Matches are substring (LIKE) hits — candidates to review, not definitive.",inputSchema:{type:"object",properties:{name:{type:"string",description:'System property name, e.g. "glide.ui.incident_reassignment_action"'},limit:{type:"number",description:"Max matches per source (default 50)"}},required:["name"]}},{name:"list_supported_artifacts",description:"Local sync: list the artifact types (tables) that support pull/push to local files and which fields sync for each.",inputSchema:{type:"object",properties:{},required:[]}},{name:"pull_artifact",description:"Local sync: fetch an artifact's editable fields (e.g. a Service Portal widget's template/css/script) for local editing. Returns the content inline; when NOWAIKIT_SYNC_DIR is set it also writes one file per field and returns the paths. This is config/pro-code editing of a single artifact, not an update-set export.",inputSchema:{type:"object",properties:{table:{type:"string",description:'Artifact table, e.g. "sp_widget", "sys_script_include"'},sys_id:{type:"string",description:"sys_id OR name of the record (a name is resolved to its sys_id)"}},required:["table","sys_id"]}},{name:"push_artifact",description:"Local sync: write edited fields back to an artifact (requires WRITE_ENABLED=true). Pass fields inline as {field:value}; if omitted and NOWAIKIT_SYNC_DIR is set, reads them from the pulled files on disk. Overwrites the listed fields with NO merge — run sync_status first, and pass expected_updated_on to abort if the instance changed since you pulled.",inputSchema:{type:"object",properties:{table:{type:"string",description:"Artifact table"},sys_id:{type:"string",description:"sys_id OR name of the record"},fields:{type:"object",description:"Optional map of {field: newValue} to update; defaults to the on-disk files under NOWAIKIT_SYNC_DIR"},expected_updated_on:{type:"string",description:"Optional sys_updated_on from your last pull/sync_status; the push aborts with a CONFLICT if the record has changed since."}},required:["table","sys_id"]}},{name:"sync_status",description:"Local sync: compare an artifact's current instance content against your local/edited content field-by-field. Each field reports unchanged | changed | not_local (no local copy to compare). Also returns sys_updated_on to feed into push_artifact's conflict check.",inputSchema:{type:"object",properties:{table:{type:"string",description:"Artifact table"},sys_id:{type:"string",description:"sys_id OR name of the record"},fields:{type:"object",description:"Optional {field: localValue} to compare; defaults to files under NOWAIKIT_SYNC_DIR"}},required:["table","sys_id"]}},{name:"visualize_aggregate",description:'Build a real-time chart of ServiceNow records grouped by a field (e.g. incidents by priority, cases by state). Returns chart-ready data, a Teams Adaptive Card (Chart.*) to drop into a Copilot Studio "Send an adaptive card" step, a markdown table, and a summary. Read-only.',inputSchema:{type:"object",properties:{table:{type:"string",description:'Table to aggregate, e.g. "incident", "sn_customerservice_case"'},group_by:{type:"string",description:'Field to group by, e.g. "priority", "state", "category", "assignment_group"'},query:{type:"string",description:'Optional encoded query filter, e.g. "active=true"'},chart_type:{type:"string",description:"column (default) | bar | pie | donut"},title:{type:"string",description:"Optional chart title"},limit:{type:"number",description:"Keep the top N groups by count (default 12)"}},required:["table","group_by"]}},{name:"aggregate_report",description:'Server-side aggregate REPORT grouped by a field, in ONE query with no 1000-row truncation. Returns per-group record count PLUS averages/sums/mins/maxes of numeric or duration fields — the right tool for a periodic summary like "incident volume by category with average resolution time". Do NOT list raw records for this; use this. For task tables (incident, problem, change_request, cases, etc.) it INCLUDES average resolution time automatically even if avg_fields is omitted. Duration fields come back pre-formatted (e.g. "21 14:03:10"). Returns a stats table (markdown), the rows, a count chart Adaptive Card, and a summary. Read-only.',inputSchema:{type:"object",properties:{table:{type:"string",description:'Table to aggregate, e.g. "incident"'},group_by:{type:"string",description:'Field to group by, e.g. "category", "assignment_group", "priority"'},query:{type:"string",description:'Encoded query filter, e.g. resolved in the last 7 days: "stateIN6,7^resolved_atRELATIVEGT@dayofweek@ago@7"'},avg_fields:{type:"array",items:{type:"string"},description:'Fields to average per group, e.g. ["business_duration"] or ["calendar_duration"] for resolution time. Comma string also accepted.'},sum_fields:{type:"array",items:{type:"string"},description:"Fields to sum per group"},min_fields:{type:"array",items:{type:"string"},description:"Fields to take the minimum of per group"},max_fields:{type:"array",items:{type:"string"},description:"Fields to take the maximum of per group"},title:{type:"string",description:"Optional report title"},limit:{type:"number",description:"Keep the top N groups by count (default 25)"}},required:["table","group_by"]}},{name:"visualize_trend",description:"Build a real-time trend line of ServiceNow record counts over time (e.g. incidents opened per day). Returns chart-ready series, a Teams Adaptive Card line chart, a markdown table, and a summary. Read-only.",inputSchema:{type:"object",properties:{table:{type:"string",description:'Table to count, e.g. "incident"'},date_field:{type:"string",description:'Date/time field to bucket on (default "sys_created_on")'},interval:{type:"string",description:"day (default) | week | month"},query:{type:"string",description:'Recommended: a span filter, e.g. "sys_created_onONLast 30 days@..." or "active=true"'},title:{type:"string",description:"Optional chart title"}},required:["table"]}}];function Cu(){return["Basic auth was rejected by the instance (HTTP 401). Common causes, in order:"," 1. Username must be the login user_name, not the email or display name."," 2. The account needs a valid LOCAL password. If it is SSO/SAML-federated, browser login works"," but Basic REST does not (no local password). Use a dedicated local integration user.",' 3. ServiceNow’s "Basic Auth Restriction" may be blocking Basic auth. The account needs the'," snc_basic_auth_api_access role, or must be a Web Service Access Only (WSAO) account.",' 4. A corporate proxy may be stripping the Authorization header (arrives as "guest"). Test from'," a different network / phone hotspot."," 5. Confirm the account is active, not locked out, and not flagged password-reset-required."," 6. If the instance restricts Basic auth, switch this connection to OAuth (the recommended path)."," Docs: https://www.servicenow.com/community/itsm-articles/review-basic-authentication-account-security/ta-p/3555125"].join(`
41
- `)}function qu(l){const d=["Authenticated, but not authorized for this operation (HTTP 403). Common causes:"," 1. The account is missing the roles this needs (e.g. itil for ITSM, or admin for config tables)."];return l&&d.push(' 2. Your OAuth app/token is missing API scope. Grant the required scope (e.g. "useraccount") in'," the OAuth application registry, and make sure the token’s user actually holds the roles."),d.push(" 3. Writes need write access AND the user’s write roles."," 4. An ACL on the specific table may be denying access even with the role."),d.join(`
42
- `)}function ta(l,d){const c=l||"";return/\b401\b|not authenticated|authentication.failed|unauthorized/i.test(c)?`${c}
43
-
44
- ${Cu()}`:/\b403\b|forbidden|insufficient|not authorized/i.test(c)?`${c}
45
-
46
- ${qu(d==="oauth")}`:c}const Iu=typeof window<"u"&&window.api!==void 0;function qt(l,d){try{const c=localStorage.getItem(l);return c?JSON.parse(c):d}catch{return d}}function wr(l,d){localStorage.setItem(l,JSON.stringify(d))}let Di=!1,Yr,Yo,Qo;function Qr(){return qt("nowaikit:instances",[])}function Au(l){return qt("nowaikit:audit",[]).slice(-l).reverse()}function vr(l){const d=qt("nowaikit:audit",[]);d.push(l),d.length>2e3&&d.splice(0,d.length-2e3),wr("nowaikit:audit",d)}function Lu(){const l=Qr(),d=qt("nowaikit:config:activeInstance","");return l.find(c=>c.name===d)||l[0]||null}function Tu(l){return btoa(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ct(l,d,c){const u=Lu();if(!u)throw new Error("No ServiceNow instance configured. Add one in Setup.");const v=`/api/snow/${Tu(u.instanceUrl)}${d}`,C={"Content-Type":"application/json",Accept:"application/json","X-NowAIKit-Proxy":"1"};u.authMethod==="basic"&&u.username&&u.password&&(C.Authorization=`Basic ${btoa(`${u.username}:${u.password}`)}`);const b={method:l,headers:C};c&&(l==="POST"||l==="PUT"||l==="PATCH")&&(b.body=JSON.stringify(c));const k=await fetch(v,b);if(!k.ok){const T=await k.text().catch(()=>""),B=`ServiceNow ${k.status}: ${T.slice(0,200)}`;throw new Error(ta(B,u.authMethod==="oauth"?"oauth":"basic"))}const q=await k.json().catch(()=>({}));return{ok:!0,status:k.status,data:q}}async function Ru(l,d){var c;switch(l){case"query_records":{const u=d.table;if(!u)throw new Error("table is required");const h=new URLSearchParams;d.query&&h.set("sysparm_query",d.query),d.fields&&h.set("sysparm_fields",d.fields),d.limit&&h.set("sysparm_limit",String(d.limit)),d.offset&&h.set("sysparm_offset",String(d.offset)),d.orderBy&&h.set("sysparm_query",(d.query||"")+"^ORDERBY"+d.orderBy),h.set("sysparm_display_value",String(d.display_value??"true"));const v=h.toString(),{data:C}=await ct("GET",`/api/now/table/${u}?${v}`),b=C.result;return{count:Array.isArray(b)?b.length:0,records:b}}case"get_record":{const u=d.table,h=d.sys_id;if(!u||!h)throw new Error("table and sys_id are required");const v=new URLSearchParams;d.fields&&v.set("sysparm_fields",d.fields),v.set("sysparm_display_value","true");const{data:C}=await ct("GET",`/api/now/table/${u}/${h}?${v}`);return C.result}case"create_record":{const u=d.table;if(!u)throw new Error("table is required");const{data:h}=await ct("POST",`/api/now/table/${u}`,d.fields||d.data||{}),v=h.result;return{sys_id:v==null?void 0:v.sys_id,record:v}}case"update_record":{const u=d.table,h=d.sys_id;if(!u||!h)throw new Error("table and sys_id are required");const{data:v}=await ct("PATCH",`/api/now/table/${u}/${h}`,d.fields||d.data||{});return v.result}case"delete_record":{const u=d.table,h=d.sys_id;if(!u||!h)throw new Error("table and sys_id are required");return await ct("DELETE",`/api/now/table/${u}/${h}`),{success:!0,deleted:h}}case"get_table_schema":{const u=d.table_name||d.table;if(!u)throw new Error("table_name is required");const{data:h}=await ct("GET",`/api/now/table/${u}?sysparm_limit=0`),{data:v}=await ct("GET",`/api/now/table/sys_dictionary?sysparm_query=name=${u}^internal_type!=collection&sysparm_fields=element,column_label,internal_type,max_length,mandatory,reference&sysparm_display_value=true&sysparm_limit=200`);return{table:u,columns:v.result}}case"get_incident":{const u=d.number||d.sys_id;if(!u)throw new Error("number or sys_id is required");if(/^[0-9a-f]{32}$/i.test(u)){const{data:b}=await ct("GET",`/api/now/table/incident/${u}?sysparm_display_value=true`);return b.result}const{data:v}=await ct("GET",`/api/now/table/incident?sysparm_query=number=${u}&sysparm_display_value=true&sysparm_limit=1`),C=v.result;return(C==null?void 0:C[0])||{error:`Incident ${u} not found`}}case"create_incident":{const{data:u}=await ct("POST","/api/now/table/incident",d),h=u.result;return{sys_id:h==null?void 0:h.sys_id,number:h==null?void 0:h.number,record:h}}default:{const u=l.match(/^list_(.+)$/),h=l.match(/^get_(.+)$/),v=l.match(/^search_(.+)$/);if(u||v){const C=d.table||op(l);if(!C)throw new Error(`Cannot determine ServiceNow table for tool "${l}". Use query_records with an explicit table name.`);const b=new URLSearchParams;d.query&&b.set("sysparm_query",d.query),d.fields&&b.set("sysparm_fields",d.fields),b.set("sysparm_limit",String(d.limit||25)),b.set("sysparm_display_value","true");const{data:k}=await ct("GET",`/api/now/table/${C}?${b}`),q=k.result;return{count:Array.isArray(q)?q.length:0,records:q}}if(h){const C=d.sys_id||d.number,b=d.table||op(l);if(!b||!C)throw new Error(`Cannot determine table/sys_id for tool "${l}". Use get_record with explicit table and sys_id.`);if(/^[0-9a-f]{32}$/i.test(C)){const{data:T}=await ct("GET",`/api/now/table/${b}/${C}?sysparm_display_value=true`);return T.result}const{data:q}=await ct("GET",`/api/now/table/${b}?sysparm_query=number=${C}&sysparm_display_value=true&sysparm_limit=1`);return(c=q.result)==null?void 0:c[0]}throw new Error(`Tool "${l}" is not supported in browser mode. Use query_records, get_record, or the desktop app for full tool support.`)}}}function op(l){return{list_incidents:"incident",get_incident:"incident",search_incidents:"incident",list_problems:"problem",get_problem:"problem",list_change_requests:"change_request",get_change_request:"change_request",list_tasks:"task",get_task:"task",list_users:"sys_user",get_user:"sys_user",list_groups:"sys_user_group",get_group:"sys_user_group",list_knowledge_bases:"kb_knowledge_base",search_knowledge:"kb_knowledge",get_knowledge_article:"kb_knowledge",list_catalog_items:"sc_cat_item",get_catalog_item:"sc_cat_item",list_assets:"alm_asset",get_asset:"alm_asset",list_reports:"sys_report",get_report:"sys_report",search_cmdb_ci:"cmdb_ci",get_cmdb_ci:"cmdb_ci",list_notifications:"sysevent_email_action",get_notification:"sysevent_email_action",list_business_rules:"sys_script",get_business_rule:"sys_script",list_script_includes:"sys_script_include",get_script_include:"sys_script_include",list_client_scripts:"sys_script_client",get_client_script:"sys_script_client",list_ui_policies:"sys_ui_policy",get_ui_policy:"sys_ui_policy",list_ui_actions:"sys_ui_action",get_ui_action:"sys_ui_action",list_acls:"sys_security_acl",get_acl:"sys_security_acl",list_scheduled_jobs:"sysauto",get_scheduled_job:"sysauto",list_scoped_apps:"sys_scope",get_scoped_app:"sys_scope",list_update_sets:"sys_update_set",get_update_set:"sys_update_set",list_email_logs:"sys_email",get_email_log:"sys_email",list_stories:"rm_story",get_story:"rm_story",list_epics:"rm_epic",get_epic:"rm_epic",list_software_licenses:"alm_license"}[l]||null}const Nu={getConfig:async l=>qt(`nowaikit:config:${l}`,null),setConfig:async(l,d)=>{wr(`nowaikit:config:${l}`,d)},getAllConfig:async()=>{var u;const l=Qr(),d=qt("nowaikit:config:activeInstance",((u=l[0])==null?void 0:u.name)||""),c=qt("nowaikit:config:settings",null);return{instances:l,activeInstance:d,theme:"dark",telemetry:!1,autoUpdate:!0,...c?{settings:c}:{}}},listInstances:async()=>Qr(),addInstance:async l=>{const d=Qr(),c=d.findIndex(h=>h.name===l.name);c>=0?d[c]=l:d.push(l),wr("nowaikit:instances",d);const u=qt("nowaikit:config:activeInstance","");return(!u||!d.some(h=>h.name===u))&&wr("nowaikit:config:activeInstance",l.name),vr({ts:new Date().toISOString(),event:"instance:add",instance:l.name,success:!0}),{success:!0}},removeInstance:async l=>{var h;const d=Qr(),c=d.findIndex(v=>v.name===l);return c<0?{success:!1,error:`Instance "${l}" not found`}:(d.splice(c,1),wr("nowaikit:instances",d),qt("nowaikit:config:activeInstance","")===l&&wr("nowaikit:config:activeInstance",((h=d[0])==null?void 0:h.name)||""),vr({ts:new Date().toISOString(),event:"instance:remove",instance:l,success:!0}),{success:!0})},testInstance:async l=>{var d,c;vr({ts:new Date().toISOString(),event:"instance:test",instance:l.name||l.instanceUrl,success:!0,durationMs:120});try{const u=`${l.instanceUrl}/api/now/table/sys_properties?sysparm_query=name=instance_name&sysparm_limit=1&sysparm_fields=value`,h={Accept:"application/json","Content-Type":"application/json"};l.authMethod==="basic"&&l.username&&l.password&&(h.Authorization=`Basic ${btoa(`${l.username}:${l.password}`)}`);const v=await fetch(u,{headers:h,signal:AbortSignal.timeout(15e3)});if(v.status===401)return{success:!1,error:ta("Authentication failed (HTTP 401). Check your credentials.",l.authMethod==="oauth"?"oauth":"basic")};if(v.status===403)return{success:!1,error:ta("Access denied (HTTP 403). Check user permissions.",l.authMethod==="oauth"?"oauth":"basic")};if(!v.ok)return{success:!1,error:`HTTP ${v.status}: ${v.statusText}`};const C=await v.json();return{success:!0,info:{instanceName:((c=(d=C==null?void 0:C.result)==null?void 0:d[0])==null?void 0:c.value)||"OK",url:l.instanceUrl}}}catch(u){return u instanceof TypeError&&String(u).includes("fetch")?{success:!0,info:{instanceName:"Connection test unavailable in browser (CORS). Use the desktop app for full testing."}}:{success:!1,error:u instanceof Error?u.message:String(u)}}},startServer:async l=>{const d=Qr(),c=l?d.find(u=>u.name===l):d[0];return c?(Di=!0,Yr=c.name,Yo=Math.floor(Math.random()*6e4)+5e3,Qo=new Date().toISOString(),vr({ts:new Date().toISOString(),event:"server:start",instance:c.name,success:!0}),{success:!0}):{success:!1,error:"No instance configured. Use Setup Wizard to add one."}},stopServer:async()=>{const l=Di;return Di=!1,Yr=void 0,Yo=void 0,Qo=void 0,l&&vr({ts:new Date().toISOString(),event:"server:stop",success:!0}),{success:!0}},getServerStatus:async()=>({running:Di,instance:Yr,pid:Yo,startedAt:Qo,toolCount:sp.length}),listTools:async()=>sp,executeTool:async(l,d)=>{if(!Di)return{success:!1,error:"Server is not running. Start the server first."};const c=Date.now();try{const u=await Ru(l,d);return vr({ts:new Date().toISOString(),event:"tool:call",tool:l,instance:Yr,success:!0,durationMs:Date.now()-c}),{success:!0,result:u}}catch(u){const h=u instanceof Error?u.message:String(u);return vr({ts:new Date().toISOString(),event:"tool:call",tool:l,instance:Yr,success:!1,error:h,durationMs:Date.now()-c}),{success:!1,error:h}}},getAuditLogs:async l=>Au(l||100),getVersion:async()=>({app:"3.1.0",electron:typeof navigator<"u"?"Browser":"N/A",node:typeof navigator<"u"?navigator.userAgent.split(" ").pop()||"Browser":"N/A"}),openExternal:async l=>{window.open(l,"_blank","noopener,noreferrer")},selectDirectory:async()=>null,getServerPath:async()=>"N/A (browser mode — use desktop app or CLI for MCP server)",sendChat:async l=>{var B,V,fe,ne,K;const{provider:d,apiKey:c,model:u,messages:h,tools:v}=l;if(!c&&!(d==="ollama"||d==="lmstudio"))return{error:"No API key configured"};const b=Date.now(),k=(D,W,Z,j,M,m,N)=>{const ee=qt("nowaikit:audit",[]),w={ts:new Date().toISOString(),event:"chat:send",provider:D,model:W,toolCount:Z,instance:Yr,success:j,durationMs:M};m&&(w.inputTokens=m.inputTokens,w.outputTokens=m.outputTokens),N&&(w.error=N),ee.push(w),ee.length>2e3&&ee.splice(0,ee.length-2e3),wr("nowaikit:audit",ee)},q=v&&v.length>0?`You are NowAIKit, an AI assistant for ServiceNow. Use tools to fetch real data — never make up data.
47
-
48
- Use "query_records" with correct table: incident, change_request, problem, task, sys_user, cmdb_ci.
49
- Query syntax: active=true, priority=1, ORDERBYDESCsys_created_on, nameLIKEtext.
50
- IMPORTANT: Do NOT add assigned_to filter unless user explicitly says "my" or "assigned to me". Query ALL matching records by default.`:void 0,T=D=>D.replace(/sk-ant-[a-zA-Z0-9_-]+/g,"sk-ant-***").replace(/sk-[a-zA-Z0-9_-]{20,}/g,"sk-***").replace(/AIza[a-zA-Z0-9_-]+/g,"AIza***").replace(/gsk_[a-zA-Z0-9_-]+/g,"gsk_***").replace(/sk-or-[a-zA-Z0-9_-]+/g,"sk-or-***").replace(/key=[^&\s]+/g,"key=***");try{if(d==="anthropic"){const D=v==null?void 0:v.map(N=>({name:N.name,description:N.description,input_schema:N.inputSchema||{type:"object",properties:{}}})),W={model:u,max_tokens:4096,messages:h};q&&(W.system=q),D&&D.length>0&&(W.tools=D);const Z=await fetch("/api/ai/anthropic/v1/messages",{method:"POST",headers:{"Content-Type":"application/json","x-api-key":c,"anthropic-version":"2023-06-01","X-NowAIKit-Proxy":"1"},body:JSON.stringify(W)});if(!Z.ok){const N=T(`API error ${Z.status}: ${await Z.text()}`);return k(d,u,(v==null?void 0:v.length)||0,!1,Date.now()-b,void 0,N),{error:N}}const j=await Z.json(),M=j.usage,m=M?{inputTokens:M.input_tokens||0,outputTokens:M.output_tokens||0}:void 0;return k(d,u,(v==null?void 0:v.length)||0,!0,Date.now()-b,m),{content:j.content,stop_reason:j.stop_reason,usage:m}}else if(d==="google"){const W={contents:h.map(F=>{const X=[];if(typeof F.content=="string")X.push({text:F.content});else if(Array.isArray(F.content))for(const ae of F.content)ae.type==="text"?X.push({text:ae.text}):ae.type==="tool_use"?X.push({functionCall:{name:ae.name,args:ae.input}}):ae.type==="tool_result"&&X.push({functionResponse:{name:"tool",response:{content:ae.content}}});return{role:F.role==="assistant"?"model":"user",parts:X}})};q&&(W.systemInstruction={parts:[{text:q}]}),v&&v.length>0&&(W.tools=[{functionDeclarations:v.map(F=>({name:F.name,description:F.description,parameters:F.inputSchema||{type:"object",properties:{}}}))}]);const Z=`/api/ai/google/v1beta/models/${u}:generateContent?key=${c}`,j=`https://generativelanguage.googleapis.com/v1beta/models/${u}:generateContent?key=${c}`;let M;try{if(M=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json","X-NowAIKit-Proxy":"1"},body:JSON.stringify(W)}),M.status===404)throw new Error("proxy_not_available")}catch{M=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)})}if(!M.ok){const F=T(`Google AI error ${M.status}: ${await M.text()}`);return k(d,u,(v==null?void 0:v.length)||0,!1,Date.now()-b,void 0,F),{error:F}}const m=await M.json(),N=((fe=(V=(B=m.candidates)==null?void 0:B[0])==null?void 0:V.content)==null?void 0:fe.parts)??[],ee=[];for(const F of N)F.text&&ee.push({type:"text",text:F.text}),F.functionCall&&ee.push({type:"tool_use",id:`toolu_${Date.now()}`,name:F.functionCall.name,input:F.functionCall.args});const w=m.usageMetadata,G=w?{inputTokens:w.promptTokenCount||0,outputTokens:w.candidatesTokenCount||0}:void 0;return k(d,u,(v==null?void 0:v.length)||0,!0,Date.now()-b,G),{content:ee,stop_reason:ee.some(F=>F.type==="tool_use")?"tool_use":"end_turn",usage:G}}else{const W={openai:"/api/ai/openai/v1/chat/completions",groq:"/api/ai/groq/openai/v1/chat/completions",openrouter:"/api/ai/openrouter/api/v1/chat/completions",ollama:"/api/ai/ollama/v1/chat/completions",lmstudio:"/api/ai/lmstudio/v1/chat/completions"}[d];if(!W)return{error:`Unknown provider: ${d}`};const Z=[];q&&Z.push({role:"system",content:q});for(const ae of h)if(typeof ae.content=="string")Z.push({role:ae.role,content:ae.content});else if(Array.isArray(ae.content)){const he=ae.content,ke=he.filter(le=>le.type==="text").map(le=>le.text).join(`
51
- `),Le=he.filter(le=>le.type==="tool_use"),Ee=he.filter(le=>le.type==="tool_result");if(Le.length>0)Z.push({role:"assistant",content:ke||null,tool_calls:Le.map(le=>({id:le.id,type:"function",function:{name:le.name,arguments:JSON.stringify(le.input)}}))});else if(Ee.length>0)for(const le of Ee)Z.push({role:"tool",tool_call_id:le.tool_use_id,content:typeof le.content=="string"?le.content:JSON.stringify(le.content)});else ke&&Z.push({role:ae.role,content:ke})}const j={model:u,messages:Z},M=v==null?void 0:v.map(ae=>({type:"function",function:{name:ae.name,description:ae.description,parameters:ae.inputSchema||{type:"object",properties:{}}}}));M&&M.length>0&&(j.tools=M);const m={"Content-Type":"application/json","X-NowAIKit-Proxy":"1"};c&&(m.Authorization=`Bearer ${c}`);const N=await fetch(W,{method:"POST",headers:m,body:JSON.stringify(j)});if(!N.ok){const ae=T(`API error ${N.status}: ${await N.text()}`);return k(d,u,(v==null?void 0:v.length)||0,!1,Date.now()-b,void 0,ae),{error:ae}}const ee=await N.json(),w=(K=(ne=ee.choices)==null?void 0:ne[0])==null?void 0:K.message,G=[];if(w!=null&&w.content&&G.push({type:"text",text:w.content}),w!=null&&w.tool_calls)for(const ae of w.tool_calls){let he={};try{he=JSON.parse(ae.function.arguments)}catch{}G.push({type:"tool_use",id:ae.id,name:ae.function.name,input:he})}const F=ee.usage,X=F?{inputTokens:F.prompt_tokens||0,outputTokens:F.completion_tokens||0}:void 0;return k(d,u,(v==null?void 0:v.length)||0,!0,Date.now()-b,X),{content:G,stop_reason:G.some(ae=>ae.type==="tool_use")?"tool_use":"end_turn",usage:X}}}catch(D){const W=D instanceof TypeError&&String(D.message).includes("Failed to fetch")?'AI proxy not available. Run "npm run serve" or "npm run dev:web" for browser AI chat, or use the desktop app.':D instanceof Error?D.message:"Request failed";return k(d,u,(v==null?void 0:v.length)||0,!1,Date.now()-b,void 0,W),{error:W}}}},It=Iu?window.api:Nu,Pu=[{value:"full",label:"Full — all 500+ tools"},{value:"service_desk",label:"Service Desk"},{value:"change_coordinator",label:"Change Coordinator"},{value:"platform_developer",label:"Platform Developer"},{value:"system_administrator",label:"System Administrator"},{value:"itom_engineer",label:"ITOM Engineer"}],br=["welcome","url","auth","creds","test","role","clients","done"],Mu=[{value:"",label:"— Select —"},{value:"prod",label:"Production"},{value:"staging",label:"Staging"},{value:"uat",label:"UAT"},{value:"test",label:"Test"},{value:"dev",label:"Development"},{value:"demo",label:"Demo"}];function Du({onComplete:l,onClose:d,existingGroups:c=[]}){const[u,h]=z.useState("welcome"),[v,C]=z.useState(""),[b,k]=z.useState({instanceUrl:"",instanceName:"default",group:"Default",environment:"",authMethod:"basic",authMode:"service-account",username:"",password:"",clientId:"",clientSecret:"",toolPackage:"full",writeEnabled:!1}),[q,T]=z.useState("idle"),[B,V]=z.useState(""),[fe,ne]=z.useState(""),K=()=>{const w=br.indexOf(u);w<br.length-1&&h(br[w+1])},D=()=>{const w=br.indexOf(u);w>0&&h(br[w-1])},W=(w,G)=>k(F=>({...F,[w]:G}));function Z(){return It}async function j(){T("testing");try{const w=Z(),G={name:b.instanceName,instanceUrl:b.instanceUrl,authMethod:b.authMethod,username:b.username,password:b.password,clientId:b.clientId,clientSecret:b.clientSecret,toolPackage:b.toolPackage,writeEnabled:b.writeEnabled,group:b.group||"Default",environment:b.environment||void 0};if(w){const F=await w.testInstance(G);F.success?(T("ok"),V("Connection successful")):(T("fail"),V(F.error??"Connection failed"))}else try{const F=await fetch(`${b.instanceUrl}/api/now/table/sys_properties?sysparm_limit=1`,{headers:b.username?{Authorization:"Basic "+btoa(`${b.username}:${b.password}`)}:{}});F.ok?(T("ok"),V("Connection successful")):(T("fail"),V(`HTTP ${F.status} — check credentials`))}catch{T("fail"),V("Could not reach instance — check URL and CORS settings")}}catch(w){T("fail"),V(w instanceof Error?w.message:"Connection failed")}}async function M(){const w=Z();if(w){const G={name:b.instanceName,instanceUrl:b.instanceUrl,authMethod:b.authMethod,username:b.username,password:b.password,clientId:b.clientId,clientSecret:b.clientSecret,toolPackage:b.toolPackage,writeEnabled:b.writeEnabled,group:b.group||"Default",environment:b.environment||void 0},F=await w.addInstance(G);if(!F.success){ne(F.error??"Failed to save config");return}}K()}const m={container:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",padding:24},card:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:40,width:"100%",maxWidth:520,position:"relative"},title:{fontSize:"1.4rem",fontWeight:700,marginBottom:8},sub:{color:"var(--text2)",marginBottom:28,fontSize:"0.9rem"},label:{display:"block",fontSize:"0.8rem",color:"var(--dim)",marginBottom:6,textTransform:"uppercase",letterSpacing:"0.05em"},input:{width:"100%",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",padding:"10px 12px",fontSize:"0.9rem",marginBottom:16},btn:{background:"var(--accent)",color:"#fff",border:"none",borderRadius:6,padding:"10px 20px",fontSize:"0.9rem",fontWeight:600,cursor:"pointer"},btnGhost:{background:"transparent",color:"var(--text2)",border:"1px solid var(--border)",borderRadius:6,padding:"10px 20px",fontSize:"0.9rem",cursor:"pointer"},row:{display:"flex",gap:12,justifyContent:"flex-end",marginTop:24},progress:{display:"flex",gap:6,marginBottom:28}},N=br.indexOf(u),ee=br.length-2;return s.jsx("div",{style:m.container,children:s.jsxs("div",{style:m.card,children:[d&&u!=="done"&&s.jsx("button",{onClick:d,style:{position:"absolute",top:12,right:12,background:"transparent",border:"none",color:"var(--dim)",fontSize:"1.2rem",cursor:"pointer",padding:"4px 8px",borderRadius:4,zIndex:10},title:"Close",children:"✕"}),u!=="welcome"&&u!=="done"&&s.jsx("div",{style:m.progress,children:Array.from({length:ee}).map((w,G)=>s.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:G<N?"var(--accent)":"var(--border)"}},G))}),u==="welcome"&&s.jsxs(s.Fragment,{children:[s.jsxs("h1",{style:m.title,children:["Welcome to ",s.jsx("span",{style:{background:"linear-gradient(135deg, #00D4AA 0%, #0F4C81 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"},children:"NowAIKit"})]}),s.jsx("p",{style:m.sub,children:"Connect Any AI to ServiceNow. Instantly."}),s.jsxs("div",{style:{display:"flex",gap:12},children:[s.jsx("button",{style:m.btn,onClick:K,children:"Get Started →"}),d&&s.jsx("button",{style:m.btnGhost,onClick:d,children:"Cancel"})]})]}),u==="url"&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{style:m.title,children:"ServiceNow Instance"}),s.jsx("label",{style:m.label,children:"Instance URL"}),s.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:16},children:[s.jsx("span",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRight:"none",borderRadius:"6px 0 0 6px",padding:"10px 10px",fontSize:"0.9rem",color:"var(--dim)",whiteSpace:"nowrap"},children:"https://"}),s.jsx("input",{style:{...m.input,marginBottom:0,borderRadius:0,flex:1},value:b.instanceUrl.replace(/^https?:\/\//,"").replace(/\.service-now\.com$/,""),onChange:w=>{const G=w.target.value.replace(/[^a-zA-Z0-9-]/g,"");W("instanceUrl",`https://${G}.service-now.com`)},placeholder:"yourcompany"}),s.jsx("span",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderLeft:"none",borderRadius:"0 6px 6px 0",padding:"10px 10px",fontSize:"0.9rem",color:"var(--dim)",whiteSpace:"nowrap"},children:".service-now.com"})]}),s.jsx("label",{style:m.label,children:"Short name (e.g. prod, dev)"}),s.jsx("input",{style:m.input,value:b.instanceName,onChange:w=>W("instanceName",w.target.value),placeholder:"default"}),s.jsx("label",{style:m.label,children:"Group / Customer"}),c.length>0?s.jsxs("div",{style:{marginBottom:16},children:[s.jsxs("select",{style:{...m.input,cursor:"pointer",marginBottom:8},value:b.group===v&&v?"__new__":b.group,onChange:w=>{w.target.value==="__new__"?(C(""),W("group","")):(W("group",w.target.value),C(""))},children:[c.map(w=>s.jsx("option",{value:w,children:w},w)),s.jsx("option",{value:"__new__",children:"+ Add new group…"})]}),(b.group===""||!c.includes(b.group)&&b.group!=="Default")&&s.jsx("input",{style:m.input,value:v,onChange:w=>{C(w.target.value),W("group",w.target.value)},placeholder:"e.g. Acme Corp, Internal, Customer A"})]}):s.jsx("input",{style:m.input,value:b.group,onChange:w=>W("group",w.target.value),placeholder:"e.g. Acme Corp, Default"}),s.jsx("label",{style:m.label,children:"Environment"}),s.jsx("select",{style:{...m.input,cursor:"pointer"},value:b.environment,onChange:w=>W("environment",w.target.value),children:Mu.map(w=>s.jsx("option",{value:w.value,children:w.label},w.value))}),s.jsxs("div",{style:m.row,children:[s.jsx("button",{style:m.btnGhost,onClick:D,children:"← Back"}),s.jsx("button",{style:m.btn,onClick:K,disabled:!b.instanceUrl.startsWith("https://"),children:"Next →"})]})]}),u==="auth"&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{style:m.title,children:"Authentication"}),s.jsx("label",{style:m.label,children:"Method"}),["basic","oauth"].map(w=>s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10,cursor:"pointer"},children:[s.jsx("input",{type:"radio",checked:b.authMethod===w,onChange:()=>W("authMethod",w)}),s.jsx("span",{style:{fontSize:"0.9rem"},children:w==="basic"?"Basic Auth (username + password)":"OAuth 2.0 (recommended for production)"})]},w)),s.jsx("br",{}),s.jsx("label",{style:m.label,children:"Execution Context"}),[["service-account","Service account — shared credentials (default)"],["per-user","Per-user — each user runs in their own ServiceNow context (enterprise)"],["impersonation","Impersonation — service account + user ACL context"]].map(([w,G])=>s.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,marginBottom:10,cursor:"pointer"},children:[s.jsx("input",{type:"radio",style:{marginTop:3},checked:b.authMode===w,onChange:()=>W("authMode",w)}),s.jsx("span",{style:{fontSize:"0.875rem",color:"var(--text2)"},children:G})]},w)),s.jsxs("div",{style:m.row,children:[s.jsx("button",{style:m.btnGhost,onClick:D,children:"← Back"}),s.jsx("button",{style:m.btn,onClick:K,children:"Next →"})]})]}),u==="creds"&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{style:m.title,children:"Credentials"}),b.authMethod==="oauth"&&s.jsxs(s.Fragment,{children:[s.jsx("label",{style:m.label,children:"OAuth Client ID"}),s.jsx("input",{style:m.input,value:b.clientId,onChange:w=>W("clientId",w.target.value)}),s.jsx("label",{style:m.label,children:"OAuth Client Secret"}),s.jsx("input",{style:m.input,type:"password",value:b.clientSecret,onChange:w=>W("clientSecret",w.target.value)})]}),s.jsx("label",{style:m.label,children:b.authMethod==="oauth"?"Service Account Username":"Username"}),s.jsx("input",{style:m.input,value:b.username,onChange:w=>W("username",w.target.value)}),s.jsx("label",{style:m.label,children:"Password"}),s.jsx("input",{style:m.input,type:"password",value:b.password,onChange:w=>W("password",w.target.value)}),s.jsxs("div",{style:m.row,children:[s.jsx("button",{style:m.btnGhost,onClick:D,children:"← Back"}),s.jsx("button",{style:m.btn,onClick:K,children:"Next →"})]})]}),u==="test"&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{style:m.title,children:"Test Connection"}),s.jsx("p",{style:m.sub,children:"Verify nowaikit can reach your ServiceNow instance."}),q==="idle"&&s.jsx("button",{style:m.btn,onClick:j,children:"Test Connection"}),q==="testing"&&s.jsx("p",{style:{color:"var(--dim)"},children:"Testing…"}),q==="ok"&&s.jsxs("p",{style:{color:"var(--green)",marginBottom:16},children:["✓ ",B]}),q==="fail"&&s.jsxs("p",{style:{color:"var(--red)",marginBottom:16},children:["✗ ",B]}),s.jsxs("div",{style:m.row,children:[s.jsx("button",{style:m.btnGhost,onClick:D,children:"← Back"}),(q==="ok"||q==="fail")&&s.jsx("button",{style:m.btn,onClick:K,children:"Next →"})]})]}),u==="role"&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{style:m.title,children:"Tool Package & Permissions"}),s.jsx("label",{style:m.label,children:"Tool Package"}),s.jsx("select",{style:{...m.input,cursor:"pointer"},value:b.toolPackage,onChange:w=>W("toolPackage",w.target.value),children:Pu.map(w=>s.jsx("option",{value:w.value,children:w.label},w.value))}),s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[s.jsx("input",{type:"checkbox",checked:b.writeEnabled,onChange:w=>W("writeEnabled",w.target.checked)}),s.jsx("span",{style:{fontSize:"0.9rem"},children:"Enable write operations (create/update/delete)"})]}),s.jsxs("div",{style:m.row,children:[s.jsx("button",{style:m.btnGhost,onClick:D,children:"← Back"}),s.jsx("button",{style:m.btn,onClick:K,children:"Next →"})]})]}),u==="clients"&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{style:m.title,children:"Install into AI Client"}),s.jsx("p",{style:m.sub,children:"nowaikit will write the config automatically. You can also do this later from the Instances page."}),s.jsxs("p",{style:{color:"var(--text2)",fontSize:"0.875rem",marginBottom:20},children:["Click ",s.jsx("strong",{children:"Install"})," to detect installed clients and write their configs, or ",s.jsx("strong",{children:"Skip"})," to configure manually later."]}),fe&&s.jsxs("p",{style:{color:"var(--red)",fontSize:"0.875rem",marginBottom:8},children:["✗ ",fe]}),s.jsxs("div",{style:m.row,children:[s.jsx("button",{style:m.btnGhost,onClick:M,children:"Skip for now"}),s.jsx("button",{style:m.btn,onClick:M,children:"Install & Finish →"})]})]}),u==="done"&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{style:{...m.title,color:"var(--green)"},children:"✓ Setup Complete!"}),s.jsxs("p",{style:m.sub,children:["nowaikit is connected to ",s.jsx("strong",{children:b.instanceUrl})," as ",s.jsx("strong",{children:b.instanceName}),"."]}),s.jsxs("p",{style:{color:"var(--text2)",fontSize:"0.875rem",marginBottom:24},children:["Open your AI client (Claude Desktop, Cursor, etc.) and start using ServiceNow tools. Try: ",s.jsx("em",{children:'"List my 5 most recent open incidents"'})]}),s.jsx("button",{style:m.btn,onClick:l,children:"Open Dashboard →"})]})]})})}const zu={full:"500+",service_desk:"47",change_coordinator:"32",platform_developer:"51",system_administrator:"38",itom_engineer:"29"};function ap(){return It}function Xn({label:l,value:d,sub:c,subTitle:u,accent:h,valueColor:v}){return s.jsxs("div",{className:"card",style:{padding:"20px 22px",flex:1,minWidth:0,overflow:"hidden"},children:[s.jsx("div",{style:{fontSize:"0.68rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.07em",marginBottom:8,whiteSpace:"nowrap"},children:l}),s.jsx("div",{style:{fontSize:"1.75rem",fontWeight:700,color:v??(h?"var(--accent)":"var(--text)"),lineHeight:1,marginBottom:c?6:0},children:d}),c&&s.jsx("div",{title:u??c,style:{fontSize:"0.78rem",color:"var(--text2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:u?"help":"default"},children:c})]})}async function Bu(l,d,c){const u=await fetch("/api/report/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:l,title:d,format:c})});if(!u.ok)throw new Error(`Report generation failed: ${u.status}`);const h=await u.blob(),v=URL.createObjectURL(h),C=document.createElement("a");C.href=v,C.download=`${d.replace(/[^a-zA-Z0-9_-]/g,"_")||"report"}.${c}`,document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(v)}function Fu(){const[l,d]=z.useState(""),[c,u]=z.useState(""),[h,v]=z.useState("pdf"),[C,b]=z.useState(!1),[k,q]=z.useState("");async function T(){if(!c.trim()){q("Paste some markdown content first");return}b(!0),q("Generating…");try{await Bu(c,l||"NowAIKit Report",h),q(`${h.toUpperCase()} downloaded`)}catch(V){q(`Error: ${V instanceof Error?V.message:"unknown"}`)}finally{b(!1)}}const B=V=>({padding:"5px 14px",borderRadius:5,fontSize:"0.8rem",fontWeight:600,cursor:"pointer",background:V?"var(--accent)":"var(--surface2)",color:V?"#fff":"var(--text2)",border:V?"none":"1px solid var(--border)",transition:"all .15s"});return s.jsxs("div",{className:"card",style:{marginBottom:28,overflow:"hidden"},children:[s.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",gap:8},children:[s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),s.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),s.jsx("polyline",{points:"10 9 9 9 8 9"})]}),s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.07em"},children:"Generate Report"})]}),s.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:10},children:[s.jsx("input",{value:l,onChange:V=>d(V.target.value),placeholder:"Report title (optional)",style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",padding:"8px 12px",fontSize:"0.85rem",outline:"none"}}),s.jsx("textarea",{value:c,onChange:V=>u(V.target.value),placeholder:"Paste markdown content here (analysis results, capability output, etc.)",rows:5,style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",padding:"8px 12px",fontSize:"0.82rem",resize:"vertical",outline:"none",minHeight:80,lineHeight:1.5}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[s.jsx("span",{style:{fontSize:"0.78rem",color:"var(--dim)"},children:"Format:"}),s.jsx("button",{onClick:()=>v("pdf"),style:B(h==="pdf"),children:"PDF"}),s.jsx("button",{onClick:()=>v("pptx"),style:B(h==="pptx"),children:"PPTX"}),s.jsx("div",{style:{flex:1}}),s.jsx("button",{onClick:T,disabled:C||!c.trim(),className:"btn-primary",style:{padding:"8px 18px",fontSize:"0.82rem",borderRadius:6,opacity:C||!c.trim()?.5:1},children:C?"Generating…":"Generate & Download"})]}),k&&s.jsx("div",{style:{fontSize:"0.78rem",color:k.startsWith("Error")?"var(--red)":"var(--text2)"},children:k})]})]})}function Ou({serverOnline:l,serverUrl:d,onRefresh:c}){const[u,h]=z.useState(!1),[v,C]=z.useState("");async function b(){const T=ap();if(!T){C("Desktop app required to manage the server");return}h(!0),C(l?"Stopping…":"Starting…");try{if(l)await T.stopServer(),C("Server stopped");else{const B=await T.startServer();B.success?C("Server started"):C(B.error??"Start failed")}setTimeout(c,1500)}catch(B){C(`Error: ${B instanceof Error?B.message:"unknown"}`)}finally{h(!1)}}async function k(){const T=ap();if(T){h(!0),C("Restarting…");try{await T.stopServer();const B=await T.startServer();C(B.success?"Server restarted":B.error??"Restart failed"),setTimeout(c,1500)}catch(B){C(`Error: ${B instanceof Error?B.message:"unknown"}`)}finally{h(!1)}}}const q=T=>s.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:`var(--${T})`,marginRight:6,flexShrink:0,boxShadow:T==="green"?"0 0 6px var(--green)":"none"}});return s.jsxs("div",{className:"card",style:{marginBottom:28,overflow:"hidden"},children:[s.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",flex:1,minWidth:200},children:[q(l?"green":"dim"),s.jsx("span",{style:{fontWeight:600,fontSize:"0.88rem"},children:"Server"}),s.jsx("span",{style:{marginLeft:8,fontSize:"0.78rem",color:l?"var(--green)":"var(--dim)"},children:l?"Online · MCP Server (stdio)":"Offline"})]}),s.jsxs("div",{style:{display:"flex",gap:6,flexShrink:0},children:[s.jsx("button",{onClick:b,disabled:u,style:{background:l?"rgba(248,113,113,0.12)":"var(--accent)",border:l?"1px solid rgba(248,113,113,0.3)":"none",color:l?"var(--red)":"#fff",borderRadius:6,padding:"6px 14px",fontSize:"0.82rem",fontWeight:600,cursor:"pointer",opacity:u?.6:1},children:u?"…":l?"■ Stop":"▶ Start"}),l&&s.jsx("button",{onClick:k,disabled:u,style:{background:"rgba(34,197,94,0.12)",border:"1px solid rgba(34,197,94,0.3)",color:"var(--green)",borderRadius:6,padding:"6px 14px",fontSize:"0.82rem",fontWeight:600,cursor:"pointer",opacity:u?.6:1},children:"↻ Restart"})]})]}),v&&s.jsx("div",{style:{padding:"8px 16px",fontSize:"0.78rem",color:"var(--text2)",background:"var(--surface2)",borderBottom:"1px solid var(--border)"},children:v}),!l&&!u&&!v&&s.jsxs("div",{style:{padding:"12px 16px",fontSize:"0.82rem",color:"var(--text2)"},children:[s.jsx("strong",{style:{color:"var(--yellow)"},children:"Server is offline."})," ","Click ",s.jsx("strong",{children:"▶ Start"})," above to launch the server, or run ",s.jsx("code",{style:{background:"var(--surface2)",padding:"1px 6px",borderRadius:4},children:"nowaikit server"})," in a terminal."]})]})}function Wu({instances:l,serverOnline:d,appVersion:c,serverUrl:u,onRefresh:h,onNavigate:v}){const C=l.find(b=>b.active);return s.jsxs("div",{children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("h2",{className:"page-title",style:{display:"flex",alignItems:"center",gap:10},children:[s.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"}),s.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Dashboard"]}),s.jsx("button",{className:"btn-ghost",onClick:h,style:{padding:"6px 14px",fontSize:"0.8rem"},children:"↻ Refresh"})]}),s.jsxs("div",{style:{display:"flex",gap:14,marginBottom:28,flexWrap:"wrap"},children:[s.jsx(Xn,{label:"Active Instance",value:(C==null?void 0:C.name)??"—",sub:C==null?void 0:C.url,subTitle:C==null?void 0:C.url,accent:!0}),s.jsx(Xn,{label:"Tools",value:C?zu[C.toolPackage]??"—":"—",sub:C?C.toolPackage.replace(/_/g," ")+" package":"no instance"}),s.jsx(Xn,{label:"Instances",value:l.length,sub:"configured"}),s.jsx(Xn,{label:"Server",value:d?"Online":"Offline",sub:void 0,valueColor:d?"var(--green)":"var(--dim)"})]}),s.jsx(Ou,{serverOnline:d,serverUrl:u,onRefresh:h}),s.jsxs("div",{style:{display:"flex",gap:12,marginBottom:28,flexWrap:"wrap"},children:[s.jsxs("button",{className:"btn-primary",onClick:()=>v("chat"),style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Start Chat"]}),s.jsxs("button",{className:"btn-ghost",onClick:()=>v("tools"),style:{display:"flex",alignItems:"center",gap:8},children:[s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"2",y:"7",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("path",{d:"M16 21V5a2 2 0 00-2-2h-4a2 2 0 00-2 2v16"})]}),"Browse Tools"]}),s.jsxs("button",{className:"btn-ghost",onClick:()=>v("instances"),style:{display:"flex",alignItems:"center",gap:8},children:[s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",ry:"2"}),s.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",ry:"2"}),s.jsx("line",{x1:"6",y1:"6",x2:"6.01",y2:"6"}),s.jsx("line",{x1:"6",y1:"18",x2:"6.01",y2:"18"})]}),"Manage Instances"]})]}),s.jsx(Fu,{}),s.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[s.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.07em"},children:"Configured Instances"}),s.jsx("button",{onClick:()=>v("instances"),style:{background:"none",border:"none",color:"var(--accent)",fontSize:"0.78rem",cursor:"pointer"},children:"Manage →"})]}),l.length===0?s.jsxs("div",{style:{padding:"32px 16px",textAlign:"center",color:"var(--dim)",fontSize:"0.875rem"},children:["No instances configured."," ",s.jsx("button",{onClick:()=>v("instances"),style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",fontSize:"0.875rem"},children:"Add one →"})]}):l.map((b,k)=>s.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"13px 16px",borderBottom:k<l.length-1?"1px solid var(--border)":"none",gap:12,minWidth:0},children:[s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{fontWeight:600,marginBottom:3,display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),b.active&&s.jsx("span",{className:"badge-green",style:{flexShrink:0},children:"active"})]}),s.jsx("div",{title:b.url,style:{fontSize:"0.8rem",color:"var(--text2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"help",maxWidth:"100%"},children:b.url})]}),s.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",fontSize:"0.75rem",color:"var(--dim)",flexShrink:0},children:[s.jsx("span",{className:"badge-dim",children:b.toolPackage.replace(/_/g," ")}),s.jsx("span",{children:"·"}),s.jsx("span",{children:b.authMethod}),s.jsx("span",{children:"·"}),s.jsx("span",{style:{color:b.writeEnabled?"var(--yellow)":"var(--dim)"},children:b.writeEnabled?"read/write":"read-only"})]})]},b.name))]})]})}const Uu={prod:{bg:"rgba(232,70,106,0.15)",fg:"#F06A82"},staging:{bg:"rgba(245,158,11,0.15)",fg:"#FF8A55"},test:{bg:"rgba(59,130,246,0.15)",fg:"#60a5fa"},dev:{bg:"rgba(16,185,129,0.15)",fg:"#34d399"},uat:{bg:"rgba(15,76,129,0.15)",fg:"#3A6FA1"}};function lp(l){return Uu[l.toLowerCase()]??{bg:"var(--surface2)",fg:"var(--dim)"}}function Gu({instances:l,onRemove:d,onSetDefault:c,onTest:u,onAddInstance:h}){const[v,C]=z.useState({}),[b,k]=z.useState(new Set),[q,T]=z.useState(""),B=z.useMemo(()=>{const j=new Map;for(const M of l){const m=M.group||"Default";j.has(m)||j.set(m,[]),j.get(m).push(M)}return Array.from(j.entries()).map(([M,m])=>({name:M,instances:m.sort((N,ee)=>{const w=["prod","staging","uat","test","dev"],G=w.indexOf(N.environment.toLowerCase()),F=w.indexOf(ee.environment.toLowerCase());return(G===-1?99:G)-(F===-1?99:F)}),hasActive:m.some(N=>N.active)})).sort((M,m)=>M.hasActive!==m.hasActive?M.hasActive?-1:1:M.name.localeCompare(m.name))},[l]);z.useMemo(()=>{if(b.size===0&&B.length>0){const j=new Set,M=B.find(m=>m.hasActive);M?j.add(M.name):j.add(B[0].name),k(j)}},[B]);const V=z.useMemo(()=>{if(!q.trim())return B;const j=q.toLowerCase();return B.map(M=>({...M,instances:M.instances.filter(m=>m.name.toLowerCase().includes(j)||m.url.toLowerCase().includes(j)||m.group.toLowerCase().includes(j)||m.environment.toLowerCase().includes(j))})).filter(M=>M.instances.length>0)},[B,q]);function fe(j){k(M=>{const m=new Set(M);return m.has(j)?m.delete(j):m.add(j),m})}function ne(){k(new Set(B.map(j=>j.name)))}function K(){k(new Set)}async function D(j){C(m=>({...m,[j]:"testing"}));const M=await u(j);C(m=>({...m,[j]:M}))}const W=B.length,Z=l.length;return s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:20,flexWrap:"wrap",gap:12},children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"page-title",style:{display:"flex",alignItems:"center",gap:10},children:[s.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",ry:"2"}),s.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",ry:"2"}),s.jsx("line",{x1:"6",y1:"6",x2:"6.01",y2:"6"}),s.jsx("line",{x1:"6",y1:"18",x2:"6.01",y2:"18"})]}),"Instances"]}),s.jsxs("div",{style:{fontSize:"0.78rem",color:"var(--dim)",marginTop:2},children:[W," ",W===1?"group":"groups"," · ",Z," ",Z===1?"instance":"instances"]})]}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{className:"btn-ghost",onClick:ne,style:{fontSize:"0.78rem",padding:"6px 12px"},children:"Expand All"}),s.jsx("button",{className:"btn-ghost",onClick:K,style:{fontSize:"0.78rem",padding:"6px 12px"},children:"Collapse All"}),s.jsx("button",{className:"btn-primary",onClick:h,style:{fontSize:"0.85rem"},children:"+ Add Instance"})]})]}),s.jsx("input",{className:"input",type:"text",value:q,onChange:j=>T(j.target.value),placeholder:`Search ${Z} instances by name, URL, group, or environment…`,style:{marginBottom:16,fontSize:"0.85rem"}}),V.length===0&&s.jsx("div",{style:{textAlign:"center",padding:48,color:"var(--dim)"},children:l.length===0?s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{fontSize:"1.5rem",marginBottom:12},children:"🔗"}),s.jsx("p",{children:"No instances configured yet."}),s.jsxs("p",{style:{fontSize:"0.85rem",marginTop:8,color:"var(--text2)"},children:["Run ",s.jsx("code",{style:{background:"var(--surface2)",padding:"1px 6px",borderRadius:3},children:"nowaikit setup"})," or click ",s.jsx("strong",{children:"Add Instance"}),"."]})]}):s.jsxs("p",{children:['No instances match "',q,'"']})}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:V.map(j=>{const M=b.has(j.name),m=j.instances.reduce((N,ee)=>{const w=ee.environment||"other";return N[w]=(N[w]||0)+1,N},{});return s.jsxs("div",{className:"card",style:{padding:0,overflow:"hidden"},children:[s.jsxs("button",{onClick:()=>fe(j.name),style:{width:"100%",display:"flex",alignItems:"center",gap:14,padding:"14px 20px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",transition:"background .15s"},children:[s.jsx("span",{style:{fontSize:"1.1rem",width:24,textAlign:"center",flexShrink:0},children:j.hasActive?"🟢":"⬡"}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("div",{style:{fontWeight:600,fontSize:"0.95rem",color:"var(--text)"},children:j.name}),s.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text2)",marginTop:2,display:"flex",gap:8,flexWrap:"wrap"},children:[s.jsxs("span",{children:[j.instances.length," ",j.instances.length===1?"instance":"instances"]}),Object.entries(m).map(([N,ee])=>{const w=lp(N);return s.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"0 6px",borderRadius:8,fontSize:"0.68rem",fontWeight:500,background:w.bg,color:w.fg},children:[ee," ",N]},N)})]})]}),j.hasActive&&s.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 10px",borderRadius:12,fontSize:"0.72rem",fontWeight:500,background:"rgba(34,197,94,0.12)",color:"var(--green)"},children:[s.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--green)"}}),"Active"]}),s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--dim)",transition:"transform .2s",transform:M?"rotate(180deg)":"rotate(0deg)"},children:"▼"})]}),M&&s.jsx("div",{style:{borderTop:"1px solid var(--border)"},children:j.instances.map(N=>{const ee=v[N.name],w=lp(N.environment);return s.jsxs("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",gap:14,transition:"background .1s"},children:[s.jsx("div",{style:{width:56,flexShrink:0,textAlign:"center",padding:"4px 0",borderRadius:6,fontSize:"0.72rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",background:w.bg,color:w.fg},children:N.environment||"—"}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:2},children:[s.jsx("span",{style:{fontWeight:600,fontSize:"0.88rem"},children:N.name}),N.active&&s.jsx("span",{style:{background:"#14532d",color:"#86efac",padding:"1px 8px",borderRadius:12,fontSize:"0.68rem",fontWeight:600},children:"ACTIVE"})]}),s.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:N.url}),s.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--dim)",marginTop:2},children:[N.authMethod," · ",N.toolPackage.replace(/_/g," ")," · ",N.writeEnabled?"read/write":"read-only"]})]}),s.jsxs("div",{style:{display:"flex",gap:6,flexShrink:0},children:[!N.active&&s.jsx("button",{className:"btn-ghost",onClick:()=>c(N.name),style:{fontSize:"0.78rem",padding:"5px 12px"},children:"Set Active"}),s.jsx("button",{className:"btn-ghost",onClick:()=>D(N.name),disabled:ee==="testing",style:{fontSize:"0.78rem",padding:"5px 12px"},children:ee==="testing"?"…":"Test"}),s.jsx("button",{onClick:()=>{confirm(`Remove instance "${N.name}"?`)&&d(N.name)},style:{background:"transparent",border:"1px solid rgba(239,68,68,0.3)",borderRadius:6,color:"var(--red)",padding:"5px 12px",cursor:"pointer",fontSize:"0.78rem",opacity:.7,transition:"opacity .15s"},children:"✕"})]}),ee&&ee!=="testing"&&s.jsxs("div",{style:{position:"absolute",bottom:4,left:90,fontSize:"0.72rem",color:ee.ok?"var(--green)":"var(--red)"},children:[ee.ok?"✓":"✗"," ",ee.message]})]},N.name)})})]},j.name)})})]})}const hp=[{id:"all",label:"All"},{id:"incident",label:"Incidents"},{id:"problem",label:"Problems"},{id:"change",label:"Change"},{id:"task",label:"Tasks"},{id:"cmdb",label:"CMDB"},{id:"user",label:"Users"},{id:"knowledge",label:"Knowledge"},{id:"catalog",label:"Catalog"},{id:"script",label:"Scripts"},{id:"event",label:"Events"}],_p=[{id:"all",label:"All Tiers",color:"var(--dim)"},{id:"read",label:"Read",color:"var(--green)"},{id:"write",label:"Write",color:"var(--yellow)"},{id:"scripting",label:"Scripting",color:"#c084fc"},{id:"agentic",label:"Agentic",color:"var(--red)"}];function Xo(l){const d=(l||"").toLowerCase();return d.includes("[scripting]")||d.includes("scripting")?"scripting":d.includes("[agentic]")||d.includes("agentic playbook")?"agentic":d.includes("[write]")||d.includes("write_enabled")||d.includes("requires write")?"write":"read"}function Hu(l){const d=_p.find(c=>c.id===l);return s.jsx("span",{style:{fontSize:"0.65rem",padding:"2px 6px",borderRadius:10,border:`1px solid ${d.color}`,color:d.color,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em"},children:d.label})}function Jo(l){const d=l.toLowerCase();for(const c of hp.slice(1))if(d.includes(c.id))return c.id;return"other"}function $u({tool:l,onClose:d}){var fe,ne;const c=((fe=l.inputSchema)==null?void 0:fe.properties)??{},u=((ne=l.inputSchema)==null?void 0:ne.required)??[],[h,v]=z.useState({}),[C,b]=z.useState(""),[k,q]=z.useState(!1),[T,B]=z.useState("");async function V(){var D;q(!0),b(""),B("");const K=It;if(!K){B("Desktop app required"),q(!1);return}try{const W={};for(const[j,M]of Object.entries(h)){if(!M&&!u.includes(j))continue;const m=(D=c[j])==null?void 0:D.type;m==="number"||m==="integer"?W[j]=Number(M):m==="boolean"?W[j]=M==="true":W[j]=M}const Z=await K.executeTool(l.name,W);Z.success?b(typeof Z.result=="string"?Z.result:JSON.stringify(Z.result,null,2)):B(Z.error??"Tool execution failed")}catch(W){B(W instanceof Error?W.message:"Error")}q(!1)}return s.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:420,background:"var(--surface)",borderLeft:"1px solid var(--border2)",boxShadow:"var(--shadow)",zIndex:100,display:"flex",flexDirection:"column"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[s.jsx("code",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:l.name}),s.jsx("button",{onClick:d,style:{background:"none",border:"none",color:"var(--dim)",fontSize:"1.2rem",padding:4},children:"✕"})]}),s.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:[l.description&&s.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text2)",marginBottom:20,lineHeight:1.6},children:l.description}),Object.entries(c).map(([K,D])=>s.jsxs("div",{style:{marginBottom:14},children:[s.jsxs("label",{style:{display:"block",fontSize:"0.78rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:5},children:[K,u.includes(K)&&s.jsx("span",{style:{color:"var(--red)",marginLeft:3},children:"*"})]}),D.description&&s.jsx("div",{style:{fontSize:"0.76rem",color:"var(--text2)",marginBottom:5},children:D.description}),D.enum?s.jsxs("select",{value:h[K]??"",onChange:W=>v(Z=>({...Z,[K]:W.target.value})),style:{width:"100%",background:"var(--surface2)",border:"1px solid var(--border2)",borderRadius:6,color:"var(--text)",padding:"8px 10px",fontSize:"0.85rem"},children:[s.jsx("option",{value:"",children:"— select —"}),D.enum.map(W=>s.jsx("option",{value:W,children:W},W))]}):s.jsx("input",{className:"input",type:D.type==="number"||D.type==="integer"?"number":"text",value:h[K]??"",onChange:W=>v(Z=>({...Z,[K]:W.target.value})),placeholder:D.type==="boolean"?"true / false":D.type??""})]},K)),Object.keys(c).length===0&&s.jsx("div",{style:{color:"var(--dim)",fontSize:"0.85rem"},children:"No parameters required."})]}),s.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",flexShrink:0},children:[s.jsx("button",{className:"btn-primary",onClick:V,disabled:k,style:{width:"100%",padding:10,opacity:k?.6:1},children:k?"Running…":"Run Tool"}),T&&s.jsxs("div",{style:{color:"var(--red)",fontSize:"0.8rem",marginTop:10},children:["✗ ",T]}),C&&s.jsx("pre",{className:"result-box",style:{marginTop:12,maxHeight:260},children:C})]})]})}function Vu({activeToolPackage:l,serverOnline:d,serverUrl:c,onRestart:u}){const[h,v]=z.useState([]),[C,b]=z.useState(!0),[k,q]=z.useState("all"),[T,B]=z.useState("all"),[V,fe]=z.useState(""),[ne,K]=z.useState(null),[D,W]=z.useState(!1);z.useEffect(()=>{const j=It;if(!j){b(!1);return}j.listTools().then(M=>v(M??[])).catch(()=>{}).finally(()=>b(!1))},[]);const Z=h.filter(j=>!(k!=="all"&&Jo(j.name)!==k||T!=="all"&&Xo(j.description)!==T||V&&!j.name.toLowerCase().includes(V.toLowerCase())&&!(j.description??"").toLowerCase().includes(V.toLowerCase())));return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"calc(100vh - 56px)"},children:[s.jsxs("div",{className:"page-header",style:{marginBottom:16},children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"page-title",style:{display:"flex",alignItems:"center",gap:10},children:[s.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"2",y:"7",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("path",{d:"M16 21V5a2 2 0 00-2-2h-4a2 2 0 00-2 2v16"})]}),"Tools"]}),!C&&s.jsxs("div",{style:{fontSize:"0.78rem",color:"var(--dim)",marginTop:2},children:[Z.length," of ",h.length," tools · ",l.replace(/_/g," ")," package"]})]}),s.jsx("input",{className:"input",placeholder:"Search tools…",value:V,onChange:j=>fe(j.target.value),style:{width:220}})]}),s.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:10},children:hp.map(j=>{const M=j.id==="all"?h.length:h.filter(m=>Jo(m.name)===j.id).length;return M===0&&j.id!=="all"?null:s.jsxs("button",{onClick:()=>q(j.id),style:{padding:"5px 12px",borderRadius:20,fontSize:"0.8rem",border:"1px solid",borderColor:k===j.id?"var(--accent)":"var(--border2)",background:k===j.id?"var(--accent-bg)":"transparent",color:k===j.id?"var(--accent)":"var(--text2)",fontWeight:k===j.id?600:400,transition:"all .15s"},children:[j.label," ",s.jsx("span",{style:{opacity:.7,marginLeft:2},children:M})]},j.id)})}),s.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:20,alignItems:"center"},children:[s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--dim)",marginRight:4},children:"Tier:"}),_p.map(j=>{const M=j.id==="all"?h.length:h.filter(m=>Xo(m.description)===j.id).length;return s.jsxs("button",{onClick:()=>B(j.id),style:{padding:"4px 10px",borderRadius:16,fontSize:"0.75rem",border:"1px solid",borderColor:T===j.id?j.color:"var(--border2)",background:T===j.id?`${j.color}15`:"transparent",color:T===j.id?j.color:"var(--text2)",fontWeight:T===j.id?600:400,transition:"all .15s"},children:[j.label," ",s.jsx("span",{style:{opacity:.7,marginLeft:2},children:M})]},j.id)})]}),!d&&!C&&s.jsxs("div",{style:{background:"rgba(251,191,36,0.1)",border:"1px solid rgba(251,191,36,0.25)",borderRadius:8,padding:"10px 16px",marginBottom:16,fontSize:"0.85rem",color:"var(--yellow)",display:"flex",alignItems:"center",gap:10},children:[s.jsx("span",{children:"⚠"}),s.jsxs("span",{style:{flex:1},children:["HTTP server offline — ",s.jsx("strong",{children:"Run"})," will fail."]}),s.jsx("button",{disabled:D,onClick:async()=>{const j=It;j&&(W(!0),await j.startServer(),W(!1),u==null||u())},style:{background:"rgba(251,191,36,0.2)",border:"1px solid rgba(251,191,36,0.4)",color:"var(--yellow)",borderRadius:6,padding:"4px 12px",fontSize:"0.8rem",cursor:"pointer",flexShrink:0,opacity:D?.6:1},children:D?"Starting…":"Start Server"})]}),C?s.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--dim)",gap:10},children:[s.jsx("span",{className:"spinner"})," Loading tools…"]}):Z.length===0?s.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--dim)"},children:h.length===0?"No tools loaded — ensure HTTP server is running":"No tools match the filter"}):s.jsx("div",{style:{flex:1,overflowY:"auto",display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(260px,1fr))",gap:10,alignContent:"start"},children:Z.map(j=>s.jsxs("button",{onClick:()=>K((ne==null?void 0:ne.name)===j.name?null:j),style:{background:(ne==null?void 0:ne.name)===j.name?"var(--accent-bg)":"var(--surface)",border:`1px solid ${(ne==null?void 0:ne.name)===j.name?"var(--accent)":"var(--border)"}`,borderRadius:"var(--radius)",padding:"14px 16px",textAlign:"left",cursor:"pointer",transition:"all .15s"},children:[s.jsx("div",{style:{fontFamily:"monospace",fontSize:"0.82rem",color:"var(--accent)",fontWeight:600,marginBottom:5},children:j.name}),s.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text2)",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:j.description||"No description"}),s.jsxs("div",{style:{marginTop:8,display:"flex",gap:6,alignItems:"center"},children:[s.jsx("span",{className:"badge-dim",children:Jo(j.name)}),Hu(Xo(j.description))]})]},j.name))}),ne&&s.jsx($u,{tool:ne,serverUrl:c,onClose:()=>K(null)})]})}const Ku=[15,25,50,100];function Yu(){return It}function Qu(){const[l,d]=z.useState([]),[c,u]=z.useState(!0),[h,v]=z.useState(""),[C,b]=z.useState(null),[k,q]=z.useState(0),[T,B]=z.useState(25);function V(){u(!0),b(null),q(0);const m=Yu();if(!m){u(!1);return}m.getAuditLogs(2e3).then(N=>{d(N??[])}).catch(()=>{}).finally(()=>u(!1))}z.useEffect(()=>{V()},[]);const fe=l.filter(m=>{if(!h)return!0;const N=h.toLowerCase();return(m.tool??"").toLowerCase().includes(N)||(m.instance??"").toLowerCase().includes(N)||(m.provider??"").toLowerCase().includes(N)||(m.model??"").toLowerCase().includes(N)||(m.error??"").toLowerCase().includes(N)||(m.event??"").toLowerCase().includes(N)||(m.user??"").toLowerCase().includes(N)}),ne=Math.ceil(fe.length/T),K=fe.slice(k*T,(k+1)*T);function D(m){if(!m)return"—";try{const N=new Date(m);return N.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})+" "+N.toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return m}}function W(m){return m.success===!0?s.jsx("span",{className:"badge-green",children:"ok"}):m.success===!1?s.jsx("span",{className:"badge-red",children:"error"}):s.jsx("span",{className:"badge-dim",children:"—"})}function Z(){const m=["Time","Event","Tool","Instance","User","Provider","Model","Status","Duration (ms)","Input Tokens","Output Tokens","Error"],N=fe.map(X=>[X.ts??"",X.event??"",X.tool||X.resource||X.prompt||"",X.instance??"",X.user??"",X.provider??"",X.model??"",X.success===!0?"ok":X.success===!1?"error":"",X.durationMs!=null?String(X.durationMs):"",X.inputTokens!=null?String(X.inputTokens):"",X.outputTokens!=null?String(X.outputTokens):"",X.error??""]),ee=[m,...N].map(X=>X.map(ae=>`"${String(ae).replace(/"/g,'""')}"`).join(",")).join(`
52
- `),w=new Blob([ee],{type:"text/csv"}),G=URL.createObjectURL(w),F=document.createElement("a");F.href=G,F.download=`nowaikit-audit-${new Date().toISOString().slice(0,10)}.csv`,F.click(),URL.revokeObjectURL(G)}const j={padding:"8px 12px",fontSize:"0.72rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.06em",textAlign:"left",borderBottom:"1px solid var(--border)",fontWeight:600},M={padding:"10px 12px",fontSize:"0.82rem",borderBottom:"1px solid var(--border)",verticalAlign:"middle"};return s.jsxs("div",{children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("h2",{className:"page-title",style:{display:"flex",alignItems:"center",gap:10},children:[s.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),s.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),"Audit Log"]}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("input",{className:"input",placeholder:"Filter by tool, instance, provider, model…",value:h,onChange:m=>{v(m.target.value),q(0)},style:{width:280}}),s.jsx("button",{className:"btn-ghost",onClick:Z,disabled:fe.length===0,style:{padding:"6px 14px",fontSize:"0.8rem"},title:"Export filtered logs as CSV",children:"Export CSV"}),s.jsx("button",{className:"btn-ghost",onClick:V,style:{padding:"6px 14px",fontSize:"0.8rem"},children:"↻"})]})]}),s.jsxs("div",{style:{fontSize:"0.78rem",color:"var(--dim)",marginBottom:14},children:["Log: ",s.jsx("code",{style:{color:"var(--text2)"},children:"~/.config/nowaikit/audit.jsonl"}),!c&&s.jsxs("span",{style:{marginLeft:12},children:["Showing ",K.length," of ",fe.length," entries",fe.length!==l.length&&` (${l.length} total)`]})]}),c?s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:200,color:"var(--dim)",gap:10},children:[s.jsx("span",{className:"spinner"})," Loading logs…"]}):l.length===0?s.jsxs("div",{className:"card",style:{padding:32,textAlign:"center",color:"var(--dim)"},children:[s.jsx("div",{style:{marginBottom:8},children:"No audit log entries found."}),s.jsx("div",{style:{fontSize:"0.8rem"},children:"Logs appear after tools are called or chat messages are sent."})]}):s.jsxs("div",{className:"card",style:{overflow:"auto"},children:[s.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:1e3},children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{style:j,children:"Time"}),s.jsx("th",{style:j,children:"Event"}),s.jsx("th",{style:j,children:"Tool"}),s.jsx("th",{style:j,children:"Instance"}),s.jsx("th",{style:j,children:"User"}),s.jsx("th",{style:j,children:"Provider"}),s.jsx("th",{style:j,children:"Model"}),s.jsx("th",{style:j,children:"Status"}),s.jsx("th",{style:j,children:"Tokens"}),s.jsx("th",{style:j,children:"Duration"}),s.jsx("th",{style:j,children:"Error"})]})}),s.jsx("tbody",{children:K.map((m,N)=>s.jsxs("tr",{onClick:()=>b(C===m?null:m),style:{cursor:"pointer",background:C===m?"var(--surface2)":"transparent",transition:"background .1s"},children:[s.jsx("td",{style:{...M,color:"var(--text2)",fontFamily:"monospace",fontSize:"0.78rem",whiteSpace:"nowrap"},children:D(m.ts)}),s.jsx("td",{style:{...M,fontSize:"0.75rem",color:"var(--dim)"},children:m.event??"—"}),s.jsx("td",{style:{...M,fontFamily:"monospace",color:"var(--accent)",fontWeight:500},children:m.tool||m.resource||m.prompt||"—"}),s.jsx("td",{style:{...M,fontSize:"0.8rem",color:"var(--text2)"},children:m.instance??"—"}),s.jsx("td",{style:{...M,fontSize:"0.8rem",color:"var(--text2)"},children:m.user??"—"}),s.jsx("td",{style:{...M,fontSize:"0.8rem",color:"var(--text2)"},children:m.provider??"—"}),s.jsx("td",{style:{...M,fontFamily:"monospace",fontSize:"0.75rem",color:"var(--text2)",maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.model??"—"}),s.jsx("td",{style:M,children:W(m)}),s.jsx("td",{style:{...M,fontFamily:"monospace",fontSize:"0.75rem",color:"var(--text2)",whiteSpace:"nowrap"},children:m.inputTokens!=null||m.outputTokens!=null?`${m.inputTokens??0}→${m.outputTokens??0}`:"—"}),s.jsx("td",{style:{...M,color:"var(--text2)"},children:m.durationMs!=null?`${m.durationMs}ms`:"—"}),s.jsx("td",{style:{...M,color:"var(--red)",fontSize:"0.75rem",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.error??""})]},k*T+N))})]}),fe.length>0&&s.jsxs("div",{style:{padding:"12px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid var(--border)",flexWrap:"wrap",gap:8},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.78rem",color:"var(--text2)"},children:[s.jsx("span",{children:"Rows:"}),s.jsx("select",{value:T,onChange:m=>{B(Number(m.target.value)),q(0)},style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:4,color:"var(--text)",padding:"3px 6px",fontSize:"0.78rem"},children:Ku.map(m=>s.jsx("option",{value:m,children:m},m))})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[s.jsx("button",{className:"btn-ghost",onClick:()=>q(0),disabled:k===0,style:{padding:"4px 8px",fontSize:"0.75rem"},children:"« First"}),s.jsx("button",{className:"btn-ghost",onClick:()=>q(m=>Math.max(0,m-1)),disabled:k===0,style:{padding:"4px 8px",fontSize:"0.75rem"},children:"‹ Prev"}),(()=>{const m=[],N=Math.max(0,k-2),ee=Math.min(ne-1,k+2);N>0&&m.push(0),N>1&&m.push(-1);for(let w=N;w<=ee;w++)m.push(w);return ee<ne-2&&m.push(-2),ee<ne-1&&m.push(ne-1),m.map((w,G)=>w<0?s.jsx("span",{style:{padding:"0 4px",color:"var(--dim)",fontSize:"0.75rem"},children:"…"},`e${G}`):s.jsx("button",{className:"btn-ghost",onClick:()=>q(w),style:{padding:"4px 8px",fontSize:"0.75rem",minWidth:28,background:w===k?"var(--accent)":"transparent",color:w===k?"#fff":"var(--text2)",borderRadius:4,fontWeight:w===k?600:400},children:w+1},w))})(),s.jsx("button",{className:"btn-ghost",onClick:()=>q(m=>Math.min(ne-1,m+1)),disabled:k>=ne-1,style:{padding:"4px 8px",fontSize:"0.75rem"},children:"Next ›"}),s.jsx("button",{className:"btn-ghost",onClick:()=>q(ne-1),disabled:k>=ne-1,style:{padding:"4px 8px",fontSize:"0.75rem"},children:"Last »"})]}),s.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--dim)"},children:[k*T+1,"–",Math.min((k+1)*T,fe.length)," of ",fe.length]})]}),C&&s.jsxs("div",{style:{padding:"14px 16px",borderTop:"2px solid var(--border2)",background:"var(--surface2)"},children:[s.jsx("div",{style:{fontSize:"0.72rem",color:"var(--dim)",marginBottom:6,textTransform:"uppercase",letterSpacing:"0.06em"},children:"Entry Detail"}),s.jsx("pre",{style:{fontSize:"0.78rem",overflowX:"auto",color:"var(--text)",lineHeight:1.5},children:JSON.stringify(C,null,2)})]})]})]})}function Xu({size:l=16,color:d="currentColor",style:c}){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,fill:d,viewBox:"0 0 16 16",style:c,children:s.jsx("path",{d:"m3.127 10.604 3.135-1.76.053-.153-.053-.085H6.11l-.525-.032-1.791-.048-1.554-.065-1.505-.08-.38-.081L0 7.832l.036-.234.32-.214.455.04 1.009.069 1.513.105 1.097.064 1.626.17h.259l.036-.105-.089-.065-.068-.064-1.566-1.062-1.695-1.121-.887-.646-.48-.327-.243-.306-.104-.67.435-.48.585.04.15.04.593.456 1.267.981 1.654 1.218.242.202.097-.068.012-.049-.109-.181-.9-1.626-.96-1.655-.428-.686-.113-.411a2 2 0 0 1-.068-.484l.496-.674L4.446 0l.662.089.279.242.411.94.666 1.48 1.033 2.014.302.597.162.553.06.17h.105v-.097l.085-1.134.157-1.392.154-1.792.052-.504.25-.605.497-.327.387.186.319.456-.045.294-.19 1.23-.37 1.93-.243 1.29h.142l.161-.16.654-.868 1.097-1.372.484-.545.565-.601.363-.287h.686l.505.751-.226.775-.707.895-.585.759-.839 1.13-.524.904.048.072.125-.012 1.897-.403 1.024-.186 1.223-.21.553.258.06.263-.218.536-1.307.323-1.533.307-2.284.54-.028.02.032.04 1.029.098.44.024h1.077l2.005.15.525.346.315.424-.053.323-.807.411-3.631-.863-.872-.218h-.12v.073l.726.71 1.331 1.202 1.667 1.55.084.383-.214.302-.226-.032-1.464-1.101-.565-.497-1.28-1.077h-.084v.113l.295.432 1.557 2.34.08.718-.112.234-.404.141-.444-.08-.911-1.28-.94-1.44-.759-1.291-.093.053-.448 4.821-.21.246-.484.186-.403-.307-.214-.496.214-.98.258-1.28.21-1.016.19-1.263.112-.42-.008-.028-.092.012-.953 1.307-1.448 1.957-1.146 1.227-.274.109-.477-.247.045-.44.266-.39 1.586-2.018.956-1.25.617-.723-.004-.105h-.036l-4.212 2.736-.75.096-.324-.302.04-.496.154-.162 1.267-.871z"})})}function Ju({size:l=16,color:d="currentColor",style:c}){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,fill:d,viewBox:"0 0 16 16",style:c,children:s.jsx("path",{d:"M14.949 6.547a3.94 3.94 0 0 0-.348-3.273 4.11 4.11 0 0 0-4.4-1.934A4.1 4.1 0 0 0 8.423.2 4.15 4.15 0 0 0 6.305.086a4.1 4.1 0 0 0-1.891.948 4.04 4.04 0 0 0-1.158 1.753 4.1 4.1 0 0 0-1.563.679A4 4 0 0 0 .554 4.72a3.99 3.99 0 0 0 .502 4.731 3.94 3.94 0 0 0 .346 3.274 4.11 4.11 0 0 0 4.402 1.933c.382.425.852.764 1.377.995.526.231 1.095.35 1.67.346 1.78.002 3.358-1.132 3.901-2.804a4.1 4.1 0 0 0 1.563-.68 4 4 0 0 0 1.14-1.253 3.99 3.99 0 0 0-.506-4.716m-6.097 8.406a3.05 3.05 0 0 1-1.945-.694l.096-.054 3.23-1.838a.53.53 0 0 0 .265-.455v-4.49l1.366.778q.02.011.025.035v3.722c-.003 1.653-1.361 2.992-3.037 2.996m-6.53-2.75a2.95 2.95 0 0 1-.36-2.01l.095.057L5.29 12.09a.53.53 0 0 0 .527 0l3.949-2.246v1.555a.05.05 0 0 1-.022.041L6.473 13.3c-1.454.826-3.311.335-4.15-1.098m-.85-6.94A3.02 3.02 0 0 1 3.07 3.949v3.785a.51.51 0 0 0 .262.451l3.93 2.237-1.366.779a.05.05 0 0 1-.048 0L2.585 9.342a2.98 2.98 0 0 1-1.113-4.094zm11.216 2.571L8.747 5.576l1.362-.776a.05.05 0 0 1 .048 0l3.265 1.86a3 3 0 0 1 1.173 1.207 2.96 2.96 0 0 1-.27 3.2 3.05 3.05 0 0 1-1.36.997V8.279a.52.52 0 0 0-.276-.445m1.36-2.015-.097-.057-3.226-1.855a.53.53 0 0 0-.53 0L6.249 6.153V4.598a.04.04 0 0 1 .019-.04L9.533 2.7a3.07 3.07 0 0 1 3.257.139c.474.325.843.778 1.066 1.303.223.526.289 1.103.191 1.664zM5.503 8.575 4.139 7.8a.05.05 0 0 1-.026-.037V4.049c0-.57.166-1.127.476-1.607s.752-.864 1.275-1.105a3.08 3.08 0 0 1 3.234.41l-.096.054-3.23 1.838a.53.53 0 0 0-.265.455zm.742-1.577 1.758-1 1.762 1v2l-1.755 1-1.762-1z"})})}function Zu({size:l=16,color:d="currentColor",style:c}){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,fill:d,viewBox:"0 0 28 28",style:c,children:s.jsx("path",{d:"M14 28C14 26.0633 13.6267 24.2433 12.88 22.54C12.1567 20.8367 11.165 19.355 9.905 18.095C8.645 16.835 7.16333 15.8433 5.46 15.12C3.75667 14.3733 1.93667 14 0 14C1.93667 14 3.75667 13.6383 5.46 12.915C7.16333 12.1683 8.645 11.165 9.905 9.905C11.165 8.645 12.1567 7.16333 12.88 5.46C13.6267 3.75667 14 1.93667 14 0C14 1.93667 14.3617 3.75667 15.085 5.46C15.8317 7.16333 16.835 8.645 18.095 9.905C19.355 11.165 20.8367 12.1683 22.54 12.915C24.2433 13.6383 26.0633 14 28 14C26.0633 14 24.2433 14.3733 22.54 15.12C20.8367 15.8433 19.355 16.835 18.095 18.095C16.835 19.355 15.8317 20.8367 15.085 22.54C14.3617 24.2433 14 26.0633 14 28Z"})})}function ey({size:l=16,color:d="currentColor",style:c}){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,fill:d,viewBox:"0 0 24 24",style:c,children:s.jsx("path",{d:"M3 3v18h18V3zm11.72 13.37c-.41.38-.82.66-1.33.87l-.21.09c-.83.3-1.82.21-2.63-.1-.45-.21-.82-.46-1.19-.8.33-.41.66-.75 1.07-1.07l.27.21c.5.35 1 .47 1.61.41.62-.12 1.12-.4 1.52-.9.37-.61.41-1.09.41-1.8V10.4c0-.72-.15-1.18-.6-1.74-.61-.49-1.17-.74-1.96-.7-.66.11-1.19.42-1.59.95-.33.53-.48 1.07-.37 1.69.2.68.45 1.25 1.07 1.61.52.27.98.32 1.56.33h.25c.2.02.4.02.61.03V14c-1.49.06-2.65.06-3.84-.97a4.22 4.22 0 0 1-1.23-2.8c.04-.88.35-1.6.86-2.32l.15-.23c1.43-1.51 3.7-1.61 5.31-.31l.17.14c.58.52.96 1.25 1.08 2.01 0 .16.01.33.01.49v3.6c0 1.05-.3 1.95-1.02 2.74Z"})})}function ty({size:l=16,color:d="currentColor",style:c}){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,fill:"none",stroke:d,viewBox:"0 0 512 512",style:c,children:[s.jsx("path",{d:"M3 248.945C18 248.945 76 236 106 219C136 202 136 202 198 158C276.497 102.293 332 120.945 423 120.945",strokeWidth:"90",strokeLinecap:"round"}),s.jsx("path",{d:"M511 121.5L357.25 210.268L357.25 32.7324L511 121.5Z",fill:d,stroke:"none"}),s.jsx("path",{d:"M0 249C15 249 73 261.945 103 278.945C133 295.945 133 295.945 195 339.945C273.497 395.652 329 377 420 377",strokeWidth:"90",strokeLinecap:"round"}),s.jsx("path",{d:"M508 376.445L354.25 287.678L354.25 465.213L508 376.445Z",fill:d,stroke:"none"})]})}function ry({size:l=16,color:d="currentColor",style:c}){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,fill:d,viewBox:"0 0 24 24",style:c,children:s.jsx("path",{d:"M12 2C8.5 2 6 4.5 6 7.5c0 1.5.6 2.8 1.5 3.8-.3.5-.5 1.1-.5 1.7v5c0 1.7 1.3 3 3 3h4c1.7 0 3-1.3 3-3v-5c0-.6-.2-1.2-.5-1.7.9-1 1.5-2.3 1.5-3.8C18 4.5 15.5 2 12 2zm-2 8.5c-.6 0-1-.7-1-1.5s.4-1.5 1-1.5 1 .7 1 1.5-.4 1.5-1 1.5zm4 0c-.6 0-1-.7-1-1.5s.4-1.5 1-1.5 1 .7 1 1.5-.4 1.5-1 1.5zm-4.5 3.5c0-.3.2-.5.5-.5h4c.3 0 .5.2.5.5s-.2.5-.5.5h-4c-.3 0-.5-.2-.5-.5z"})})}function iy({size:l=16,color:d="currentColor",style:c}){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,fill:d,viewBox:"0 0 24 24",style:c,children:s.jsx("path",{d:"M4 3h16c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2h-6l-4 4v-4H4c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2zm1 3v2h2V6H5zm0 3v2h2V9H5zm0 3v2h2v-2H5zm4-6v8h6V6H9zm7 0v2h2V6h-2zm0 3v2h2V9h-2z"})})}const vp={anthropic:Xu,openai:Ju,google:Zu,groq:ey,openrouter:ty,ollama:ry,lmstudio:iy};function ny(l){const d=new Map;for(const u of l)if(u.role==="user"&&Array.isArray(u.content))for(const h of u.content)h.type==="tool_result"&&d.set(h.tool_use_id,h);const c=[];for(const u of l)if(u.role==="user"&&typeof u.content=="string")c.push({kind:"user",text:u.content});else if(u.role==="assistant"&&Array.isArray(u.content))for(const h of u.content)h.type==="text"&&c.push({kind:"assistant",parts:[h]}),h.type==="tool_use"&&c.push({kind:"tool",tu:h,result:d.get(h.id)});return c}function sy(l){const d=/```[\w]*\n?([\s\S]*?)```/g,c=[];let u=0,h=0,v;for(;(v=d.exec(l))!==null;)v.index>u&&c.push(cp(l.slice(u,v.index),h++)),c.push(s.jsx("pre",{style:{background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,padding:"10px 14px",overflowX:"auto",fontSize:"0.8rem",margin:"8px 0"},children:s.jsx("code",{children:v[1].trim()})},h++)),u=v.index+v[0].length;return u<l.length&&c.push(cp(l.slice(u),h++)),c}function cp(l,d){const c=l.split(/(`[^`\n]+`|\*\*[^*]+\*\*)/g);return s.jsx("span",{style:{whiteSpace:"pre-wrap"},children:c.map((u,h)=>u.startsWith("`")&&u.endsWith("`")?s.jsx("code",{style:{background:"var(--surface3)",padding:"1px 5px",borderRadius:4,fontSize:"0.82em"},children:u.slice(1,-1)},h):u.startsWith("**")&&u.endsWith("**")?s.jsx("strong",{children:u.slice(2,-2)},h):u)},d)}async function oy(l,d){const c=await fetch("/api/report/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:l,title:"NowAIKit Chat Export",format:d})});if(!c.ok)throw new Error(`Report generation failed: ${c.status}`);const u=await c.blob(),h=URL.createObjectURL(u),v=document.createElement("a");v.href=h,v.download=`chat-export-${Date.now()}.${d}`,document.body.appendChild(v),v.click(),document.body.removeChild(v),URL.revokeObjectURL(h)}function ay(l){return l.length>500&&/^#{1,3}\s/m.test(l)}function ly({text:l}){const[d,c]=z.useState(null);async function u(v){c(v);try{await oy(l,v)}catch{}finally{c(null)}}const h={background:"var(--surface)",border:"1px solid var(--border)",borderRadius:4,color:"var(--text2)",padding:"2px 8px",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",transition:"all .15s"};return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[s.jsx("span",{style:{fontSize:"0.68rem",color:"var(--dim)"},children:"Export:"}),s.jsx("button",{onClick:()=>u("pdf"),disabled:d!==null,style:{...h,opacity:d?.5:1},children:d==="pdf"?"…":"PDF"}),s.jsx("button",{onClick:()=>u("pptx"),disabled:d!==null,style:{...h,opacity:d?.5:1},children:d==="pptx"?"…":"PPTX"})]})}function cy({tu:l,result:d}){const[c,u]=z.useState(!1),h=d&&!d.is_error;return s.jsxs("div",{style:{background:"#1a1f35",border:"1px solid #2e3a5f",borderRadius:8,fontSize:"0.78rem",overflow:"hidden",fontFamily:"monospace"},children:[s.jsxs("button",{onClick:()=>u(v=>!v),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"transparent",border:"none",color:"#93c5fd",cursor:"pointer",textAlign:"left"},children:[s.jsx("span",{style:{fontSize:"0.7rem",opacity:.7},children:c?"▼":"▶"}),s.jsx("span",{style:{fontWeight:600},children:l.name}),d&&s.jsx("span",{className:h?"badge-green":"badge-red",style:{marginLeft:"auto"},children:h?"ok":"error"}),!d&&s.jsx("span",{className:"badge-dim",style:{marginLeft:"auto"},children:"running…"})]}),c&&s.jsxs("div",{style:{padding:"8px 10px",borderTop:"1px solid #2e3a5f"},children:[s.jsx("div",{style:{color:"var(--dim)",fontSize:"0.68rem",marginBottom:3,letterSpacing:"0.05em"},children:"INPUT"}),s.jsx("pre",{style:{fontSize:"0.74rem",overflowX:"auto",color:"#a5f3fc",marginBottom:d?8:0},children:JSON.stringify(l.input,null,2)}),d&&s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{color:"var(--dim)",fontSize:"0.68rem",marginBottom:3,letterSpacing:"0.05em"},children:d.is_error?"ERROR":"OUTPUT"}),s.jsx("pre",{style:{fontSize:"0.74rem",overflowX:"auto",color:d.is_error?"var(--red)":"#a5f3fc"},children:d.content})]})]})]})}const ra=new Set(["ollama","lmstudio"]),pp=[{id:"anthropic",label:"Claude"},{id:"openai",label:"ChatGPT"},{id:"google",label:"Gemini"},{id:"groq",label:"Groq"},{id:"openrouter",label:"OpenRouter"},{id:"ollama",label:"Ollama"},{id:"lmstudio",label:"LM Studio"}],dp={anthropic:[{value:"claude-opus-5",label:"Claude Opus 5"},{value:"claude-fable-5",label:"Claude Fable 5"},{value:"claude-sonnet-5",label:"Claude Sonnet 5"},{value:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5"}],openai:[{value:"gpt-5.6-sol",label:"GPT-5.6 Sol"},{value:"gpt-5.6-terra",label:"GPT-5.6 Terra"},{value:"gpt-5.6-luna",label:"GPT-5.6 Luna"},{value:"gpt-5.5",label:"GPT-5.5"}],google:[{value:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro"},{value:"gemini-3-pro-preview",label:"Gemini 3 Pro"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash"},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash"},{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro"}],groq:[{value:"meta-llama/llama-4-maverick-17b-128e-instruct",label:"Llama 4 Maverick"},{value:"meta-llama/llama-4-scout-17b-16e-instruct",label:"Llama 4 Scout"},{value:"llama-3.3-70b-versatile",label:"Llama 3.3 70B"},{value:"llama-3.1-8b-instant",label:"Llama 3.1 8B"}],openrouter:[{value:"openai/o1-pro",label:"OpenAI o1 Pro"},{value:"xai/grok-4",label:"Grok 4 (xAI)"},{value:"anthropic/claude-sonnet-5",label:"Claude Sonnet 5"},{value:"google/gemini-3-flash-preview",label:"Gemini 3 Flash"},{value:"deepseek/deepseek-r1:free",label:"DeepSeek R1 (free)"},{value:"meta-llama/llama-4-maverick-17b-128e-instruct",label:"Llama 4 Maverick"},{value:"meta-llama/llama-3.3-70b-instruct",label:"Llama 3.3 70B"},{value:"google/gemma-2-9b-it:free",label:"Gemma 2 9B (free)"}],ollama:[{value:"llama3.3:latest",label:"Llama 3.3 70B"},{value:"llama3.2:latest",label:"Llama 3.2 3B"},{value:"qwen3:latest",label:"Qwen 3"},{value:"deepseek-r1:latest",label:"DeepSeek R1"},{value:"gemma3:latest",label:"Gemma 3"},{value:"phi4:latest",label:"Phi-4"},{value:"mistral:latest",label:"Mistral"},{value:"granite3.3:latest",label:"Granite 3.3"}],lmstudio:[{value:"llama-3.3-70b",label:"Llama 3.3 70B"},{value:"qwen3-8b",label:"Qwen 3 8B"},{value:"deepseek-r1-distill",label:"DeepSeek R1 Distill"},{value:"gemma-3-9b",label:"Gemma 3 9B"},{value:"phi-4",label:"Phi-4"},{value:"mistral-7b",label:"Mistral 7B"}]},py=["Show me my 5 most recent open incidents","List all critical change requests scheduled for this week","Find all CIs with no owner assigned","What problems have been open for more than 30 days?"],up=128,dy=new Set(["query_records","get_record","get_table_schema","get_user","get_group","get_incident","create_incident","update_incident","resolve_incident","get_change_request","list_change_requests","create_change_request","update_change_request","get_task","list_my_tasks","update_task","get_problem","create_problem","update_problem","search_knowledge","get_knowledge_article","add_work_note","add_comment","search_cmdb_ci","get_cmdb_ci","list_users","list_groups","natural_language_search"]),yp={incident:["incident","resolve_incident","close_incident","add_work_note","add_comment"],incidents:["incident","query_records"],change:["change_request","change"],changes:["change_request","query_records"],problem:["problem"],problems:["problem","query_records"],task:["task"],tasks:["task","query_records"],user:["user","get_user"],users:["user","list_users","query_records"],group:["group"],groups:["group","list_groups"],knowledge:["knowledge"],kb:["knowledge"],ci:["cmdb","ci"],cmdb:["cmdb","ci"],server:["cmdb","ci_server"],catalog:["catalog"],flow:["flow"],report:["report","aggregate","trend"],sla:["sla"],approval:["approval"],hr:["hr_"],security:["security"],vulnerability:["vulnerab"],asset:["asset"],license:["license"],portal:["portal"],widget:["widget"],script:["script","business_rule"],acl:["acl"],notification:["notification","email"],atf:["atf"],test:["atf","test"]};function mp(l){return l.endsWith("ies")?l.slice(0,-3)+"y":l.endsWith("ses")||l.endsWith("xes")||l.endsWith("zes")||l.endsWith("es")?l.slice(0,-2):l.endsWith("s")&&!l.endsWith("ss")?l.slice(0,-1):l.endsWith("ing")&&l.length>5?l.slice(0,-3):l.endsWith("ed")&&l.length>4?l.slice(0,-2):l}function uy(l,d){if(l.length<=up)return l;const u=d.toLowerCase().split(/\s+/).filter(b=>b.length>2),h=[...new Set([...u,...u.map(mp)])],v=[];for(const b of u){const k=yp[b]||yp[mp(b)];k&&v.push(...k)}const C=l.map(b=>{let k=0;const q=b.name.toLowerCase(),T=(b.description||"").toLowerCase();dy.has(b.name)&&(k+=5);for(const B of h)q.includes(B)&&(k+=3),T.includes(B)&&(k+=1);for(const B of v)q.includes(B)&&(k+=4);return(q.startsWith("list_")||q.startsWith("get_")||q.startsWith("search_"))&&(k+=1),{tool:b,score:k}});return C.sort((b,k)=>k.score-b.score),C.slice(0,up).map(b=>b.tool)}const yy=8;async function my(l,d,c,u,h,v,C){if(!d&&!ra.has(l))return{error:"No API key configured. Go to Settings to add one."};const b=It;let k=[...u];try{for(let q=0;q<yy;q++){const T=k.map(D=>({role:D.role,content:D.content})),B=await b.sendChat({provider:l,apiKey:d,model:c,messages:T,tools:h.length>0?h:void 0,baseUrl:C});if(B.error)return{error:B.error};const fe=(B.content??[]).map(D=>D.type==="tool_use"?{type:"tool_use",id:D.id??`toolu_${Date.now()}`,name:D.name??"",input:D.input??{}}:{type:"text",text:D.text??""});k=[...k,{role:"assistant",content:fe}],v(k);const ne=fe.filter(D=>D.type==="tool_use");if(ne.length===0||B.stop_reason!=="tool_use")return{messages:k};const K=[];for(const D of ne)try{const W=await b.executeTool(D.name,D.input),Z=W.success?typeof W.result=="string"?W.result:JSON.stringify(W.result,null,2):`Error: ${W.error??"Tool execution failed"}`;K.push({type:"tool_result",tool_use_id:D.id,content:Z,is_error:!W.success})}catch(W){K.push({type:"tool_result",tool_use_id:D.id,content:`Error: ${W instanceof Error?W.message:"Unknown error"}`,is_error:!0})}k=[...k,{role:"user",content:K}],v(k)}return{messages:k,error:"Tool execution limit reached. The AI made too many consecutive tool calls."}}catch(q){return{error:q instanceof Error?q.message:"Request failed"}}}const Fi="nowaikit_chat_history";function fy(l,d){try{const c=JSON.parse(localStorage.getItem(Fi)||"{}");c[l]=d,localStorage.setItem(Fi,JSON.stringify(c))}catch{}}function fp(l){try{return JSON.parse(localStorage.getItem(Fi)||"{}")[l]||[]}catch{return[]}}function gy(l){try{const d=JSON.parse(localStorage.getItem(Fi)||"{}");delete d[l],localStorage.setItem(Fi,JSON.stringify(d))}catch{}}function hy({settings:l,serverUrl:d,instances:c}){var ge;const[u,h]=z.useState(l.activeProvider||"anthropic"),[v,C]=z.useState(l.model||"claude-sonnet-5"),[b,k]=z.useState(()=>fp(l.activeProvider||"anthropic")),[q,T]=z.useState(""),[B,V]=z.useState(!1),[fe,ne]=z.useState(""),[K,D]=z.useState([]),[W,Z]=z.useState(!1),[j,M]=z.useState(""),[m,N]=z.useState(0),ee=z.useRef(null),w=z.useRef(null),G=z.useRef(null),F=z.useRef(u);z.useEffect(()=>{F.current===u&&fy(u,b)},[b,u]),z.useEffect(()=>{const I=dp[u],Y=I[0].value;I.find($=>$.value===v)||C(Y),k(fp(u)),ne(""),F.current=u},[u]),z.useEffect(()=>{var I;(I=ee.current)==null||I.scrollIntoView({behavior:"smooth"})},[b,B]),z.useEffect(()=>{It.listTools().then(Y=>D(Y??[])).catch(()=>{})},[]),z.useEffect(()=>{if(!W)return;const I=Y=>{var $,ve;!(($=G.current)!=null&&$.contains(Y.target))&&!((ve=w.current)!=null&&ve.contains(Y.target))&&Z(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[W]);const X=l.providers[u],ae=ra.has(u),he=ae||!!(X!=null&&X.apiKey),ke=c.find(I=>I.active),Le=ny(b),Ee=j?K.filter(I=>{var Y;return I.name.toLowerCase().includes(j.toLowerCase())||((Y=I.description)==null?void 0:Y.toLowerCase().includes(j.toLowerCase()))}):K,le=Ee.slice(0,10);function U(I){const Y=I.target.value;T(Y);const $=Y.match(/(?:^|\s)\/([\w_]*)$/);$?(M($[1]),N(0),Z(!0)):Z(!1)}function se(I){var $;const Y=q.replace(/(?:^|\s)\/([\w_]*)$/,ve=>`${ve.startsWith(" ")?" ":""}/${I.name} `);T(Y),Z(!1),($=w.current)==null||$.focus()}async function H(I){const Y=(I??q).trim();if(!Y||B)return;T(""),ne(""),Z(!1);const $=Y.replace(/\/([\w_]+)/g,(_e,E)=>K.find(me=>me.name===E)?`(use tool: ${E})`:_e),ve=[...b,{role:"user",content:Y}];k(ve),V(!0);try{const _e=uy(K,Y),E=await my(u,(X==null?void 0:X.apiKey)??"",v,ve,_e,oe=>k(oe),X==null?void 0:X.baseUrl);if(V(!1),E.error){ne(E.error);return}E.messages&&k(E.messages)}catch(_e){V(!1),ne(_e instanceof Error?_e.message:"Chat request failed")}}function g(I){if(W&&le.length>0){if(I.key==="ArrowDown"){I.preventDefault(),N(Y=>Math.min(Y+1,le.length-1));return}if(I.key==="ArrowUp"){I.preventDefault(),N(Y=>Math.max(Y-1,0));return}if(I.key==="Tab"||I.key==="Enter"&&W){I.preventDefault(),le[m]&&se(le[m]);return}if(I.key==="Escape"){Z(!1);return}}I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),H())}const A={background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",padding:"6px 10px",fontSize:"0.8rem"};return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"calc(100vh - 56px)",maxWidth:900,margin:"0 auto"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16,gap:12,flexWrap:"wrap"},children:[s.jsxs("div",{style:{minWidth:0},children:[s.jsxs("h2",{className:"page-title",style:{display:"flex",alignItems:"center",gap:10},children:[s.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"AI Chat"]}),ke&&s.jsxs("div",{style:{fontSize:"0.78rem",color:"var(--dim)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["Instance: ",ke.name," · ",ke.url]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0,flexWrap:"wrap"},children:[s.jsx("div",{style:{display:"flex",border:"1px solid var(--border)",borderRadius:6,overflow:"hidden"},children:pp.map(I=>{var $;const Y=ra.has(I.id)||!!(($=l.providers[I.id])!=null&&$.apiKey);return s.jsxs("button",{onClick:()=>h(I.id),style:{padding:"5px 12px",border:"none",fontSize:"0.78rem",cursor:"pointer",background:u===I.id?"var(--accent)":"transparent",color:u===I.id?"#fff":Y?"var(--text2)":"var(--dim)",fontWeight:u===I.id?600:400,transition:"all .15s",display:"flex",alignItems:"center",gap:5},children:[sa.createElement(vp[I.id]??(()=>null),{size:14,color:u===I.id?"#fff":"currentColor"})," ",I.label,Y&&u!==I.id&&s.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:"var(--green)"}})]},I.id)})}),s.jsx("select",{value:v,onChange:I=>C(I.target.value),style:A,children:dp[u].map(I=>s.jsx("option",{value:I.value,children:I.label},I.value))}),b.length>0&&s.jsx(s.Fragment,{children:s.jsx("button",{className:"btn-ghost",onClick:()=>{gy(u),k([]),ne("")},style:{padding:"6px 14px",fontSize:"0.8rem"},children:"New Chat"})})]})]}),!he&&!ae&&s.jsxs("div",{style:{background:"rgba(251,191,36,0.1)",border:"1px solid rgba(251,191,36,0.3)",borderRadius:8,padding:"12px 16px",marginBottom:16,fontSize:"0.875rem",color:"var(--yellow)"},children:["No API key for ",s.jsx("strong",{children:(ge=pp.find(I=>I.id===u))==null?void 0:ge.label}),". Go to ",s.jsx("strong",{children:"Settings → AI Providers"})," to add your key."]}),s.jsxs("div",{style:{flex:1,overflowY:"auto",marginBottom:16,display:"flex",flexDirection:"column",gap:4},children:[Le.length===0&&s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:24,color:"var(--dim)"},children:[s.jsxs("div",{style:{textAlign:"center"},children:[s.jsx("div",{style:{fontSize:"1.8rem",marginBottom:8},children:"🔗"}),s.jsx("div",{style:{fontSize:"0.95rem",color:"var(--text2)",fontWeight:500},children:"Ask anything about your ServiceNow instance"}),s.jsxs("div",{style:{fontSize:"0.8rem",marginTop:4},children:["Type ",s.jsx("code",{style:{background:"var(--surface2)",padding:"1px 5px",borderRadius:3},children:"/"})," to browse & run tools · Shift+Enter for new line"]})]}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%",maxWidth:560},children:py.map(I=>s.jsx("button",{onClick:()=>H(I),style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,color:"var(--text2)",padding:"10px 14px",textAlign:"left",fontSize:"0.85rem",cursor:"pointer",transition:"all .15s"},children:I},I))})]}),Le.map((I,Y)=>{if(I.kind==="user")return s.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:6},children:s.jsx("div",{style:{background:"var(--accent)",color:"#fff",borderRadius:8,padding:"10px 12px",maxWidth:"88%",fontSize:"0.85rem",lineHeight:1.5},children:I.text})},Y);if(I.kind==="assistant"){const $=I.parts[0].text;return s.jsx("div",{style:{display:"flex",justifyContent:"flex-start",marginBottom:6},children:s.jsxs("div",{style:{background:"var(--surface2)",borderRadius:8,padding:"10px 12px",maxWidth:"88%",fontSize:"0.85rem",lineHeight:1.5},children:[sy($),ay($)&&s.jsx(ly,{text:$})]})},Y)}return I.kind==="tool"?s.jsx("div",{style:{maxWidth:"95%",marginBottom:4},children:s.jsx(cy,{tu:I.tu,result:I.result})},Y):null}),B&&s.jsx("div",{style:{display:"flex",justifyContent:"flex-start",marginBottom:4},children:s.jsx("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"3px 14px 14px 14px",padding:"12px 16px"},children:s.jsx("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[0,1,2].map(I=>s.jsx("div",{style:{width:7,height:7,borderRadius:"50%",background:"var(--dim)",animation:`bounce .9s ease-in-out ${I*.2}s infinite alternate`}},I))})})}),fe&&s.jsx("div",{style:{background:"rgba(248,113,113,0.1)",border:"1px solid rgba(248,113,113,0.3)",borderRadius:8,padding:"10px 14px",color:"var(--red)",fontSize:"0.85rem"},children:fe}),s.jsx("div",{ref:ee})]}),W&&le.length>0&&s.jsx("div",{ref:G,style:{position:"relative",marginBottom:4},children:s.jsxs("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:50,maxHeight:280,overflowY:"auto"},children:[s.jsx("div",{style:{padding:"8px 12px 6px",fontSize:"0.7rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.07em",borderBottom:"1px solid var(--border)"},children:"Tools — Tab or Enter to select · Esc to close"}),le.map((I,Y)=>s.jsxs("button",{onMouseDown:$=>{$.preventDefault(),se(I)},style:{display:"flex",alignItems:"baseline",gap:10,width:"100%",padding:"8px 12px",background:Y===m?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer",textAlign:"left",transition:"background .1s",borderBottom:Y<le.length-1?"1px solid var(--border)":"none"},children:[s.jsxs("code",{style:{color:"var(--accent)",fontWeight:600,fontSize:"0.8rem",flexShrink:0},children:["/",I.name]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I.description})]},I.name)),K.length>10&&s.jsxs("div",{style:{padding:"6px 12px",fontSize:"0.72rem",color:"var(--dim)",borderTop:"1px solid var(--border)"},children:[Ee.length," tools · type to filter"]})]})}),s.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-end",paddingBottom:4},children:[s.jsx("textarea",{ref:w,value:q,onChange:U,onKeyDown:g,placeholder:"Ask anything… or type / to browse tools (Enter to send)",rows:1,disabled:B||!he,style:{flex:1,background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:10,color:"var(--text)",padding:"11px 14px",fontSize:"0.9rem",resize:"none",outline:"none",transition:"border-color .15s, box-shadow .15s",minHeight:46,maxHeight:160,lineHeight:1.5,...q?{borderColor:"var(--accent)",boxShadow:"0 0 0 3px var(--accent-bg)"}:{}}}),s.jsx("button",{onClick:()=>H(),disabled:B||!q.trim()||!he,className:"btn-primary",style:{padding:"11px 20px",borderRadius:10,flexShrink:0,opacity:B||!q.trim()||!he?.45:1},children:B?s.jsx("span",{className:"spinner",style:{width:16,height:16,borderWidth:2}}):"Send"})]}),s.jsx("style",{children:`
53
- @keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-5px); } }
54
- textarea:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-bg) !important; }
55
- `})]})}const Jn=new Set(["ollama","lmstudio"]);function _y(l,d){if(!d.length)return l;const c=new Set(l.map(h=>h.value)),u=d.filter(h=>!c.has(h.value)).map(h=>({value:h.value,label:h.label,desc:"Live from provider"}));return[...l,...u]}const zi=[{id:"anthropic",label:"Claude (Anthropic)",icon:"◈",keyLabel:"Anthropic API Key",keyPlaceholder:"sk-ant-api03-…",portalUrl:"https://console.anthropic.com/settings/keys",portalLabel:"Anthropic Console",subscriptionNote:"Anthropic API access is separate from Claude.ai subscriptions. You need an API key from the Anthropic Console.",signInSteps:['Click "Open Anthropic Console" below',"Sign in with your Anthropic account","Go to Settings → API Keys",'Click "Create Key", copy it',"Paste the key in the field that appears"]},{id:"openai",label:"ChatGPT / Codex (OpenAI)",icon:"◎",keyLabel:"OpenAI API Key",keyPlaceholder:"sk-proj-…",portalUrl:"https://platform.openai.com/api-keys",portalLabel:"OpenAI Platform",subscriptionNote:"ChatGPT Plus / Pro subscriptions give access to chat.openai.com but not the API. You need a separate API key from the OpenAI Platform.",signInSteps:['Click "Open OpenAI Platform" below',"Sign in with your OpenAI account",'Click "Create new secret key"',"Copy the key (shown only once)","Paste the key in the field that appears"]},{id:"google",label:"Gemini (Google AI)",icon:"◇",keyLabel:"Google AI API Key",keyPlaceholder:"AIza…",portalUrl:"https://aistudio.google.com/app/apikey",portalLabel:"Google AI Studio",subscriptionNote:"Sign in with your Google account to access Gemini API via Google AI Studio. Free tier available for personal use.",signInSteps:['Click "Sign in with Google" below',"Sign in with your Google account",'Click "Create API key"',"Copy the generated key","Paste the key in the field that appears"]},{id:"groq",label:"Groq (Free)",icon:"⚡",keyLabel:"Groq API Key",keyPlaceholder:"gsk_…",portalUrl:"https://console.groq.com/keys",portalLabel:"Groq Console",subscriptionNote:"Groq offers free, ultra-fast inference for open models like Llama 3.3 and Mixtral. Generous free tier with no credit card required.",signInSteps:['Click "Open Groq Console" below',"Sign up or sign in (free)","Go to API Keys",'Click "Create API Key", copy it',"Paste the key in the field that appears"]},{id:"openrouter",label:"OpenRouter (Multi-Provider)",icon:"⊕",keyLabel:"OpenRouter API Key",keyPlaceholder:"sk-or-v1-…",portalUrl:"https://openrouter.ai/keys",portalLabel:"OpenRouter",subscriptionNote:"OpenRouter is a unified gateway to 200+ models from OpenAI, Anthropic, Google, xAI, Meta, DeepSeek and more. Many models have free tiers — no credit card required.",signInSteps:['Click "Open OpenRouter" below',"Sign up or sign in (free)","Go to Keys",'Click "Create Key", copy it',"Paste the key in the field that appears"]},{id:"ollama",label:"Ollama (Local)",icon:"🦙",keyLabel:"Base URL",keyPlaceholder:"http://localhost:11434",portalUrl:"https://ollama.com/download",portalLabel:"Ollama",subscriptionNote:"Ollama runs AI models locally on your machine — completely free, private, and offline. No API key needed.",signInSteps:["Download Ollama from ollama.com/download","Install and open — it runs in the background","Open Terminal and pull a model: ollama pull llama3.3","Wait for download (models are 2–40 GB depending on size)",`Verify it's running: open http://localhost:11434 in browser — should show "Ollama is running"`,"Come back here — no API key needed, just keep the default URL"]},{id:"lmstudio",label:"LM Studio (Local)",icon:"🖥",keyLabel:"Base URL",keyPlaceholder:"http://localhost:1234",portalUrl:"https://lmstudio.ai",portalLabel:"LM Studio",subscriptionNote:"LM Studio provides a visual interface to download and run AI models locally — free for personal use. No API key needed.",signInSteps:["Download LM Studio from lmstudio.ai","Install and launch the application",'Go to the "Discover" tab and download a model (e.g., Llama 3.3, Qwen 3, DeepSeek R1)','Go to the "Developer" tab on the left sidebar','Click "Start Server" — it will start on port 1234',"Come back here — no API key needed, just keep the default URL"]}],Zo={anthropic:[{value:"claude-opus-5",label:"Claude Opus 5",desc:"Most capable, complex reasoning"},{value:"claude-fable-5",label:"Claude Fable 5",desc:"Creative, fast frontier model"},{value:"claude-sonnet-5",label:"Claude Sonnet 5",desc:"Balanced — recommended"},{value:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5",desc:"Fastest, lowest cost"}],openai:[{value:"gpt-5.6-sol",label:"GPT-5.6 Sol",desc:"Latest flagship — hardest reasoning & coding"},{value:"gpt-5.6-terra",label:"GPT-5.6 Terra",desc:"Balanced everyday — GPT-5.5 quality, lower cost"},{value:"gpt-5.6-luna",label:"GPT-5.6 Luna",desc:"Fastest & cheapest — high-volume, low latency"},{value:"gpt-5.5",label:"GPT-5.5",desc:"Previous flagship — strong all-round"}],google:[{value:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro",desc:"Latest — state-of-the-art reasoning"},{value:"gemini-3-pro-preview",label:"Gemini 3 Pro",desc:"Frontier-class multimodal"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash",desc:"Fast & capable — best value"},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash",desc:"Previous gen — stable & proven"},{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro",desc:"Previous gen — advanced reasoning"}],groq:[{value:"meta-llama/llama-4-maverick-17b-128e-instruct",label:"Llama 4 Maverick",desc:"Best quality — 128 experts (recommended)"},{value:"meta-llama/llama-4-scout-17b-16e-instruct",label:"Llama 4 Scout",desc:"Fast & efficient — 16 experts"},{value:"llama-3.3-70b-versatile",label:"Llama 3.3 70B",desc:"Reliable workhorse — tool use"},{value:"llama-3.1-8b-instant",label:"Llama 3.1 8B",desc:"Ultra-fast, lightweight"}],openrouter:[{value:"openai/o1-pro",label:"OpenAI o1 Pro",desc:"High-end reasoning via OpenRouter"},{value:"xai/grok-4",label:"Grok 4 (xAI)",desc:"Latest xAI general-purpose model"},{value:"anthropic/claude-sonnet-5",label:"Claude Sonnet 5",desc:"Latest Claude variant via OpenRouter"},{value:"google/gemini-3-flash-preview",label:"Gemini 3 Flash",desc:"Google Gemini Flash variant"},{value:"deepseek/deepseek-r1:free",label:"DeepSeek R1",desc:"Free — open reasoning model"},{value:"meta-llama/llama-4-maverick-17b-128e-instruct",label:"Llama 4 Maverick",desc:"Free — best open model"},{value:"meta-llama/llama-3.3-70b-instruct",label:"Llama 3.3 70B",desc:"Free — strong general-purpose"},{value:"google/gemma-2-9b-it:free",label:"Gemma 2 9B",desc:"Free — lightweight Google model"}],ollama:[{value:"llama3.3:latest",label:"Llama 3.3 70B",desc:"Best quality open model"},{value:"llama3.2:latest",label:"Llama 3.2 3B",desc:"Fast & lightweight"},{value:"qwen3:latest",label:"Qwen 3",desc:"Strong multilingual reasoning"},{value:"deepseek-r1:latest",label:"DeepSeek R1",desc:"Advanced reasoning model"},{value:"gemma3:latest",label:"Gemma 3",desc:"Google open model"},{value:"phi4:latest",label:"Phi-4",desc:"Microsoft compact model"},{value:"mistral:latest",label:"Mistral",desc:"Efficient general-purpose"},{value:"granite3.3:latest",label:"Granite 3.3",desc:"IBM enterprise model"}],lmstudio:[{value:"llama-3.3-70b",label:"Llama 3.3 70B",desc:"Best quality open model"},{value:"qwen3-8b",label:"Qwen 3 8B",desc:"Strong multilingual reasoning"},{value:"deepseek-r1-distill",label:"DeepSeek R1 Distill",desc:"Reasoning distilled model"},{value:"gemma-3-9b",label:"Gemma 3 9B",desc:"Google open model"},{value:"phi-4",label:"Phi-4",desc:"Microsoft compact model"},{value:"mistral-7b",label:"Mistral 7B",desc:"Efficient general-purpose"}]},vy=[{id:"teal",color:"#00D4AA",label:"Teal (default)"},{id:"navy",color:"#0F4C81",label:"Navy"},{id:"blue",color:"#3b82f6",label:"Blue"},{id:"emerald",color:"#22c55e",label:"Emerald"},{id:"amber",color:"#f59e0b",label:"Amber"}];function Sr(){return It}function by({settings:l,onSave:d,activeInstance:c,onNavigate:u}){const{mode:h,accent:v,setMode:C,setAccent:b}=bp(),[k,q]=z.useState(l),[T,B]=z.useState(""),[V,fe]=z.useState(!1),[ne,K]=z.useState(!1),[D,W]=z.useState(!1),[Z,j]=z.useState(!1),[M,m]=z.useState("none"),[N,ee]=z.useState(!1),[w,G]=z.useState(!1),[F,X]=z.useState(null),[ae,he]=z.useState([]),[ke,Le]=z.useState(!1);function Ee(){X(null)}function le(E,oe){Ee(),q(me=>({...me,providers:{...me.providers,[E]:{...me.providers[E],apiKey:oe}}}))}function U(E,oe){Ee(),he([]),q(me=>({...me,providers:{...me.providers,[E]:{...me.providers[E],baseUrl:oe}}}))}async function se(){j(!0),await d(k),j(!1),W(!0),setTimeout(()=>W(!1),2e3)}async function H(){m("steps"),ee(!0);try{const E=Sr();E?await E.openExternal($.portalUrl):window.open($.portalUrl,"_blank")}finally{ee(!1),m("paste")}}async function g(){var me;if(Jn.has(T)){await I();return}const oe=((me=k.providers[T])==null?void 0:me.apiKey)??"";if(!oe){X({ok:!1,msg:"Enter a key first"});return}G(!0),X(null);try{const ue={anthropic:["sk-ant-"],openai:["sk-"],google:["AIza"],groq:["gsk_"],openrouter:["sk-or-"]}[T]??[];ue.length>0&&!ue.some(de=>oe.startsWith(de))?X({ok:!1,msg:`Key doesn't match expected format for ${T}`}):(X({ok:!0,msg:"Key format looks valid — save to use it"}),ge(T,oe))}catch{X({ok:!1,msg:"Validation error"})}finally{G(!1)}}async function A(E,oe){try{const me=await fetch(oe,{signal:AbortSignal.timeout(5e3),headers:{"X-NowAIKit-Proxy":"1"}});if(me.status===404||me.status===403)throw new Error("proxy_unavailable");return me}catch{return fetch(E,{signal:AbortSignal.timeout(5e3)})}}async function ge(E,oe){const me=async(Pe,ue)=>{const de=await fetch(Pe,{signal:AbortSignal.timeout(6e3),headers:{"X-NowAIKit-Proxy":"1",...ue}});return de.ok?de.json():null};try{let Pe=[];if(E==="anthropic"){const ue=await me("/api/ai/anthropic/v1/models",{"x-api-key":oe,"anthropic-version":"2023-06-01"});Pe=((ue==null?void 0:ue.data)||[]).filter(de=>/^claude-/.test(de.id)&&!/-\d{8}$/.test(de.id)).map(de=>({value:de.id,label:de.display_name||de.id}))}else if(E==="openai"){const ue=await me("/api/ai/openai/v1/models",{Authorization:`Bearer ${oe}`});Pe=((ue==null?void 0:ue.data)||[]).filter(de=>/^gpt-/.test(de.id)&&!/instruct|realtime|audio|search|transcribe|tts|image/.test(de.id)).map(de=>({value:de.id,label:de.id})).sort((de,nr)=>nr.value.localeCompare(de.value))}else if(E==="google"){const ue=await me(`/api/ai/google/v1beta/models?key=${encodeURIComponent(oe)}`,{});Pe=((ue==null?void 0:ue.models)||[]).map(de=>({value:(de.name||"").replace(/^models\//,""),label:de.displayName||(de.name||"").replace(/^models\//,"")})).filter(de=>/gemini/i.test(de.value)&&!/embedding|aqa/.test(de.value))}else if(E==="groq"){const ue=await me("/api/ai/groq/openai/v1/models",{Authorization:`Bearer ${oe}`});Pe=((ue==null?void 0:ue.data)||[]).map(de=>({value:de.id,label:de.id}))}else if(E==="openrouter"){const ue=await me("/api/ai/openrouter/api/v1/models",{Authorization:`Bearer ${oe}`});Pe=((ue==null?void 0:ue.data)||[]).map(de=>({value:de.id,label:de.name||de.id}))}Pe.length&&he(Pe)}catch{}}async function I(){var oe;const E=((oe=k.providers[T])==null?void 0:oe.baseUrl)||(T==="ollama"?"http://localhost:11434":"http://localhost:1234");G(!0),X(null);try{const me=T==="ollama"?`${E}/api/tags`:`${E}/v1/models`,ue=await A(me,T==="ollama"?"/api/ai/ollama/api/tags":"/api/ai/lmstudio/v1/models");ue.ok?X({ok:!0,msg:"Connected — server is running"}):X({ok:!1,msg:`Server responded with status ${ue.status}`})}catch{X({ok:!1,msg:`Cannot reach server — make sure ${T==="ollama"?"Ollama":"LM Studio"} is running`})}finally{G(!1)}}async function Y(){var oe;const E=((oe=k.providers[T])==null?void 0:oe.baseUrl)||(T==="ollama"?"http://localhost:11434":"http://localhost:1234");Le(!0),he([]);try{if(T==="ollama"){const me=await A(`${E}/api/tags`,"/api/ai/ollama/api/tags");if(!me.ok)throw new Error(`HTTP ${me.status}`);const ue=((await me.json()).models||[]).map(de=>({value:de.name,label:de.name}));he(ue),ue.length===0?X({ok:!1,msg:"No models found. Pull one first: ollama pull llama3.3"}):X({ok:!0,msg:`Found ${ue.length} model${ue.length>1?"s":""}`})}else{const me=await A(`${E}/v1/models`,"/api/ai/lmstudio/v1/models");if(!me.ok)throw new Error(`HTTP ${me.status}`);const ue=((await me.json()).data||[]).map(de=>({value:de.id,label:de.id}));he(ue),ue.length===0?X({ok:!1,msg:"No models loaded. Download one in LM Studio first."}):X({ok:!0,msg:`Found ${ue.length} model${ue.length>1?"s":""}`})}}catch{X({ok:!1,msg:`Cannot reach ${T==="ollama"?"Ollama":"LM Studio"} — make sure it's running`})}finally{Le(!1)}}const $=zi.find(E=>E.id===T)??zi[0],ve=(E,oe)=>s.jsxs("div",{style:{marginBottom:28},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:700,color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:12},children:E}),s.jsx("div",{className:"card",style:{padding:"20px 24px"},children:oe})]}),_e=(E,oe,me)=>s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:24,padding:"12px 0",borderBottom:"1px solid var(--border)"},children:[s.jsxs("div",{style:{minWidth:0},children:[s.jsx("div",{style:{fontWeight:500,marginBottom:2},children:E}),s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text2)"},children:oe})]}),s.jsx("div",{style:{flexShrink:0},children:me})]});return s.jsxs("div",{style:{maxWidth:680},children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("h2",{className:"page-title",style:{display:"flex",alignItems:"center",gap:10},children:[s.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"})]}),"Settings"]}),s.jsx("button",{className:"btn-primary",onClick:se,disabled:Z,style:{opacity:Z?.6:1},children:D?"✓ Saved":Z?"Saving…":"Save Changes"})]}),s.jsxs("div",{style:{marginBottom:28},children:[s.jsxs("button",{onClick:()=>fe(E=>!E),style:{display:"flex",alignItems:"center",gap:8,width:"100%",background:"transparent",border:"none",cursor:"pointer",padding:0,marginBottom:12},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:700,color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.08em"},children:"ServiceNow Connection"}),s.jsx("span",{style:{fontSize:"0.68rem",color:"var(--dim)",marginLeft:"auto"},children:c?c.name:"Not configured"}),s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--dim)",transition:"transform .2s",transform:V?"rotate(180deg)":"rotate(0deg)"},children:"▼"})]}),V&&s.jsx("div",{className:"card",style:{padding:"20px 24px"},children:c?s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 24px",marginBottom:16},children:[["Instance",c.name],["URL",c.url],["Auth Method",c.authMethod],["Tool Package",c.toolPackage.replace(/_/g," ")],["Write Access",c.writeEnabled?"Enabled":"Read-only"]].map(([E,oe])=>s.jsxs("div",{style:{padding:"8px 0",borderBottom:"1px solid var(--border)"},children:[s.jsx("div",{style:{fontSize:"0.72rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:3},children:E}),s.jsx("div",{style:{fontSize:"0.88rem",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe})]},E))}),s.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[s.jsx("button",{className:"btn-primary",onClick:()=>u==null?void 0:u("instances"),style:{fontSize:"0.82rem",padding:"7px 14px"},children:"Manage Instances"}),s.jsx("button",{className:"btn-ghost",onClick:()=>u==null?void 0:u("instances"),style:{fontSize:"0.82rem",padding:"7px 14px"},children:"+ Add Instance"})]})]}):s.jsxs("div",{style:{textAlign:"center",padding:"20px 0",color:"var(--dim)"},children:[s.jsx("div",{style:{fontSize:"0.88rem",marginBottom:12},children:"No ServiceNow instance configured yet."}),s.jsx("button",{className:"btn-primary",onClick:()=>u==null?void 0:u("instances"),style:{fontSize:"0.85rem"},children:"Configure ServiceNow Instance"})]})})]}),s.jsxs("div",{style:{marginBottom:28},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:700,color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.08em"},children:"AI Providers"}),s.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--dim)"},children:[zi.filter(E=>{var oe;return Jn.has(E.id)||((oe=k.providers[E.id])==null?void 0:oe.apiKey)}).length,"/",zi.length," connected"]})]}),s.jsxs("div",{style:{marginBottom:12,padding:"10px 14px",borderRadius:8,background:"rgba(99,102,241,0.06)",border:"1px solid var(--border)",fontSize:"0.78rem",color:"var(--text2)",lineHeight:1.5},children:["Already pay for Claude Code or Codex? Run capabilities and branded reports with your own subscription (no API key) from the CLI:"," ",s.jsx("code",{style:{fontSize:"0.75rem"},children:"nowaikit run scan-health -p claude-cli --format pdf"}),". The chat here uses live tool calls, so it needs a provider API key below."]}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:zi.map(E=>{var nr,Xr;const oe=Jn.has(E.id),me=oe||!!((nr=k.providers[E.id])!=null&&nr.apiKey),Pe=T===E.id,ue=Zo[E.id],de=k.providers[E.id];return s.jsxs("div",{className:"card",style:{padding:0,overflow:"hidden",borderColor:Pe?"var(--accent)":me?"var(--green-dim, var(--border))":"var(--border)",transition:"border-color .2s"},children:[s.jsxs("button",{onClick:()=>{var Se;if(Pe)B("");else{B(E.id),q(Be=>{const zt={...Be,activeProvider:E.id};return Zo[E.id].find(sr=>sr.value===Be.model)||(zt.model=Zo[E.id][0].value),zt}),m("none"),Ee(),K(!1),he([]);{const Be=(Se=k.providers[E.id])==null?void 0:Se.apiKey;Be&&!Jn.has(E.id)&&ge(E.id,Be)}}},style:{width:"100%",display:"flex",alignItems:"center",gap:14,padding:"14px 20px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",transition:"background .15s"},children:[s.jsx("span",{style:{width:28,textAlign:"center",flexShrink:0,opacity:me?1:.5,display:"flex",alignItems:"center",justifyContent:"center"},children:sa.createElement(vp[E.id]??(()=>null),{size:20})}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("div",{style:{fontWeight:600,fontSize:"0.9rem",color:"var(--text)"},children:E.label}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text2)",marginTop:1},children:me?`Connected · ${((Xr=ue.find(Se=>Se.value===(k.activeProvider===E.id?k.model:ue[0].value)))==null?void 0:Xr.label)??ue[0].label}`:"Not configured"})]}),me?s.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 10px",borderRadius:12,fontSize:"0.72rem",fontWeight:500,background:oe?"rgba(99,102,241,0.12)":"rgba(34,197,94,0.12)",color:oe?"var(--accent)":"var(--green)"},children:[s.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:oe?"var(--accent)":"var(--green)"}}),oe?"Local":"Active"]}):s.jsx("span",{style:{padding:"3px 10px",borderRadius:12,fontSize:"0.72rem",fontWeight:500,background:"var(--surface2)",color:"var(--dim)"},children:"Setup needed"}),s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--dim)",transition:"transform .2s",transform:Pe?"rotate(180deg)":"rotate(0deg)"},children:"▼"})]}),Pe&&s.jsxs("div",{style:{padding:"0 20px 20px",borderTop:"1px solid var(--border)"},children:[s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text2)",background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,padding:"10px 14px",margin:"16px 0",lineHeight:1.6},children:$.subscriptionNote}),M==="steps"&&s.jsxs("div",{children:[s.jsx("div",{style:{fontWeight:600,marginBottom:14,fontSize:"0.9rem"},children:N?`Opening ${$.portalLabel}…`:`Sign in to ${$.label}`}),s.jsx("ol",{style:{margin:0,padding:"0 0 0 20px",color:"var(--text2)",fontSize:"0.85rem",lineHeight:2},children:$.signInSteps.map((Se,Be)=>s.jsx("li",{style:{color:Be===0&&N?"var(--accent)":"var(--text2)"},children:Se},Be))}),N&&s.jsxs("div",{style:{marginTop:16,display:"flex",alignItems:"center",gap:10,color:"var(--dim)",fontSize:"0.82rem"},children:[s.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:2}}),"Portal open — sign in and copy your API key, then close the window"]}),!N&&s.jsx("button",{className:"btn-ghost",onClick:()=>m("none"),style:{marginTop:14,fontSize:"0.82rem",padding:"6px 14px"},children:"Cancel"})]}),M==="paste"&&s.jsxs("div",{children:[s.jsx("div",{style:{fontWeight:600,marginBottom:8},children:"Paste your API key"}),s.jsxs("div",{style:{fontSize:"0.82rem",color:"var(--text2)",marginBottom:12},children:["Copy the key from ",$.portalLabel," and paste it below."]}),s.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12},children:[s.jsx("input",{autoFocus:!0,className:"input",type:ne?"text":"password",value:de.apiKey,onChange:Se=>le(T,Se.target.value),placeholder:$.keyPlaceholder,style:{fontFamily:"monospace",fontSize:"0.85rem",flex:1}}),s.jsx("button",{className:"btn-ghost",onClick:()=>K(Se=>!Se),style:{flexShrink:0,padding:"8px 14px"},children:ne?"Hide":"Show"})]}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{className:"btn-primary",onClick:async()=>{await g()},disabled:w||!de.apiKey,style:{fontSize:"0.82rem",padding:"8px 16px"},children:w?"Verifying…":"Verify Key"}),s.jsx("button",{className:"btn-ghost",onClick:()=>{m("none")},style:{fontSize:"0.82rem",padding:"8px 16px"},children:"Done"})]}),F&&s.jsxs("div",{style:{marginTop:10,fontSize:"0.8rem",color:F.ok?"var(--green)":"var(--red)"},children:[F.ok?"✓ ":"✗ ",F.msg]})]}),M==="none"&&s.jsxs("div",{children:[oe?s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"btn-primary",onClick:H,style:{display:"flex",alignItems:"center",gap:10,marginBottom:16,fontSize:"0.85rem"},children:[$.icon," ",$.portalLabel," Setup Guide",s.jsx("span",{style:{opacity:.7,fontSize:"0.72rem"},children:"→ opens download page"})]}),s.jsx("ol",{style:{margin:"0 0 16px",padding:"0 0 0 20px",color:"var(--text2)",fontSize:"0.82rem",lineHeight:2},children:$.signInSteps.map((Se,Be)=>s.jsx("li",{children:Se},Be))}),s.jsx("div",{style:{marginBottom:6,fontWeight:500,fontSize:"0.85rem"},children:$.keyLabel}),s.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8},children:[s.jsx("input",{className:"input",type:"text",value:de.baseUrl||"",onChange:Se=>U(T,Se.target.value),placeholder:$.keyPlaceholder,style:{fontFamily:"monospace",fontSize:"0.85rem",flex:1}}),s.jsx("button",{className:"btn-ghost",onClick:I,disabled:w,style:{flexShrink:0,padding:"8px 14px",opacity:w?.5:1},children:w?"Testing…":"Test Connection"}),s.jsx("button",{className:"btn-ghost",onClick:Y,disabled:ke,style:{flexShrink:0,padding:"8px 14px",opacity:ke?.5:1},children:ke?"Detecting…":"Detect Models"})]}),F&&s.jsxs("div",{style:{fontSize:"0.78rem",color:F.ok?"var(--green)":"var(--red)",marginBottom:16},children:[F.ok?"✓ ":"✗ ",F.msg]}),ae.length>0&&s.jsxs("div",{style:{marginBottom:16,background:"var(--surface2)",border:"1px solid var(--border)",borderRadius:6,padding:"10px 14px"},children:[s.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:8},children:["Detected Models (",ae.length,")"]}),s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:ae.map(Se=>s.jsx("button",{onClick:()=>q(Be=>({...Be,model:Se.value})),style:{padding:"4px 10px",borderRadius:4,fontSize:"0.78rem",cursor:"pointer",background:k.model===Se.value?"var(--accent)":"var(--surface3)",color:k.model===Se.value?"#fff":"var(--text2)",border:`1px solid ${k.model===Se.value?"var(--accent)":"var(--border)"}`},children:Se.label},Se.value))})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"btn-primary",onClick:H,style:{display:"flex",alignItems:"center",gap:10,marginBottom:16,fontSize:"0.85rem"},children:[$.icon," Sign in to ",$.label.split("(")[0].trim(),s.jsx("span",{style:{opacity:.7,fontSize:"0.72rem"},children:"→ opens portal"})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:16},children:[s.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}}),s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--dim)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"or paste API key directly"}),s.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]}),s.jsx("div",{style:{marginBottom:6,fontWeight:500,fontSize:"0.85rem"},children:$.keyLabel}),s.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8},children:[s.jsx("input",{className:"input",type:ne?"text":"password",value:de.apiKey,onChange:Se=>le(T,Se.target.value),placeholder:$.keyPlaceholder,style:{fontFamily:"monospace",fontSize:"0.85rem",flex:1}}),s.jsx("button",{className:"btn-ghost",onClick:()=>K(Se=>!Se),style:{flexShrink:0,padding:"8px 14px"},children:ne?"Hide":"Show"}),s.jsx("button",{className:"btn-ghost",onClick:g,disabled:w||!de.apiKey,style:{flexShrink:0,padding:"8px 14px",opacity:!de.apiKey||w?.5:1},children:w?"Testing…":"Test"})]}),F?s.jsxs("div",{style:{fontSize:"0.78rem",color:F.ok?"var(--green)":"var(--red)",marginBottom:16},children:[F.ok?"✓ ":"✗ ",F.msg]}):de.apiKey?s.jsx("div",{style:{fontSize:"0.78rem",color:"var(--green)",marginBottom:16},children:"✓ Key configured — click Test to verify"}):s.jsx("div",{style:{fontSize:"0.78rem",color:"var(--dim)",marginBottom:16},children:"No key set — this provider is unavailable"})]}),s.jsxs("div",{style:{borderTop:"1px solid var(--border)",paddingTop:16},children:[s.jsx("div",{style:{fontWeight:500,marginBottom:10,fontSize:"0.85rem"},children:"Default Model"}),s.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:_y(ue,ae).map(Se=>{const Be=k.model===Se.value;return s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderRadius:6,cursor:"pointer",transition:"all .15s",background:Be?"var(--accent-bg, rgba(79,142,247,0.12))":"var(--surface2)",border:`1px solid ${Be?"var(--accent)":"var(--border)"}`},children:[s.jsx("input",{type:"radio",name:"model",checked:Be,onChange:()=>q(zt=>({...zt,model:Se.value})),style:{accentColor:"var(--accent)",width:14,height:14,flexShrink:0}}),s.jsxs("div",{style:{minWidth:0},children:[s.jsx("div",{style:{fontWeight:500,fontSize:"0.82rem"},children:Se.label}),s.jsx("div",{style:{fontSize:"0.72rem",color:"var(--text2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Se.desc})]})]},Se.value)})})]})]})]})]},E.id)})})]}),ve("Appearance",s.jsxs(s.Fragment,{children:[_e("Theme","Switch between dark and light mode",s.jsx("div",{style:{display:"flex",gap:4},children:["dark","light"].map(E=>s.jsx("button",{onClick:()=>C(E),style:{padding:"7px 14px",borderRadius:6,fontSize:"0.82rem",fontWeight:500,background:h===E?"var(--accent)":"var(--surface3)",color:h===E?"#fff":"var(--text2)",border:"none",cursor:"pointer"},children:E==="dark"?"🌙 Dark":"☀️ Light"},E))})),s.jsxs("div",{style:{padding:"12px 0"},children:[s.jsx("div",{style:{fontWeight:500,marginBottom:10},children:"Accent Color"}),s.jsx("div",{style:{display:"flex",gap:10},children:vy.map(E=>s.jsx("button",{onClick:()=>b(E.id),title:E.label,style:{width:30,height:30,borderRadius:"50%",background:E.color,border:"none",boxShadow:v===E.id?`0 0 0 3px var(--bg), 0 0 0 5px ${E.color}`:"none",transition:"box-shadow .15s",cursor:"pointer"}},E.id))})]})]})),ve("Support",s.jsx(s.Fragment,{children:s.jsxs("div",{style:{fontSize:"0.85rem",color:"var(--text2)",lineHeight:1.7},children:[s.jsx("div",{children:"Need help or want to report a bug?"}),s.jsxs("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:6},children:[s.jsxs("div",{children:[s.jsx("span",{style:{color:"var(--dim)",fontSize:"0.78rem",marginRight:8},children:"Email"}),s.jsx("button",{onClick:()=>{var E;return(E=Sr())==null?void 0:E.openExternal("mailto:support@nowaikit.com")},style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",padding:0,fontSize:"0.85rem"},children:"support@nowaikit.com"})]}),s.jsxs("div",{children:[s.jsx("span",{style:{color:"var(--dim)",fontSize:"0.78rem",marginRight:8},children:"Issues"}),s.jsx("button",{onClick:()=>{var E;return(E=Sr())==null?void 0:E.openExternal("https://github.com/aartiq/nowaikit/issues")},style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",padding:0,fontSize:"0.85rem"},children:"GitHub Issues"})]})]})]})})),ve("About",s.jsx(s.Fragment,{children:s.jsxs("div",{style:{fontSize:"0.85rem",color:"var(--text2)",lineHeight:1.7},children:[s.jsxs("div",{children:[s.jsx("strong",{children:"nowaikit"})," — Your AI companion for ServiceNow"]}),s.jsxs("div",{children:["Config: ",s.jsx("code",{style:{fontSize:"0.8rem"},children:"~/.config/nowaikit/"})]}),s.jsxs("div",{style:{marginTop:8},children:[s.jsx("button",{onClick:()=>{var E;return(E=Sr())==null?void 0:E.openExternal("https://github.com/aartiq/nowaikit")},style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",padding:0,fontSize:"0.85rem"},children:"GitHub"})," · ",s.jsx("button",{onClick:()=>{var E;return(E=Sr())==null?void 0:E.openExternal("https://nowaitkit.com")},style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",padding:0,fontSize:"0.85rem"},children:"Website"})]}),s.jsxs("div",{style:{marginTop:12,fontSize:"0.72rem",color:"var(--dim)",lineHeight:1.6},children:['This software is provided "as is" under the'," ",s.jsx("button",{onClick:()=>{var E;return(E=Sr())==null?void 0:E.openExternal("https://github.com/aartiq/nowaikit/blob/main/LICENSE")},style:{background:"none",border:"none",color:"var(--dim)",cursor:"pointer",padding:0,fontSize:"0.72rem",textDecoration:"underline"},children:"Elastic License 2.0"}),", without warranty of any kind. Use at your own risk."," ",s.jsx("button",{onClick:()=>{var E;return(E=Sr())==null?void 0:E.openExternal("https://github.com/aartiq/nowaikit/blob/main/TERMS.md")},style:{background:"none",border:"none",color:"var(--dim)",cursor:"pointer",padding:0,fontSize:"0.72rem",textDecoration:"underline"},children:"Terms & Conditions"})]})]})})),s.jsxs("div",{style:{marginTop:28,padding:"14px 18px",background:"var(--surface)",border:"1px solid var(--border)",borderRadius:8,fontSize:"0.78rem",color:"var(--text2)",lineHeight:1.6},children:[s.jsx("strong",{style:{color:"var(--text)"},children:"Security note:"})," Passwords and API keys are encrypted at rest using AES-256-GCM (keys stored in your OS keychain). You can edit ",s.jsx("code",{style:{background:"var(--surface2)",padding:"1px 5px",borderRadius:3},children:"config.json"})," directly with plaintext values — they will be automatically encrypted the next time the app saves settings."]})]})}const Sy={dashboard:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"}),s.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),chat:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),tools:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"2",y:"7",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("path",{d:"M16 21V5a2 2 0 00-2-2h-4a2 2 0 00-2 2v16"})]}),instances:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",ry:"2"}),s.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",ry:"2"}),s.jsx("line",{x1:"6",y1:"6",x2:"6.01",y2:"6"}),s.jsx("line",{x1:"6",y1:"18",x2:"6.01",y2:"18"})]}),logs:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),s.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),settings:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"})]})},xy=[{id:"dashboard",label:"Dashboard"},{id:"chat",label:"AI Chat"},{id:"tools",label:"Tools"},{id:"instances",label:"Instances"},{id:"logs",label:"Audit Log"},{id:"settings",label:"Settings"}],wy=[{id:"teal",color:"#00D4AA"},{id:"navy",color:"#0F4C81"},{id:"blue",color:"#3b82f6"},{id:"emerald",color:"#22c55e"},{id:"amber",color:"#f59e0b"}];function ky({size:l=28}){return s.jsxs("svg",{width:l,height:l,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{flexShrink:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"logoGrad",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[s.jsx("stop",{offset:"0%",stopColor:"#00F0C0"}),s.jsx("stop",{offset:"50%",stopColor:"#00D4AA"}),s.jsx("stop",{offset:"100%",stopColor:"#0F4C81"})]})}),s.jsx("rect",{width:"32",height:"32",rx:"8",fill:"url(#logoGrad)"}),s.jsx("path",{d:"M9 23V9l7 10V9",stroke:"#fff",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("circle",{cx:"23",cy:"12",r:"2.5",fill:"#fff",opacity:"0.9"}),s.jsx("circle",{cx:"23",cy:"20",r:"2.5",fill:"#fff",opacity:"0.9"}),s.jsx("line",{x1:"23",y1:"14.5",x2:"23",y2:"17.5",stroke:"#fff",strokeWidth:"1.5",opacity:"0.6"})]})}function jy({currentPage:l,onNavigate:d,instanceName:c,instanceCount:u,serverOnline:h}){const{mode:v,accent:C,setMode:b,setAccent:k}=bp();return s.jsxs("aside",{style:{width:220,background:"var(--surface)",borderRight:"1px solid var(--border)",display:"flex",flexDirection:"column",flexShrink:0},children:[s.jsx("div",{style:{height:38,flexShrink:0,WebkitAppRegion:"drag"}}),s.jsxs("div",{style:{padding:"4px 18px 16px",borderBottom:"1px solid var(--border)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[s.jsx(ky,{size:30}),s.jsxs("span",{style:{fontWeight:700,fontSize:"1.05rem",letterSpacing:"-0.3px"},children:[s.jsx("span",{style:{color:"var(--text)"},children:"Now"}),s.jsx("span",{style:{background:"linear-gradient(135deg, #00D4AA 0%, #0F4C81 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",fontWeight:800},children:"AI"}),s.jsx("span",{style:{color:"var(--text)"},children:"Kit"})]})]}),s.jsx("div",{style:{fontSize:"0.73rem",color:"var(--dim)",paddingLeft:40},children:c||"No instance"})]}),s.jsx("nav",{style:{flex:1,padding:"10px 10px",overflowY:"auto"},children:xy.map(q=>{const T=l===q.id;return s.jsxs("button",{onClick:()=>d(q.id),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"9px 12px",borderRadius:7,marginBottom:2,background:T?"var(--accent-bg)":"transparent",color:T?"var(--accent)":"var(--text2)",border:"none",fontSize:"0.875rem",cursor:"pointer",textAlign:"left",fontWeight:T?600:400,transition:"all .15s"},children:[s.jsx("span",{style:{opacity:.8,width:18,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:Sy[q.id]}),s.jsx("span",{children:q.label}),q.id==="chat"&&s.jsx("span",{style:{marginLeft:"auto",width:7,height:7,borderRadius:"50%",background:"var(--accent)",opacity:.8}})]},q.id)})}),s.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",gap:8,fontSize:"0.75rem"},children:[s.jsx("div",{style:{width:7,height:7,borderRadius:"50%",background:h?"var(--green)":"var(--dim)",flexShrink:0}}),s.jsx("span",{style:{color:h?"var(--green)":"var(--dim)"},children:h?"Server online":"Server offline"}),s.jsx("span",{style:{color:"var(--dim)",marginLeft:"auto"},children:u>0?`${u} inst.`:"no inst."})]}),s.jsxs("div",{style:{padding:"12px 14px 14px"},children:[s.jsx("div",{style:{display:"flex",gap:4,marginBottom:10},children:["dark","light"].map(q=>s.jsx("button",{onClick:()=>b(q),style:{flex:1,padding:"5px 0",borderRadius:6,fontSize:"0.75rem",background:v===q?"var(--surface3)":"transparent",color:v===q?"var(--text)":"var(--dim)",border:`1px solid ${v===q?"var(--border2)":"transparent"}`,transition:"all .15s"},children:q==="dark"?"🌙 Dark":"☀ Light"},q))}),s.jsx("div",{style:{display:"flex",gap:7,justifyContent:"center"},children:wy.map(q=>s.jsx("button",{onClick:()=>k(q.id),title:q.id,style:{width:18,height:18,borderRadius:"50%",background:q.color,border:"none",outline:C===q.id?`2px solid ${q.color}`:"2px solid transparent",outlineOffset:2,transition:"outline .15s",cursor:"pointer"}},q.id))})]})]})}const Bi={providers:{anthropic:{apiKey:"",authMethod:"apiKey"},openai:{apiKey:"",authMethod:"apiKey"},google:{apiKey:"",authMethod:"apiKey"},groq:{apiKey:"",authMethod:"apiKey"},openrouter:{apiKey:"",authMethod:"apiKey"},ollama:{apiKey:"",authMethod:"apiKey",baseUrl:"http://localhost:11434"},lmstudio:{apiKey:"",authMethod:"apiKey",baseUrl:"http://localhost:1234"}},activeProvider:"anthropic",model:"claude-sonnet-5"},ia=z.createContext({mode:"dark",accent:"teal",setMode:()=>{},setAccent:()=>{}}),bp=()=>z.useContext(ia);function xr(){return It}function ea(l,d){document.documentElement.setAttribute("data-theme",l),document.documentElement.setAttribute("data-accent",d),localStorage.setItem("nwk-theme",l),localStorage.setItem("nwk-accent",d)}function Ey(){const[l,d]=z.useState(()=>localStorage.getItem("nwk-theme")||"dark"),[c,u]=z.useState(()=>localStorage.getItem("nwk-accent")||"teal"),h=z.useCallback(G=>{d(G),ea(G,c)},[c]),v=z.useCallback(G=>{u(G),ea(l,G)},[l]);z.useEffect(()=>{ea(l,c)},[]);const[C,b]=z.useState("dashboard"),[k,q]=z.useState([]),[T,B]=z.useState(!1),[V,fe]=z.useState("stdio"),[ne,K]=z.useState(""),[D,W]=z.useState(Bi),[Z,j]=z.useState(!0),[M,m]=z.useState(!1),N=z.useCallback(async()=>{const G=xr();if(G)try{const F=await G.getServerStatus();B((F==null?void 0:F.running)??!1)}catch{B(!1)}},[]),ee=z.useCallback(async()=>{const G=xr();if(G){try{const[F,X,ae]=await Promise.all([G.listInstances(),G.getVersion(),G.getAllConfig()]);K(X.app),fe("stdio");const he=ae,ke=he.settings??he;let Le=Bi;ke.providers?Le=ke:ke.anthropicApiKey&&(Le={...Bi,providers:{...Bi.providers,anthropic:{apiKey:ke.anthropicApiKey,authMethod:"apiKey"}},model:ke.model||Bi.model}),W(Le);const Ee=he.activeInstance??"",le=F.map(U=>({name:U.name,url:U.instanceUrl,active:U.name===Ee,group:U.group||"Default",environment:U.environment||"",toolPackage:U.toolPackage||"full",writeEnabled:!!U.writeEnabled,authMethod:U.authMethod||"basic"}));q(le),le.length===0&&m(!0)}catch{m(!0)}await N()}},[N]);if(z.useEffect(()=>{if(!xr()){j(!1);return}ee().finally(()=>j(!1));const F=setInterval(N,15e3);return()=>clearInterval(F)},[ee,N]),Z)return s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",flexDirection:"column",gap:12,color:"var(--dim)"},children:[s.jsx("div",{className:"spinner",style:{width:28,height:28,borderWidth:3}}),s.jsx("span",{style:{fontSize:"0.85rem"},children:"Starting nowaikit…"})]});if(M)return s.jsx(ia.Provider,{value:{mode:l,accent:c,setMode:h,setAccent:v},children:s.jsx(Du,{onComplete:()=>{m(!1),ee()},onClose:()=>m(!1),existingGroups:[...new Set(k.map(G=>G.group).filter(Boolean))]})});const w=k.find(G=>G.active);return s.jsx(ia.Provider,{value:{mode:l,accent:c,setMode:h,setAccent:v},children:s.jsxs("div",{style:{display:"flex",height:"100vh",overflow:"hidden"},children:[s.jsx(jy,{currentPage:C,onNavigate:b,instanceName:w==null?void 0:w.name,instanceCount:k.length,serverOnline:T}),s.jsxs("main",{className:"fade-in",style:{flex:1,overflow:"auto",padding:"0 32px 28px",background:"var(--bg)"},children:[s.jsx("div",{style:{height:38,flexShrink:0,WebkitAppRegion:"drag"}}),C==="dashboard"&&s.jsx(Wu,{instances:k,serverOnline:T,appVersion:ne,serverUrl:V,onRefresh:ee,onNavigate:b}),C==="chat"&&s.jsx(hy,{settings:D,serverUrl:V,instances:k}),C==="tools"&&s.jsx(Vu,{activeToolPackage:(w==null?void 0:w.toolPackage)??"full",serverOnline:T,serverUrl:V,onRestart:ee}),C==="instances"&&s.jsx(Gu,{instances:k,onRemove:async G=>{var F;await((F=xr())==null?void 0:F.removeInstance(G)),ee()},onSetDefault:async G=>{var F;await((F=xr())==null?void 0:F.setConfig("activeInstance",G)),ee()},onTest:async G=>{const F=xr();if(!F)return{ok:!1,message:"Not available"};const ae=(await F.listInstances()).find(ke=>ke.name===G);if(!ae)return{ok:!1,message:"Instance not found"};const he=await F.testInstance(ae);return{ok:he.success,message:he.success?"Connection successful":he.error??"Failed"}},onAddInstance:()=>m(!0)}),C==="logs"&&s.jsx(Qu,{}),C==="settings"&&s.jsx(by,{settings:D,activeInstance:w,onNavigate:b,onSave:async G=>{var F;W(G),await((F=xr())==null?void 0:F.setConfig("settings",G))}})]},C)]})})}Eu.createRoot(document.getElementById("root")).render(s.jsx(sa.StrictMode,{children:s.jsx(Ey,{})}));