@objectstack/studio 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-BJgzPGy7.js","./chunk-DECur_0Z.js","./data-
|
|
2
|
-
import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{A as r,C as i,D as a,E as o,M as s,O as c,S as l,T as u,_ as d,a as f,b as p,c as m,d as h,f as g,g as _,h as v,j as y,k as b,l as x,m as S,n as C,o as w,p as T,r as E,s as ee,t as D,u as O,v as te,w as k,x as A,y as j}from"./data-ALkBmK2s.js";if((function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),typeof window<`u`){window.process||(window.process={});let e=window.process;e.env=e.env||{},e.cwd||=()=>`/`,e.platform||=`browser`}var M=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function A(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,j(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+k(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+k(a,u),c+=j(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+k(a,u++),c+=j(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return j(A(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},re={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=re,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.4`})),ne=n(((e,t)=>{t.exports=M()})),N=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&k(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&k(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(ee)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,te=O.port2;O.port1.onmessage=ee,D=function(){te.postMessage(null)}}else D=function(){_(ee,0)};function k(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,k(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=n(((e,t)=>{t.exports=N()})),ie=n((e=>{var t=ne();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.4`})),ae=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=n((e=>{var t=re(),n=ne(),r=ae();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),D=Symbol.iterator;function O(e){return typeof e!=`object`||!e?null:(e=D&&e[D]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function k(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?k(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return k(e(t))}catch{}}return null}var A=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N={pending:!1,data:null,method:null,action:null},ie=[],oe=-1;function se(e){return{current:e}}function P(e){0>oe||(e.current=ie[oe],ie[oe]=null,oe--)}function ce(e,t){oe++,ie[oe]=e.current,e.current=t}var le=se(null),ue=se(null),de=se(null),fe=se(null);function pe(e,t){switch(ce(de,t),ce(ue,e),ce(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rf(t),e=af(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}P(le),ce(le,e)}function me(){P(le),P(ue),P(de)}function he(e){e.memoizedState!==null&&ce(fe,e);var t=le.current,n=af(t,e.type);t!==n&&(ce(ue,e),ce(le,n))}function ge(e){ue.current===e&&(P(le),P(ue)),fe.current===e&&(P(fe),pp._currentValue=N)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-BJgzPGy7.js","./chunk-DECur_0Z.js","./data-CesT9QEt.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{A as r,C as i,D as a,E as o,M as s,O as c,S as l,T as u,_ as d,a as f,b as p,c as m,d as h,f as g,g as _,h as v,j as y,k as b,l as x,m as S,n as C,o as w,p as T,r as E,s as ee,t as D,u as O,v as te,w as k,x as A,y as j}from"./data-CesT9QEt.js";if((function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),typeof window<`u`){window.process||(window.process={});let e=window.process;e.env=e.env||{},e.cwd||=()=>`/`,e.platform||=`browser`}var M=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function A(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,j(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+k(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+k(a,u),c+=j(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+k(a,u++),c+=j(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return j(A(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},re={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=re,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.4`})),ne=n(((e,t)=>{t.exports=M()})),N=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&k(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&k(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(ee)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,te=O.port2;O.port1.onmessage=ee,D=function(){te.postMessage(null)}}else D=function(){_(ee,0)};function k(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,k(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=n(((e,t)=>{t.exports=N()})),ie=n((e=>{var t=ne();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.4`})),ae=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=n((e=>{var t=re(),n=ne(),r=ae();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),D=Symbol.iterator;function O(e){return typeof e!=`object`||!e?null:(e=D&&e[D]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function k(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?k(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return k(e(t))}catch{}}return null}var A=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N={pending:!1,data:null,method:null,action:null},ie=[],oe=-1;function se(e){return{current:e}}function P(e){0>oe||(e.current=ie[oe],ie[oe]=null,oe--)}function ce(e,t){oe++,ie[oe]=e.current,e.current=t}var le=se(null),ue=se(null),de=se(null),fe=se(null);function pe(e,t){switch(ce(de,t),ce(ue,e),ce(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rf(t),e=af(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}P(le),ce(le,e)}function me(){P(le),P(ue),P(de)}function he(e){e.memoizedState!==null&&ce(fe,e);var t=le.current,n=af(t,e.type);t!==n&&(ce(ue,e),ce(le,n))}function ge(e){ue.current===e&&(P(le),P(ue)),fe.current===e&&(P(fe),pp._currentValue=N)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+_e+e+ve}var be=!1;function xe(e,t){if(!e||be)return``;be=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -61,10 +61,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
61
61
|
`,children:[(0,z.jsx)(n,{className:`h-3.5 w-3.5`}),t.label]},e)})}),u.length>1&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`}),(0,z.jsxs)(qx,{children:[(0,z.jsx)(Jx,{asChild:!0,children:(0,z.jsxs)(th,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 text-xs`,children:[p.label,(0,z.jsx)(Vf,{className:`h-3 w-3`})]})}),(0,z.jsx)(Yx,{align:`start`,children:u.map((e,t)=>(0,z.jsxs)(Xx,{onClick:()=>f(t),className:t===d?`bg-accent`:``,children:[(0,z.jsx)(`span`,{className:`text-xs`,children:e.label}),(0,z.jsx)(dS,{variant:`outline`,className:`ml-2 text-[10px]`,children:e.pluginId})]},e.id))})]})]}),(0,z.jsx)(`div`,{className:`flex-1`}),c.map(r=>(0,z.jsx)(th,{variant:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:()=>r.handler({metadataType:e,metadataName:t,data:n}),children:r.label},r.id)),(0,z.jsx)(dS,{variant:`secondary`,className:`text-[10px] font-mono`,children:p.pluginId})]}),(0,z.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,z.jsx)(m,{metadataType:e,metadataName:t,data:n,mode:l})})]})}var YC=x([`preview`,`design`,`code`,`data`]),XC=l({id:o().describe(`Unique viewer identifier`),metadataTypes:S(o()).min(1).describe(`Metadata types this viewer can handle`),label:o().describe(`Viewer display label`),priority:A().default(0).describe(`Viewer priority (higher wins)`),modes:S(YC).default([`preview`]).describe(`Supported view modes`)}),ZC=l({key:o().describe(`Unique group key`),label:o().describe(`Group display label`),icon:o().optional().describe(`Lucide icon name`),metadataTypes:S(o()).describe(`Metadata types in this group`),order:A().default(100).describe(`Sort order (lower = higher)`)}),Oae=x([`toolbar`,`contextMenu`,`commandPalette`]),kae=l({id:o().describe(`Unique action identifier`),label:o().describe(`Action display label`),icon:o().optional().describe(`Lucide icon name`),location:Oae.describe(`UI location`),metadataTypes:S(o()).default([]).describe(`Applicable metadata types`)}),Aae=l({metadataType:o().describe(`Metadata type`),label:o().describe(`Display label`),icon:o().describe(`Lucide icon name`)}),jae=x([`bottom`,`right`,`modal`]),Mae=l({id:o().describe(`Unique panel identifier`),label:o().describe(`Panel display label`),icon:o().optional().describe(`Lucide icon name`),location:jae.default(`bottom`).describe(`Panel location`)}),Nae=l({id:o().describe(`Unique command identifier`),label:o().describe(`Command display label`),shortcut:o().optional().describe(`Keyboard shortcut`),icon:o().optional().describe(`Lucide icon name`)}),Pae=l({metadataViewers:S(XC).default([]),sidebarGroups:S(ZC).default([]),actions:S(kae).default([]),metadataIcons:S(Aae).default([]),panels:S(Mae).default([]),commands:S(Nae).default([])}),Fae=o().describe(`Activation event pattern`),Iae=l({id:o().regex(/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/).describe(`Plugin ID (dot-separated lowercase)`),name:o().describe(`Plugin display name`),version:o().default(`0.0.1`).describe(`Plugin version`),description:o().optional().describe(`Plugin description`),author:o().optional().describe(`Author`),contributes:Pae.default({metadataViewers:[],sidebarGroups:[],actions:[],metadataIcons:[],panels:[],commands:[]}),activationEvents:S(Fae).default([`*`])});function QC(e){return Iae.parse(e)}var Lae=l({key:o().describe(`Section key (e.g., "basics", "constraints", "security")`),label:o().describe(`Section display label`),icon:o().optional().describe(`Lucide icon name`),defaultExpanded:v().default(!0).describe(`Whether section is expanded by default`),order:A().default(0).describe(`Sort order (lower = higher)`)}),Rae=l({key:o().describe(`Group key matching field.group values`),label:o().describe(`Group display label`),icon:o().optional().describe(`Lucide icon name`),defaultExpanded:v().default(!0).describe(`Whether group is expanded by default`),order:A().default(0).describe(`Sort order (lower = higher)`)}),zae=l({inlineEditing:v().default(!0).describe(`Enable inline editing of field properties`),dragReorder:v().default(!0).describe(`Enable drag-and-drop field reordering`),showFieldGroups:v().default(!0).describe(`Show field group headers`),showPropertyPanel:v().default(!0).describe(`Show the right-side property panel`),propertySections:S(Lae).default([{key:`basics`,label:`Basic Properties`,defaultExpanded:!0,order:0},{key:`constraints`,label:`Constraints & Validation`,defaultExpanded:!0,order:10},{key:`relationship`,label:`Relationship Config`,defaultExpanded:!0,order:20},{key:`display`,label:`Display & UI`,defaultExpanded:!1,order:30},{key:`security`,label:`Security & Compliance`,defaultExpanded:!1,order:40},{key:`advanced`,label:`Advanced`,defaultExpanded:!1,order:50}]).describe(`Property panel section definitions`),fieldGroups:S(Rae).default([]).describe(`Field group definitions`),paginationThreshold:A().default(50).describe(`Number of fields before pagination is enabled`),batchOperations:v().default(!0).describe(`Enable batch add/remove field operations`),showUsageStats:v().default(!1).describe(`Show field usage statistics`)}),Bae=l({type:x([`lookup`,`master_detail`,`tree`]).describe(`Relationship type`),lineStyle:x([`solid`,`dashed`,`dotted`]).default(`solid`).describe(`Line style in diagrams`),color:o().default(`#94a3b8`).describe(`Line color (CSS value)`),highlightColor:o().default(`#0891b2`).describe(`Highlighted color on hover/select`),cardinalityLabel:o().default(`1:N`).describe(`Cardinality label (e.g., "1:N", "1:1", "N:M")`)}),Vae=l({visualCreation:v().default(!0).describe(`Enable drag-to-create relationships`),showReverseRelationships:v().default(!0).describe(`Show reverse/child-to-parent relationships`),showCascadeWarnings:v().default(!0).describe(`Show cascade delete behavior warnings`),displayConfig:S(Bae).default([{type:`lookup`,lineStyle:`dashed`,color:`#0891b2`,highlightColor:`#06b6d4`,cardinalityLabel:`1:N`},{type:`master_detail`,lineStyle:`solid`,color:`#ea580c`,highlightColor:`#f97316`,cardinalityLabel:`1:N`},{type:`tree`,lineStyle:`dotted`,color:`#8b5cf6`,highlightColor:`#a78bfa`,cardinalityLabel:`1:N`}]).describe(`Visual config per relationship type`)}),Hae=x([`force`,`hierarchy`,`grid`,`circular`]).describe(`ER diagram layout algorithm`),Uae=l({showFields:v().default(!0).describe(`Show field list inside entity nodes`),maxFieldsVisible:A().default(8).describe(`Max fields visible before "N more..." collapse`),showFieldTypes:v().default(!0).describe(`Show field type badges`),showRequiredIndicator:v().default(!0).describe(`Show required field indicators`),showRecordCount:v().default(!1).describe(`Show live record count on nodes`),showIcon:v().default(!0).describe(`Show object icon on node header`),showDescription:v().default(!0).describe(`Show description tooltip on hover`)}),Wae=l({enabled:v().default(!0).describe(`Enable ER diagram panel`),layout:Hae.default(`force`).describe(`Default layout algorithm`),nodeDisplay:Uae.default({showFields:!0,maxFieldsVisible:8,showFieldTypes:!0,showRequiredIndicator:!0,showRecordCount:!1,showIcon:!0,showDescription:!0}).describe(`Node display configuration`),showMinimap:v().default(!0).describe(`Show minimap for large diagrams`),zoomControls:v().default(!0).describe(`Show zoom in/out/fit controls`),minZoom:A().default(.1).describe(`Minimum zoom level`),maxZoom:A().default(3).describe(`Maximum zoom level`),showEdgeLabels:v().default(!0).describe(`Show cardinality labels on relationship edges`),highlightOnHover:v().default(!0).describe(`Highlight connected entities on node hover`),clickToNavigate:v().default(!0).describe(`Click node to navigate to object detail`),dragToConnect:v().default(!0).describe(`Drag between nodes to create relationships`),hideOrphans:v().default(!1).describe(`Hide objects with no relationships`),autoFit:v().default(!0).describe(`Auto-fit diagram to viewport on load`),exportFormats:S(x([`png`,`svg`,`json`])).default([`png`,`svg`]).describe(`Available export formats for diagram`)}),Gae=x([`table`,`cards`,`tree`]).describe(`Object list display mode`),Kae=x([`name`,`label`,`fieldCount`,`updatedAt`]).describe(`Object list sort field`),qae=l({package:o().optional().describe(`Filter by owning package`),tags:S(o()).optional().describe(`Filter by object tags`),includeSystem:v().default(!0).describe(`Include system-level objects`),includeAbstract:v().default(!1).describe(`Include abstract base objects`),hasFieldType:o().optional().describe(`Filter to objects containing a specific field type`),hasRelationships:v().optional().describe(`Filter to objects with lookup/master_detail fields`),searchQuery:o().optional().describe(`Free-text search across name, label, and description`)}),Jae=l({defaultDisplayMode:Gae.default(`table`).describe(`Default list display mode`),defaultSortField:Kae.default(`label`).describe(`Default sort field`),defaultSortDirection:x([`asc`,`desc`]).default(`asc`).describe(`Default sort direction`),defaultFilter:qae.default({includeSystem:!0,includeAbstract:!1}).describe(`Default filter configuration`),showFieldCount:v().default(!0).describe(`Show field count badge`),showRelationshipCount:v().default(!0).describe(`Show relationship count badge`),showQuickPreview:v().default(!0).describe(`Show quick field preview tooltip on hover`),enableComparison:v().default(!1).describe(`Enable side-by-side object comparison`),showERDiagramToggle:v().default(!0).describe(`Show ER diagram toggle in toolbar`),showCreateAction:v().default(!0).describe(`Show create object action`),showStatsSummary:v().default(!0).describe(`Show statistics summary bar`)}),Yae=l({tabs:S(l({key:o().describe(`Tab key`),label:o().describe(`Tab display label`),icon:o().optional().describe(`Lucide icon name`),enabled:v().default(!0).describe(`Whether this tab is available`),order:A().default(0).describe(`Sort order (lower = higher)`)})).default([{key:`fields`,label:`Fields`,icon:`list`,enabled:!0,order:0},{key:`relationships`,label:`Relationships`,icon:`link`,enabled:!0,order:10},{key:`indexes`,label:`Indexes`,icon:`zap`,enabled:!0,order:20},{key:`validations`,label:`Validations`,icon:`shield-check`,enabled:!0,order:30},{key:`capabilities`,label:`Capabilities`,icon:`settings`,enabled:!0,order:40},{key:`data`,label:`Data`,icon:`table-2`,enabled:!0,order:50},{key:`api`,label:`API`,icon:`globe`,enabled:!0,order:60},{key:`code`,label:`Code`,icon:`code-2`,enabled:!0,order:70}]).describe(`Object detail preview tabs`),defaultTab:o().default(`fields`).describe(`Default active tab key`),showHeader:v().default(!0).describe(`Show object summary header`),showBreadcrumbs:v().default(!0).describe(`Show navigation breadcrumbs`)});l({defaultView:x([`field-editor`,`relationship-mapper`,`er-diagram`,`object-manager`]).describe(`Default view when entering the Object Designer`).default(`field-editor`).describe(`Default view`),fieldEditor:zae.default({inlineEditing:!0,dragReorder:!0,showFieldGroups:!0,showPropertyPanel:!0,propertySections:[{key:`basics`,label:`Basic Properties`,defaultExpanded:!0,order:0},{key:`constraints`,label:`Constraints & Validation`,defaultExpanded:!0,order:10},{key:`relationship`,label:`Relationship Config`,defaultExpanded:!0,order:20},{key:`display`,label:`Display & UI`,defaultExpanded:!1,order:30},{key:`security`,label:`Security & Compliance`,defaultExpanded:!1,order:40},{key:`advanced`,label:`Advanced`,defaultExpanded:!1,order:50}],fieldGroups:[],paginationThreshold:50,batchOperations:!0,showUsageStats:!1}).describe(`Field editor configuration`),relationshipMapper:Vae.default({visualCreation:!0,showReverseRelationships:!0,showCascadeWarnings:!0,displayConfig:[{type:`lookup`,lineStyle:`dashed`,color:`#0891b2`,highlightColor:`#06b6d4`,cardinalityLabel:`1:N`},{type:`master_detail`,lineStyle:`solid`,color:`#ea580c`,highlightColor:`#f97316`,cardinalityLabel:`1:N`},{type:`tree`,lineStyle:`dotted`,color:`#8b5cf6`,highlightColor:`#a78bfa`,cardinalityLabel:`1:N`}]}).describe(`Relationship mapper configuration`),erDiagram:Wae.default({enabled:!0,layout:`force`,nodeDisplay:{showFields:!0,maxFieldsVisible:8,showFieldTypes:!0,showRequiredIndicator:!0,showRecordCount:!1,showIcon:!0,showDescription:!0},showMinimap:!0,zoomControls:!0,minZoom:.1,maxZoom:3,showEdgeLabels:!0,highlightOnHover:!0,clickToNavigate:!0,dragToConnect:!0,hideOrphans:!1,autoFit:!0,exportFormats:[`png`,`svg`]}).describe(`ER diagram configuration`),objectManager:Jae.default({defaultDisplayMode:`table`,defaultSortField:`label`,defaultSortDirection:`asc`,defaultFilter:{includeSystem:!0,includeAbstract:!1},showFieldCount:!0,showRelationshipCount:!0,showQuickPreview:!0,enableComparison:!1,showERDiagramToggle:!0,showCreateAction:!0,showStatsSummary:!0}).describe(`Object manager configuration`),objectPreview:Yae.default({tabs:[{key:`fields`,label:`Fields`,icon:`list`,enabled:!0,order:0},{key:`relationships`,label:`Relationships`,icon:`link`,enabled:!0,order:10},{key:`indexes`,label:`Indexes`,icon:`zap`,enabled:!0,order:20},{key:`validations`,label:`Validations`,icon:`shield-check`,enabled:!0,order:30},{key:`capabilities`,label:`Capabilities`,icon:`settings`,enabled:!0,order:40},{key:`data`,label:`Data`,icon:`table-2`,enabled:!0,order:50},{key:`api`,label:`API`,icon:`globe`,enabled:!0,order:60},{key:`code`,label:`Code`,icon:`code-2`,enabled:!0,order:70}],defaultTab:`fields`,showHeader:!0,showBreadcrumbs:!0}).describe(`Object preview configuration`)});var Xae=l({enabled:v().default(!0).describe(`Enable snap-to-grid`),gridSize:A().int().min(1).default(8).describe(`Snap grid size in pixels`),showGrid:v().default(!0).describe(`Show grid overlay on canvas`),showGuides:v().default(!0).describe(`Show alignment guides when dragging`)}),Zae=l({min:A().min(.1).default(.25).describe(`Minimum zoom level`),max:A().max(10).default(3).describe(`Maximum zoom level`),default:A().default(1).describe(`Default zoom level`),step:A().default(.1).describe(`Zoom step increment`)}),Qae=l({type:o().describe(`Component type (e.g. "element:button", "element:text")`),label:o().describe(`Display label in palette`),icon:o().optional().describe(`Icon name for palette display`),category:x([`content`,`interactive`,`data`,`layout`]).describe(`Palette category grouping`),defaultWidth:A().int().min(1).default(4).describe(`Default width in grid columns`),defaultHeight:A().int().min(1).default(2).describe(`Default height in grid rows`)});l({snap:Xae.optional().describe(`Canvas snap settings`),zoom:Zae.optional().describe(`Canvas zoom settings`),palette:S(Qae).optional().describe(`Custom element palette (defaults to all registered elements)`),showLayerPanel:v().default(!0).describe(`Show layer ordering panel`),showPropertyPanel:v().default(!0).describe(`Show property inspector panel`),undoLimit:A().int().min(1).default(50).describe(`Maximum undo history steps`)});var $ae=x([`rounded_rect`,`circle`,`diamond`,`parallelogram`,`hexagon`,`diamond_thick`,`attached_circle`,`screen_rect`]).describe(`Visual shape for rendering a flow node on the canvas`),eoe=l({action:o().describe(`FlowNodeAction value (e.g., "parallel_gateway")`),shape:$ae.describe(`Shape to render`),icon:o().describe(`Lucide icon name`),defaultLabel:o().describe(`Default display label`),defaultWidth:A().int().min(20).default(120).describe(`Default width in pixels`),defaultHeight:A().int().min(20).default(60).describe(`Default height in pixels`),fillColor:o().default(`#ffffff`).describe(`Node fill color (CSS value)`),borderColor:o().default(`#94a3b8`).describe(`Node border color (CSS value)`),allowBoundaryEvents:v().default(!1).describe(`Whether boundary events can be attached to this node type`),paletteCategory:x([`event`,`gateway`,`activity`,`data`,`subflow`]).describe(`Palette category for grouping`)}).describe(`Visual render descriptor for a flow node type`);l({nodeId:o().describe(`Corresponding FlowNode.id`),x:A().describe(`X position on canvas`),y:A().describe(`Y position on canvas`),width:A().int().min(20).optional().describe(`Width override in pixels`),height:A().int().min(20).optional().describe(`Height override in pixels`),collapsed:v().default(!1).describe(`Whether the node is collapsed`),fillColor:o().optional().describe(`Fill color override`),borderColor:o().optional().describe(`Border color override`),annotation:o().optional().describe(`User annotation displayed near the node`)}).describe(`Canvas layout data for a flow node`);var toe=x([`solid`,`dashed`,`dotted`,`bold`]).describe(`Edge line style`);l({edgeId:o().describe(`Corresponding FlowEdge.id`),style:toe.default(`solid`).describe(`Line style`),color:o().default(`#94a3b8`).describe(`Edge line color`),labelPosition:A().min(0).max(1).default(.5).describe(`Position of the condition label along the edge`),waypoints:S(l({x:A().describe(`Waypoint X`),y:A().describe(`Waypoint Y`)})).optional().describe(`Manual waypoints for edge routing`),animated:v().default(!1).describe(`Show animated flow indicator`)}).describe(`Canvas layout and visual data for a flow edge`);var noe=x([`dagre`,`elk`,`force`,`manual`]).describe(`Auto-layout algorithm for the flow canvas`),roe=x([`TB`,`BT`,`LR`,`RL`]).describe(`Auto-layout direction`);l({snap:l({enabled:v().default(!0).describe(`Enable snap-to-grid`),gridSize:A().int().min(1).default(16).describe(`Snap grid size in pixels`),showGrid:v().default(!0).describe(`Show grid overlay`)}).default({enabled:!0,gridSize:16,showGrid:!0}).describe(`Canvas snap-to-grid settings`),zoom:l({min:A().min(.1).default(.25).describe(`Minimum zoom level`),max:A().max(10).default(3).describe(`Maximum zoom level`),default:A().default(1).describe(`Default zoom level`),step:A().default(.1).describe(`Zoom step`)}).default({min:.25,max:3,default:1,step:.1}).describe(`Canvas zoom settings`),layoutAlgorithm:noe.default(`dagre`).describe(`Default auto-layout algorithm`),layoutDirection:roe.default(`TB`).describe(`Default auto-layout direction`),nodeDescriptors:S(eoe).optional().describe(`Custom node render descriptors (merged with built-in defaults)`),showMinimap:v().default(!0).describe(`Show minimap panel`),showPropertyPanel:v().default(!0).describe(`Show property panel`),showPalette:v().default(!0).describe(`Show node palette sidebar`),undoLimit:A().int().min(1).default(50).describe(`Maximum undo history steps`),animateExecution:v().default(!0).describe(`Animate edges during execution preview`),connectionValidation:v().default(!0).describe(`Validate connections before creating edges`)}).describe(`Studio Flow Builder configuration`);var $C=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,z.jsx)(`table`,{ref:n,className:H(`w-full caption-bottom text-sm`,e),...t})}));$C.displayName=`Table`;var ew=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`thead`,{ref:n,className:H(`[&_tr]:border-b`,e),...t}));ew.displayName=`TableHeader`;var tw=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`tbody`,{ref:n,className:H(`[&_tr:last-child]:border-0`,e),...t}));tw.displayName=`TableBody`;var ioe=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`tfoot`,{ref:n,className:H(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,e),...t}));ioe.displayName=`TableFooter`;var nw=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`tr`,{ref:n,className:H(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));nw.displayName=`TableRow`;var rw=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`th`,{ref:n,className:H(`h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));rw.displayName=`TableHead`;var iw=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`td`,{ref:n,className:H(`p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));iw.displayName=`TableCell`;var aoe=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`caption`,{ref:n,className:H(`mt-4 text-sm text-muted-foreground`,e),...t}));aoe.displayName=`TableCaption`;function ooe({value:e,type:t}){if(e==null)return(0,z.jsx)(`span`,{className:`text-muted-foreground/50`,children:`—`});if(t===`boolean`)return e?(0,z.jsxs)(dS,{variant:`default`,className:`gap-1 bg-emerald-100 text-emerald-700 border-emerald-200 hover:bg-emerald-100 dark:bg-emerald-950 dark:text-emerald-400 dark:border-emerald-800`,children:[(0,z.jsx)(Bf,{className:`h-3 w-3`}),` Yes`]}):(0,z.jsxs)(dS,{variant:`secondary`,className:`gap-1`,children:[(0,z.jsx)(Hp,{className:`h-3 w-3`}),` No`]});if(t===`number`)return(0,z.jsx)(`span`,{className:`font-mono text-sm tabular-nums`,children:e});if(t===`select`)return(0,z.jsx)(dS,{variant:`outline`,children:String(e)});let n=String(e);return n.length>50?(0,z.jsx)(Ly,{children:(0,z.jsxs)(Ry,{children:[(0,z.jsx)(zy,{asChild:!0,children:(0,z.jsxs)(`span`,{className:`cursor-default`,children:[n.slice(0,50),`…`]})}),(0,z.jsx)(By,{className:`max-w-sm`,children:(0,z.jsx)(`p`,{className:`text-xs`,children:n})})]})}):(0,z.jsx)(`span`,{children:n})}function soe({cols:e}){return(0,z.jsx)(z.Fragment,{children:Array.from({length:3}).map((t,n)=>(0,z.jsx)(nw,{children:Array.from({length:e+1}).map((e,t)=>(0,z.jsx)(iw,{children:(0,z.jsx)(f_,{className:`h-4 w-full`})},t))},n))})}function coe({objectApiName:e,onEdit:t}){let n=yf(),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)([]),[s,c]=(0,P.useState)(!1),[l,u]=(0,P.useState)(1),[d,f]=(0,P.useState)(0),[p,m]=(0,P.useState)(``);(0,P.useEffect)(()=>{let t=!0;async function r(){try{let r=await n.meta.getItem(`object`,e);t&&r&&i(r.item||r)}catch(e){console.error(`Failed to load definition`,e)}}return r(),()=>{t=!1}},[n,e]),(0,P.useEffect)(()=>{let t=!0;async function r(){c(!0);try{let r=await n.data.find(e,{filters:{top:10,skip:(l-1)*10,count:!0}});t&&(o(r?.records||r?.value||(Array.isArray(r)?r:[])),typeof r?.total==`number`?f(r.total):typeof r?.count==`number`&&f(r.count))}catch(e){console.error(`Failed to load data`,e)}finally{t&&c(!1)}}return r(),()=>{t=!1}},[n,e,l]);async function h(t){if(confirm(`Are you sure you want to delete this record?`))try{await n.data.delete(e,t);let r=await n.data.find(e,{filters:{top:10,skip:(l-1)*10,count:!0}});o(r?.records||r?.value||(Array.isArray(r)?r:[])),typeof r?.total==`number`?f(r.total):typeof r?.count==`number`&&f(r.count)}catch(e){alert(`Failed to delete: `+e)}}async function g(){c(!0);try{let t=await n.data.find(e,{filters:{top:10,skip:(l-1)*10,count:!0}});o(t?.records||t?.value||(Array.isArray(t)?t:[])),typeof t?.total==`number`?f(t.total):typeof t?.count==`number`&&f(t.count)}catch(e){console.error(`Failed to refresh`,e)}finally{c(!1)}}if(!r)return(0,z.jsxs)(bS,{children:[(0,z.jsxs)(xS,{children:[(0,z.jsx)(f_,{className:`h-6 w-48`}),(0,z.jsx)(f_,{className:`h-4 w-32 mt-1`})]}),(0,z.jsx)(wS,{children:(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(f_,{className:`h-10 w-full`}),(0,z.jsx)(f_,{className:`h-10 w-full`}),(0,z.jsx)(f_,{className:`h-10 w-full`})]})})]});let _=r.fields||{},v=Object.keys(_).map(e=>{let t=_[e];return{name:t.name||e,label:t.label||e,type:t.type||`text`}}).filter(e=>![`formatted_summary`].includes(e.name)),y=p?a.filter(e=>v.some(t=>{let n=e[t.name];return n!==void 0&&String(n).toLowerCase().includes(p.toLowerCase())})):a,b=Math.max(1,Math.ceil((d||a.length)/10));return(0,z.jsxs)(bS,{className:`flex flex-col shadow-sm`,children:[(0,z.jsxs)(xS,{className:`pb-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(SS,{className:`text-xl font-semibold tracking-tight`,children:r.label}),(0,z.jsxs)(CS,{children:[d>0?d:a.length,` records • `,(0,z.jsx)(`code`,{className:`text-xs bg-muted px-1 py-0.5 rounded`,children:r.name})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(th,{variant:`outline`,size:`sm`,onClick:g,className:`gap-1.5`,children:[(0,z.jsx)(Tp,{className:`h-3.5 w-3.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:`Refresh`})]}),(0,z.jsxs)(th,{onClick:()=>t({}),size:`sm`,className:`gap-1.5`,children:[(0,z.jsx)(Sp,{className:`h-3.5 w-3.5`}),`New `,r.label]})]})]}),(0,z.jsxs)(`div`,{className:`relative mt-3`,children:[(0,z.jsx)(Dp,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,z.jsx)(nh,{placeholder:`Search ${r.label.toLowerCase()}...`,value:p,onChange:e=>m(e.target.value),className:`pl-9 h-9`})]})]}),(0,z.jsx)(wS,{className:`p-0`,children:(0,z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,z.jsxs)($C,{children:[(0,z.jsx)(ew,{children:(0,z.jsxs)(nw,{className:`hover:bg-transparent`,children:[v.map(e=>(0,z.jsx)(rw,{className:`font-medium whitespace-nowrap`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.label,(0,z.jsx)(dS,{variant:`outline`,className:`text-[10px] px-1 py-0 font-normal opacity-50 hidden lg:inline-flex`,children:e.type})]})},e.name)),(0,z.jsx)(rw,{className:`w-15 sticky right-0 bg-background`})]})}),(0,z.jsxs)(tw,{children:[s&&a.length===0?(0,z.jsx)(soe,{cols:v.length}):y.map(e=>(0,z.jsxs)(nw,{className:`group`,children:[v.map(t=>(0,z.jsx)(iw,{className:`py-2.5`,children:(0,z.jsx)(ooe,{value:e[t.name],type:t.type})},t.name)),(0,z.jsx)(iw,{className:`py-2.5 sticky right-0 bg-background`,children:(0,z.jsxs)(qx,{children:[(0,z.jsx)(Jx,{asChild:!0,children:(0,z.jsxs)(th,{variant:`ghost`,size:`icon`,className:`h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,z.jsx)($f,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Actions`})]})}),(0,z.jsxs)(Yx,{align:`end`,children:[(0,z.jsxs)(Xx,{onClick:()=>t(e),children:[(0,z.jsx)(Mp,{className:`mr-2 h-4 w-4`}),`Edit`]}),(0,z.jsx)(Qx,{}),(0,z.jsxs)(Xx,{onClick:()=>h(e.id),className:`text-destructive focus:text-destructive`,children:[(0,z.jsx)(Lp,{className:`mr-2 h-4 w-4`}),`Delete`]})]})]})})]},e.id)),!s&&y.length===0&&(0,z.jsx)(nw,{children:(0,z.jsx)(iw,{colSpan:v.length+1,className:`h-32 text-center`,children:(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 text-muted-foreground`,children:[(0,z.jsx)(Dp,{className:`h-8 w-8 opacity-30`}),(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:`No records found`}),(0,z.jsx)(`span`,{className:`text-xs`,children:p?`Try a different search term`:`Create your first record to get started`})]})})})]})]})})}),(0,z.jsxs)(TS,{className:`py-3 px-4 border-t flex justify-between items-center`,children:[(0,z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Page `,l,` of `,b]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(th,{variant:`outline`,size:`sm`,disabled:l===1,onClick:()=>u(e=>Math.max(1,e-1)),className:`h-8 gap-1`,children:[(0,z.jsx)(jf,{className:`h-3.5 w-3.5`}),`Previous`]}),(0,z.jsxs)(th,{variant:`outline`,size:`sm`,disabled:l>=b,onClick:()=>u(e=>e+1),className:`h-8 gap-1`,children:[`Next`,(0,z.jsx)(Mf,{className:`h-3.5 w-3.5`})]})]})]})]})}var loe={text:Rp,textarea:ip,number:op,boolean:Ip,select:fp,lookup:dp,formula:If,date:Lf,datetime:Lf,autonumber:op},uoe={text:`text-blue-600 bg-blue-50 border-blue-200 dark:text-blue-400 dark:bg-blue-950 dark:border-blue-800`,textarea:`text-blue-600 bg-blue-50 border-blue-200 dark:text-blue-400 dark:bg-blue-950 dark:border-blue-800`,number:`text-amber-600 bg-amber-50 border-amber-200 dark:text-amber-400 dark:bg-amber-950 dark:border-amber-800`,boolean:`text-emerald-600 bg-emerald-50 border-emerald-200 dark:text-emerald-400 dark:bg-emerald-950 dark:border-emerald-800`,select:`text-purple-600 bg-purple-50 border-purple-200 dark:text-purple-400 dark:bg-purple-950 dark:border-purple-800`,lookup:`text-cyan-600 bg-cyan-50 border-cyan-200 dark:text-cyan-400 dark:bg-cyan-950 dark:border-cyan-800`,formula:`text-orange-600 bg-orange-50 border-orange-200 dark:text-orange-400 dark:bg-orange-950 dark:border-orange-800`,date:`text-pink-600 bg-pink-50 border-pink-200 dark:text-pink-400 dark:bg-pink-950 dark:border-pink-800`,datetime:`text-pink-600 bg-pink-50 border-pink-200 dark:text-pink-400 dark:bg-pink-950 dark:border-pink-800`};function doe({text:e}){let[t,n]=(0,P.useState)(!1);return(0,z.jsx)(Ly,{children:(0,z.jsxs)(Ry,{children:[(0,z.jsx)(zy,{asChild:!0,children:(0,z.jsx)(th,{variant:`ghost`,size:`icon`,className:`h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,z.jsx)(Bf,{className:`h-3 w-3 text-emerald-500`}):(0,z.jsx)(Xf,{className:`h-3 w-3`})})}),(0,z.jsx)(By,{children:`Copy field name`})]})})}function foe({objectApiName:e}){let t=yf(),[n,r]=(0,P.useState)(null),[i,a]=(0,P.useState)(!0),[o,s]=(0,P.useState)(``);if((0,P.useEffect)(()=>{let n=!0;a(!0);async function i(){try{let i=await t.meta.getItem(`object`,e);n&&i&&r(i.item||i)}catch(e){console.error(`Failed to load schema:`,e)}finally{n&&a(!1)}}return i(),()=>{n=!1}},[t,e]),i)return(0,z.jsxs)(bS,{children:[(0,z.jsx)(xS,{children:(0,z.jsx)(f_,{className:`h-6 w-48`})}),(0,z.jsxs)(wS,{className:`space-y-3`,children:[(0,z.jsx)(f_,{className:`h-10 w-full`}),(0,z.jsx)(f_,{className:`h-10 w-full`}),(0,z.jsx)(f_,{className:`h-10 w-full`})]})]});if(!n)return(0,z.jsx)(bS,{children:(0,z.jsxs)(wS,{className:`py-12 text-center text-muted-foreground`,children:[`Object definition not found: `,(0,z.jsx)(`code`,{className:`font-mono`,children:e})]})});let c=n.fields||{},l=Object.entries(c).map(([e,t])=>({name:t.name||e,label:t.label||e,type:t.type||`text`,required:t.required||!1,multiple:t.multiple||!1,reference:t.reference,defaultValue:t.defaultValue,description:t.description,options:t.options,formula:t.formula,maxLength:t.maxLength,sortOrder:t.sortOrder})),u=n.name||e,[d,f]=u.includes(`__`)?u.split(`__`):[null,u],p=n._packageId,m=o?l.filter(e=>e.name.toLowerCase().includes(o.toLowerCase())||e.label.toLowerCase().includes(o.toLowerCase())||e.type.toLowerCase().includes(o.toLowerCase())):l;return(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsxs)(bS,{children:[(0,z.jsx)(xS,{className:`pb-3`,children:(0,z.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(SS,{className:`text-xl`,children:n.label}),d&&(0,z.jsx)(dS,{variant:`secondary`,className:`font-mono text-xs`,children:d})]}),(0,z.jsxs)(CS,{className:`flex items-center gap-3 flex-wrap`,children:[(0,z.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:u}),(0,z.jsx)(`span`,{children:`·`}),(0,z.jsxs)(`span`,{children:[l.length,` fields`]}),p&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{children:`·`}),(0,z.jsxs)(`span`,{className:`text-xs`,children:[`owned by `,(0,z.jsx)(`code`,{className:`font-mono`,children:p})]})]})]})]})})}),d&&(0,z.jsx)(wS,{className:`pt-0 pb-3`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground bg-muted/50 rounded-md px-3 py-2`,children:[(0,z.jsx)(Qf,{className:`h-3.5 w-3.5`}),(0,z.jsxs)(`span`,{children:[`Namespace: `,(0,z.jsx)(`strong`,{children:d}),` · Short name: `,(0,z.jsx)(`strong`,{children:f}),` · Table: `,(0,z.jsx)(`code`,{className:`font-mono bg-muted px-1 rounded`,children:u})]})]})})]}),(0,z.jsxs)(bS,{children:[(0,z.jsxs)(xS,{className:`pb-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(SS,{className:`text-base flex items-center gap-2`,children:[(0,z.jsx)(Yf,{className:`h-4 w-4`}),`Field Definitions`]}),(0,z.jsxs)(dS,{variant:`secondary`,className:`text-xs`,children:[m.length,` / `,l.length]})]}),(0,z.jsxs)(`div`,{className:`relative mt-2`,children:[(0,z.jsx)(Dp,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,z.jsx)(nh,{placeholder:`Filter fields by name, label, or type...`,value:o,onChange:e=>s(e.target.value),className:`pl-9 h-8 text-sm`})]})]}),(0,z.jsx)(wS,{className:`p-0`,children:(0,z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,z.jsxs)($C,{children:[(0,z.jsx)(ew,{children:(0,z.jsxs)(nw,{className:`hover:bg-transparent`,children:[(0,z.jsx)(rw,{className:`w-8`}),(0,z.jsx)(rw,{className:`font-medium`,children:`Field Name`}),(0,z.jsx)(rw,{className:`font-medium`,children:`Label`}),(0,z.jsx)(rw,{className:`font-medium`,children:`Type`}),(0,z.jsx)(rw,{className:`font-medium`,children:`Required`}),(0,z.jsx)(rw,{className:`font-medium`,children:`Details`})]})}),(0,z.jsxs)(tw,{children:[m.map((e,t)=>{let n=loe[e.type]||Kf,r=uoe[e.type]||`text-gray-600 bg-gray-50 border-gray-200 dark:text-gray-400 dark:bg-gray-950 dark:border-gray-800`;return(0,z.jsxs)(nw,{className:`group`,children:[(0,z.jsx)(iw,{className:`py-2 text-center text-xs text-muted-foreground tabular-nums`,children:t+1}),(0,z.jsx)(iw,{className:`py-2`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`code`,{className:`font-mono text-sm font-medium`,children:e.name}),(0,z.jsx)(doe,{text:e.name}),e.required&&(0,z.jsx)(sp,{className:`h-3 w-3 text-amber-500`})]})}),(0,z.jsx)(iw,{className:`py-2 text-sm`,children:e.label}),(0,z.jsx)(iw,{className:`py-2`,children:(0,z.jsxs)(dS,{variant:`outline`,className:`gap-1 text-xs ${r}`,children:[(0,z.jsx)(n,{className:`h-3 w-3`}),e.type,e.multiple&&`[]`]})}),(0,z.jsx)(iw,{className:`py-2`,children:e.required?(0,z.jsx)(dS,{variant:`default`,className:`text-[10px] bg-amber-100 text-amber-700 border-amber-200 hover:bg-amber-100 dark:bg-amber-950 dark:text-amber-400 dark:border-amber-800`,children:`Required`}):(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Optional`})}),(0,z.jsx)(iw,{className:`py-2`,children:(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.reference&&(0,z.jsxs)(dS,{variant:`outline`,className:`text-[10px] font-mono gap-1`,children:[(0,z.jsx)(dp,{className:`h-2.5 w-2.5`}),` → `,e.reference]}),e.defaultValue!==void 0&&(0,z.jsxs)(dS,{variant:`outline`,className:`text-[10px] font-mono`,children:[`default: `,JSON.stringify(e.defaultValue)]}),e.maxLength&&(0,z.jsxs)(dS,{variant:`outline`,className:`text-[10px] font-mono`,children:[`max: `,e.maxLength]}),e.options&&(0,z.jsxs)(dS,{variant:`outline`,className:`text-[10px]`,children:[e.options.length,` options`]}),e.formula&&(0,z.jsxs)(dS,{variant:`outline`,className:`text-[10px] font-mono`,children:[`ƒ `,String(e.formula).slice(0,30)]})]})})]},e.name)}),m.length===0&&(0,z.jsx)(nw,{children:(0,z.jsx)(iw,{colSpan:6,className:`h-24 text-center text-muted-foreground text-sm`,children:o?`No fields matching filter`:`No fields defined`})})]})]})})})]})]})}var aw=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(`textarea`,{className:H(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));aw.displayName=`Textarea`;var poe=`Label`,ow=P.forwardRef((e,t)=>(0,z.jsx)(ih.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));ow.displayName=poe;var sw=ow,moe=am(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),cw=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(sw,{ref:n,className:H(moe(),e),...t}));cw.displayName=sw.displayName;function lw(e){let t=P.useRef({value:e,previous:e});return P.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var uw=`Switch`,[hoe,goe]=lh(uw),[_oe,voe]=hoe(uw),dw=P.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=P.useState(null),m=Jp(t,e=>p(e)),h=P.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=fh({prop:i,defaultProp:a??!1,onChange:l,caller:uw});return(0,z.jsxs)(_oe,{scope:n,checked:_,disabled:s,children:[(0,z.jsx)(W.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":hw(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:U(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,z.jsx)(mw,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});dw.displayName=uw;var fw=`SwitchThumb`,pw=P.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=voe(fw,n);return(0,z.jsx)(W.span,{"data-state":hw(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});pw.displayName=fw;var yoe=`SwitchBubbleInput`,mw=P.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=P.useRef(null),s=Jp(o,a),c=lw(n),l=Pv(t);return P.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,z.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});mw.displayName=yoe;function hw(e){return e?`checked`:`unchecked`}var gw=dw,boe=pw,_w=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(gw,{className:H(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,z.jsx)(boe,{className:H(`pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));_w.displayName=gw.displayName;function vw(e,[t,n]){return Math.min(n,Math.max(t,e))}var xoe=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Soe=[` `,`Enter`],yw=`Select`,[bw,xw,Coe]=_b(yw),[Sw,woe]=lh(yw,[Coe,Lv]),Cw=Lv(),[Toe,ww]=Sw(yw),[Eoe,Doe]=Sw(yw),Tw=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Cw(t),[g,_]=P.useState(null),[v,y]=P.useState(null),[b,x]=P.useState(!1),S=vb(l),[C,w]=fh({prop:r,defaultProp:i??!1,onChange:a,caller:yw}),[T,E]=fh({prop:o,defaultProp:s,onChange:c,caller:yw}),ee=P.useRef(null),D=g?m||!!g.closest(`form`):!0,[O,te]=P.useState(new Set),k=Array.from(O).map(e=>e.props.value).join(`;`);return(0,z.jsx)(Xv,{...h,children:(0,z.jsxs)(Toe,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:dh(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:ee,disabled:f,children:[(0,z.jsx)(bw.Provider,{scope:t,children:(0,z.jsx)(Eoe,{scope:e.__scopeSelect,onNativeOptionAdd:P.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:P.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),D?(0,z.jsxs)(pT,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,z.jsx)(`option`,{value:``}):null,Array.from(O)]},k):null]})})};Tw.displayName=yw;var Ew=`SelectTrigger`,Dw=P.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Cw(n),o=ww(Ew,n),s=o.disabled||r,c=Jp(t,o.onTriggerChange),l=xw(n),u=P.useRef(`touch`),[d,f,p]=hT(e=>{let t=l().filter(e=>!e.disabled),n=gT(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,z.jsx)(Zv,{asChild:!0,...a,children:(0,z.jsx)(W.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":mT(o.value)?``:void 0,...i,ref:c,onClick:U(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:U(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:U(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&xoe.includes(e.key)&&(m(),e.preventDefault())})})})});Dw.displayName=Ew;var Ow=`SelectValue`,kw=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=ww(Ow,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Jp(t,c.onValueNodeChange);return uh(()=>{l(u)},[l,u]),(0,z.jsx)(W.span,{...s,ref:d,style:{pointerEvents:`none`},children:mT(c.value)?(0,z.jsx)(z.Fragment,{children:o}):a})});kw.displayName=Ow;var Ooe=`SelectIcon`,Aw=P.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,z.jsx)(W.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Aw.displayName=Ooe;var koe=`SelectPortal`,jw=e=>(0,z.jsx)(Rh,{asChild:!0,...e});jw.displayName=koe;var Mw=`SelectContent`,Nw=P.forwardRef((e,t)=>{let n=ww(Mw,e.__scopeSelect),[r,i]=P.useState();if(uh(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?rh.createPortal((0,z.jsx)(Fw,{scope:e.__scopeSelect,children:(0,z.jsx)(bw.Slot,{scope:e.__scopeSelect,children:(0,z.jsx)(`div`,{children:e.children})})}),t):null}return(0,z.jsx)(Lw,{...e,ref:t})});Nw.displayName=Mw;var Pw=10,[Fw,Iw]=Sw(Mw),Aoe=`SelectContentImpl`,joe=mh(`SelectContent.RemoveScroll`),Lw=P.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=ww(Mw,n),[y,b]=P.useState(null),[x,S]=P.useState(null),C=Jp(t,e=>b(e)),[w,T]=P.useState(null),[E,ee]=P.useState(null),D=xw(n),[O,te]=P.useState(!1),k=P.useRef(!1);P.useEffect(()=>{if(y)return Eg(y)},[y]),Gh();let A=P.useCallback(e=>{let[t,...n]=D().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[D,x]),j=P.useCallback(()=>A([w,y]),[A,w,y]);P.useEffect(()=>{O&&j()},[O,j]);let{onOpenChange:M,triggerPointerDownPosRef:ne}=v;P.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(ne.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ne.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||M(!1),document.removeEventListener(`pointermove`,t),ne.current=null};return ne.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,M,ne]),P.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[N,re]=hT(e=>{let t=D().filter(e=>!e.disabled),n=gT(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ie=P.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(k.current=!0))},[v.value]),ae=P.useCallback(()=>y?.focus(),[y]),oe=P.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&ee(e)},[v.value]),se=r===`popper`?zw:Rw,ce=se===zw?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,z.jsx)(Fw,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ie,selectedItem:w,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:j,selectedItemText:E,position:r,isPositioned:O,searchRef:N,children:(0,z.jsx)(bg,{as:joe,allowPinchZoom:!0,children:(0,z.jsx)(Mh,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:U(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,z.jsx)(Ch,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,z.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>te(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:U(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=D().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>A(t)),e.preventDefault()}})})})})})})});Lw.displayName=Aoe;var Moe=`SelectItemAlignedPosition`,Rw=P.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=ww(Mw,n),o=Iw(Mw,n),[s,c]=P.useState(null),[l,u]=P.useState(null),d=Jp(t,e=>u(e)),f=xw(n),p=P.useRef(!1),m=P.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=P.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Pw,d=vw(a,[Pw,Math.max(Pw,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Pw,d=vw(a,[Pw,Math.max(Pw,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Pw*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Pw,ee=c-E,D=g.offsetHeight/2,O=g.offsetTop+D,te=m+v+O,k=x-te;if(te<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=te+Math.max(ee,D+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+D)+k;s.style.height=t+`px`,h.scrollTop=te-E+h.offsetTop}s.style.margin=`${Pw}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);uh(()=>y(),[y]);let[b,x]=P.useState();return uh(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,z.jsx)(Poe,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:P.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,z.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,z.jsx)(W.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Rw.displayName=Moe;var Noe=`SelectPopperPosition`,zw=P.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Pw,...a}=e,o=Cw(n);return(0,z.jsx)(Qv,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});zw.displayName=Noe;var[Poe,Bw]=Sw(Mw,{}),Vw=`SelectViewport`,Hw=P.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Iw(Vw,n),o=Bw(Vw,n),s=Jp(t,a.onViewportChange),c=P.useRef(0);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,z.jsx)(bw.Slot,{scope:n,children:(0,z.jsx)(W.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:U(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Pw*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Hw.displayName=Vw;var Uw=`SelectGroup`,[Ww,Gw]=Sw(Uw),Kw=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=dh();return(0,z.jsx)(Ww,{scope:n,id:i,children:(0,z.jsx)(W.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Kw.displayName=Uw;var qw=`SelectLabel`,Jw=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gw(qw,n);return(0,z.jsx)(W.div,{id:i.id,...r,ref:t})});Jw.displayName=qw;var Yw=`SelectItem`,[Xw,Zw]=Sw(Yw),Qw=P.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=ww(Yw,n),c=Iw(Yw,n),l=s.value===r,[u,d]=P.useState(a??``),[f,p]=P.useState(!1),m=Jp(t,e=>c.itemRefCallback?.(e,r,i)),h=dh(),g=P.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,z.jsx)(Xw,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:P.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,z.jsx)(bw.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,z.jsx)(W.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:U(o.onFocus,()=>p(!0)),onBlur:U(o.onBlur,()=>p(!1)),onClick:U(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:U(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:U(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:U(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:U(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:U(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Soe.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Qw.displayName=Yw;var $w=`SelectItemText`,eT=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=ww($w,n),s=Iw($w,n),c=Zw($w,n),l=Doe($w,n),[u,d]=P.useState(null),f=Jp(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=P.useMemo(()=>(0,z.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return uh(()=>(h(m),()=>g(m)),[h,g,m]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(W.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?rh.createPortal(a.children,o.valueNode):null]})});eT.displayName=$w;var tT=`SelectItemIndicator`,nT=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Zw(tT,n).isSelected?(0,z.jsx)(W.span,{"aria-hidden":!0,...r,ref:t}):null});nT.displayName=tT;var rT=`SelectScrollUpButton`,iT=P.forwardRef((e,t)=>{let n=Iw(rT,e.__scopeSelect),r=Bw(rT,e.__scopeSelect),[i,a]=P.useState(!1),o=Jp(t,r.onScrollButtonChange);return uh(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,z.jsx)(sT,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});iT.displayName=rT;var aT=`SelectScrollDownButton`,oT=P.forwardRef((e,t)=>{let n=Iw(aT,e.__scopeSelect),r=Bw(aT,e.__scopeSelect),[i,a]=P.useState(!1),o=Jp(t,r.onScrollButtonChange);return uh(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,z.jsx)(sT,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});oT.displayName=aT;var sT=P.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Iw(`SelectScrollButton`,n),o=P.useRef(null),s=xw(n),c=P.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return P.useEffect(()=>()=>c(),[c]),uh(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,z.jsx)(W.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:U(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:U(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:U(i.onPointerLeave,()=>{c()})})}),cT=`SelectSeparator`,lT=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,z.jsx)(W.div,{"aria-hidden":!0,...r,ref:t})});lT.displayName=cT;var uT=`SelectArrow`,dT=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Cw(n),a=ww(uT,n),o=Iw(uT,n);return a.open&&o.position===`popper`?(0,z.jsx)($v,{...i,...r,ref:t}):null});dT.displayName=uT;var fT=`SelectBubbleInput`,pT=P.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=P.useRef(null),a=Jp(r,i),o=lw(t);return P.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,z.jsx)(W.select,{...n,style:{...ey,...n.style},ref:a,defaultValue:t})});pT.displayName=fT;function mT(e){return e===``||e===void 0}function hT(e){let t=_h(e),n=P.useRef(``),r=P.useRef(0),i=P.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=P.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function gT(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=_T(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function _T(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var vT=Tw,yT=Dw,bT=kw,xT=Aw,ST=jw,CT=Nw,wT=Hw,TT=Jw,ET=Qw,DT=eT,OT=nT,kT=iT,AT=oT,jT=lT,MT=vT,NT=bT,PT=P.forwardRef(({className:e,children:t,...n},r)=>(0,z.jsxs)(yT,{ref:r,className:H(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,z.jsx)(xT,{asChild:!0,children:(0,z.jsx)(Vf,{className:`h-4 w-4 opacity-50`})})]}));PT.displayName=yT.displayName;var FT=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(kT,{ref:n,className:H(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,z.jsx)(Uf,{className:`h-4 w-4`})}));FT.displayName=kT.displayName;var IT=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(AT,{ref:n,className:H(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,z.jsx)(Vf,{className:`h-4 w-4`})}));IT.displayName=AT.displayName;var LT=P.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,z.jsx)(ST,{children:(0,z.jsxs)(CT,{ref:i,className:H(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,z.jsx)(FT,{}),(0,z.jsx)(wT,{className:H(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,z.jsx)(IT,{})]})}));LT.displayName=CT.displayName;var RT=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(TT,{ref:n,className:H(`px-2 py-1.5 text-sm font-semibold`,e),...t}));RT.displayName=TT.displayName;var zT=P.forwardRef(({className:e,children:t,...n},r)=>(0,z.jsxs)(ET,{ref:r,className:H(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,z.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,z.jsx)(OT,{children:(0,z.jsx)(Bf,{className:`h-4 w-4`})})}),(0,z.jsx)(DT,{children:t})]}));zT.displayName=ET.displayName;var BT=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(jT,{ref:n,className:H(`-mx-1 my-1 h-px bg-muted`,e),...t}));BT.displayName=jT.displayName;var VT=r_,HT=i_,UT=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(a_,{ref:n,className:H(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));UT.displayName=a_.displayName;var WT=P.forwardRef(({className:e,children:t,...n},r)=>(0,z.jsxs)(HT,{children:[(0,z.jsx)(UT,{}),(0,z.jsxs)(o_,{ref:r,className:H(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 sm:rounded-lg`,e),...n,children:[t,(0,z.jsxs)(l_,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,z.jsx)(Hp,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));WT.displayName=o_.displayName;var GT=({className:e,...t})=>(0,z.jsx)(`div`,{className:H(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});GT.displayName=`DialogHeader`;var KT=({className:e,...t})=>(0,z.jsx)(`div`,{className:H(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});KT.displayName=`DialogFooter`;var qT=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(s_,{ref:n,className:H(`text-lg font-semibold leading-none tracking-tight`,e),...t}));qT.displayName=s_.displayName;var JT=P.forwardRef(({className:e,...t},n)=>(0,z.jsx)(c_,{ref:n,className:H(`text-sm text-muted-foreground`,e),...t}));JT.displayName=c_.displayName;function YT(e,t){return P.useReducer((e,n)=>t[e][n]??e,e)}var XT=`ScrollArea`,[ZT,Foe]=lh(XT),[Ioe,QT]=ZT(XT),$T=P.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=P.useState(null),[l,u]=P.useState(null),[d,f]=P.useState(null),[p,m]=P.useState(null),[h,g]=P.useState(null),[_,v]=P.useState(0),[y,b]=P.useState(0),[x,S]=P.useState(!1),[C,w]=P.useState(!1),T=Jp(t,e=>c(e)),E=vb(i);return(0,z.jsx)(Ioe,{scope:n,type:r,dir:E,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:w,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,z.jsx)(W.div,{dir:E,...o,ref:T,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});$T.displayName=XT;var eE=`ScrollAreaViewport`,tE=P.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=QT(eE,n),s=Jp(t,P.useRef(null),o.onViewportChange);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,z.jsx)(W.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,z.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});tE.displayName=eE;var nE=`ScrollAreaScrollbar`,rE=P.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=QT(nE,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return P.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,z.jsx)(Loe,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,z.jsx)(Roe,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,z.jsx)(iE,{...r,ref:t,forceMount:n}):i.type===`always`?(0,z.jsx)(aE,{...r,ref:t}):null});rE.displayName=nE;var Loe=P.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=QT(nE,e.__scopeScrollArea),[a,o]=P.useState(!1);return P.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,z.jsx)(Bh,{present:n||a,children:(0,z.jsx)(iE,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Roe=P.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=QT(nE,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=vE(()=>c(`SCROLL_END`),100),[s,c]=YT(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return P.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),P.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,z.jsx)(Bh,{present:n||s!==`hidden`,children:(0,z.jsx)(aE,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:U(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:U(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),iE=P.forwardRef((e,t)=>{let n=QT(nE,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=P.useState(!1),s=e.orientation===`horizontal`,c=vE(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return yE(n.viewport,c),yE(n.content,c),(0,z.jsx)(Bh,{present:r||a,children:(0,z.jsx)(aE,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),aE=P.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=QT(nE,e.__scopeScrollArea),a=P.useRef(null),o=P.useRef(0),[s,c]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=pE(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return Woe(e,o.current,s,t)}return n===`horizontal`?(0,z.jsx)(zoe,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=hE(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,z.jsx)(Boe,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=hE(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),zoe=P.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=QT(nE,e.__scopeScrollArea),[o,s]=P.useState(),c=P.useRef(null),l=Jp(t,c,a.onScrollbarXChange);return P.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,z.jsx)(sE,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":mE(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),_E(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:fE(o.paddingLeft),paddingEnd:fE(o.paddingRight)}})}})}),Boe=P.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=QT(nE,e.__scopeScrollArea),[o,s]=P.useState(),c=P.useRef(null),l=Jp(t,c,a.onScrollbarYChange);return P.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,z.jsx)(sE,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":mE(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),_E(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:fE(o.paddingTop),paddingEnd:fE(o.paddingBottom)}})}})}),[Voe,oE]=ZT(nE),sE=P.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=QT(nE,n),[m,h]=P.useState(null),g=Jp(t,e=>h(e)),_=P.useRef(null),v=P.useRef(``),y=p.viewport,b=r.content-r.viewport,x=_h(u),S=_h(c),C=vE(d,10);function w(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return P.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&x(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),P.useEffect(S,[r,S]),yE(m,C),yE(p.content,C),(0,z.jsx)(Voe,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:_h(a),onThumbPointerUp:_h(o),onThumbPositionChange:S,onThumbPointerDown:_h(s),children:(0,z.jsx)(W.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:U(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),w(e))}),onPointerMove:U(e.onPointerMove,w),onPointerUp:U(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})}),cE=`ScrollAreaThumb`,lE=P.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=oE(cE,e.__scopeScrollArea);return(0,z.jsx)(Bh,{present:n||i.hasThumb,children:(0,z.jsx)(Hoe,{ref:t,...r})})}),Hoe=P.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=QT(cE,n),o=oE(cE,n),{onThumbPositionChange:s}=o,c=Jp(t,e=>o.onThumbChange(e)),l=P.useRef(void 0),u=vE(()=>{l.current&&=(l.current(),void 0)},100);return P.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=Goe(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,z.jsx)(W.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:U(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:U(e.onPointerUp,o.onThumbPointerUp)})});lE.displayName=cE;var uE=`ScrollAreaCorner`,dE=P.forwardRef((e,t)=>{let n=QT(uE,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,z.jsx)(Uoe,{...e,ref:t}):null});dE.displayName=uE;var Uoe=P.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=QT(uE,n),[a,o]=P.useState(0),[s,c]=P.useState(0),l=!!(a&&s);return yE(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),yE(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,z.jsx)(W.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function fE(e){return e?parseInt(e,10):0}function pE(e,t){let n=e/t;return isNaN(n)?0:n}function mE(e){let t=pE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Woe(e,t,n,r=`ltr`){let i=mE(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return gE([c,l],d)(e)}function hE(e,t,n=`ltr`){let r=mE(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=vw(e,n===`ltr`?[0,o]:[o*-1,0]);return gE([0,o],[0,s])(c)}function gE(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function _E(e,t){return e>0&&e<t}var Goe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function vE(e,t){let n=_h(e),r=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),P.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function yE(e,t){let n=_h(t);uh(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var bE=$T,Koe=tE,qoe=dE,xE=P.forwardRef(({className:e,children:t,...n},r)=>(0,z.jsxs)(bE,{ref:r,className:H(`relative overflow-hidden`,e),...n,children:[(0,z.jsx)(Koe,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,z.jsx)(SE,{}),(0,z.jsx)(qoe,{})]}));xE.displayName=bE.displayName;var SE=P.forwardRef(({className:e,orientation:t=`vertical`,...n},r)=>(0,z.jsx)(rE,{ref:r,orientation:t,className:H(`flex touch-none select-none transition-colors`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent p-[1px]`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent p-[1px]`,e),...n,children:(0,z.jsx)(lE,{className:`relative flex-1 rounded-full bg-border`})}));SE.displayName=rE.displayName;function Joe({objectApiName:e,record:t,onSuccess:n,onCancel:r}){let i=yf(),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)({}),[l,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(null);(0,P.useEffect)(()=>{let n=!0;async function r(){try{let r=await i.meta.getItem(`object`,e);n&&r&&(o(r.item||r),c(t?{...t}:{}))}catch(e){console.error(`Failed to load definition`,e)}}return r(),()=>{n=!1}},[i,e,t]);let p=async r=>{r.preventDefault(),u(!0),f(null);try{let r={...s};delete r.id,delete r.created_at,delete r.updated_at,a&&a.fields&&Object.keys(a.fields).forEach(e=>{a.fields[e].type===`number`&&r[e]&&(r[e]=parseFloat(r[e]))}),t&&t.id?await i.data.update(e,t.id,r):await i.data.create(e,r),n()}catch(e){f(e.message||`Operation failed`)}finally{u(!1)}},m=(e,t)=>{c(n=>({...n,[e]:t}))};if(!a)return(0,z.jsx)(VT,{open:!0,onOpenChange:e=>!e&&r(),children:(0,z.jsxs)(WT,{className:`sm:max-w-lg`,children:[(0,z.jsxs)(GT,{children:[(0,z.jsx)(qT,{children:`Loading...`}),(0,z.jsx)(JT,{children:`Fetching object definition`})]}),(0,z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,z.jsx)(pp,{className:`h-6 w-6 animate-spin text-muted-foreground`})})]})});let h=a.fields||{},g=Object.keys(h).filter(e=>![`created_at`,`updated_at`,`created_by`,`updated_by`].includes(e)),_=!!(t&&t.id);return(0,z.jsx)(VT,{open:!0,onOpenChange:e=>!e&&r(),children:(0,z.jsxs)(WT,{className:`sm:max-w-lg max-h-[85vh] flex flex-col p-0 gap-0`,children:[(0,z.jsxs)(GT,{className:`px-6 pt-6 pb-4 border-b`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(qT,{className:`text-lg`,children:[_?`Edit`:`New`,` `,a.label]}),(0,z.jsx)(dS,{variant:_?`secondary`:`default`,className:`text-xs`,children:_?`Editing`:`Creating`})]}),(0,z.jsx)(JT,{children:_?`Update the fields below to modify this ${a.label.toLowerCase()}.`:`Fill in the fields below to create a new ${a.label.toLowerCase()}.`})]}),(0,z.jsxs)(`form`,{onSubmit:p,className:`flex-1 flex flex-col overflow-hidden`,children:[(0,z.jsx)(xE,{className:`flex-1`,children:(0,z.jsxs)(`div`,{className:`p-6 space-y-5`,children:[d&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 bg-destructive/10 text-destructive p-3 rounded-lg text-sm border border-destructive/20`,children:[(0,z.jsx)(Gf,{className:`h-4 w-4 shrink-0`}),d]}),g.map(e=>{let t=h[e],n=t.label||e,r=t.required;return(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(cw,{htmlFor:e,className:`text-sm font-medium`,children:n}),r&&(0,z.jsx)(`span`,{className:`text-xs text-destructive`,children:`*`}),(0,z.jsx)(dS,{variant:`outline`,className:`text-[10px] px-1 py-0 font-normal opacity-40 ml-auto`,children:t.type})]}),t.type===`boolean`?(0,z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border p-3`,children:[(0,z.jsx)(_w,{id:e,checked:!!s[e],onCheckedChange:t=>m(e,t)}),(0,z.jsx)(cw,{htmlFor:e,className:`text-sm text-muted-foreground cursor-pointer`,children:s[e]?`Enabled`:`Disabled`})]}):t.type===`select`?(0,z.jsxs)(MT,{value:s[e]||``,onValueChange:t=>m(e,t),children:[(0,z.jsx)(PT,{id:e,children:(0,z.jsx)(NT,{placeholder:`Select an option...`})}),(0,z.jsx)(LT,{children:t.options?.map(e=>(0,z.jsx)(zT,{value:e.value,children:e.label},e.value))})]}):t.type===`textarea`?(0,z.jsx)(aw,{id:e,value:s[e]||``,onChange:t=>m(e,t.target.value),rows:3,required:r,placeholder:`Enter ${n.toLowerCase()}...`,className:`resize-none`}):(0,z.jsx)(nh,{id:e,type:t.type===`number`?`number`:`text`,value:s[e]||``,onChange:t=>m(e,t.target.value),required:r,placeholder:`Enter ${n.toLowerCase()}...`}),t.description&&(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description})]},e)})]})}),(0,z.jsxs)(KT,{className:`px-6 py-4 border-t bg-muted/30`,children:[(0,z.jsx)(th,{variant:`outline`,onClick:r,type:`button`,className:`gap-1.5`,children:`Cancel`}),(0,z.jsx)(th,{type:`submit`,disabled:l,className:`gap-1.5`,children:l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(pp,{className:`h-4 w-4 animate-spin`}),` Saving...`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Ep,{className:`h-4 w-4`}),` `,_?`Update`:`Create`]})})]})]})]})})}var CE={GET:`text-emerald-600 bg-emerald-50 border-emerald-200 dark:text-emerald-400 dark:bg-emerald-950/50`,POST:`text-blue-600 bg-blue-50 border-blue-200 dark:text-blue-400 dark:bg-blue-950/50`,PATCH:`text-amber-600 bg-amber-50 border-amber-200 dark:text-amber-400 dark:bg-amber-950/50`,DELETE:`text-red-600 bg-red-50 border-red-200 dark:text-red-400 dark:bg-red-950/50`},Yoe={2:`text-emerald-600 dark:text-emerald-400`,3:`text-blue-600 dark:text-blue-400`,4:`text-amber-600 dark:text-amber-400`,5:`text-red-600 dark:text-red-400`};function Xoe({objectApiName:e}){let t=yf(),n=[{method:`GET`,path:`/api/v1/data/${e}`,desc:`List records`},{method:`POST`,path:`/api/v1/data/${e}`,desc:`Create record`,bodyTemplate:{name:`example`}},{method:`GET`,path:`/api/v1/data/${e}/:id`,desc:`Get by ID`},{method:`PATCH`,path:`/api/v1/data/${e}/:id`,desc:`Update record`,bodyTemplate:{name:`updated`}},{method:`DELETE`,path:`/api/v1/data/${e}/:id`,desc:`Delete record`},{method:`GET`,path:`/api/v1/meta/object/${e}`,desc:`Object schema`}],[r,i]=(0,P.useState)(n[0]),[a,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(``),[l,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(null),[p,m]=(0,P.useState)([]),[h,g]=(0,P.useState)(null),[_,v]=(0,P.useState)(!1),y=a||r.path,b=(0,P.useCallback)(e=>{i(e),o(e.path),c(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),f(null)},[]),x=(0,P.useCallback)(async()=>{if(l)return;let e=`${t?.baseUrl??``}${y}`;u(!0);let n=performance.now();try{let t={method:r.method,headers:{"Content-Type":`application/json`}};[`POST`,`PATCH`].includes(r.method)&&s.trim()&&(t.body=s);let i=await fetch(e,t),a=Math.round(performance.now()-n),o;if((i.headers.get(`content-type`)??``).includes(`json`)){let e=await i.json();o=JSON.stringify(e,null,2)}else o=await i.text();f({status:i.status,body:o,duration:a}),m(e=>[{id:Date.now(),method:r.method,url:y,body:s||void 0,status:i.status,duration:a,response:o,timestamp:new Date},...e].slice(0,20))}catch(e){let t=Math.round(performance.now()-n);f({status:0,body:`Network Error: ${e.message}`,duration:t})}finally{u(!1)}},[t,y,r,s,l]),S=(0,P.useCallback)(()=>{d?.body&&(navigator.clipboard.writeText(d.body),v(!0),setTimeout(()=>v(!1),1500))},[d]),C=e=>Yoe[String(e)[0]]??`text-muted-foreground`;return(0,z.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[280px_1fr] gap-4 h-full`,children:[(0,z.jsxs)(`div`,{className:`space-y-3 lg:border-r lg:pr-4`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wider`,children:`Endpoints`}),(0,z.jsx)(`div`,{className:`space-y-1`,children:n.map((e,t)=>(0,z.jsxs)(`button`,{onClick:()=>b(e),className:`w-full text-left flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors ${e===r?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,z.jsx)(dS,{variant:`outline`,className:`font-mono text-[10px] shrink-0 ${CE[e.method]}`,children:e.method}),(0,z.jsx)(`span`,{className:`truncate text-xs`,children:e.desc})]},t))}),(0,z.jsxs)(`div`,{className:`pt-3 border-t`,children:[(0,z.jsx)(`h4`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Query Parameters`}),(0,z.jsxs)(`div`,{className:`space-y-1 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`code`,{className:`text-foreground`,children:`?$top=10`}),` — limit`]}),(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`code`,{className:`text-foreground`,children:`?$skip=20`}),` — offset`]}),(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`code`,{className:`text-foreground`,children:`?$sort=name`}),` — sort`]}),(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`code`,{className:`text-foreground`,children:`?$select=name,email`}),` — fields`]}),(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`code`,{className:`text-foreground`,children:`?$count=true`}),` — total count`]})]})]})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(dS,{variant:`outline`,className:`font-mono text-xs shrink-0 ${CE[r.method]}`,children:r.method}),(0,z.jsx)(`input`,{type:`text`,value:a||y,onChange:e=>o(e.target.value),className:`flex-1 rounded-md border bg-background px-3 py-1.5 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-ring`,placeholder:r.path}),(0,z.jsxs)(`button`,{onClick:x,disabled:l,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors`,children:[l?(0,z.jsx)(pp,{className:`h-3.5 w-3.5 animate-spin`}):(0,z.jsx)(xp,{className:`h-3.5 w-3.5`}),`Send`]})]}),[`POST`,`PATCH`].includes(r.method)&&(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,z.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:4,className:`w-full rounded-md border bg-background px-3 py-2 font-mono text-xs focus:outline-none focus:ring-1 focus:ring-ring resize-y`,placeholder:`{ "name": "value" }`})]}),d&&(0,z.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col rounded-lg border overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,z.jsx)(`span`,{className:`font-mono font-semibold ${C(d.status)}`,children:d.status||`ERR`}),(0,z.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,z.jsx)(Jf,{className:`h-3 w-3`}),d.duration,`ms`]})]}),(0,z.jsxs)(`button`,{onClick:S,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[_?(0,z.jsx)(Bf,{className:`h-3 w-3`}):(0,z.jsx)(Xf,{className:`h-3 w-3`}),_?`Copied`:`Copy`]})]}),(0,z.jsx)(`pre`,{className:`flex-1 overflow-auto p-3 text-xs font-mono bg-muted/10 whitespace-pre-wrap break-all`,children:d.body})]}),!d&&!l&&(0,z.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,z.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,z.jsx)(ap,{className:`h-8 w-8 mx-auto opacity-30`}),(0,z.jsxs)(`p`,{children:[`Select an endpoint and click `,(0,z.jsx)(`strong`,{children:`Send`}),` to test`]})]})}),p.length>0&&(0,z.jsxs)(`div`,{className:`border-t pt-3 space-y-1`,children:[(0,z.jsx)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`History`}),(0,z.jsx)(`div`,{className:`space-y-1 max-h-48 overflow-auto`,children:p.map(e=>(0,z.jsxs)(`div`,{className:`rounded border`,children:[(0,z.jsxs)(`button`,{onClick:()=>g(h===e.id?null:e.id),className:`w-full flex items-center gap-2 px-2 py-1.5 text-xs hover:bg-muted/30 transition-colors`,children:[h===e.id?(0,z.jsx)(Vf,{className:`h-3 w-3 shrink-0`}):(0,z.jsx)(Hf,{className:`h-3 w-3 shrink-0`}),(0,z.jsx)(dS,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${CE[e.method]}`,children:e.method}),(0,z.jsx)(`span`,{className:`font-mono truncate`,children:e.url}),(0,z.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${C(e.status)}`,children:e.status}),(0,z.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]})]}),h===e.id&&(0,z.jsx)(`pre`,{className:`px-3 py-2 text-xs font-mono bg-muted/10 border-t overflow-auto max-h-40 whitespace-pre-wrap break-all`,children:e.response})]},e.id))})]})]})]})}function Zoe({objectApiName:e}){let[t,n]=(0,P.useState)(`schema`),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(!1);function s(e){i(e),o(!0)}function c(){o(!1),i(null),t===`data`&&(n(`schema`),setTimeout(()=>n(`data`),0))}return(0,z.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1 border-b px-4 bg-muted/30`,children:[[{id:`schema`,label:`Schema`,icon:Yf},{id:`data`,label:`Data`,icon:Pp},{id:`api`,label:`API`,icon:ap}].map(e=>{let r=e.icon;return(0,z.jsxs)(`button`,{onClick:()=>n(e.id),className:`
|
|
62
62
|
flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2
|
|
63
63
|
${t===e.id?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-border`}
|
|
64
|
-
`,children:[(0,z.jsx)(r,{className:`h-3.5 w-3.5`}),e.label]},e.id)}),(0,z.jsx)(`div`,{className:`ml-auto flex items-center gap-2 py-2`,children:(0,z.jsxs)(dS,{variant:`outline`,className:`font-mono text-xs gap-1`,children:[(0,z.jsx)(Qf,{className:`h-3 w-3`}),e]})})]}),(0,z.jsxs)(`div`,{className:`flex-1 overflow-auto p-4`,children:[t===`schema`&&(0,z.jsx)(foe,{objectApiName:e}),t===`data`&&(0,z.jsx)(coe,{objectApiName:e,onEdit:s}),t===`api`&&(0,z.jsx)(Xoe,{objectApiName:e})]}),a&&(0,z.jsx)(Joe,{objectApiName:e,record:r&&Object.keys(r).length>0?r:void 0,onSuccess:c,onCancel:()=>{o(!1),i(null)}})]})}function Qoe({metadataName:e}){return(0,z.jsx)(Zoe,{objectApiName:e})}var $oe={manifest:QC({id:`objectstack.object-designer`,name:`Object Designer`,version:`1.0.0`,description:`Schema inspector, data table, and API reference for Object metadata.`,contributes:{metadataViewers:[{id:`object-explorer`,metadataTypes:[`object`,`objects`],label:`Object Explorer`,priority:100,modes:[`preview`,`data`,`code`]}],sidebarGroups:[{key:`data`,label:`Data`,icon:`database`,metadataTypes:[`object`,`objects`,`hooks`,`mappings`,`analyticsCubes`,`data`],order:10}],metadataIcons:[{metadataType:`object`,label:`Objects`,icon:`package`},{metadataType:`objects`,label:`Objects`,icon:`package`},{metadataType:`hooks`,label:`Hooks`,icon:`anchor`},{metadataType:`mappings`,label:`Mappings`,icon:`map`},{metadataType:`analyticsCubes`,label:`Analytics Cubes`,icon:`pie-chart`},{metadataType:`data`,label:`Seed Data`,icon:`database`}]}}),activate(e){e.registerViewer(`object-explorer`,Qoe),e.registerMetadataIcon(`object`,_p,`Objects`),e.registerMetadataIcon(`objects`,_p,`Objects`),e.registerMetadataIcon(`hooks`,kf,`Hooks`),e.registerMetadataIcon(`mappings`,hp,`Mappings`),e.registerMetadataIcon(`analyticsCubes`,zf,`Analytics Cubes`),e.registerMetadataIcon(`data`,Qf,`Seed Data`)}},ese={actions:Up,dashboards:Rf,reports:ip,flows:Vp,agents:Pf,apis:ap,ragPipelines:Nf,profiles:kp,sharingRules:kp},tse={actions:`Action`,dashboards:`Dashboard`,reports:`Report`,flows:`Flow`,agents:`Agent`,apis:`API`,ragPipelines:`RAG Pipeline`,profiles:`Profile`,sharingRules:`Sharing Rule`};function wE({text:e}){let[t,n]=(0,P.useState)(!1);return(0,z.jsx)(Ly,{children:(0,z.jsxs)(Ry,{children:[(0,z.jsx)(zy,{asChild:!0,children:(0,z.jsx)(th,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,z.jsx)(Bf,{className:`h-3 w-3 text-emerald-500`}):(0,z.jsx)(Xf,{className:`h-3 w-3`})})}),(0,z.jsx)(By,{children:`Copy`})]})})}function TE({data:e,depth:t=0}){let[n,r]=(0,P.useState)({});if(e==null)return(0,z.jsx)(`span`,{className:`text-muted-foreground italic`,children:`null`});if(typeof e==`boolean`)return(0,z.jsx)(dS,{variant:`outline`,className:`text-[10px] font-mono ${e?`text-emerald-600 border-emerald-300`:`text-red-500 border-red-300`}`,children:String(e)});if(typeof e==`number`)return(0,z.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400 font-mono text-sm`,children:e});if(typeof e==`string`)return e.length>120?(0,z.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-400 font-mono text-sm break-all`,children:[`"`,e.slice(0,120),`…"`]}):(0,z.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-400 font-mono text-sm`,children:[`"`,e,`"`]});if(Array.isArray(e))return e.length===0?(0,z.jsx)(`span`,{className:`text-muted-foreground font-mono text-sm`,children:`[]`}):e.length<=5&&e.every(e=>typeof e!=`object`)?(0,z.jsxs)(`span`,{className:`font-mono text-sm`,children:[`[`,e.map((e,n)=>(0,z.jsxs)(`span`,{children:[n>0&&`, `,(0,z.jsx)(TE,{data:e,depth:t+1})]},n)),`]`]}):(0,z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,z.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[`Array(`,e.length,`)`]}),(0,z.jsx)(`div`,{className:`ml-4 border-l pl-3 space-y-0.5`,children:e.map((e,n)=>(0,z.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,z.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs shrink-0 mt-0.5`,children:[`[`,n,`]`]}),(0,z.jsx)(TE,{data:e,depth:t+1})]},n))})]});if(typeof e==`object`){let i=Object.keys(e);return i.length===0?(0,z.jsx)(`span`,{className:`text-muted-foreground font-mono text-sm`,children:`{}`}):(0,z.jsx)(`div`,{className:`space-y-0.5`,children:i.map(i=>{let a=e[i],o=typeof a==`object`&&!!a,s=n[i]??(t>1&&o);return(0,z.jsx)(`div`,{children:(0,z.jsxs)(`div`,{className:`flex items-start gap-1 group`,children:[o?(0,z.jsx)(`button`,{onClick:()=>r(e=>({...e,[i]:!s})),className:`shrink-0 mt-0.5 p-0.5 rounded hover:bg-muted`,children:s?(0,z.jsx)(Hf,{className:`h-3 w-3 text-muted-foreground`}):(0,z.jsx)(Vf,{className:`h-3 w-3 text-muted-foreground`})}):(0,z.jsx)(`span`,{className:`w-4 shrink-0`}),(0,z.jsxs)(`span`,{className:`text-blue-600 dark:text-blue-400 font-mono text-sm shrink-0`,children:[i,`:`]}),o&&s?(0,z.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:Array.isArray(a)?`Array(${a.length})`:`{${Object.keys(a).length} keys}`}):(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsx)(TE,{data:a,depth:t+1})})]})},i)})})}return(0,z.jsx)(`span`,{className:`font-mono text-sm`,children:String(e)})}function nse({metaType:e,metaName:t}){let n=yf(),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(!0),[s,c]=(0,P.useState)(``),l=ese[e]||ip,u=tse[e]||e.charAt(0).toUpperCase()+e.slice(1);if((0,P.useEffect)(()=>{let r=!0;o(!0),i(null);async function a(){try{let a=await n.meta.getItem(e,t);r&&i(a?.item||a)}catch(n){console.error(`[MetadataInspector] Failed to load ${e}/${t}:`,n)}finally{r&&o(!1)}}return a(),()=>{r=!1}},[n,e,t]),a)return(0,z.jsx)(`div`,{className:`space-y-4 p-4`,children:(0,z.jsxs)(bS,{children:[(0,z.jsx)(xS,{children:(0,z.jsx)(f_,{className:`h-6 w-48`})}),(0,z.jsxs)(wS,{className:`space-y-3`,children:[(0,z.jsx)(f_,{className:`h-10 w-full`}),(0,z.jsx)(f_,{className:`h-10 w-full`}),(0,z.jsx)(f_,{className:`h-10 w-full`})]})]})});if(!r)return(0,z.jsx)(`div`,{className:`p-4`,children:(0,z.jsx)(bS,{children:(0,z.jsxs)(wS,{className:`py-12 text-center text-muted-foreground`,children:[u,` definition not found: `,(0,z.jsx)(`code`,{className:`font-mono`,children:t})]})})});let d=r.label||r.name||t,f=r.name||t,p=r.description,[m]=f.includes(`__`)?f.split(`__`):[null],h=Object.keys(r),g=s?h.filter(e=>e.toLowerCase().includes(s.toLowerCase())||JSON.stringify(r[e]).toLowerCase().includes(s.toLowerCase())):h;return(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsx)(bS,{children:(0,z.jsx)(xS,{className:`pb-3`,children:(0,z.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(l,{className:`h-5 w-5 text-muted-foreground`}),(0,z.jsx)(SS,{className:`text-xl`,children:d}),m&&(0,z.jsx)(dS,{variant:`secondary`,className:`font-mono text-xs`,children:m}),(0,z.jsx)(dS,{variant:`outline`,className:`text-xs`,children:u})]}),(0,z.jsxs)(CS,{className:`flex items-center gap-3 flex-wrap`,children:[(0,z.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:f}),(0,z.jsx)(wE,{text:f}),p&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{children:`·`}),(0,z.jsx)(`span`,{className:`text-xs`,children:p})]})]})]})})})}),(0,z.jsxs)(bS,{children:[(0,z.jsxs)(xS,{className:`pb-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(SS,{className:`text-base`,children:`Properties`}),(0,z.jsxs)(dS,{variant:`secondary`,className:`text-xs`,children:[g.length,` / `,h.length,` keys`]})]}),(0,z.jsxs)(`div`,{className:`relative mt-2`,children:[(0,z.jsx)(Dp,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,z.jsx)(nh,{placeholder:`Filter properties...`,value:s,onChange:e=>c(e.target.value),className:`pl-9 h-8 text-sm`})]})]}),(0,z.jsx)(wS,{children:(0,z.jsx)(xE,{className:`max-h-[60vh]`,children:(0,z.jsxs)(`div`,{className:`space-y-3`,children:[g.map(e=>(0,z.jsxs)(`div`,{className:`group rounded-md border p-3 hover:bg-muted/30 transition-colors`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,z.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400 font-mono text-sm font-medium`,children:e}),(0,z.jsx)(wE,{text:JSON.stringify(r[e],null,2)}),(0,z.jsx)(dS,{variant:`outline`,className:`text-[10px] font-mono ml-auto`,children:Array.isArray(r[e])?`array(${r[e].length})`:typeof r[e]})]}),(0,z.jsx)(`div`,{className:`pl-1`,children:(0,z.jsx)(TE,{data:r[e]})})]},e)),g.length===0&&(0,z.jsx)(`p`,{className:`text-sm text-center text-muted-foreground py-8`,children:s?`No properties match filter`:`No properties`})]})})})]})]})}function rse({metadataType:e,metadataName:t}){return(0,z.jsx)(nse,{metaType:e,metaName:t})}var ise=[{manifest:QC({id:`objectstack.default-inspector`,name:`Default Metadata Inspector`,version:`1.0.0`,description:`JSON tree viewer for any metadata type. Fallback when no specialized viewer is available.`,contributes:{metadataViewers:[{id:`json-inspector`,metadataTypes:[`*`],label:`JSON Inspector`,priority:-1,modes:[`preview`,`code`]}]}}),activate(e){e.registerViewer(`json-inspector`,rse)}},$oe,{manifest:QC({id:`objectstack.ui-protocol`,name:`UI Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for UI metadata types.`,contributes:{sidebarGroups:[{key:`ui`,label:`UI`,icon:`app-window`,metadataTypes:[`actions`,`views`,`pages`,`dashboards`,`reports`,`themes`],order:20}],metadataIcons:[{metadataType:`actions`,label:`Actions`,icon:`zap`},{metadataType:`views`,label:`Views`,icon:`eye`},{metadataType:`pages`,label:`Pages`,icon:`file-code`},{metadataType:`dashboards`,label:`Dashboards`,icon:`bar-chart-3`},{metadataType:`reports`,label:`Reports`,icon:`file-text`},{metadataType:`themes`,label:`Themes`,icon:`palette`}]}}),activate(e){e.registerMetadataIcon(`actions`,Up,`Actions`),e.registerMetadataIcon(`views`,np,`Views`),e.registerMetadataIcon(`pages`,rp,`Pages`),e.registerMetadataIcon(`dashboards`,Rf,`Dashboards`),e.registerMetadataIcon(`reports`,ip,`Reports`),e.registerMetadataIcon(`themes`,vp,`Themes`)}},{manifest:QC({id:`objectstack.automation-protocol`,name:`Automation Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for automation metadata types.`,contributes:{sidebarGroups:[{key:`automation`,label:`Automation`,icon:`workflow`,metadataTypes:[`flows`,`workflows`,`approvals`,`webhooks`],order:30}],metadataIcons:[{metadataType:`flows`,label:`Flows`,icon:`workflow`},{metadataType:`workflows`,label:`Workflows`,icon:`workflow`},{metadataType:`approvals`,label:`Approvals`,icon:`check-square`},{metadataType:`webhooks`,label:`Webhooks`,icon:`webhook`}]}}),activate(e){e.registerMetadataIcon(`flows`,Vp,`Flows`),e.registerMetadataIcon(`workflows`,Vp,`Workflows`),e.registerMetadataIcon(`approvals`,jp,`Approvals`),e.registerMetadataIcon(`webhooks`,Bp,`Webhooks`)}},{manifest:QC({id:`objectstack.security-protocol`,name:`Security Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for security metadata types.`,contributes:{sidebarGroups:[{key:`security`,label:`Security`,icon:`shield`,metadataTypes:[`roles`,`permissions`,`profiles`,`sharingRules`,`policies`],order:40}],metadataIcons:[{metadataType:`roles`,label:`Roles`,icon:`user-cog`},{metadataType:`permissions`,label:`Permissions`,icon:`lock`},{metadataType:`profiles`,label:`Profiles`,icon:`shield`},{metadataType:`sharingRules`,label:`Sharing Rules`,icon:`shield`},{metadataType:`policies`,label:`Policies`,icon:`shield`}]}}),activate(e){e.registerMetadataIcon(`roles`,zp,`Roles`),e.registerMetadataIcon(`permissions`,mp,`Permissions`),e.registerMetadataIcon(`profiles`,kp,`Profiles`),e.registerMetadataIcon(`sharingRules`,kp,`Sharing Rules`),e.registerMetadataIcon(`policies`,kp,`Policies`)}},{manifest:QC({id:`objectstack.ai-protocol`,name:`AI Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for AI metadata types.`,contributes:{sidebarGroups:[{key:`ai`,label:`AI`,icon:`bot`,metadataTypes:[`agents`,`ragPipelines`],order:50}],metadataIcons:[{metadataType:`agents`,label:`Agents`,icon:`bot`},{metadataType:`ragPipelines`,label:`RAG Pipelines`,icon:`book-open`}]}}),activate(e){e.registerMetadataIcon(`agents`,Pf,`Agents`),e.registerMetadataIcon(`ragPipelines`,Nf,`RAG Pipelines`)}},{manifest:QC({id:`objectstack.api-protocol`,name:`API Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for API metadata types.`,contributes:{sidebarGroups:[{key:`api`,label:`API`,icon:`globe`,metadataTypes:[`apis`,`connectors`],order:60}],metadataIcons:[{metadataType:`apis`,label:`APIs`,icon:`globe`},{metadataType:`connectors`,label:`Connectors`,icon:`link-2`}]}}),activate(e){e.registerMetadataIcon(`apis`,ap,`APIs`),e.registerMetadataIcon(`connectors`,up,`Connectors`)}}];function ase(){let[e,t]=(0,P.useState)(null),[n,r]=(0,P.useState)([]),[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(`overview`);(0,P.useEffect)(()=>{let e=gS();console.log(`[App] Connecting to API: ${e} (mode: ${pS.mode})`),t(new gf({baseUrl:e}))},[]),(0,P.useEffect)(()=>{if(!e)return;let t=!0;async function n(){try{let n=((await e.packages.list())?.packages||[]).filter(e=>e.manifest?.version!==`0.0.0`&&e.manifest?.id!==`dev-workspace`);console.log(`[App] Fetched packages:`,n.map(e=>e.manifest?.name||e.manifest?.id)),t&&n.length>0&&(r(n),a(n[0]))}catch(e){console.error(`[App] Failed to fetch packages:`,e)}}return n(),()=>{t=!1}},[e]);let f=(0,P.useCallback)(e=>{a(e),s(null),d(`overview`)},[]),p=(0,P.useCallback)(e=>{e?(s(e),d(`object`)):(s(null),d(`overview`))},[]),m=(0,P.useCallback)(e=>{d(e),s(null),l(null)},[]),h=(0,P.useCallback)((e,t)=>{l({type:e,name:t}),s(null),d(`metadata`)},[]),g=(0,P.useCallback)((e,t)=>{e===`packages`?m(`packages`):t&&p(t)},[m,p]);return e?(0,z.jsx)(vf,{client:e,children:(0,z.jsx)(VC,{plugins:ise,children:(0,z.jsx)(Gp,{children:(0,z.jsxs)(Uy,{children:[(0,z.jsx)(nae,{selectedObject:o,onSelectObject:p,selectedMeta:c,onSelectMeta:h,packages:n,selectedPackage:i,onSelectPackage:f,onSelectView:m,selectedView:u}),(0,z.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col h-svh overflow-hidden bg-background`,children:[(0,z.jsx)(yS,{selectedObject:o,selectedMeta:c,selectedView:u,packageLabel:i?.manifest?.name||i?.manifest?.id}),(0,z.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:u===`object`&&o?(0,z.jsx)(JC,{metadataType:`object`,metadataName:o}):u===`metadata`&&c?(0,z.jsx)(JC,{metadataType:c.type,metadataName:c.name}):u===`packages`?(0,z.jsx)(PS,{}):u===`api-console`?(0,z.jsx)(GS,{}):(0,z.jsx)(cae,{packages:n,selectedPackage:i,onNavigate:g})})]}),(0,z.jsx)(PC,{})]})})})}):(0,z.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:(0,z.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,z.jsx)(`div`,{className:`h-8 w-8 mx-auto animate-spin rounded-full border-4 border-muted border-t-primary`}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connecting to ObjectStack…`})]})})}var ose=Object.defineProperty,EE=(e,t)=>{for(var n in t)ose(e,n,{get:t[n],enumerable:!0})};EE({},{AggregationFunctionEnum:()=>sse,AppNameSchema:()=>mse,BaseMetadataRecordSchema:()=>use,CacheStrategyEnum:()=>lse,CorsConfigSchema:()=>FE,EventNameSchema:()=>kE,FieldMappingSchema:()=>jE,FieldNameSchema:()=>fse,FlowNameSchema:()=>hse,HttpMethod:()=>ME,HttpMethodSchema:()=>NE,HttpRequestSchema:()=>PE,IsolationLevelEnum:()=>BE,MAP_SUPPORTED_FIELDS:()=>lD,METADATA_ALIASES:()=>fD,MetadataFormatSchema:()=>VE,MutationEventEnum:()=>cse,ObjectNameSchema:()=>dse,RateLimitConfigSchema:()=>IE,RoleNameSchema:()=>gse,SnakeCaseIdentifierSchema:()=>OE,SortDirectionEnum:()=>RE,SortItemSchema:()=>zE,StaticMountSchema:()=>LE,SystemIdentifierSchema:()=>DE,TransformTypeSchema:()=>AE,ViewNameSchema:()=>pse,findClosestMatches:()=>rD,formatSuggestion:()=>aD,formatZodError:()=>cD,formatZodIssue:()=>sD,levenshteinDistance:()=>nD,normalizeMetadataCollection:()=>uD,normalizePluginMetadata:()=>pD,normalizeStackInput:()=>dD,objectStackErrorMap:()=>oD,safeParsePretty:()=>wse,suggestFieldType:()=>iD});var DE=o().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`),OE=o().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`),kE=o().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`),AE=d(`type`,[l({type:p(`constant`),value:b().describe(`Constant value to use`)}).describe(`Set a constant value`),l({type:p(`cast`),targetType:x([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),l({type:p(`lookup`),table:o().describe(`Lookup table name`),keyField:o().describe(`Field to match on`),valueField:o().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),l({type:p(`javascript`),expression:o().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),l({type:p(`map`),mappings:u(o(),b()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]),jE=l({source:o().describe(`Source field name`),target:o().describe(`Target field name`),transform:AE.optional().describe(`Transformation to apply`),defaultValue:b().optional().describe(`Default if source is null/undefined`)}),ME=x([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),NE=x([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),PE=l({url:o().describe(`API endpoint URL`),method:NE.optional().default(`GET`).describe(`HTTP method`),headers:u(o(),o()).optional().describe(`Custom HTTP headers`),params:u(o(),b()).optional().describe(`Query parameters`),body:b().optional().describe(`Request body for POST/PUT/PATCH`)}),FE=l({enabled:v().default(!0).describe(`Enable CORS`),origins:c([o(),S(o())]).default(`*`).describe(`Allowed origins (* for all)`),methods:S(ME).optional().describe(`Allowed HTTP methods`),credentials:v().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:A().int().optional().describe(`Preflight cache duration in seconds`)}),IE=l({enabled:v().default(!1).describe(`Enable rate limiting`),windowMs:A().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:A().int().default(100).describe(`Max requests per window`)}),LE=l({path:o().describe(`URL path to serve from`),directory:o().describe(`Physical directory to serve`),cacheControl:o().optional().describe(`Cache-Control header value`)}),sse=x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`),RE=x([`asc`,`desc`]).describe(`Sort order direction`),zE=l({field:o().describe(`Field name to sort by`),order:RE.describe(`Sort direction`)}).describe(`Sort field and direction pair`),cse=x([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),BE=x([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),lse=x([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`),VE=x([`yaml`,`json`,`typescript`,`javascript`]).describe(`Metadata file format`),use=l({id:o().describe(`Unique metadata record identifier`),type:o().describe(`Metadata type (e.g. "object", "view", "flow")`),name:OE.describe(`Machine name (snake_case)`),format:VE.optional().describe(`Source file format`)}).describe(`Base metadata record fields shared across kernel and system`),dse=OE.brand().describe(`Branded object name (snake_case, no dots)`),fse=OE.brand().describe(`Branded field name (snake_case, no dots)`),pse=DE.brand().describe(`Branded view name (system identifier)`),mse=DE.brand().describe(`Branded app name (system identifier)`),hse=DE.brand().describe(`Branded flow name (system identifier)`),gse=DE.brand().describe(`Branded role name (system identifier)`),HE=x([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),UE=x([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),WE=l({enabled:v().default(!1).describe(`Enable automatic key rotation`),frequencyDays:A().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:A().default(3).describe(`Number of old key versions to retain`),autoRotate:v().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),GE=l({enabled:v().default(!1).describe(`Enable field-level encryption`),algorithm:HE.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:l({provider:UE.describe(`Key management service provider`),keyId:o().optional().describe(`Key identifier in the provider`),rotationPolicy:WE.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:x([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:v().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:v().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`),_se=l({fieldName:o().describe(`Name of the field to encrypt`),encryptionConfig:GE.describe(`Encryption settings for this field`),indexable:v().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`),KE=x([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),qE=l({field:o().describe(`Field name to apply masking to`),strategy:KE.describe(`Masking strategy to use`),pattern:o().optional().describe(`Regex pattern for partial masking`),preserveFormat:v().default(!0).describe(`Keep the original data format after masking`),preserveLength:v().default(!0).describe(`Keep the original data length after masking`),roles:S(o()).optional().describe(`Roles that see masked data`),exemptRoles:S(o()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`),vse=l({enabled:v().default(!1).describe(`Enable data masking`),rules:S(qE).describe(`List of field-level masking rules`),auditUnmasking:v().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`),JE=x(`text.textarea.email.url.phone.password.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),YE=l({label:o().describe(`Display label (human-readable, any case allowed)`),value:DE.describe(`Stored value (lowercase machine identifier)`),color:o().optional().describe(`Color code for badges/charts`),default:v().optional().describe(`Is default option`)}),yse=l({latitude:A().min(-90).max(90).describe(`Latitude coordinate`),longitude:A().min(-180).max(180).describe(`Longitude coordinate`),altitude:A().optional().describe(`Altitude in meters`),accuracy:A().optional().describe(`Accuracy in meters`)}),XE=l({precision:A().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:x([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:o().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}),bse=l({value:A().describe(`Monetary amount`),currency:o().length(3).describe(`Currency code (ISO 4217)`)}),xse=l({street:o().optional().describe(`Street address`),city:o().optional().describe(`City name`),state:o().optional().describe(`State/Province`),postalCode:o().optional().describe(`Postal/ZIP code`),country:o().optional().describe(`Country name or code`),countryCode:o().optional().describe(`ISO country code (e.g., US, GB)`),formatted:o().optional().describe(`Formatted address string`)}),ZE=l({dimensions:A().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:x([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:v().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:v().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:x([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),QE=l({minSize:A().min(0).optional().describe(`Minimum file size in bytes`),maxSize:A().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:S(o()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:S(o()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:S(o()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:S(o()).optional().describe(`Blocked MIME types`),virusScan:v().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:x([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:v().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:v().default(!0).describe(`Quarantine files if threat detected`),storageProvider:o().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:o().optional().describe(`Target bucket name`),storagePrefix:o().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:l({minWidth:A().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:A().min(1).optional().describe(`Maximum image width in pixels`),minHeight:A().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:A().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:o().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:v().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:S(l({name:o().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:A().min(1).describe(`Thumbnail width in pixels`),height:A().min(1).describe(`Thumbnail height in pixels`),crop:v().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:v().default(!1).describe(`Preserve EXIF metadata`),autoRotate:v().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:v().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:v().default(!0).describe(`Allow replacing existing files`),allowDelete:v().default(!0).describe(`Allow deleting uploaded files`),requireUpload:v().default(!1).describe(`Require at least one file when field is required`),extractMetadata:v().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:v().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:v().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:A().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:v().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:A().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`}),$E=l({uniqueness:v().default(!1).describe(`Enforce unique values across all records`),completeness:A().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:l({source:o().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:A().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),eD=l({enabled:v().describe(`Enable caching for computed field results`),ttl:A().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:S(o()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),tD=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:o().optional().describe(`Human readable label`),type:JE.describe(`Field Data Type`),description:o().optional().describe(`Tooltip/Help text`),format:o().optional().describe(`Format string (e.g. email, phone)`),columnName:o().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:v().default(!1).describe(`Is required`),searchable:v().default(!1).describe(`Is searchable`),multiple:v().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:v().default(!1).describe(`Is unique constraint`),defaultValue:b().optional().describe(`Default value`),maxLength:A().optional().describe(`Max character length`),minLength:A().optional().describe(`Min character length`),precision:A().optional().describe(`Total digits`),scale:A().optional().describe(`Decimal places`),min:A().optional().describe(`Minimum value`),max:A().optional().describe(`Maximum value`),options:S(YE).optional().describe(`Static options for select/multiselect`),reference:o().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:S(o()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:v().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:x([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:o().optional().describe(`Formula expression`),summaryOperations:l({object:o().describe(`Source child object name for roll-up`),field:o().describe(`Field on child object to aggregate`),function:x([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:o().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:o().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:v().optional().describe(`Show line numbers in code editor`),maxRating:A().optional().describe(`Maximum rating value (default: 5)`),allowHalf:v().optional().describe(`Allow half-star ratings`),displayMap:v().optional().describe(`Display map widget for location field`),allowGeocoding:v().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:x([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:x([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:v().optional().describe(`Allow transparency/alpha channel`),presetColors:S(o()).optional().describe(`Preset color options`),step:A().optional().describe(`Step increment for slider (default: 1)`),showValue:v().optional().describe(`Display current value on slider`),marks:u(o(),o()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:x([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:x([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:v().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:v().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:XE.optional().describe(`Configuration for currency field type`),vectorConfig:ZE.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:QE.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:GE.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:qE.optional().describe(`Data masking rules for PII protection`),auditTrail:v().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:S(o()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:eD.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:$E.optional().describe(`Data quality validation and monitoring rules`),group:o().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:o().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:v().default(!1).describe(`Hidden from default UI`),readonly:v().default(!1).describe(`Read-only in UI`),sortable:v().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:o().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:v().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:v().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:o().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:v().default(!1).describe(`Create standard database index`),externalId:v().default(!1).describe(`Is external ID for upsert operations`)}),Sse={text:(e={})=>({type:`text`,...e}),textarea:(e={})=>({type:`textarea`,...e}),number:(e={})=>({type:`number`,...e}),boolean:(e={})=>({type:`boolean`,...e}),date:(e={})=>({type:`date`,...e}),datetime:(e={})=>({type:`datetime`,...e}),currency:(e={})=>({type:`currency`,...e}),percent:(e={})=>({type:`percent`,...e}),url:(e={})=>({type:`url`,...e}),email:(e={})=>({type:`email`,...e}),phone:(e={})=>({type:`phone`,...e}),image:(e={})=>({type:`image`,...e}),file:(e={})=>({type:`file`,...e}),avatar:(e={})=>({type:`avatar`,...e}),formula:(e={})=>({type:`formula`,...e}),summary:(e={})=>({type:`summary`,...e}),autonumber:(e={})=>({type:`autonumber`,...e}),markdown:(e={})=>({type:`markdown`,...e}),html:(e={})=>({type:`html`,...e}),password:(e={})=>({type:`password`,...e}),select:(e,t)=>{let n=e=>e.toLowerCase().replace(/\s+/g,`_`).replace(/[^a-z0-9_]/g,``),r,i;if(Array.isArray(e))r=e.map(e=>typeof e==`string`?{label:e,value:n(e)}:{...e,value:e.value.toLowerCase()}),i=t||{};else{r=(e.options||[]).map(e=>typeof e==`string`?{label:e,value:n(e)}:{...e,value:e.value.toLowerCase()});let{options:t,...a}=e;i=a}return{type:`select`,options:r,...i}},lookup:(e,t={})=>({type:`lookup`,reference:e,...t}),masterDetail:(e,t={})=>({type:`master_detail`,reference:e,...t}),location:(e={})=>({type:`location`,...e}),address:(e={})=>({type:`address`,...e}),richtext:(e={})=>({type:`richtext`,...e}),code:(e,t={})=>({type:`code`,language:e,...t}),color:(e={})=>({type:`color`,...e}),rating:(e=5,t={})=>({type:`rating`,maxRating:e,...t}),signature:(e={})=>({type:`signature`,...e}),slider:(e={})=>({type:`slider`,...e}),qrcode:(e={})=>({type:`qrcode`,...e}),vector:(e,t={})=>({type:`vector`,vectorConfig:{dimensions:e,distanceMetric:`cosine`,normalized:!1,indexed:!0,...t.vectorConfig},...t})};function nD(e,t){let n=e.length,r=t.length;if(n===0)return r;if(r===0)return n;let i=Array(r+1),a=Array(r+1);for(let e=0;e<=r;e++)i[e]=e;for(let o=1;o<=n;o++){a[0]=o;for(let n=1;n<=r;n++){let r=e[o-1]===t[n-1]?0:1;a[n]=Math.min(i[n]+1,a[n-1]+1,i[n-1]+r)}[i,a]=[a,i]}return i[r]}function rD(e,t,n=3,r=3){let i=e.toLowerCase().replace(/[-\s]/g,`_`);return t.map(e=>({value:e,distance:nD(i,e)})).filter(e=>e.distance<=n&&e.distance>0).sort((e,t)=>e.distance-t.distance).slice(0,r).map(e=>e.value)}var Cse={string:`text`,str:`text`,varchar:`text`,char:`text`,int:`number`,integer:`number`,float:`number`,double:`number`,decimal:`number`,numeric:`number`,bool:`boolean`,checkbox:`boolean`,check:`boolean`,date_time:`datetime`,timestamp:`datetime`,text_area:`textarea`,textarea_:`textarea`,textfield:`text`,dropdown:`select`,picklist:`select`,enum:`select`,multi_select:`multiselect`,multiselect_:`multiselect`,reference:`lookup`,ref:`lookup`,foreign_key:`lookup`,fk:`lookup`,relation:`lookup`,master:`master_detail`,richtext_:`richtext`,rich_text:`richtext`,upload:`file`,attachment:`file`,photo:`image`,picture:`image`,img:`image`,percent_:`percent`,percentage:`percent`,money:`currency`,price:`currency`,auto_number:`autonumber`,auto_increment:`autonumber`,sequence:`autonumber`,markdown_:`markdown`,md:`markdown`,barcode:`qrcode`,tag:`tags`,star:`rating`,stars:`rating`,geo:`location`,gps:`location`,coordinates:`location`,embed:`vector`,embedding:`vector`,embeddings:`vector`};function iD(e){let t=e.toLowerCase().replace(/[-\s]/g,`_`),n=Cse[t];return n?[n]:rD(t,JE.options)}function aD(e){return e.length===0?``:e.length===1?`Did you mean '${e[0]}'?`:`Did you mean one of: ${e.map(e=>`'${e}'`).join(`, `)}?`}var oD=e=>{if(e.code===`invalid_value`){let t=e.values,n=e.input,r=String(n??``),i=t.map(String),a=JE.options;if(i.length>10&&a.every(e=>i.includes(e))){let e=aD(iD(r)),t=`Invalid field type '${r}'.`;return{message:e?`${t} ${e}`:`${t} Valid types: ${i.slice(0,10).join(`, `)}...`}}let o=aD(rD(r,i)),s=`Invalid value '${r}'.`;return{message:o?`${s} ${o}`:`${s} Expected one of: ${i.join(`, `)}.`}}if(e.code===`too_small`){let t=e.origin,n=e.minimum;if(t===`string`)return{message:`Must be at least ${n} character${n===1?``:`s`} long.`}}if(e.code===`too_big`){let t=e.origin,n=e.maximum;if(t===`string`)return{message:`Must be at most ${n} character${n===1?``:`s`} long.`}}if(e.code===`invalid_format`){let t=e.format,n=e.input;if(t===`regex`&&n){let t=e.path?.join(`.`)??``;if(t.endsWith(`name`)||t===`name`)return{message:`Invalid identifier '${n}'. Must be lowercase snake_case (e.g., 'my_object', 'task_name'). No uppercase, spaces, or hyphens allowed.`}}}if(e.code===`invalid_type`){let t=e.expected,n=e.input;if(n===void 0){let t=e.path;return{message:`Required property '${t?.[t.length-1]??``}' is missing.`}}return{message:`Expected ${t} but received ${n===null?`null`:typeof n}.`}}if(e.code===`unrecognized_keys`){let t=e.keys,n=t.join(`, `);return{message:`Unrecognized key${t.length>1?`s`:``}: ${n}. Check for typos in property names.`}}return null};function sD(e){return` \u2717 ${e.path.length>0?e.path.join(`.`):`(root)`}: ${e.message}`}function cD(e,t){let n=e.issues.length;return`${t?`${t} (${n} issue${n===1?``:`s`}):`:`Validation failed (${n} issue${n===1?``:`s`}):`}
|
|
64
|
+
`,children:[(0,z.jsx)(r,{className:`h-3.5 w-3.5`}),e.label]},e.id)}),(0,z.jsx)(`div`,{className:`ml-auto flex items-center gap-2 py-2`,children:(0,z.jsxs)(dS,{variant:`outline`,className:`font-mono text-xs gap-1`,children:[(0,z.jsx)(Qf,{className:`h-3 w-3`}),e]})})]}),(0,z.jsxs)(`div`,{className:`flex-1 overflow-auto p-4`,children:[t===`schema`&&(0,z.jsx)(foe,{objectApiName:e}),t===`data`&&(0,z.jsx)(coe,{objectApiName:e,onEdit:s}),t===`api`&&(0,z.jsx)(Xoe,{objectApiName:e})]}),a&&(0,z.jsx)(Joe,{objectApiName:e,record:r&&Object.keys(r).length>0?r:void 0,onSuccess:c,onCancel:()=>{o(!1),i(null)}})]})}function Qoe({metadataName:e}){return(0,z.jsx)(Zoe,{objectApiName:e})}var $oe={manifest:QC({id:`objectstack.object-designer`,name:`Object Designer`,version:`1.0.0`,description:`Schema inspector, data table, and API reference for Object metadata.`,contributes:{metadataViewers:[{id:`object-explorer`,metadataTypes:[`object`,`objects`],label:`Object Explorer`,priority:100,modes:[`preview`,`data`,`code`]}],sidebarGroups:[{key:`data`,label:`Data`,icon:`database`,metadataTypes:[`object`,`objects`,`hooks`,`mappings`,`analyticsCubes`,`data`],order:10}],metadataIcons:[{metadataType:`object`,label:`Objects`,icon:`package`},{metadataType:`objects`,label:`Objects`,icon:`package`},{metadataType:`hooks`,label:`Hooks`,icon:`anchor`},{metadataType:`mappings`,label:`Mappings`,icon:`map`},{metadataType:`analyticsCubes`,label:`Analytics Cubes`,icon:`pie-chart`},{metadataType:`data`,label:`Seed Data`,icon:`database`}]}}),activate(e){e.registerViewer(`object-explorer`,Qoe),e.registerMetadataIcon(`object`,_p,`Objects`),e.registerMetadataIcon(`objects`,_p,`Objects`),e.registerMetadataIcon(`hooks`,kf,`Hooks`),e.registerMetadataIcon(`mappings`,hp,`Mappings`),e.registerMetadataIcon(`analyticsCubes`,zf,`Analytics Cubes`),e.registerMetadataIcon(`data`,Qf,`Seed Data`)}},ese={actions:Up,dashboards:Rf,reports:ip,flows:Vp,agents:Pf,apis:ap,ragPipelines:Nf,profiles:kp,sharingRules:kp},tse={actions:`Action`,dashboards:`Dashboard`,reports:`Report`,flows:`Flow`,agents:`Agent`,apis:`API`,ragPipelines:`RAG Pipeline`,profiles:`Profile`,sharingRules:`Sharing Rule`};function wE({text:e}){let[t,n]=(0,P.useState)(!1);return(0,z.jsx)(Ly,{children:(0,z.jsxs)(Ry,{children:[(0,z.jsx)(zy,{asChild:!0,children:(0,z.jsx)(th,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,z.jsx)(Bf,{className:`h-3 w-3 text-emerald-500`}):(0,z.jsx)(Xf,{className:`h-3 w-3`})})}),(0,z.jsx)(By,{children:`Copy`})]})})}function TE({data:e,depth:t=0}){let[n,r]=(0,P.useState)({});if(e==null)return(0,z.jsx)(`span`,{className:`text-muted-foreground italic`,children:`null`});if(typeof e==`boolean`)return(0,z.jsx)(dS,{variant:`outline`,className:`text-[10px] font-mono ${e?`text-emerald-600 border-emerald-300`:`text-red-500 border-red-300`}`,children:String(e)});if(typeof e==`number`)return(0,z.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400 font-mono text-sm`,children:e});if(typeof e==`string`)return e.length>120?(0,z.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-400 font-mono text-sm break-all`,children:[`"`,e.slice(0,120),`…"`]}):(0,z.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-400 font-mono text-sm`,children:[`"`,e,`"`]});if(Array.isArray(e))return e.length===0?(0,z.jsx)(`span`,{className:`text-muted-foreground font-mono text-sm`,children:`[]`}):e.length<=5&&e.every(e=>typeof e!=`object`)?(0,z.jsxs)(`span`,{className:`font-mono text-sm`,children:[`[`,e.map((e,n)=>(0,z.jsxs)(`span`,{children:[n>0&&`, `,(0,z.jsx)(TE,{data:e,depth:t+1})]},n)),`]`]}):(0,z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,z.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[`Array(`,e.length,`)`]}),(0,z.jsx)(`div`,{className:`ml-4 border-l pl-3 space-y-0.5`,children:e.map((e,n)=>(0,z.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,z.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs shrink-0 mt-0.5`,children:[`[`,n,`]`]}),(0,z.jsx)(TE,{data:e,depth:t+1})]},n))})]});if(typeof e==`object`){let i=Object.keys(e);return i.length===0?(0,z.jsx)(`span`,{className:`text-muted-foreground font-mono text-sm`,children:`{}`}):(0,z.jsx)(`div`,{className:`space-y-0.5`,children:i.map(i=>{let a=e[i],o=typeof a==`object`&&!!a,s=n[i]??(t>1&&o);return(0,z.jsx)(`div`,{children:(0,z.jsxs)(`div`,{className:`flex items-start gap-1 group`,children:[o?(0,z.jsx)(`button`,{onClick:()=>r(e=>({...e,[i]:!s})),className:`shrink-0 mt-0.5 p-0.5 rounded hover:bg-muted`,children:s?(0,z.jsx)(Hf,{className:`h-3 w-3 text-muted-foreground`}):(0,z.jsx)(Vf,{className:`h-3 w-3 text-muted-foreground`})}):(0,z.jsx)(`span`,{className:`w-4 shrink-0`}),(0,z.jsxs)(`span`,{className:`text-blue-600 dark:text-blue-400 font-mono text-sm shrink-0`,children:[i,`:`]}),o&&s?(0,z.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:Array.isArray(a)?`Array(${a.length})`:`{${Object.keys(a).length} keys}`}):(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsx)(TE,{data:a,depth:t+1})})]})},i)})})}return(0,z.jsx)(`span`,{className:`font-mono text-sm`,children:String(e)})}function nse({metaType:e,metaName:t}){let n=yf(),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(!0),[s,c]=(0,P.useState)(``),l=ese[e]||ip,u=tse[e]||e.charAt(0).toUpperCase()+e.slice(1);if((0,P.useEffect)(()=>{let r=!0;o(!0),i(null);async function a(){try{let a=await n.meta.getItem(e,t);r&&i(a?.item||a)}catch(n){console.error(`[MetadataInspector] Failed to load ${e}/${t}:`,n)}finally{r&&o(!1)}}return a(),()=>{r=!1}},[n,e,t]),a)return(0,z.jsx)(`div`,{className:`space-y-4 p-4`,children:(0,z.jsxs)(bS,{children:[(0,z.jsx)(xS,{children:(0,z.jsx)(f_,{className:`h-6 w-48`})}),(0,z.jsxs)(wS,{className:`space-y-3`,children:[(0,z.jsx)(f_,{className:`h-10 w-full`}),(0,z.jsx)(f_,{className:`h-10 w-full`}),(0,z.jsx)(f_,{className:`h-10 w-full`})]})]})});if(!r)return(0,z.jsx)(`div`,{className:`p-4`,children:(0,z.jsx)(bS,{children:(0,z.jsxs)(wS,{className:`py-12 text-center text-muted-foreground`,children:[u,` definition not found: `,(0,z.jsx)(`code`,{className:`font-mono`,children:t})]})})});let d=r.label||r.name||t,f=r.name||t,p=r.description,[m]=f.includes(`__`)?f.split(`__`):[null],h=Object.keys(r),g=s?h.filter(e=>e.toLowerCase().includes(s.toLowerCase())||JSON.stringify(r[e]).toLowerCase().includes(s.toLowerCase())):h;return(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsx)(bS,{children:(0,z.jsx)(xS,{className:`pb-3`,children:(0,z.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(l,{className:`h-5 w-5 text-muted-foreground`}),(0,z.jsx)(SS,{className:`text-xl`,children:d}),m&&(0,z.jsx)(dS,{variant:`secondary`,className:`font-mono text-xs`,children:m}),(0,z.jsx)(dS,{variant:`outline`,className:`text-xs`,children:u})]}),(0,z.jsxs)(CS,{className:`flex items-center gap-3 flex-wrap`,children:[(0,z.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:f}),(0,z.jsx)(wE,{text:f}),p&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{children:`·`}),(0,z.jsx)(`span`,{className:`text-xs`,children:p})]})]})]})})})}),(0,z.jsxs)(bS,{children:[(0,z.jsxs)(xS,{className:`pb-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(SS,{className:`text-base`,children:`Properties`}),(0,z.jsxs)(dS,{variant:`secondary`,className:`text-xs`,children:[g.length,` / `,h.length,` keys`]})]}),(0,z.jsxs)(`div`,{className:`relative mt-2`,children:[(0,z.jsx)(Dp,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,z.jsx)(nh,{placeholder:`Filter properties...`,value:s,onChange:e=>c(e.target.value),className:`pl-9 h-8 text-sm`})]})]}),(0,z.jsx)(wS,{children:(0,z.jsx)(xE,{className:`max-h-[60vh]`,children:(0,z.jsxs)(`div`,{className:`space-y-3`,children:[g.map(e=>(0,z.jsxs)(`div`,{className:`group rounded-md border p-3 hover:bg-muted/30 transition-colors`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,z.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400 font-mono text-sm font-medium`,children:e}),(0,z.jsx)(wE,{text:JSON.stringify(r[e],null,2)}),(0,z.jsx)(dS,{variant:`outline`,className:`text-[10px] font-mono ml-auto`,children:Array.isArray(r[e])?`array(${r[e].length})`:typeof r[e]})]}),(0,z.jsx)(`div`,{className:`pl-1`,children:(0,z.jsx)(TE,{data:r[e]})})]},e)),g.length===0&&(0,z.jsx)(`p`,{className:`text-sm text-center text-muted-foreground py-8`,children:s?`No properties match filter`:`No properties`})]})})})]})]})}function rse({metadataType:e,metadataName:t}){return(0,z.jsx)(nse,{metaType:e,metaName:t})}var ise=[{manifest:QC({id:`objectstack.default-inspector`,name:`Default Metadata Inspector`,version:`1.0.0`,description:`JSON tree viewer for any metadata type. Fallback when no specialized viewer is available.`,contributes:{metadataViewers:[{id:`json-inspector`,metadataTypes:[`*`],label:`JSON Inspector`,priority:-1,modes:[`preview`,`code`]}]}}),activate(e){e.registerViewer(`json-inspector`,rse)}},$oe,{manifest:QC({id:`objectstack.ui-protocol`,name:`UI Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for UI metadata types.`,contributes:{sidebarGroups:[{key:`ui`,label:`UI`,icon:`app-window`,metadataTypes:[`actions`,`views`,`pages`,`dashboards`,`reports`,`themes`],order:20}],metadataIcons:[{metadataType:`actions`,label:`Actions`,icon:`zap`},{metadataType:`views`,label:`Views`,icon:`eye`},{metadataType:`pages`,label:`Pages`,icon:`file-code`},{metadataType:`dashboards`,label:`Dashboards`,icon:`bar-chart-3`},{metadataType:`reports`,label:`Reports`,icon:`file-text`},{metadataType:`themes`,label:`Themes`,icon:`palette`}]}}),activate(e){e.registerMetadataIcon(`actions`,Up,`Actions`),e.registerMetadataIcon(`views`,np,`Views`),e.registerMetadataIcon(`pages`,rp,`Pages`),e.registerMetadataIcon(`dashboards`,Rf,`Dashboards`),e.registerMetadataIcon(`reports`,ip,`Reports`),e.registerMetadataIcon(`themes`,vp,`Themes`)}},{manifest:QC({id:`objectstack.automation-protocol`,name:`Automation Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for automation metadata types.`,contributes:{sidebarGroups:[{key:`automation`,label:`Automation`,icon:`workflow`,metadataTypes:[`flows`,`workflows`,`approvals`,`webhooks`],order:30}],metadataIcons:[{metadataType:`flows`,label:`Flows`,icon:`workflow`},{metadataType:`workflows`,label:`Workflows`,icon:`workflow`},{metadataType:`approvals`,label:`Approvals`,icon:`check-square`},{metadataType:`webhooks`,label:`Webhooks`,icon:`webhook`}]}}),activate(e){e.registerMetadataIcon(`flows`,Vp,`Flows`),e.registerMetadataIcon(`workflows`,Vp,`Workflows`),e.registerMetadataIcon(`approvals`,jp,`Approvals`),e.registerMetadataIcon(`webhooks`,Bp,`Webhooks`)}},{manifest:QC({id:`objectstack.security-protocol`,name:`Security Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for security metadata types.`,contributes:{sidebarGroups:[{key:`security`,label:`Security`,icon:`shield`,metadataTypes:[`roles`,`permissions`,`profiles`,`sharingRules`,`policies`],order:40}],metadataIcons:[{metadataType:`roles`,label:`Roles`,icon:`user-cog`},{metadataType:`permissions`,label:`Permissions`,icon:`lock`},{metadataType:`profiles`,label:`Profiles`,icon:`shield`},{metadataType:`sharingRules`,label:`Sharing Rules`,icon:`shield`},{metadataType:`policies`,label:`Policies`,icon:`shield`}]}}),activate(e){e.registerMetadataIcon(`roles`,zp,`Roles`),e.registerMetadataIcon(`permissions`,mp,`Permissions`),e.registerMetadataIcon(`profiles`,kp,`Profiles`),e.registerMetadataIcon(`sharingRules`,kp,`Sharing Rules`),e.registerMetadataIcon(`policies`,kp,`Policies`)}},{manifest:QC({id:`objectstack.ai-protocol`,name:`AI Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for AI metadata types.`,contributes:{sidebarGroups:[{key:`ai`,label:`AI`,icon:`bot`,metadataTypes:[`agents`,`ragPipelines`],order:50}],metadataIcons:[{metadataType:`agents`,label:`Agents`,icon:`bot`},{metadataType:`ragPipelines`,label:`RAG Pipelines`,icon:`book-open`}]}}),activate(e){e.registerMetadataIcon(`agents`,Pf,`Agents`),e.registerMetadataIcon(`ragPipelines`,Nf,`RAG Pipelines`)}},{manifest:QC({id:`objectstack.api-protocol`,name:`API Protocol`,version:`1.0.0`,description:`Sidebar groups and icons for API metadata types.`,contributes:{sidebarGroups:[{key:`api`,label:`API`,icon:`globe`,metadataTypes:[`apis`,`connectors`],order:60}],metadataIcons:[{metadataType:`apis`,label:`APIs`,icon:`globe`},{metadataType:`connectors`,label:`Connectors`,icon:`link-2`}]}}),activate(e){e.registerMetadataIcon(`apis`,ap,`APIs`),e.registerMetadataIcon(`connectors`,up,`Connectors`)}}];function ase(){let[e,t]=(0,P.useState)(null),[n,r]=(0,P.useState)([]),[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(`overview`);(0,P.useEffect)(()=>{let e=gS();console.log(`[App] Connecting to API: ${e} (mode: ${pS.mode})`),t(new gf({baseUrl:e}))},[]),(0,P.useEffect)(()=>{if(!e)return;let t=!0;async function n(){try{let n=((await e.packages.list())?.packages||[]).filter(e=>e.manifest?.version!==`0.0.0`&&e.manifest?.id!==`dev-workspace`);console.log(`[App] Fetched packages:`,n.map(e=>e.manifest?.name||e.manifest?.id)),t&&n.length>0&&(r(n),a(n[0]))}catch(e){console.error(`[App] Failed to fetch packages:`,e)}}return n(),()=>{t=!1}},[e]);let f=(0,P.useCallback)(e=>{a(e),s(null),d(`overview`)},[]),p=(0,P.useCallback)(e=>{e?(s(e),d(`object`)):(s(null),d(`overview`))},[]),m=(0,P.useCallback)(e=>{d(e),s(null),l(null)},[]),h=(0,P.useCallback)((e,t)=>{l({type:e,name:t}),s(null),d(`metadata`)},[]),g=(0,P.useCallback)((e,t)=>{e===`packages`?m(`packages`):t&&p(t)},[m,p]);return e?(0,z.jsx)(vf,{client:e,children:(0,z.jsx)(VC,{plugins:ise,children:(0,z.jsx)(Gp,{children:(0,z.jsxs)(Uy,{children:[(0,z.jsx)(nae,{selectedObject:o,onSelectObject:p,selectedMeta:c,onSelectMeta:h,packages:n,selectedPackage:i,onSelectPackage:f,onSelectView:m,selectedView:u}),(0,z.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col h-svh overflow-hidden bg-background`,children:[(0,z.jsx)(yS,{selectedObject:o,selectedMeta:c,selectedView:u,packageLabel:i?.manifest?.name||i?.manifest?.id}),(0,z.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:u===`object`&&o?(0,z.jsx)(JC,{metadataType:`object`,metadataName:o}):u===`metadata`&&c?(0,z.jsx)(JC,{metadataType:c.type,metadataName:c.name}):u===`packages`?(0,z.jsx)(PS,{}):u===`api-console`?(0,z.jsx)(GS,{}):(0,z.jsx)(cae,{packages:n,selectedPackage:i,onNavigate:g})})]}),(0,z.jsx)(PC,{})]})})})}):(0,z.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:(0,z.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,z.jsx)(`div`,{className:`h-8 w-8 mx-auto animate-spin rounded-full border-4 border-muted border-t-primary`}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connecting to ObjectStack…`})]})})}var ose=Object.defineProperty,EE=(e,t)=>{for(var n in t)ose(e,n,{get:t[n],enumerable:!0})};EE({},{AggregationFunctionEnum:()=>sse,AppNameSchema:()=>mse,BaseMetadataRecordSchema:()=>use,CacheStrategyEnum:()=>lse,CorsConfigSchema:()=>FE,EventNameSchema:()=>kE,FieldMappingSchema:()=>jE,FieldNameSchema:()=>fse,FlowNameSchema:()=>hse,HttpMethod:()=>ME,HttpMethodSchema:()=>NE,HttpRequestSchema:()=>PE,IsolationLevelEnum:()=>BE,MAP_SUPPORTED_FIELDS:()=>lD,METADATA_ALIASES:()=>fD,MetadataFormatSchema:()=>VE,MutationEventEnum:()=>cse,ObjectNameSchema:()=>dse,RateLimitConfigSchema:()=>IE,RoleNameSchema:()=>gse,SnakeCaseIdentifierSchema:()=>OE,SortDirectionEnum:()=>RE,SortItemSchema:()=>zE,StaticMountSchema:()=>LE,SystemIdentifierSchema:()=>DE,TransformTypeSchema:()=>AE,ViewNameSchema:()=>pse,findClosestMatches:()=>rD,formatSuggestion:()=>aD,formatZodError:()=>cD,formatZodIssue:()=>sD,levenshteinDistance:()=>nD,normalizeMetadataCollection:()=>uD,normalizePluginMetadata:()=>pD,normalizeStackInput:()=>dD,objectStackErrorMap:()=>oD,safeParsePretty:()=>wse,suggestFieldType:()=>iD});var DE=o().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`),OE=o().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`),kE=o().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`),AE=d(`type`,[l({type:p(`constant`),value:b().describe(`Constant value to use`)}).describe(`Set a constant value`),l({type:p(`cast`),targetType:x([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),l({type:p(`lookup`),table:o().describe(`Lookup table name`),keyField:o().describe(`Field to match on`),valueField:o().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),l({type:p(`javascript`),expression:o().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),l({type:p(`map`),mappings:u(o(),b()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]),jE=l({source:o().describe(`Source field name`),target:o().describe(`Target field name`),transform:AE.optional().describe(`Transformation to apply`),defaultValue:b().optional().describe(`Default if source is null/undefined`)}),ME=x([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),NE=x([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),PE=l({url:o().describe(`API endpoint URL`),method:NE.optional().default(`GET`).describe(`HTTP method`),headers:u(o(),o()).optional().describe(`Custom HTTP headers`),params:u(o(),b()).optional().describe(`Query parameters`),body:b().optional().describe(`Request body for POST/PUT/PATCH`)}),FE=l({enabled:v().default(!0).describe(`Enable CORS`),origins:c([o(),S(o())]).default(`*`).describe(`Allowed origins (* for all)`),methods:S(ME).optional().describe(`Allowed HTTP methods`),credentials:v().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:A().int().optional().describe(`Preflight cache duration in seconds`)}),IE=l({enabled:v().default(!1).describe(`Enable rate limiting`),windowMs:A().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:A().int().default(100).describe(`Max requests per window`)}),LE=l({path:o().describe(`URL path to serve from`),directory:o().describe(`Physical directory to serve`),cacheControl:o().optional().describe(`Cache-Control header value`)}),sse=x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`),RE=x([`asc`,`desc`]).describe(`Sort order direction`),zE=l({field:o().describe(`Field name to sort by`),order:RE.describe(`Sort direction`)}).describe(`Sort field and direction pair`),cse=x([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),BE=x([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),lse=x([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`),VE=x([`yaml`,`json`,`typescript`,`javascript`]).describe(`Metadata file format`),use=l({id:o().describe(`Unique metadata record identifier`),type:o().describe(`Metadata type (e.g. "object", "view", "flow")`),name:OE.describe(`Machine name (snake_case)`),format:VE.optional().describe(`Source file format`)}).describe(`Base metadata record fields shared across kernel and system`),dse=OE.brand().describe(`Branded object name (snake_case, no dots)`),fse=OE.brand().describe(`Branded field name (snake_case, no dots)`),pse=DE.brand().describe(`Branded view name (system identifier)`),mse=DE.brand().describe(`Branded app name (system identifier)`),hse=DE.brand().describe(`Branded flow name (system identifier)`),gse=DE.brand().describe(`Branded role name (system identifier)`),HE=x([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),UE=x([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),WE=l({enabled:v().default(!1).describe(`Enable automatic key rotation`),frequencyDays:A().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:A().default(3).describe(`Number of old key versions to retain`),autoRotate:v().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),GE=l({enabled:v().default(!1).describe(`Enable field-level encryption`),algorithm:HE.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:l({provider:UE.describe(`Key management service provider`),keyId:o().optional().describe(`Key identifier in the provider`),rotationPolicy:WE.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:x([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:v().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:v().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`),_se=l({fieldName:o().describe(`Name of the field to encrypt`),encryptionConfig:GE.describe(`Encryption settings for this field`),indexable:v().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`),KE=x([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),qE=l({field:o().describe(`Field name to apply masking to`),strategy:KE.describe(`Masking strategy to use`),pattern:o().optional().describe(`Regex pattern for partial masking`),preserveFormat:v().default(!0).describe(`Keep the original data format after masking`),preserveLength:v().default(!0).describe(`Keep the original data length after masking`),roles:S(o()).optional().describe(`Roles that see masked data`),exemptRoles:S(o()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`),vse=l({enabled:v().default(!1).describe(`Enable data masking`),rules:S(qE).describe(`List of field-level masking rules`),auditUnmasking:v().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`),JE=x(`text.textarea.email.url.phone.password.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),YE=l({label:o().describe(`Display label (human-readable, any case allowed)`),value:DE.describe(`Stored value (lowercase machine identifier)`),color:o().optional().describe(`Color code for badges/charts`),default:v().optional().describe(`Is default option`)}),yse=l({latitude:A().min(-90).max(90).describe(`Latitude coordinate`),longitude:A().min(-180).max(180).describe(`Longitude coordinate`),altitude:A().optional().describe(`Altitude in meters`),accuracy:A().optional().describe(`Accuracy in meters`)}),XE=l({precision:A().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:x([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:o().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}),bse=l({value:A().describe(`Monetary amount`),currency:o().length(3).describe(`Currency code (ISO 4217)`)}),xse=l({street:o().optional().describe(`Street address`),city:o().optional().describe(`City name`),state:o().optional().describe(`State/Province`),postalCode:o().optional().describe(`Postal/ZIP code`),country:o().optional().describe(`Country name or code`),countryCode:o().optional().describe(`ISO country code (e.g., US, GB)`),formatted:o().optional().describe(`Formatted address string`)}),ZE=l({dimensions:A().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:x([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:v().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:v().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:x([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),QE=l({minSize:A().min(0).optional().describe(`Minimum file size in bytes`),maxSize:A().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:S(o()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:S(o()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:S(o()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:S(o()).optional().describe(`Blocked MIME types`),virusScan:v().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:x([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:v().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:v().default(!0).describe(`Quarantine files if threat detected`),storageProvider:o().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:o().optional().describe(`Target bucket name`),storagePrefix:o().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:l({minWidth:A().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:A().min(1).optional().describe(`Maximum image width in pixels`),minHeight:A().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:A().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:o().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:v().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:S(l({name:o().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:A().min(1).describe(`Thumbnail width in pixels`),height:A().min(1).describe(`Thumbnail height in pixels`),crop:v().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:v().default(!1).describe(`Preserve EXIF metadata`),autoRotate:v().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:v().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:v().default(!0).describe(`Allow replacing existing files`),allowDelete:v().default(!0).describe(`Allow deleting uploaded files`),requireUpload:v().default(!1).describe(`Require at least one file when field is required`),extractMetadata:v().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:v().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:v().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:A().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:v().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:A().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`}),$E=l({uniqueness:v().default(!1).describe(`Enforce unique values across all records`),completeness:A().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:l({source:o().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:A().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),eD=l({enabled:v().describe(`Enable caching for computed field results`),ttl:A().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:S(o()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),tD=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:o().optional().describe(`Human readable label`),type:JE.describe(`Field Data Type`),description:o().optional().describe(`Tooltip/Help text`),format:o().optional().describe(`Format string (e.g. email, phone)`),columnName:o().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:v().default(!1).describe(`Is required`),searchable:v().default(!1).describe(`Is searchable`),multiple:v().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:v().default(!1).describe(`Is unique constraint`),defaultValue:b().optional().describe(`Default value`),maxLength:A().optional().describe(`Max character length`),minLength:A().optional().describe(`Min character length`),precision:A().optional().describe(`Total digits`),scale:A().optional().describe(`Decimal places`),min:A().optional().describe(`Minimum value`),max:A().optional().describe(`Maximum value`),options:S(YE).optional().describe(`Static options for select/multiselect`),reference:o().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:S(o()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:v().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:x([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:o().optional().describe(`Formula expression`),summaryOperations:l({object:o().describe(`Source child object name for roll-up`),field:o().describe(`Field on child object to aggregate`),function:x([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:o().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:o().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:v().optional().describe(`Show line numbers in code editor`),maxRating:A().optional().describe(`Maximum rating value (default: 5)`),allowHalf:v().optional().describe(`Allow half-star ratings`),displayMap:v().optional().describe(`Display map widget for location field`),allowGeocoding:v().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:x([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:x([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:v().optional().describe(`Allow transparency/alpha channel`),presetColors:S(o()).optional().describe(`Preset color options`),step:A().optional().describe(`Step increment for slider (default: 1)`),showValue:v().optional().describe(`Display current value on slider`),marks:u(o(),o()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:x([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:x([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:v().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:v().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:XE.optional().describe(`Configuration for currency field type`),vectorConfig:ZE.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:QE.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:GE.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:qE.optional().describe(`Data masking rules for PII protection`),auditTrail:v().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:S(o()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:eD.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:$E.optional().describe(`Data quality validation and monitoring rules`),group:o().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:o().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:v().default(!1).describe(`Hidden from default UI`),readonly:v().default(!1).describe(`Read-only in UI`),sortable:v().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:o().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:v().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:v().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:o().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:v().default(!1).describe(`Create standard database index`),externalId:v().default(!1).describe(`Is external ID for upsert operations`)}),Sse={text:(e={})=>({type:`text`,...e}),textarea:(e={})=>({type:`textarea`,...e}),number:(e={})=>({type:`number`,...e}),boolean:(e={})=>({type:`boolean`,...e}),date:(e={})=>({type:`date`,...e}),datetime:(e={})=>({type:`datetime`,...e}),currency:(e={})=>({type:`currency`,...e}),percent:(e={})=>({type:`percent`,...e}),url:(e={})=>({type:`url`,...e}),email:(e={})=>({type:`email`,...e}),phone:(e={})=>({type:`phone`,...e}),image:(e={})=>({type:`image`,...e}),file:(e={})=>({type:`file`,...e}),avatar:(e={})=>({type:`avatar`,...e}),formula:(e={})=>({type:`formula`,...e}),summary:(e={})=>({type:`summary`,...e}),autonumber:(e={})=>({type:`autonumber`,...e}),markdown:(e={})=>({type:`markdown`,...e}),html:(e={})=>({type:`html`,...e}),password:(e={})=>({type:`password`,...e}),select:(e,t)=>{let n=e=>e.toLowerCase().replace(/\s+/g,`_`).replace(/[^a-z0-9_]/g,``),r,i;if(Array.isArray(e))r=e.map(e=>typeof e==`string`?{label:e,value:n(e)}:{...e,value:e.value.toLowerCase()}),i=t||{};else{r=(e.options||[]).map(e=>typeof e==`string`?{label:e,value:n(e)}:{...e,value:e.value.toLowerCase()});let{options:t,...a}=e;i=a}return{type:`select`,options:r,...i}},lookup:(e,t={})=>({type:`lookup`,reference:e,...t}),masterDetail:(e,t={})=>({type:`master_detail`,reference:e,...t}),location:(e={})=>({type:`location`,...e}),address:(e={})=>({type:`address`,...e}),richtext:(e={})=>({type:`richtext`,...e}),code:(e,t={})=>({type:`code`,language:e,...t}),color:(e={})=>({type:`color`,...e}),rating:(e=5,t={})=>({type:`rating`,maxRating:e,...t}),signature:(e={})=>({type:`signature`,...e}),slider:(e={})=>({type:`slider`,...e}),qrcode:(e={})=>({type:`qrcode`,...e}),json:(e={})=>({type:`json`,...e}),vector:(e,t={})=>({type:`vector`,vectorConfig:{dimensions:e,distanceMetric:`cosine`,normalized:!1,indexed:!0,...t.vectorConfig},...t})};function nD(e,t){let n=e.length,r=t.length;if(n===0)return r;if(r===0)return n;let i=Array(r+1),a=Array(r+1);for(let e=0;e<=r;e++)i[e]=e;for(let o=1;o<=n;o++){a[0]=o;for(let n=1;n<=r;n++){let r=e[o-1]===t[n-1]?0:1;a[n]=Math.min(i[n]+1,a[n-1]+1,i[n-1]+r)}[i,a]=[a,i]}return i[r]}function rD(e,t,n=3,r=3){let i=e.toLowerCase().replace(/[-\s]/g,`_`);return t.map(e=>({value:e,distance:nD(i,e)})).filter(e=>e.distance<=n&&e.distance>0).sort((e,t)=>e.distance-t.distance).slice(0,r).map(e=>e.value)}var Cse={string:`text`,str:`text`,varchar:`text`,char:`text`,int:`number`,integer:`number`,float:`number`,double:`number`,decimal:`number`,numeric:`number`,bool:`boolean`,checkbox:`boolean`,check:`boolean`,date_time:`datetime`,timestamp:`datetime`,text_area:`textarea`,textarea_:`textarea`,textfield:`text`,dropdown:`select`,picklist:`select`,enum:`select`,multi_select:`multiselect`,multiselect_:`multiselect`,reference:`lookup`,ref:`lookup`,foreign_key:`lookup`,fk:`lookup`,relation:`lookup`,master:`master_detail`,richtext_:`richtext`,rich_text:`richtext`,upload:`file`,attachment:`file`,photo:`image`,picture:`image`,img:`image`,percent_:`percent`,percentage:`percent`,money:`currency`,price:`currency`,auto_number:`autonumber`,auto_increment:`autonumber`,sequence:`autonumber`,markdown_:`markdown`,md:`markdown`,barcode:`qrcode`,tag:`tags`,star:`rating`,stars:`rating`,geo:`location`,gps:`location`,coordinates:`location`,embed:`vector`,embedding:`vector`,embeddings:`vector`};function iD(e){let t=e.toLowerCase().replace(/[-\s]/g,`_`),n=Cse[t];return n?[n]:rD(t,JE.options)}function aD(e){return e.length===0?``:e.length===1?`Did you mean '${e[0]}'?`:`Did you mean one of: ${e.map(e=>`'${e}'`).join(`, `)}?`}var oD=e=>{if(e.code===`invalid_value`){let t=e.values,n=e.input,r=String(n??``),i=t.map(String),a=JE.options;if(i.length>10&&a.every(e=>i.includes(e))){let e=aD(iD(r)),t=`Invalid field type '${r}'.`;return{message:e?`${t} ${e}`:`${t} Valid types: ${i.slice(0,10).join(`, `)}...`}}let o=aD(rD(r,i)),s=`Invalid value '${r}'.`;return{message:o?`${s} ${o}`:`${s} Expected one of: ${i.join(`, `)}.`}}if(e.code===`too_small`){let t=e.origin,n=e.minimum;if(t===`string`)return{message:`Must be at least ${n} character${n===1?``:`s`} long.`}}if(e.code===`too_big`){let t=e.origin,n=e.maximum;if(t===`string`)return{message:`Must be at most ${n} character${n===1?``:`s`} long.`}}if(e.code===`invalid_format`){let t=e.format,n=e.input;if(t===`regex`&&n){let t=e.path?.join(`.`)??``;if(t.endsWith(`name`)||t===`name`)return{message:`Invalid identifier '${n}'. Must be lowercase snake_case (e.g., 'my_object', 'task_name'). No uppercase, spaces, or hyphens allowed.`}}}if(e.code===`invalid_type`){let t=e.expected,n=e.input;if(n===void 0){let t=e.path;return{message:`Required property '${t?.[t.length-1]??``}' is missing.`}}return{message:`Expected ${t} but received ${n===null?`null`:typeof n}.`}}if(e.code===`unrecognized_keys`){let t=e.keys,n=t.join(`, `);return{message:`Unrecognized key${t.length>1?`s`:``}: ${n}. Check for typos in property names.`}}return null};function sD(e){return` \u2717 ${e.path.length>0?e.path.join(`.`):`(root)`}: ${e.message}`}function cD(e,t){let n=e.issues.length;return`${t?`${t} (${n} issue${n===1?``:`s`}):`:`Validation failed (${n} issue${n===1?``:`s`}):`}
|
|
65
65
|
|
|
66
66
|
${e.issues.map(sD).join(`
|
|
67
|
-
`)}`}function wse(e,t,n){let r=e.safeParse(t,{error:oD});return r.success?{success:!0,data:r.data}:{success:!1,error:r.error,formatted:cD(r.error,n)}}var lD=[`objects`,`apps`,`pages`,`dashboards`,`reports`,`actions`,`themes`,`workflows`,`approvals`,`flows`,`roles`,`permissions`,`sharingRules`,`policies`,`apis`,`webhooks`,`agents`,`ragPipelines`,`hooks`,`mappings`,`analyticsCubes`,`connectors`,`datasources`];function uD(e,t=`name`){return e==null||Array.isArray(e)?e:typeof e==`object`?Object.entries(e).map(([e,n])=>{if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n;return!(t in r)||r[t]===void 0?{...r,[t]:e}:r}return n}):e}function dD(e){let t={...e};for(let e of lD)e in t&&(t[e]=uD(t[e]));return t}var fD={triggers:`hooks`};function pD(e){let t={...e};for(let[e,n]of Object.entries(fD))if(e in t){let r=uD(t[e]),i=uD(t[n]);Array.isArray(r)&&(t[n]=Array.isArray(i)?[...i,...r]:r),delete t[e]}for(let e of lD)e in t&&(t[e]=uD(t[e]));return Array.isArray(t.plugins)&&(t.plugins=t.plugins.map(e=>e&&typeof e==`object`&&!Array.isArray(e)?pD(e):e)),t}EE({},{ALL_OPERATORS:()=>Pse,AddressSchema:()=>xse,AggregationFunction:()=>wD,AggregationMetricType:()=>zk,AggregationNodeSchema:()=>TD,AggregationPipelineSchema:()=>hk,AggregationStageSchema:()=>mk,AnalyticsQuerySchema:()=>Kk,ApiMethod:()=>iO,AsyncValidationSchema:()=>HD,BaseEngineOptionsSchema:()=>wO,CDCConfigSchema:()=>fO,ComparisonOperatorSchema:()=>Ese,ComputedFieldCacheSchema:()=>eD,ConditionalValidationSchema:()=>GD,ConsistencyLevelSchema:()=>ok,CrossFieldValidationSchema:()=>BD,CubeJoinSchema:()=>Wk,CubeSchema:()=>Gk,CurrencyConfigSchema:()=>XE,CurrencyValueSchema:()=>bse,CustomValidatorSchema:()=>UD,DataEngineAggregateOptionsSchema:()=>AO,DataEngineAggregateRequestSchema:()=>HO,DataEngineBatchRequestSchema:()=>GO,DataEngineContractSchema:()=>NO,DataEngineCountOptionsSchema:()=>MO,DataEngineCountRequestSchema:()=>VO,DataEngineDeleteOptionsSchema:()=>Gse,DataEngineDeleteRequestSchema:()=>BO,DataEngineExecuteRequestSchema:()=>UO,DataEngineFilterSchema:()=>SO,DataEngineFindOneRequestSchema:()=>LO,DataEngineFindRequestSchema:()=>IO,DataEngineInsertOptionsSchema:()=>EO,DataEngineInsertRequestSchema:()=>RO,DataEngineQueryOptionsSchema:()=>Use,DataEngineRequestSchema:()=>KO,DataEngineSortSchema:()=>CO,DataEngineUpdateOptionsSchema:()=>Wse,DataEngineUpdateRequestSchema:()=>zO,DataEngineVectorFindRequestSchema:()=>WO,DataQualityRulesSchema:()=>$E,DataTypeMappingSchema:()=>$O,DatasetLoadResultSchema:()=>Tk,DatasetMode:()=>vk,DatasetSchema:()=>yk,DatasourceCapabilities:()=>Lk,DatasourceSchema:()=>Rk,DimensionSchema:()=>Uk,DimensionType:()=>Bk,DocumentSchema:()=>jk,DocumentSchemaValidationSchema:()=>uk,DocumentTemplateSchema:()=>kk,DocumentVersionSchema:()=>Ok,DriverCapabilitiesSchema:()=>JO,DriverConfigSchema:()=>ZO,DriverDefinitionSchema:()=>Ik,DriverInterfaceSchema:()=>YO,DriverOptionsSchema:()=>qO,DriverType:()=>Fk,ESignatureConfigSchema:()=>Ak,EngineAggregateOptionsSchema:()=>kO,EngineCountOptionsSchema:()=>jO,EngineDeleteOptionsSchema:()=>OO,EngineQueryOptionsSchema:()=>TO,EngineUpdateOptionsSchema:()=>DO,EqualityOperatorSchema:()=>Tse,ExternalDataSourceSchema:()=>Mk,ExternalFieldMappingSchema:()=>Nk,ExternalLookupSchema:()=>Pk,FILTER_OPERATORS:()=>xD,FeedActorSchema:()=>Zk,FeedFilterMode:()=>eA,FeedItemSchema:()=>$k,FeedItemType:()=>qk,FeedVisibility:()=>Qk,Field:()=>Sse,FieldChangeEntrySchema:()=>Yk,FieldMappingSchema:()=>yO,FieldNodeSchema:()=>MD,FieldOperatorsSchema:()=>hD,FieldReferenceSchema:()=>mD,FieldSchema:()=>tD,FieldType:()=>JE,FileAttachmentConfigSchema:()=>QE,FilterConditionSchema:()=>gD,FormatValidationSchema:()=>zD,FullTextSearchSchema:()=>ND,HookContextSchema:()=>Hse,HookEvent:()=>gO,HookSchema:()=>_O,IndexSchema:()=>oO,JSONValidationSchema:()=>VD,JoinNodeSchema:()=>OD,JoinStrategy:()=>DD,JoinType:()=>ED,LOGICAL_OPERATORS:()=>SD,LocationCoordinatesSchema:()=>yse,MappingSchema:()=>bO,MentionSchema:()=>Jk,MetricSchema:()=>Hk,NoSQLDataTypeMappingSchema:()=>dk,NoSQLDatabaseTypeSchema:()=>ik,NoSQLDriverConfigSchema:()=>fk,NoSQLIndexSchema:()=>gk,NoSQLIndexTypeSchema:()=>sk,NoSQLOperationTypeSchema:()=>ak,NoSQLQueryOptionsSchema:()=>pk,NoSQLTransactionOptionsSchema:()=>_k,NormalizedFilterSchema:()=>_D,NotificationChannel:()=>nA,ObjectCapabilities:()=>aO,ObjectDependencyGraphSchema:()=>Sk,ObjectDependencyNodeSchema:()=>xk,ObjectExtensionSchema:()=>hO,ObjectOwnershipEnum:()=>Vse,ObjectSchema:()=>mO,PartitioningConfigSchema:()=>dO,PoolConfigSchema:()=>XO,QueryFilterSchema:()=>jse,QuerySchema:()=>PD,RangeOperatorSchema:()=>Ose,ReactionSchema:()=>Xk,RecordSubscriptionSchema:()=>rA,ReferenceResolutionErrorSchema:()=>Ck,ReferenceResolutionSchema:()=>bk,ReplicationConfigSchema:()=>lk,SQLDialectSchema:()=>QO,SQLDriverConfigSchema:()=>tk,SQLiteAlterTableLimitations:()=>rk,SQLiteDataTypeMappingDefaults:()=>nk,SSLConfigSchema:()=>ek,ScriptValidationSchema:()=>ID,SearchConfigSchema:()=>sO,SeedLoaderConfigSchema:()=>wk,SeedLoaderRequestSchema:()=>Dk,SeedLoaderResultSchema:()=>Ek,SelectOptionSchema:()=>YE,SetOperatorSchema:()=>Dse,ShardingConfigSchema:()=>ck,SoftDeleteConfigSchema:()=>lO,SortNodeSchema:()=>CD,SpecialOperatorSchema:()=>Ase,StateMachineValidationSchema:()=>RD,StringOperatorSchema:()=>kse,SubscriptionEventType:()=>tA,TenancyConfigSchema:()=>cO,TenantDatabaseLifecycleSchema:()=>oA,TenantResolverStrategySchema:()=>iA,TimeUpdateInterval:()=>Vk,TransformType:()=>vO,TursoGroupSchema:()=>aA,TursoMultiTenantConfigSchema:()=>sA,UniquenessValidationSchema:()=>LD,VALID_AST_OPERATORS:()=>vD,ValidationRuleSchema:()=>WD,VectorConfigSchema:()=>ZE,VersioningConfigSchema:()=>uO,WindowFunction:()=>kD,WindowFunctionNodeSchema:()=>jD,WindowSpecSchema:()=>AD,isFilterAST:()=>yD,parseFilterAST:()=>bD});var mD=l({$field:o().describe(`Field Reference/Column Name`)}),Tse=l({$eq:T().optional(),$ne:T().optional()}),Ese=l({$gt:c([A(),_(),mD]).optional(),$gte:c([A(),_(),mD]).optional(),$lt:c([A(),_(),mD]).optional(),$lte:c([A(),_(),mD]).optional()}),Dse=l({$in:S(T()).optional(),$nin:S(T()).optional()}),Ose=l({$between:a([c([A(),_(),mD]),c([A(),_(),mD])]).optional()}),kse=l({$contains:o().optional(),$notContains:o().optional(),$startsWith:o().optional(),$endsWith:o().optional()}),Ase=l({$null:v().optional(),$exists:v().optional()}),hD=l({$eq:T().optional(),$ne:T().optional(),$gt:c([A(),_(),mD]).optional(),$gte:c([A(),_(),mD]).optional(),$lt:c([A(),_(),mD]).optional(),$lte:c([A(),_(),mD]).optional(),$in:S(T()).optional(),$nin:S(T()).optional(),$between:a([c([A(),_(),mD]),c([A(),_(),mD])]).optional(),$contains:o().optional(),$notContains:o().optional(),$startsWith:o().optional(),$endsWith:o().optional(),$null:v().optional(),$exists:v().optional()}),gD=j(()=>u(o(),b()).and(l({$and:S(gD).optional(),$or:S(gD).optional(),$not:gD.optional()}))),jse=l({where:gD.optional()}),_D=j(()=>l({$and:S(c([u(o(),hD),_D])).optional(),$or:S(c([u(o(),hD),_D])).optional(),$not:c([u(o(),hD),_D]).optional()})),vD=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function yD(e){if(!Array.isArray(e)||e.length===0)return!1;let t=e[0];if(typeof t==`string`){let n=t.toLowerCase();if(n===`and`||n===`or`)return e.length>=2&&e.slice(1).every(e=>yD(e));if(e.length>=2&&typeof e[1]==`string`)return vD.has(e[1].toLowerCase())}return e.every(e=>yD(e))?e.length>0:!1}var Mse={"=":`$eq`,"==":`$eq`,"!=":`$ne`,"<>":`$ne`,">":`$gt`,">=":`$gte`,"<":`$lt`,"<=":`$lte`,in:`$in`,nin:`$nin`,not_in:`$nin`,contains:`$contains`,notcontains:`$notContains`,not_contains:`$notContains`,like:`$contains`,startswith:`$startsWith`,starts_with:`$startsWith`,endswith:`$endsWith`,ends_with:`$endsWith`,between:`$between`,is_null:`$null`,is_not_null:`$null`};function Nse(e){let[t,n,r]=e,i=n.toLowerCase();if(i===`=`||i===`==`)return{[t]:r};if(i===`is_null`)return{[t]:{$null:!0}};if(i===`is_not_null`)return{[t]:{$null:!1}};let a=Mse[i];return a?{[t]:{[a]:r}}:{[t]:{[`$${i}`]:r}}}function bD(e){if(e==null)return;if(!Array.isArray(e))return e;if(e.length===0)return;let t=e[0];if(typeof t==`string`&&(t.toLowerCase()===`and`||t.toLowerCase()===`or`)){let n=`$${t.toLowerCase()}`,r=e.slice(1).map(e=>bD(e)).filter(Boolean);return r.length===0?void 0:r.length===1?r[0]:{[n]:r}}if(e.length>=2&&typeof t==`string`)return Nse(e);if(e.every(e=>Array.isArray(e))){let t=e.map(e=>bD(e)).filter(Boolean);return t.length===0?void 0:t.length===1?t[0]:{$and:t}}}var xD=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],SD=[`$and`,`$or`,`$not`],Pse=[...xD,...SD],CD=l({field:o(),order:x([`asc`,`desc`]).default(`asc`)}),wD=x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),TD=l({function:wD.describe(`Aggregation function`),field:o().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:o().describe(`Result column alias`),distinct:v().optional().describe(`Apply DISTINCT before aggregation`),filter:gD.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)}),ED=x([`inner`,`left`,`right`,`full`]),DD=x([`auto`,`database`,`hash`,`loop`]),OD=j(()=>l({type:ED.describe(`Join type`),strategy:DD.optional().describe(`Execution strategy hint`),object:o().describe(`Object/table to join`),alias:o().optional().describe(`Table alias`),on:gD.describe(`Join condition`),subquery:j(()=>PD).optional().describe(`Subquery instead of object`)})),kD=x([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),AD=l({partitionBy:S(o()).optional().describe(`PARTITION BY fields`),orderBy:S(CD).optional().describe(`ORDER BY specification`),frame:l({type:x([`rows`,`range`]).optional(),start:o().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:o().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)}),jD=l({function:kD.describe(`Window function name`),field:o().optional().describe(`Field to operate on (for aggregate window functions)`),alias:o().describe(`Result column alias`),over:AD.describe(`Window specification (OVER clause)`)}),MD=j(()=>c([o(),l({field:o(),fields:S(MD).optional(),alias:o().optional()})])),ND=l({query:o().describe(`Search query text`),fields:S(o()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:v().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:x([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:u(o(),A()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:A().optional().describe(`Minimum relevance score threshold`),language:o().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:v().optional().default(!1).describe(`Enable search result highlighting`)}),PD=l({object:o().describe(`Object name (e.g. account)`),fields:S(MD).optional().describe(`Fields to retrieve`),where:gD.optional().describe(`Filtering criteria (WHERE)`),search:ND.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:S(CD).optional().describe(`Sorting instructions (ORDER BY)`),limit:A().optional().describe(`Max records to return (LIMIT)`),offset:A().optional().describe(`Records to skip (OFFSET)`),top:A().optional().describe(`Alias for limit (OData compatibility)`),cursor:u(o(),b()).optional().describe(`Cursor for keyset pagination`),joins:S(OD).optional().describe(`Explicit Table Joins`),aggregations:S(TD).optional().describe(`Aggregation functions`),groupBy:S(o()).optional().describe(`GROUP BY fields`),having:gD.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:S(jD).optional().describe(`Window functions with OVER clause`),distinct:v().optional().describe(`SELECT DISTINCT flag`)}).extend({expand:j(()=>u(o(),PD)).optional().describe(`Recursive relation loading map. Keys are lookup/master_detail field names; values are nested QueryAST objects that control select, filter, sort, and further expansion on the related object. The engine resolves expand via batch $in queries (driver-agnostic) with a default max depth of 3.`)}),FD=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:o().optional().describe(`Human-readable label for the rule listing`),description:o().optional().describe(`Administrative notes explaining the business reason`),active:v().default(!0),events:S(x([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:A().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:S(o()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:x([`error`,`warning`,`info`]).default(`error`),message:o().describe(`Error message to display to the user`)}),ID=FD.extend({type:p(`script`),condition:o().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),LD=FD.extend({type:p(`unique`),fields:S(o()).describe(`Fields that must be combined unique`),scope:o().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:v().default(!0)}),RD=FD.extend({type:p(`state_machine`),field:o().describe(`State field (e.g. status)`),transitions:u(o(),S(o())).describe(`Map of { OldState: [AllowedNewStates] }`)}),zD=FD.extend({type:p(`format`),field:o(),regex:o().optional(),format:x([`email`,`url`,`phone`,`json`]).optional()}),BD=FD.extend({type:p(`cross_field`),condition:o().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:S(o()).describe(`Fields involved in the validation`)}),VD=FD.extend({type:p(`json_schema`),field:o().describe(`JSON field to validate`),schema:u(o(),b()).describe(`JSON Schema object definition`)}),HD=FD.extend({type:p(`async`),field:o().describe(`Field to validate`),validatorUrl:o().optional().describe(`External API endpoint for validation`),method:x([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:u(o(),o()).optional().describe(`Custom headers for the request`),validatorFunction:o().optional().describe(`Reference to custom validator function`),timeout:A().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:A().optional().describe(`Debounce delay in milliseconds`),params:u(o(),b()).optional().describe(`Additional parameters to pass to validator`)}),UD=FD.extend({type:p(`custom`),handler:o().describe(`Name of the custom validation function registered in the system`),params:u(o(),b()).optional().describe(`Parameters passed to the custom handler`)}),WD=j(()=>d(`type`,[ID,LD,RD,zD,BD,VD,HD,UD,GD])),GD=FD.extend({type:p(`conditional`),when:o().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:WD.describe(`Validation rule to apply when condition is true`),otherwise:WD.optional().describe(`Validation rule to apply when condition is false`)}),KD=c([o().describe(`Action Name`),l({type:o(),params:u(o(),b()).optional()})]),qD=c([o().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),l({type:o(),params:u(o(),b()).optional()})]),JD=l({target:o().optional().describe(`Target State ID`),cond:qD.optional().describe(`Condition (Guard) required to take this path`),actions:S(KD).optional().describe(`Actions to execute during transition`),description:o().optional().describe(`Human readable description of this rule`)}),Fse=l({type:o().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:u(o(),b()).optional().describe(`Expected event payload structure`)}),YD=j(()=>l({type:x([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:S(KD).optional().describe(`Actions to run when entering this state`),exit:S(KD).optional().describe(`Actions to run when leaving this state`),on:u(o(),c([o(),JD,S(JD)])).optional().describe(`Map of Event Type -> Transition Definition`),always:S(JD).optional(),initial:o().optional().describe(`Initial child state (if compound)`),states:u(o(),YD).optional(),meta:l({label:o().optional(),description:o().optional(),color:o().optional(),aiInstructions:o().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),XD=l({id:OE.describe(`Unique Machine ID`),description:o().optional(),contextSchema:u(o(),b()).optional().describe(`Zod Schema for the machine context/memory`),initial:o().describe(`Initial State ID`),states:u(o(),YD).describe(`State Nodes`),on:u(o(),c([o(),JD,S(JD)])).optional()}),ZD=l({key:o().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:o().optional().describe(`Fallback value when translation key is not found`),params:u(o(),c([o(),A(),v()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}),G=c([o(),ZD]).describe(`Display label: plain string or i18n translation object`),QD=l({ariaLabel:G.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:o().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:o().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`),Ise=l({key:o().describe(`Translation key`),zero:o().optional().describe(`Zero form (e.g., "No items")`),one:o().optional().describe(`Singular form (e.g., "{count} item")`),two:o().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:o().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:o().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:o().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`),$D=l({style:x([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:o().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:o().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:A().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:A().optional().describe(`Maximum number of fraction digits`),useGrouping:v().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),eO=l({dateStyle:x([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:x([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:o().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:v().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`),Lse=l({code:o().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:S(o()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:x([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:$D.optional().describe(`Default number formatting rules`),dateFormat:eO.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`),tO=l({name:o(),label:G,type:JE,required:v().default(!1),options:S(l({label:G,value:o()})).optional()}),nO=x([`script`,`url`,`modal`,`flow`,`api`]),Rse=new Set(nO.options.filter(e=>e!==`script`)),rO=l({name:OE.describe(`Machine name (lowercase snake_case)`),label:G.describe(`Display label`),objectName:o().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:o().optional().describe(`Icon name`),locations:S(x([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:x([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:nO.default(`script`).describe(`Action functionality type`),target:o().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:o().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:S(tO).optional().describe(`Input parameters required from user`),variant:x([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:G.optional().describe(`Confirmation message before execution`),successMessage:G.optional().describe(`Success message to show after execution`),refreshAfter:v().default(!1).describe(`Refresh view after execution`),visible:o().optional().describe(`Formula returning boolean`),disabled:c([v(),o()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:o().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:v().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:A().optional().describe(`Maximum execution time in milliseconds for the action`),aria:QD.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(Rse.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),zse={create:e=>rO.parse(e)},iO=x([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),aO=l({trackHistory:v().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:v().default(!0).describe(`Index records for global search`),apiEnabled:v().default(!0).describe(`Expose object via automatic APIs`),apiMethods:S(iO).optional().describe(`Whitelist of allowed API operations`),files:v().default(!1).describe(`Enable file attachments and document management`),feeds:v().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:v().default(!1).describe(`Enable standard tasks and events tracking`),trash:v().default(!0).describe(`Enable soft-delete with restore capability`),mru:v().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:v().default(!0).describe(`Allow record deep cloning`)}),oO=l({name:o().optional().describe(`Index name (auto-generated if not provided)`),fields:S(o()).describe(`Fields included in the index`),type:x([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:v().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:o().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),sO=l({fields:S(o()).describe(`Fields to index for full-text search weighting`),displayFields:S(o()).optional().describe(`Fields to display in search result cards`),filters:S(o()).optional().describe(`Default filters for search results`)}),cO=l({enabled:v().describe(`Enable multi-tenancy for this object`),strategy:x([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:o().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:v().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),lO=l({enabled:v().describe(`Enable soft delete (trash/recycle bin)`),field:o().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:v().default(!1).describe(`Cascade soft delete to related records`)}),uO=l({enabled:v().describe(`Enable record versioning`),strategy:x([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:A().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:o().default(`version`).describe(`Field name for version number/timestamp`)}),dO=l({enabled:v().describe(`Enable table partitioning`),strategy:x([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:o().describe(`Field name to partition by`),interval:o().optional().describe(`Partition interval for range strategy (e.g., "1 month", "1 year")`)}).refine(e=>!(e.strategy===`range`&&!e.interval),{message:`interval is required when strategy is "range"`}),fO=l({enabled:v().describe(`Enable Change Data Capture`),events:S(x([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:o().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),pO=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:o().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:o().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:o().optional().describe(`Developer documentation / description`),icon:o().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:o().regex(/^[a-z][a-z0-9]*$/).optional().describe(`Logical domain namespace — single lowercase word (e.g. "sys", "crm"). Used for routing, permissions, and auto-deriving tableName as {namespace}_{name}.`),tags:S(o()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:v().optional().default(!0).describe(`Is the object active and usable`),isSystem:v().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:v().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:o().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:o().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:u(o().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),tD).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:S(oO).optional().describe(`Database performance indexes`),tenancy:cO.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:lO.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:uO.optional().describe(`Record versioning and history tracking configuration`),partitioning:dO.optional().describe(`Table partitioning configuration for performance`),cdc:fO.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:S(WD).optional().describe(`Object-level validation rules`),stateMachines:u(o(),XD).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:o().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:l({type:x([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:o().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:A().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:o().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:S(o()).optional().describe(`Primary fields for hover/cards/lookups`),search:sO.optional().describe(`Search engine configuration`),enable:aO.optional().describe(`Enabled system features modules`),recordTypes:S(o()).optional().describe(`Record type names for this object`),sharingModel:x([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:o().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:S(rO).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Bse(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var mO=Object.assign(pO,{create:e=>{let t={...e,label:e.label??Bse(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return pO.parse(t)}}),Vse=x([`own`,`extend`]),hO=l({extend:o().describe(`Target object name (FQN) to extend`),fields:u(o(),tD).optional().describe(`Fields to add/override`),label:o().optional().describe(`Override label for the extended object`),pluralLabel:o().optional().describe(`Override plural label for the extended object`),description:o().optional().describe(`Override description for the extended object`),validations:S(WD).optional().describe(`Additional validation rules to merge into the target object`),indexes:S(oO).optional().describe(`Additional indexes to merge into the target object`),priority:A().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}),gO=x([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]),_O=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:o().optional().describe(`Description of what this hook does`),object:c([o(),S(o())]).describe(`Target object(s)`),events:S(gO).describe(`Lifecycle events`),handler:c([o(),O()]).optional().describe(`Handler function name (string) or inline function reference`),priority:A().default(100).describe(`Execution priority`),async:v().default(!1).describe(`Run specifically as fire-and-forget`),condition:o().optional().describe(`Formula expression; hook runs only when TRUE (e.g., "status = 'closed' AND amount > 1000")`),description:o().optional().describe(`Human-readable description of what this hook does`),retryPolicy:l({maxRetries:A().default(3).describe(`Maximum retry attempts on failure`),backoffMs:A().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:A().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:x([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)}),Hse=l({id:o().optional().describe(`Unique execution ID for tracing`),object:o(),event:gO,input:u(o(),b()).describe(`Mutable input parameters`),result:b().optional().describe(`Operation result (After hooks only)`),previous:u(o(),b()).optional().describe(`Record state before operation`),session:l({userId:o().optional(),tenantId:o().optional(),roles:S(o()).optional(),accessToken:o().optional()}).optional().describe(`Current session context`),transaction:b().optional().describe(`Database transaction handle`),ql:b().describe(`ObjectQL Engine Reference`),api:b().optional().describe(`Cross-object data access (ScopedContext)`),user:l({id:o().optional(),name:o().optional(),email:o().optional()}).optional().describe(`Current user info shortcut`)}),vO=x([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),yO=l({source:c([o(),S(o())]).describe(`Source column header(s)`),target:c([o(),S(o())]).describe(`Target object field(s)`),transform:vO.default(`none`),params:l({value:b().optional(),object:o().optional(),fromField:o().optional(),toField:o().optional(),autoCreate:v().optional(),valueMap:u(o(),b()).optional(),separator:o().optional()}).optional()}),bO=l({name:OE.describe(`Mapping unique name (lowercase snake_case)`),label:o().optional(),sourceFormat:x([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:o().describe(`Target Object Name`),fieldMapping:S(yO),mode:x([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:S(o()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:PD.optional().describe(`Query to run for export only`),errorPolicy:x([`skip`,`abort`,`retry`]).default(`skip`),batchSize:A().default(1e3)}),xO=l({userId:o().optional(),tenantId:o().optional(),roles:S(o()).default([]),permissions:S(o()).default([]),isSystem:v().default(!1),accessToken:o().optional(),transaction:b().optional(),traceId:o().optional()}),SO=c([u(o(),b()),gD]).describe(`Data Engine query filter conditions`),CO=c([u(o(),x([`asc`,`desc`])),u(o(),c([p(1),p(-1)])),S(CD)]).describe(`Sort order definition`),wO=l({context:xO.optional()}),TO=wO.extend({where:c([u(o(),b()),gD]).optional(),fields:S(MD).optional(),orderBy:S(CD).optional(),limit:A().optional(),offset:A().optional(),top:A().optional(),cursor:u(o(),b()).optional(),search:ND.optional(),expand:j(()=>u(o(),PD)).optional(),distinct:v().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`),Use=wO.extend({filter:SO.optional(),select:S(o()).optional(),sort:CO.optional(),limit:A().int().min(1).optional(),skip:A().int().min(0).optional(),top:A().int().min(1).optional(),populate:S(o()).optional()}).describe(`Query options for IDataEngine.find() operations`),EO=wO.extend({returning:v().default(!0).optional()}).describe(`Options for DataEngine.insert operations`),DO=wO.extend({where:c([u(o(),b()),gD]).optional(),upsert:v().default(!1).optional(),multi:v().default(!1).optional(),returning:v().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`),Wse=wO.extend({filter:SO.optional(),upsert:v().default(!1).optional(),multi:v().default(!1).optional(),returning:v().default(!1).optional()}).describe(`Options for DataEngine.update operations`),OO=wO.extend({where:c([u(o(),b()),gD]).optional(),multi:v().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`),Gse=wO.extend({filter:SO.optional(),multi:v().default(!1).optional()}).describe(`Options for DataEngine.delete operations`),kO=wO.extend({where:c([u(o(),b()),gD]).optional(),groupBy:S(o()).optional(),aggregations:S(TD).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`),AO=wO.extend({filter:SO.optional(),groupBy:S(o()).optional(),aggregations:S(l({field:o(),method:x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:o().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`),jO=wO.extend({where:c([u(o(),b()),gD]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`),MO=wO.extend({filter:SO.optional()}).describe(`Options for DataEngine.count operations`),NO=l({find:O().input(a([o(),TO.optional()])).output(k(S(b()))),findOne:O().input(a([o(),TO.optional()])).output(k(b())),insert:O().input(a([o(),c([u(o(),b()),S(u(o(),b()))]),EO.optional()])).output(k(b())),update:O().input(a([o(),u(o(),b()),DO.optional()])).output(k(b())),delete:O().input(a([o(),OO.optional()])).output(k(b())),count:O().input(a([o(),jO.optional()])).output(k(A())),aggregate:O().input(a([o(),kO])).output(k(S(b())))}).describe(`Standard Data Engine Contract`),PO={filter:SO.optional()},FO=TO.extend({...PO,select:S(o()).optional(),sort:CO.optional(),skip:A().int().min(0).optional(),populate:S(o()).optional()}),IO=l({method:p(`find`),object:o(),query:FO.optional()}),LO=l({method:p(`findOne`),object:o(),query:FO.optional()}),RO=l({method:p(`insert`),object:o(),data:c([u(o(),b()),S(u(o(),b()))]),options:EO.optional()}),zO=l({method:p(`update`),object:o(),data:u(o(),b()),id:c([o(),A()]).optional().describe(`ID for single update, or use where in options`),options:DO.extend(PO).optional()}),BO=l({method:p(`delete`),object:o(),id:c([o(),A()]).optional().describe(`ID for single delete, or use where in options`),options:OO.extend(PO).optional()}),VO=l({method:p(`count`),object:o(),query:jO.extend(PO).optional()}),HO=l({method:p(`aggregate`),object:o(),query:kO.extend(PO)}),UO=l({method:p(`execute`),command:b(),options:u(o(),b()).optional()}),WO=l({method:p(`vectorFind`),object:o(),vector:S(A()),where:c([u(o(),b()),gD]).optional(),fields:S(o()).optional(),limit:A().int().default(5).optional(),threshold:A().optional()}),GO=l({method:p(`batch`),requests:S(d(`method`,[IO,LO,RO,zO,BO,VO,HO,UO,WO])),transaction:v().default(!0).optional()}),KO=d(`method`,[IO,LO,RO,zO,BO,VO,HO,GO,UO,WO]).describe(`Virtual ObjectQL Request Protocol`),qO=l({transaction:b().optional().describe(`Transaction handle`),timeout:A().optional().describe(`Timeout in ms`),skipCache:v().optional().describe(`Bypass cache`),traceContext:u(o(),o()).optional().describe(`OpenTelemetry context or request ID`),tenantId:o().optional().describe(`Tenant Isolation identifier`)}),JO=l({create:v().default(!0).describe(`Supports CREATE operations`),read:v().default(!0).describe(`Supports READ operations`),update:v().default(!0).describe(`Supports UPDATE operations`),delete:v().default(!0).describe(`Supports DELETE operations`),bulkCreate:v().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:v().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:v().default(!1).describe(`Supports bulk DELETE operations`),transactions:v().default(!1).describe(`Supports ACID transactions`),savepoints:v().default(!1).describe(`Supports transaction savepoints`),isolationLevels:S(BE).optional().describe(`Supported isolation levels`),queryFilters:v().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:v().default(!1).describe(`Supports GROUP BY and aggregation functions`),querySorting:v().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:v().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:v().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:v().default(!1).describe(`Supports subqueries`),queryCTE:v().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:v().default(!1).describe(`Supports SQL joins`),fullTextSearch:v().default(!1).describe(`Supports full-text search`),jsonQuery:v().default(!1).describe(`Supports JSON field querying`),geospatialQuery:v().default(!1).describe(`Supports geospatial queries`),streaming:v().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:v().default(!1).describe(`Supports JSON field types`),arrayFields:v().default(!1).describe(`Supports array field types`),vectorSearch:v().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:v().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:v().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:v().default(!1).describe(`Supports database migrations`),indexes:v().default(!1).describe(`Supports index creation and management`),connectionPooling:v().default(!1).describe(`Supports connection pooling`),preparedStatements:v().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:v().default(!1).describe(`Supports query result caching`)}),YO=l({name:o().describe(`Driver unique name`),version:o().describe(`Driver version`),supports:JO,connect:O().input(a([])).output(k(g())).describe(`Establish connection`),disconnect:O().input(a([])).output(k(g())).describe(`Close connection`),checkHealth:O().input(a([])).output(k(v())).describe(`Health check`),getPoolStats:O().input(a([])).output(l({total:A(),idle:A(),active:A(),waiting:A()}).optional()).optional().describe(`Get connection pool statistics`),execute:O().input(a([b(),S(b()).optional(),qO.optional()])).output(k(b())).describe(`Execute raw command`),find:O().input(a([o(),PD,qO.optional()])).output(k(S(u(o(),b())))).describe(`Find records`),findStream:O().input(a([o(),PD,qO.optional()])).output(b()).describe(`Stream records (AsyncIterable)`),findOne:O().input(a([o(),PD,qO.optional()])).output(k(u(o(),b()).nullable())).describe(`Find one record`),create:O().input(a([o(),u(o(),b()),qO.optional()])).output(k(u(o(),b()))).describe(`Create record`),update:O().input(a([o(),o().or(A()),u(o(),b()),qO.optional()])).output(k(u(o(),b()))).describe(`Update record`),upsert:O().input(a([o(),u(o(),b()),S(o()).optional(),qO.optional()])).output(k(u(o(),b()))).describe(`Upsert record`),delete:O().input(a([o(),o().or(A()),qO.optional()])).output(k(v())).describe(`Delete record`),count:O().input(a([o(),PD.optional(),qO.optional()])).output(k(A())).describe(`Count records`),bulkCreate:O().input(a([o(),S(u(o(),b())),qO.optional()])).output(k(S(u(o(),b())))),bulkUpdate:O().input(a([o(),S(l({id:o().or(A()),data:u(o(),b())})),qO.optional()])).output(k(S(u(o(),b())))),bulkDelete:O().input(a([o(),S(o().or(A())),qO.optional()])).output(k(g())),updateMany:O().input(a([o(),PD,u(o(),b()),qO.optional()])).output(k(A())).optional(),deleteMany:O().input(a([o(),PD,qO.optional()])).output(k(A())).optional(),beginTransaction:O().input(a([l({isolationLevel:BE.optional()}).optional()])).output(k(b())).describe(`Start transaction`),commit:O().input(a([b()])).output(k(g())).describe(`Commit transaction`),rollback:O().input(a([b()])).output(k(g())).describe(`Rollback transaction`),syncSchema:O().input(a([o(),b(),qO.optional()])).output(k(g())).describe(`Sync object schema to DB`),syncSchemasBatch:O().input(a([S(l({object:o(),schema:b()})),qO.optional()])).output(k(g())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:O().input(a([o(),qO.optional()])).output(k(g())),explain:O().input(a([o(),PD,qO.optional()])).output(k(b())).optional()}),XO=l({min:A().min(0).default(2).describe(`Minimum number of connections in pool`),max:A().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:A().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:A().min(0).default(5e3).describe(`Time in ms to wait for available connection`)}),ZO=l({name:o().describe(`Driver instance name`),type:x([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:JO.describe(`Driver capability flags`),connectionString:o().optional().describe(`Database connection string (driver-specific format)`),poolConfig:XO.optional().describe(`Connection pool configuration`)}),QO=x([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`]),$O=l({text:o().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:o().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:o().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:o().describe(`SQL type for date fields (e.g., DATE)`),datetime:o().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:o().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:o().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:o().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)}),ek=l({rejectUnauthorized:v().default(!0).describe(`Reject connections with invalid certificates`),ca:o().optional().describe(`CA certificate file path or content`),cert:o().optional().describe(`Client certificate file path or content`),key:o().optional().describe(`Client private key file path or content`)}).refine(e=>e.cert!==void 0==(e.key!==void 0),{message:`Client certificate (cert) and private key (key) must be provided together`}),tk=ZO.extend({type:p(`sql`).describe(`Driver type must be "sql"`),dialect:QO.describe(`SQL database dialect`),dataTypeMapping:$O.describe(`SQL data type mapping configuration`),ssl:v().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:ek.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}),nk={text:`TEXT`,number:`REAL`,boolean:`INTEGER`,date:`TEXT`,datetime:`TEXT`,json:`TEXT`,uuid:`TEXT`,binary:`BLOB`},rk={supportsAddColumn:!0,supportsRenameColumn:!0,supportsDropColumn:!0,supportsModifyColumn:!1,supportsAddConstraint:!1,rebuildStrategy:`create_copy_drop_rename`},ik=x([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]),ak=x([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]),ok=x([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`]),sk=x([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`]),ck=l({enabled:v().default(!1).describe(`Enable sharding`),shardKey:o().optional().describe(`Field to use as shard key`),shardingStrategy:x([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:A().int().positive().optional().describe(`Number of shards`)}),lk=l({enabled:v().default(!1).describe(`Enable replication`),replicaSetName:o().optional().describe(`Replica set name`),replicas:A().int().positive().optional().describe(`Number of replicas`),readPreference:x([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:x([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)}),uk=l({enabled:v().default(!1).describe(`Enable schema validation`),validationLevel:x([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:x([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:u(o(),b()).optional().describe(`JSON Schema for validation`)}),dk=l({text:o().describe(`NoSQL type for text fields`),number:o().describe(`NoSQL type for number fields`),boolean:o().describe(`NoSQL type for boolean fields`),date:o().describe(`NoSQL type for date fields`),datetime:o().describe(`NoSQL type for datetime fields`),json:o().optional().describe(`NoSQL type for JSON/object fields`),uuid:o().optional().describe(`NoSQL type for UUID fields`),binary:o().optional().describe(`NoSQL type for binary fields`),array:o().optional().describe(`NoSQL type for array fields`),objectId:o().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:o().optional().describe(`NoSQL type for geospatial point fields`)}),fk=ZO.extend({type:p(`nosql`).describe(`Driver type must be "nosql"`),databaseType:ik.describe(`Specific NoSQL database type`),dataTypeMapping:dk.describe(`NoSQL data type mapping configuration`),consistency:ok.optional().describe(`Consistency level for operations`),replication:lk.optional().describe(`Replication configuration`),sharding:ck.optional().describe(`Sharding configuration`),schemaValidation:uk.optional().describe(`Document schema validation`),region:o().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:o().optional().describe(`AWS access key ID`),secretAccessKey:o().optional().describe(`AWS secret access key`),ttlField:o().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:A().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:o().optional().describe(`Prefix for collection/table names`)}),pk=l({consistency:ok.optional().describe(`Consistency level override`),readFromSecondary:v().optional().describe(`Allow reading from secondary replicas`),projection:u(o(),c([p(0),p(1)])).optional().describe(`Field projection`),timeout:A().int().positive().optional().describe(`Query timeout (ms)`),useCursor:v().optional().describe(`Use cursor instead of loading all results`),batchSize:A().int().positive().optional().describe(`Cursor batch size`),profile:v().optional().describe(`Enable query profiling`),hint:o().optional().describe(`Index hint for query optimization`)}),mk=l({operator:o().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:u(o(),b()).describe(`Stage-specific options`)}),hk=l({collection:o().describe(`Collection/table name`),stages:S(mk).describe(`Aggregation pipeline stages`),options:pk.optional().describe(`Query options`)}),gk=l({name:o().describe(`Index name`),type:sk.describe(`Index type`),fields:S(l({field:o().describe(`Field name`),order:x([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:v().default(!1).describe(`Enforce uniqueness`),sparse:v().default(!1).describe(`Sparse index`),expireAfterSeconds:A().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:u(o(),b()).optional().describe(`Partial index filter`),background:v().default(!1).describe(`Create index in background`)}),_k=l({readConcern:x([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:x([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:x([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:A().int().positive().optional().describe(`Transaction commit timeout (ms)`)}),vk=x([`insert`,`update`,`upsert`,`replace`,`ignore`]),yk=l({object:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:o().default(`name`).describe(`Field match for uniqueness check`),mode:vk.default(`upsert`).describe(`Conflict resolution strategy`),env:S(x([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:S(u(o(),b())).describe(`Data records`)}),bk=l({field:o().describe(`Source field name containing the reference value`),targetObject:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:o().default(`name`).describe(`Field on target object used for matching`),fieldType:x([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`),xk=l({object:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:S(o()).describe(`Objects this object depends on`),references:S(bk).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`),Sk=l({nodes:S(xk).describe(`All objects in the dependency graph`),insertOrder:S(o()).describe(`Topologically sorted insert order`),circularDependencies:S(S(o())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`),Ck=l({sourceObject:o().describe(`Object with the broken reference`),field:o().describe(`Field name with unresolved reference`),targetObject:o().describe(`Target object searched for the reference`),targetField:o().describe(`ExternalId field used for matching`),attemptedValue:b().describe(`Value that failed to resolve`),recordIndex:A().int().min(0).describe(`Index of the record in the dataset`),message:o().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`),wk=l({dryRun:v().default(!1).describe(`Validate references without writing data`),haltOnError:v().default(!1).describe(`Stop on first reference resolution error`),multiPass:v().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:vk.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:A().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:v().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:x([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`)}).describe(`Seed data loader configuration`),Tk=l({object:o().describe(`Object that was loaded`),mode:vk.describe(`Import mode used`),inserted:A().int().min(0).describe(`Records inserted`),updated:A().int().min(0).describe(`Records updated`),skipped:A().int().min(0).describe(`Records skipped`),errored:A().int().min(0).describe(`Records with errors`),total:A().int().min(0).describe(`Total records in dataset`),referencesResolved:A().int().min(0).describe(`References resolved via externalId`),referencesDeferred:A().int().min(0).describe(`References deferred to second pass`),errors:S(Ck).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`),Ek=l({success:v().describe(`Overall success status`),dryRun:v().describe(`Whether this was a dry-run`),dependencyGraph:Sk.describe(`Object dependency graph`),results:S(Tk).describe(`Per-object load results`),errors:S(Ck).describe(`All reference resolution errors`),summary:l({objectsProcessed:A().int().min(0).describe(`Total objects processed`),totalRecords:A().int().min(0).describe(`Total records across all objects`),totalInserted:A().int().min(0).describe(`Total records inserted`),totalUpdated:A().int().min(0).describe(`Total records updated`),totalSkipped:A().int().min(0).describe(`Total records skipped`),totalErrored:A().int().min(0).describe(`Total records with errors`),totalReferencesResolved:A().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:A().int().min(0).describe(`Total references deferred`),circularDependencyCount:A().int().min(0).describe(`Circular dependency chains detected`),durationMs:A().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`),Dk=l({datasets:S(yk).min(1).describe(`Datasets to load`),config:i(e=>e??{},wk).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`),Ok=l({versionNumber:A().describe(`Version number`),createdAt:A().describe(`Creation timestamp`),createdBy:o().describe(`Creator user ID`),size:A().describe(`File size in bytes`),checksum:o().describe(`File checksum`),downloadUrl:o().url().describe(`Download URL`),isLatest:v().optional().default(!1).describe(`Is latest version`)}),kk=l({id:o().describe(`Template ID`),name:o().describe(`Template name`),description:o().optional().describe(`Template description`),fileUrl:o().url().describe(`Template file URL`),fileType:o().describe(`File MIME type`),placeholders:S(l({key:o().describe(`Placeholder key`),label:o().describe(`Placeholder label`),type:x([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:v().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)}),Ak=l({provider:x([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:v().optional().default(!1).describe(`E-signature enabled`),signers:S(l({email:o().email().describe(`Signer email`),name:o().describe(`Signer name`),role:o().describe(`Signer role`),order:A().describe(`Signing order`)})).describe(`Document signers`),expirationDays:A().optional().default(30).describe(`Expiration days`),reminderDays:A().optional().default(7).describe(`Reminder interval days`)}),jk=l({id:o().describe(`Document ID`),name:o().describe(`Document name`),description:o().optional().describe(`Document description`),fileType:o().describe(`File MIME type`),fileSize:A().describe(`File size in bytes`),category:o().optional().describe(`Document category`),tags:S(o()).optional().describe(`Document tags`),versioning:l({enabled:v().describe(`Versioning enabled`),versions:S(Ok).describe(`Version history`),majorVersion:A().describe(`Major version`),minorVersion:A().describe(`Minor version`)}).optional().describe(`Version control`),template:kk.optional().describe(`Document template`),eSignature:Ak.optional().describe(`E-signature config`),access:l({isPublic:v().optional().default(!1).describe(`Public access`),sharedWith:S(o()).optional().describe(`Shared with`),expiresAt:A().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:u(o(),b()).optional().describe(`Custom metadata`)}),Mk=l({id:o().describe(`Data source ID`),name:o().describe(`Data source name`),type:x([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:o().url().describe(`API endpoint URL`),authentication:l({type:x([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:u(o(),b()).describe(`Auth configuration`)}).describe(`Authentication`)}),Nk=jE.extend({type:o().optional().describe(`Field type`),readonly:v().optional().default(!0).describe(`Read-only field`)}),Pk=l({fieldName:o().describe(`Field name`),dataSource:Mk.describe(`External data source`),query:l({endpoint:o().describe(`Query endpoint path`),method:x([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:u(o(),b()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:S(Nk).describe(`Field mappings`),caching:l({enabled:v().optional().default(!0).describe(`Cache enabled`),ttl:A().optional().default(300).describe(`Cache TTL (seconds)`),strategy:x([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:l({enabled:v().optional().default(!0).describe(`Fallback enabled`),defaultValue:b().optional().describe(`Default fallback value`),showError:v().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:l({requestsPerSecond:A().describe(`Requests per second limit`),burstSize:A().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:l({maxRetries:A().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:A().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:A().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:A().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:S(A()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:l({request:l({headers:u(o(),o()).optional().describe(`Additional request headers`),queryParams:u(o(),o()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:l({dataPath:o().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:o().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:l({type:x([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:A().default(100).describe(`Items per page`),maxPages:A().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}),Fk=o().describe(`Underlying driver identifier`),Ik=l({id:o().describe(`Unique driver identifier (e.g. "postgres")`),label:o().describe(`Display label (e.g. "PostgreSQL")`),description:o().optional(),icon:o().optional(),configSchema:u(o(),b()).describe(`JSON Schema for connection configuration`),capabilities:j(()=>Lk).optional()}),Lk=l({transactions:v().default(!1),queryFilters:v().default(!1),queryAggregations:v().default(!1),querySorting:v().default(!1),queryPagination:v().default(!1),queryWindowFunctions:v().default(!1),querySubqueries:v().default(!1),joins:v().default(!1),fullTextSearch:v().default(!1),readOnly:v().default(!1),dynamicSchema:v().default(!1)}),Rk=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:o().optional().describe(`Display label`),driver:Fk.describe(`Underlying driver type`),config:u(o(),b()).describe(`Driver specific configuration`),pool:l({min:A().default(0).describe(`Minimum connections`),max:A().default(10).describe(`Maximum connections`),idleTimeoutMillis:A().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:A().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:S(u(o(),b())).optional().describe(`Read-only replica configurations`),capabilities:Lk.optional().describe(`Capability overrides`),healthCheck:l({enabled:v().default(!0).describe(`Enable health check endpoint`),intervalMs:A().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:A().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:l({enabled:v().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:v().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:o().optional().describe(`CA certificate (PEM format or path to file)`),cert:o().optional().describe(`Client certificate (PEM format or path to file)`),key:o().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:l({maxRetries:A().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:A().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:A().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:A().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:o().optional().describe(`Internal description`),active:v().default(!0).describe(`Is datasource enabled`)}),zk=x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),Bk=x([`string`,`number`,`boolean`,`time`,`geo`]),Vk=x([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),Hk=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:o().describe(`Human readable label`),description:o().optional(),type:zk,sql:o().describe(`SQL expression or field reference`),filters:S(l({sql:o()})).optional(),format:o().optional()}),Uk=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:o().describe(`Human readable label`),description:o().optional(),type:Bk,sql:o().describe(`SQL expression or column reference`),granularities:S(Vk).optional()}),Wk=l({name:o().describe(`Target cube name`),relationship:x([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:o().describe(`Join condition (ON clause)`)}),Gk=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:o().optional(),description:o().optional(),sql:o().describe(`Base SQL statement or Table Name`),measures:u(o(),Hk).describe(`Quantitative metrics`),dimensions:u(o(),Uk).describe(`Qualitative attributes`),joins:u(o(),Wk).optional(),refreshKey:l({every:o().optional(),sql:o().optional()}).optional(),public:v().default(!1)}),Kk=l({cube:o().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:S(o()).describe(`List of metrics to calculate`),dimensions:S(o()).optional().describe(`List of dimensions to group by`),filters:S(l({member:o().describe(`Dimension or Measure`),operator:x([`equals`,`notEquals`,`contains`,`notContains`,`gt`,`gte`,`lt`,`lte`,`set`,`notSet`,`inDateRange`]),values:S(o()).optional()})).optional(),timeDimensions:S(l({dimension:o(),granularity:Vk.optional(),dateRange:c([o(),S(o())]).optional()})).optional(),order:u(o(),x([`asc`,`desc`])).optional(),limit:A().optional(),offset:A().optional(),timezone:o().optional().default(`UTC`)}),qk=x([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Jk=l({type:x([`user`,`team`,`record`]).describe(`Mention target type`),id:o().describe(`Target ID`),name:o().describe(`Display name for rendering`),offset:A().int().min(0).describe(`Character offset in body text`),length:A().int().min(1).describe(`Length of mention token in body text`)}),Yk=l({field:o().describe(`Field machine name`),fieldLabel:o().optional().describe(`Field display label`),oldValue:b().optional().describe(`Previous value`),newValue:b().optional().describe(`New value`),oldDisplayValue:o().optional().describe(`Human-readable old value`),newDisplayValue:o().optional().describe(`Human-readable new value`)}),Xk=l({emoji:o().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:S(o()).describe(`Users who reacted`),count:A().int().min(1).describe(`Total reaction count`)}),Zk=l({type:x([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:o().describe(`Actor ID`),name:o().optional().describe(`Actor display name`),avatarUrl:o().url().optional().describe(`Actor avatar URL`),source:o().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),Qk=x([`public`,`internal`,`private`]),$k=l({id:o().describe(`Feed item ID`),type:qk.describe(`Activity type`),object:o().describe(`Object name (e.g., "account")`),recordId:o().describe(`Record ID this feed item belongs to`),actor:Zk.describe(`Who performed this action`),body:o().optional().describe(`Rich text body (Markdown supported)`),mentions:S(Jk).optional().describe(`Mentioned users/teams/records`),changes:S(Yk).optional().describe(`Field-level changes`),reactions:S(Xk).optional().describe(`Emoji reactions on this item`),parentId:o().optional().describe(`Parent feed item ID for threaded replies`),replyCount:A().int().min(0).default(0).describe(`Number of replies`),pinned:v().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:o().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:o().optional().describe(`User ID who pinned the item`),starred:v().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:o().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Qk.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:o().datetime().describe(`Creation timestamp`),updatedAt:o().datetime().optional().describe(`Last update timestamp`),editedAt:o().datetime().optional().describe(`When comment was last edited`),isEdited:v().default(!1).describe(`Whether comment has been edited`)}),eA=x([`all`,`comments_only`,`changes_only`,`tasks_only`]),tA=x([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),nA=x([`in_app`,`email`,`push`,`slack`]),rA=l({object:o().describe(`Object name`),recordId:o().describe(`Record ID`),userId:o().describe(`Subscribing user ID`),events:S(tA).default([`all`]).describe(`Event types to receive notifications for`),channels:S(nA).default([`in_app`]).describe(`Notification delivery channels`),active:v().default(!0).describe(`Whether the subscription is active`),createdAt:o().datetime().describe(`Subscription creation timestamp`)}),iA=x([`header`,`subdomain`,`path`,`token`,`lookup`]).describe(`Strategy for resolving tenant identity from request context`),aA=l({name:o().min(1).describe(`Turso database group name`),primaryLocation:o().min(2).describe(`Primary Turso region code (e.g., iad, lhr, nrt)`),replicaLocations:S(o().min(2)).default([]).describe(`Additional replica region codes`),schemaDatabase:o().optional().describe(`Schema database name for multi-db schemas`)}).describe(`Turso database group configuration`),oA=l({onTenantCreate:l({autoCreate:v().default(!0).describe(`Auto-create database on tenant registration`),group:o().optional().describe(`Turso group for the new database`),applyGroupSchema:v().default(!0).describe(`Apply shared schema from group`),seedData:v().default(!1).describe(`Populate seed data on creation`)}).describe(`Tenant creation hook`),onTenantDelete:l({immediate:v().default(!1).describe(`Destroy database immediately`),gracePeriodHours:A().int().min(0).default(72).describe(`Grace period before permanent deletion`),createBackup:v().default(!0).describe(`Create backup before deletion`)}).describe(`Tenant deletion hook`),onTenantSuspend:l({revokeTokens:v().default(!0).describe(`Revoke auth tokens on suspension`),readOnly:v().default(!0).describe(`Set database to read-only on suspension`)}).describe(`Tenant suspension hook`)}).describe(`Tenant database lifecycle hooks`),sA=l({organizationSlug:o().min(1).describe(`Turso organization slug`),urlTemplate:o().min(1).describe(`URL template with {tenant_id} placeholder`),groupAuthToken:o().min(1).describe(`Group-level auth token for platform operations`),tenantResolverStrategy:iA.default(`token`),group:aA.optional().describe(`Database group configuration`),lifecycle:oA.optional().describe(`Lifecycle hooks`),maxCachedConnections:A().int().min(1).default(100).describe(`Max cached tenant connections (LRU)`),connectionCacheTTL:A().int().min(0).default(300).describe(`Connection cache TTL in seconds`)}).describe(`Turso multi-tenant router configuration`);EE({},{AuditPolicySchema:()=>jA,CriteriaSharingRuleSchema:()=>wA,FieldPermissionSchema:()=>_A,NetworkPolicySchema:()=>kA,OWDModel:()=>yA,ObjectPermissionSchema:()=>gA,OwnerSharingRuleSchema:()=>TA,PasswordPolicySchema:()=>OA,PermissionSetSchema:()=>vA,PolicySchema:()=>MA,RLS:()=>hA,RLSAuditConfigSchema:()=>dA,RLSAuditEventSchema:()=>uA,RLSConfigSchema:()=>fA,RLSEvaluationResultSchema:()=>mA,RLSOperation:()=>cA,RLSUserContextSchema:()=>pA,RowLevelSecurityPolicySchema:()=>lA,SessionPolicySchema:()=>AA,ShareRecipientType:()=>SA,SharingLevel:()=>xA,SharingRuleSchema:()=>EA,SharingRuleType:()=>bA,TerritoryModelSchema:()=>Kse,TerritorySchema:()=>qse,TerritoryType:()=>DA});var cA=x([`select`,`insert`,`update`,`delete`,`all`]),lA=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy unique identifier (snake_case)`),label:o().optional().describe(`Human-readable policy label`),description:o().optional().describe(`Policy description and business justification`),object:o().describe(`Target object name`),operation:cA.describe(`Database operation this policy applies to`),using:o().optional().describe(`Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.`),check:o().optional().describe(`Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)`),roles:S(o()).optional().describe(`Roles this policy applies to (omit for all roles)`),enabled:v().default(!0).describe(`Whether this policy is active`),priority:A().int().default(0).describe(`Policy evaluation priority (higher = evaluated first)`),tags:S(o()).optional().describe(`Policy categorization tags`)}).superRefine((e,t)=>{!e.using&&!e.check&&t.addIssue({code:le.custom,message:`At least one of "using" or "check" must be specified. For SELECT/UPDATE/DELETE operations, provide "using". For INSERT operations, provide "check".`})}),uA=l({timestamp:o().describe(`ISO 8601 timestamp of the evaluation`),userId:o().describe(`User ID whose access was evaluated`),operation:x([`select`,`insert`,`update`,`delete`]).describe(`Database operation being performed`),object:o().describe(`Target object name`),policyName:o().describe(`Name of the RLS policy evaluated`),granted:v().describe(`Whether access was granted`),evaluationDurationMs:A().describe(`Policy evaluation duration in milliseconds`),matchedCondition:o().optional().describe(`Which USING/CHECK clause matched`),rowCount:A().optional().describe(`Number of rows affected`),metadata:u(o(),b()).optional().describe(`Additional audit event metadata`)}),dA=l({enabled:v().describe(`Enable RLS audit logging`),logLevel:x([`all`,`denied_only`,`granted_only`,`none`]).describe(`Which evaluations to log`),destination:x([`system_log`,`audit_trail`,`external`]).describe(`Audit log destination`),sampleRate:A().min(0).max(1).describe(`Sampling rate (0-1) for high-traffic environments`),retentionDays:A().int().default(90).describe(`Audit log retention period in days`),includeRowData:v().default(!1).describe(`Include row data in audit logs (security-sensitive)`),alertOnDenied:v().default(!0).describe(`Send alerts when access is denied`)}),fA=l({enabled:v().default(!0).describe(`Enable RLS enforcement globally`),defaultPolicy:x([`deny`,`allow`]).default(`deny`).describe(`Default action when no policies match`),allowSuperuserBypass:v().default(!0).describe(`Allow superusers to bypass RLS`),bypassRoles:S(o()).optional().describe(`Roles that bypass RLS (see all data)`),logEvaluations:v().default(!1).describe(`Log RLS policy evaluations for debugging`),cacheResults:v().default(!0).describe(`Cache RLS evaluation results`),cacheTtlSeconds:A().int().positive().default(300).describe(`Cache TTL in seconds`),prefetchUserContext:v().default(!0).describe(`Pre-fetch user context for performance`),audit:dA.optional().describe(`RLS audit logging configuration`)}),pA=l({id:o().describe(`User ID`),email:o().email().optional().describe(`User email`),tenantId:o().optional().describe(`Tenant/Organization ID`),role:c([o(),S(o())]).optional().describe(`User role(s)`),department:o().optional().describe(`User department`),attributes:u(o(),b()).optional().describe(`Additional custom user attributes`)}),mA=l({policyName:o().describe(`Policy name`),granted:v().describe(`Whether access was granted`),durationMs:A().optional().describe(`Evaluation duration in milliseconds`),error:o().optional().describe(`Error message if evaluation failed`),usingResult:v().optional().describe(`USING clause evaluation result`),checkResult:v().optional().describe(`CHECK clause evaluation result`)}),hA={ownerPolicy:(e,t=`owner_id`)=>({name:`${e}_owner_access`,label:`Owner Access for ${e}`,object:e,operation:`all`,using:`${t} = current_user.id`,enabled:!0,priority:0}),tenantPolicy:(e,t=`tenant_id`)=>({name:`${e}_tenant_isolation`,label:`Tenant Isolation for ${e}`,object:e,operation:`all`,using:`${t} = current_user.tenant_id`,check:`${t} = current_user.tenant_id`,enabled:!0,priority:0}),rolePolicy:(e,t,n)=>({name:`${e}_${t.join(`_`)}_access`,label:`${t.join(`, `)} Access for ${e}`,object:e,operation:`select`,using:n,roles:t,enabled:!0,priority:0}),allowAllPolicy:(e,t)=>({name:`${e}_${t.join(`_`)}_full_access`,label:`Full Access for ${t.join(`, `)}`,object:e,operation:`all`,using:`1 = 1`,roles:t,enabled:!0,priority:0})},gA=l({allowCreate:v().default(!1).describe(`Create permission`),allowRead:v().default(!1).describe(`Read permission`),allowEdit:v().default(!1).describe(`Edit permission`),allowDelete:v().default(!1).describe(`Delete permission`),allowTransfer:v().default(!1).describe(`Change record ownership`),allowRestore:v().default(!1).describe(`Restore from trash (Undelete)`),allowPurge:v().default(!1).describe(`Permanently delete (Hard Delete/GDPR)`),viewAllRecords:v().default(!1).describe(`View All Data (Bypass Sharing)`),modifyAllRecords:v().default(!1).describe(`Modify All Data (Bypass Sharing)`)}),_A=l({readable:v().default(!0).describe(`Field read access`),editable:v().default(!1).describe(`Field edit access`)}),vA=l({name:OE.describe(`Permission set unique name (lowercase snake_case)`),label:o().optional().describe(`Display label`),isProfile:v().default(!1).describe(`Whether this is a user profile`),objects:u(o(),gA).describe(`Entity permissions`),fields:u(o(),_A).optional().describe(`Field level security`),systemPermissions:S(o()).optional().describe(`System level capabilities`),tabPermissions:u(o(),x([`visible`,`hidden`,`default_on`,`default_off`])).optional().describe(`App/tab visibility: visible, hidden, default_on (shown by default), default_off (available but hidden initially)`),rowLevelSecurity:S(lA).optional().describe(`Row-level security policies (see rls.zod.ts for full spec)`),contextVariables:u(o(),b()).optional().describe(`Context variables for RLS evaluation`)}),yA=x([`private`,`public_read`,`public_read_write`,`controlled_by_parent`]),bA=x([`owner`,`criteria`]),xA=x([`read`,`edit`,`full`]),SA=x([`user`,`group`,`role`,`role_and_subordinates`,`guest`]),CA=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:o().optional().describe(`Human-readable label`),description:o().optional().describe(`Administrative notes`),object:o().describe(`Target Object Name`),active:v().default(!0),accessLevel:xA.default(`read`),sharedWith:l({type:SA,value:o().describe(`ID or Code of the User/Group/Role`)}).describe(`The recipient of the shared access`)}),wA=CA.extend({type:p(`criteria`),condition:o().describe(`Formula condition (e.g. "department = 'Sales'")`)}),TA=CA.extend({type:p(`owner`),ownedBy:l({type:SA,value:o()}).describe(`Source group/role whose records are being shared`)}),EA=d(`type`,[wA,TA]),DA=x([`geography`,`industry`,`named_account`,`product_line`]),Kse=l({name:o().describe(`Model Name (e.g. FY24 Planning)`),state:x([`planning`,`active`,`archived`]).default(`planning`),startDate:o().optional(),endDate:o().optional()}),qse=l({name:OE.describe(`Territory unique name (lowercase snake_case)`),label:o().describe(`Territory Label (e.g. "West Coast")`),modelId:o().describe(`Belongs to which Territory Model`),parent:o().optional().describe(`Parent Territory`),type:DA.default(`geography`),assignmentRule:o().optional().describe(`Criteria based assignment rule`),assignedUsers:S(o()).optional(),accountAccess:x([`read`,`edit`]).default(`read`),opportunityAccess:x([`read`,`edit`]).default(`read`),caseAccess:x([`read`,`edit`]).default(`read`)}),OA=l({minLength:A().default(8),requireUppercase:v().default(!0),requireLowercase:v().default(!0),requireNumbers:v().default(!0),requireSymbols:v().default(!1),expirationDays:A().optional().describe(`Force password change every X days`),historyCount:A().default(3).describe(`Prevent reusing last X passwords`)}),kA=l({trustedRanges:S(o()).describe(`CIDR ranges allowed to access (e.g. 10.0.0.0/8)`),blockUnknown:v().default(!1).describe(`Block all IPs not in trusted ranges`),vpnRequired:v().default(!1)}),AA=l({idleTimeout:A().default(30).describe(`Minutes before idle session logout`),absoluteTimeout:A().default(480).describe(`Max session duration (minutes)`),forceMfa:v().default(!1).describe(`Require 2FA for all users`)}),jA=l({logRetentionDays:A().default(180),sensitiveFields:S(o()).describe(`Fields to redact in logs (e.g. password, ssn)`),captureRead:v().default(!1).describe(`Log read access (High volume!)`)}),MA=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy Name`),password:OA.optional(),network:kA.optional(),session:AA.optional(),audit:jA.optional(),isDefault:v().default(!1).describe(`Apply to all users by default`),assignedProfiles:S(o()).optional().describe(`Apply to specific profiles`)});EE({},{AIChatWindowProps:()=>vM,Action:()=>zse,ActionNavItemSchema:()=>QA,ActionParamSchema:()=>tO,ActionSchema:()=>rO,ActionType:()=>nO,AddRecordConfigSchema:()=>xj,AnimationSchema:()=>HM,AnimationTriggerSchema:()=>rN,App:()=>Jse,AppBrandingSchema:()=>tj,AppSchema:()=>rj,AppearanceConfigSchema:()=>yj,AriaPropsSchema:()=>QD,BlankPageLayoutItemSchema:()=>Zj,BlankPageLayoutSchema:()=>Qj,BorderRadiusSchema:()=>zM,BreakpointColumnMapSchema:()=>BA,BreakpointName:()=>zA,BreakpointOrderMapSchema:()=>VA,BreakpointsSchema:()=>VM,CalendarConfigSchema:()=>Cj,ChartAnnotationSchema:()=>IA,ChartAxisSchema:()=>PA,ChartConfigSchema:()=>RA,ChartInteractionSchema:()=>LA,ChartSeriesSchema:()=>FA,ChartTypeSchema:()=>NA,ColorPaletteSchema:()=>IM,ColumnSummarySchema:()=>oj,ComponentAnimationSchema:()=>iN,ComponentPropsMap:()=>tce,ConflictResolutionSchema:()=>YM,Dashboard:()=>Zse,DashboardHeaderActionSchema:()=>Pj,DashboardHeaderSchema:()=>Fj,DashboardNavItemSchema:()=>JA,DashboardSchema:()=>Bj,DashboardWidgetSchema:()=>Lj,DateFormatSchema:()=>eO,DensityMode:()=>ace,DensityModeSchema:()=>GM,DndConfigSchema:()=>dce,DragConstraintSchema:()=>fN,DragHandleSchema:()=>uN,DragItemSchema:()=>mN,DropEffectSchema:()=>dN,DropZoneSchema:()=>pN,EasingFunctionSchema:()=>tN,ElementButtonPropsSchema:()=>SM,ElementDataSourceSchema:()=>Jj,ElementFilterPropsSchema:()=>CM,ElementFormPropsSchema:()=>wM,ElementImagePropsSchema:()=>xM,ElementNumberPropsSchema:()=>bM,ElementRecordPickerPropsSchema:()=>TM,ElementTextPropsSchema:()=>yM,EmbedConfigSchema:()=>GA,EvictionPolicySchema:()=>QM,FieldWidgetPropsSchema:()=>ece,FocusManagementSchema:()=>FM,FocusTrapConfigSchema:()=>NM,FormFieldSchema:()=>Oj,FormSectionSchema:()=>kj,FormViewSchema:()=>Aj,GalleryConfigSchema:()=>pj,GanttConfigSchema:()=>wj,GestureConfigSchema:()=>MM,GestureTypeSchema:()=>DM,GlobalFilterOptionsFromSchema:()=>Rj,GlobalFilterSchema:()=>zj,GroupNavItemSchema:()=>$A,GroupingConfigSchema:()=>fj,GroupingFieldSchema:()=>dj,HttpMethodSchema:()=>NE,HttpRequestSchema:()=>PE,I18nLabelSchema:()=>G,I18nObjectSchema:()=>ZD,InterfacePageConfigSchema:()=>tM,KanbanConfigSchema:()=>Sj,KeyboardNavigationConfigSchema:()=>rce,KeyboardShortcutSchema:()=>PM,ListColumnSchema:()=>sj,ListViewSchema:()=>Dj,LocaleConfigSchema:()=>Lse,LongPressGestureConfigSchema:()=>jM,MotionConfigSchema:()=>cce,NavigationAreaSchema:()=>nj,NavigationConfigSchema:()=>Ej,NavigationItemSchema:()=>ej,NavigationModeSchema:()=>Tj,NotificationActionSchema:()=>lN,NotificationConfigSchema:()=>uce,NotificationPositionSchema:()=>cN,NotificationSchema:()=>lce,NotificationSeveritySchema:()=>sN,NotificationTypeSchema:()=>oN,NumberFormatSchema:()=>$D,ObjectNavItemSchema:()=>qA,OfflineCacheConfigSchema:()=>$M,OfflineConfigSchema:()=>sce,OfflineStrategySchema:()=>JM,PageAccordionProps:()=>_M,PageCardProps:()=>uM,PageComponentSchema:()=>Yj,PageComponentType:()=>qj,PageHeaderProps:()=>cM,PageNavItemSchema:()=>YA,PageRegionSchema:()=>Kj,PageSchema:()=>nM,PageTabsProps:()=>lM,PageTransitionSchema:()=>aN,PageTypeSchema:()=>$j,PageVariableSchema:()=>Xj,PaginationConfigSchema:()=>lj,PerformanceConfigSchema:()=>UA,PersistStorageSchema:()=>ZM,PinchGestureConfigSchema:()=>AM,PluralRuleSchema:()=>Ise,RecordActivityProps:()=>mM,RecordChatterProps:()=>hM,RecordDetailsProps:()=>dM,RecordHighlightsProps:()=>pM,RecordPathProps:()=>gM,RecordRelatedListProps:()=>fM,RecordReviewConfigSchema:()=>eM,Report:()=>Qse,ReportChartSchema:()=>Wj,ReportColumnSchema:()=>Hj,ReportGroupingSchema:()=>Uj,ReportNavItemSchema:()=>ZA,ReportSchema:()=>Gj,ReportType:()=>Vj,ResponsiveConfigSchema:()=>HA,RowColorConfigSchema:()=>gj,RowHeightSchema:()=>uj,SelectionConfigSchema:()=>cj,ShadowSchema:()=>BM,SharingConfigSchema:()=>WA,SpacingSchema:()=>RM,SwipeDirectionSchema:()=>OM,SwipeGestureConfigSchema:()=>kM,SyncConfigSchema:()=>XM,ThemeMode:()=>ice,ThemeModeSchema:()=>WM,ThemeSchema:()=>qM,TimelineConfigSchema:()=>mj,TouchInteractionSchema:()=>nce,TouchTargetConfigSchema:()=>EM,TransitionConfigSchema:()=>nN,TransitionPresetSchema:()=>eN,TypographySchema:()=>LM,UrlNavItemSchema:()=>XA,UserActionsConfigSchema:()=>vj,ViewDataSchema:()=>ij,ViewFilterRuleSchema:()=>aj,ViewSchema:()=>jj,ViewSharingSchema:()=>hj,ViewTabSchema:()=>bj,VisualizationTypeSchema:()=>_j,WcagContrastLevel:()=>oce,WcagContrastLevelSchema:()=>KM,WidgetActionTypeSchema:()=>Nj,WidgetColorVariantSchema:()=>Mj,WidgetEventSchema:()=>iM,WidgetLifecycleSchema:()=>rM,WidgetManifestSchema:()=>$se,WidgetMeasureSchema:()=>Ij,WidgetPropertySchema:()=>aM,WidgetSourceSchema:()=>oM,ZIndexSchema:()=>UM,defineApp:()=>Yse,defineView:()=>Xse});var NA=x(`bar.horizontal-bar.column.grouped-bar.stacked-bar.bi-polar-bar.line.area.stacked-area.step-line.spline.pie.donut.funnel.pyramid.scatter.bubble.treemap.sunburst.sankey.word-cloud.gauge.solid-gauge.metric.kpi.bullet.choropleth.bubble-map.gl-map.heatmap.radar.waterfall.box-plot.violin.candlestick.stock.table.pivot`.split(`.`)),PA=l({field:o().describe(`Data field key`),title:G.optional().describe(`Axis display title`),format:o().optional().describe(`Value format string (e.g., "$0,0.00")`),min:A().optional().describe(`Minimum value`),max:A().optional().describe(`Maximum value`),stepSize:A().optional().describe(`Step size for ticks`),showGridLines:v().default(!0),position:x([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:v().default(!1)}),FA=l({name:o().describe(`Field name or series identifier`),label:G.optional().describe(`Series display label`),type:NA.optional().describe(`Override chart type for this series`),color:o().optional().describe(`Series color (hex/rgb/token)`),stack:o().optional().describe(`Stack identifier to group series`),yAxis:x([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`)}),IA=l({type:x([`line`,`region`]).default(`line`),axis:x([`x`,`y`]).default(`y`),value:c([A(),o()]).describe(`Start value`),endValue:c([A(),o()]).optional().describe(`End value for regions`),color:o().optional(),label:G.optional(),style:x([`solid`,`dashed`,`dotted`]).default(`dashed`)}),LA=l({tooltips:v().default(!0),zoom:v().default(!1),brush:v().default(!1),clickAction:o().optional().describe(`Action ID to trigger on click`)}),RA=l({type:NA,title:G.optional().describe(`Chart title`),subtitle:G.optional().describe(`Chart subtitle`),description:G.optional().describe(`Accessibility description`),xAxis:PA.optional().describe(`X-Axis configuration`),yAxis:S(PA).optional().describe(`Y-Axis configuration (support dual axis)`),series:S(FA).optional().describe(`Defined series configuration`),colors:S(o()).optional().describe(`Color palette`),height:A().optional().describe(`Fixed height in pixels`),showLegend:v().default(!0).describe(`Display legend`),showDataLabels:v().default(!1).describe(`Display data labels`),annotations:S(IA).optional(),interaction:LA.optional(),aria:QD.optional().describe(`ARIA accessibility attributes`)}),zA=x([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),BA=l({xs:A().min(1).max(12).optional(),sm:A().min(1).max(12).optional(),md:A().min(1).max(12).optional(),lg:A().min(1).max(12).optional(),xl:A().min(1).max(12).optional(),"2xl":A().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),VA=l({xs:A().optional(),sm:A().optional(),md:A().optional(),lg:A().optional(),xl:A().optional(),"2xl":A().optional()}).describe(`Display order per breakpoint`),HA=l({breakpoint:zA.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:S(zA).optional().describe(`Hide on these breakpoints`),columns:BA.optional().describe(`Grid columns per breakpoint`),order:VA.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),UA=l({lazyLoad:v().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:l({enabled:v().default(!1).describe(`Enable virtual scrolling`),itemHeight:A().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:A().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:x([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:v().optional().describe(`Prefetch data before component is visible`),pageSize:A().optional().describe(`Number of items per page for pagination`),debounceMs:A().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),WA=l({enabled:v().default(!1).describe(`Enable public sharing`),publicLink:o().optional().describe(`Generated public share URL`),password:o().optional().describe(`Password required to access shared link`),allowedDomains:S(o()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:o().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:v().optional().default(!1).describe(`Allow access without authentication`)}),GA=l({enabled:v().default(!1).describe(`Enable iframe embedding`),allowedOrigins:S(o()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:o().optional().default(`100%`).describe(`Embed width (CSS value)`),height:o().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:v().optional().default(!0).describe(`Show interface header in embed`),showNavigation:v().optional().default(!1).describe(`Show navigation in embed`),responsive:v().optional().default(!0).describe(`Enable responsive resizing`)}),KA=l({id:OE.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:G.describe(`Display proper label`),icon:o().optional().describe(`Icon name`),order:A().optional().describe(`Sort order within the same level (lower = first)`),badge:c([o(),A()]).optional().describe(`Badge text or count displayed on the item`),visible:o().optional().describe(`Visibility formula condition`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this item`)}),qA=KA.extend({type:p(`object`),objectName:o().describe(`Target object name`),viewName:o().optional().describe(`Default list view to open. Defaults to "all"`)}),JA=KA.extend({type:p(`dashboard`),dashboardName:o().describe(`Target dashboard name`)}),YA=KA.extend({type:p(`page`),pageName:o().describe(`Target custom page component name`),params:u(o(),b()).optional().describe(`Parameters passed to the page context`)}),XA=KA.extend({type:p(`url`),url:o().describe(`Target external URL`),target:x([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),ZA=KA.extend({type:p(`report`),reportName:o().describe(`Target report name`)}),QA=KA.extend({type:p(`action`),actionDef:l({actionName:o().describe(`Action machine name to execute`),params:u(o(),b()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),$A=KA.extend({type:p(`group`),expanded:v().default(!1).describe(`Default expansion state in sidebar`)}),ej=j(()=>c([qA.extend({children:S(ej).optional().describe(`Child navigation items (e.g. specific views)`)}),JA,YA,XA,ZA,QA,$A.extend({children:S(ej).describe(`Child navigation items`)})])),tj=l({primaryColor:o().optional().describe(`Primary theme color hex code`),logo:o().optional().describe(`Custom logo URL for this app`),favicon:o().optional().describe(`Custom favicon URL for this app`)}),nj=l({id:OE.describe(`Unique area identifier (lowercase snake_case)`),label:G.describe(`Area display label`),icon:o().optional().describe(`Area icon name`),order:A().optional().describe(`Sort order among areas (lower = first)`),description:G.optional().describe(`Area description`),visible:o().optional().describe(`Visibility formula condition for this area`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this area`),navigation:S(ej).describe(`Navigation items within this area`)}),rj=l({name:OE.describe(`App unique machine name (lowercase snake_case)`),label:G.describe(`App display label`),version:o().optional().describe(`App version`),description:G.optional().describe(`App description`),icon:o().optional().describe(`App icon used in the App Launcher`),branding:tj.optional().describe(`App-specific branding`),active:v().optional().default(!0).describe(`Whether the app is enabled`),isDefault:v().optional().default(!1).describe(`Is default app`),navigation:S(ej).optional().describe(`Full navigation tree for the app sidebar`),areas:S(nj).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:o().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this app`),objects:S(b()).optional().describe(`Objects belonging to this app`),apis:S(b()).optional().describe(`Custom APIs belonging to this app`),sharing:WA.optional().describe(`Public sharing configuration`),embed:GA.optional().describe(`Iframe embedding configuration`),mobileNavigation:l({mode:x([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:S(o()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:QD.optional().describe(`ARIA accessibility attributes for the application`)}),Jse={create:e=>rj.parse(e)};function Yse(e){return rj.parse(e)}var ij=d(`provider`,[l({provider:p(`object`),object:o().describe(`Target object name`)}),l({provider:p(`api`),read:PE.optional().describe(`Configuration for fetching data`),write:PE.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),l({provider:p(`value`),items:S(b()).describe(`Static data array`)})]),aj=l({field:o().describe(`Field name to filter on`),operator:o().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:c([o(),A(),v(),h(),S(c([o(),A()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),oj=x([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),sj=l({field:o().describe(`Field name (snake_case)`),label:G.optional().describe(`Display label override`),width:A().positive().optional().describe(`Column width in pixels`),align:x([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:v().optional().describe(`Hide column by default`),sortable:v().optional().describe(`Allow sorting by this column`),resizable:v().optional().describe(`Allow resizing this column`),wrap:v().optional().describe(`Allow text wrapping`),type:o().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:x([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:oj.optional().describe(`Footer aggregation function for this column`),link:v().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:o().optional().describe(`Registered Action ID to execute when clicked`)}),cj=l({type:x([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),lj=l({pageSize:A().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:S(A().int().positive()).optional().describe(`Available page size options`)}),uj=x([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),dj=l({field:o().describe(`Field name to group by`),order:x([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:v().default(!1).describe(`Collapse groups by default`)}),fj=l({fields:S(dj).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),pj=l({coverField:o().optional().describe(`Attachment/image field to display as card cover`),coverFit:x([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:x([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:o().optional().describe(`Field to display as card title`),visibleFields:S(o()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),mj=l({startDateField:o().describe(`Field for timeline item start date`),endDateField:o().optional().describe(`Field for timeline item end date`),titleField:o().describe(`Field to display as timeline item title`),groupByField:o().optional().describe(`Field to group timeline rows`),colorField:o().optional().describe(`Field to determine item color`),scale:x([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),hj=l({type:x([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:o().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),gj=l({field:o().describe(`Field to derive color from (typically a select/status field)`),colors:u(o(),o()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),_j=x([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),vj=l({sort:v().default(!0).describe(`Allow users to sort records`),search:v().default(!0).describe(`Allow users to search records`),filter:v().default(!0).describe(`Allow users to filter records`),rowHeight:v().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:v().default(!1).describe(`Add records through a form instead of inline`),buttons:S(o()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),yj=l({showDescription:v().default(!0).describe(`Show the view description text`),allowedVisualizations:S(_j).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),bj=l({name:OE.describe(`Tab identifier (snake_case)`),label:G.optional().describe(`Display label`),icon:o().optional().describe(`Tab icon name`),view:o().optional().describe(`Referenced list view name from listViews`),filter:S(aj).optional().describe(`Tab-specific filter criteria`),order:A().int().min(0).optional().describe(`Tab display order`),pinned:v().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:v().default(!1).describe(`Set as the default active tab`),visible:v().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),xj=l({enabled:v().default(!0).describe(`Show the add record entry point`),position:x([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:x([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:o().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),Sj=l({groupByField:o().describe(`Field to group columns by (usually status/select)`),summarizeField:o().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:S(o()).describe(`Fields to show on cards`)}),Cj=l({startDateField:o(),endDateField:o().optional(),titleField:o(),colorField:o().optional()}),wj=l({startDateField:o(),endDateField:o(),titleField:o(),progressField:o().optional(),dependenciesField:o().optional()}),Tj=x([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]),Ej=l({mode:Tj.default(`page`),view:o().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:v().default(!1).describe(`Disable standard navigation entirely`),openNewTab:v().default(!1).describe(`Force open in new tab (applies to page mode)`),width:c([o(),A()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),Dj=l({name:OE.optional().describe(`Internal view name (lowercase snake_case)`),label:G.optional(),type:x([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:ij.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:c([S(o()),S(sj)]).describe(`Fields to display as columns`),filter:S(aj).optional().describe(`Filter criteria (JSON Rules)`),sort:c([o(),S(l({field:o(),order:x([`asc`,`desc`])}))]).optional(),searchableFields:S(o()).optional().describe(`Fields enabled for search`),filterableFields:S(o()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:S(l({field:o().describe(`Field name to filter by`),label:o().optional().describe(`Display label for the chip`),operator:x([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:c([o(),A(),v(),h(),S(c([o(),A()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:v().optional().describe(`Enable column resizing`),striped:v().optional().describe(`Striped row styling`),bordered:v().optional().describe(`Show borders`),selection:cj.optional().describe(`Row selection configuration`),navigation:Ej.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:lj.optional().describe(`Pagination configuration`),kanban:Sj.optional(),calendar:Cj.optional(),gantt:wj.optional(),gallery:pj.optional(),timeline:mj.optional(),description:G.optional().describe(`View description for documentation/tooltips`),sharing:hj.optional().describe(`View sharing and access configuration`),rowHeight:uj.optional().describe(`Row height / density setting`),grouping:fj.optional().describe(`Group records by one or more fields`),rowColor:gj.optional().describe(`Color rows based on field value`),hiddenFields:S(o()).optional().describe(`Fields to hide in this specific view`),fieldOrder:S(o()).optional().describe(`Explicit field display order for this view`),rowActions:S(o()).optional().describe(`Actions available for individual row items`),bulkActions:S(o()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:v().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:S(l({condition:o().describe(`Condition expression to evaluate`),style:u(o(),o()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:v().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:S(x([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:vj.optional().describe(`User action toggles for the view toolbar`),appearance:yj.optional().describe(`Appearance and visualization configuration`),tabs:S(bj).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:xj.optional().describe(`Add record entry point configuration`),showRecordCount:v().optional().describe(`Show record count at the bottom of the list`),allowPrinting:v().optional().describe(`Allow users to print the view`),emptyState:l({title:G.optional(),message:G.optional(),icon:o().optional()}).optional().describe(`Empty state configuration when no records found`),aria:QD.optional().describe(`ARIA accessibility attributes for the list view`),responsive:HA.optional().describe(`Responsive layout configuration`),performance:UA.optional().describe(`Performance optimization settings`)}),Oj=l({field:o().describe(`Field name (snake_case)`),label:G.optional().describe(`Display label override`),placeholder:G.optional().describe(`Placeholder text`),helpText:G.optional().describe(`Help/hint text`),readonly:v().optional().describe(`Read-only override`),required:v().optional().describe(`Required override`),hidden:v().optional().describe(`Hidden override`),colSpan:A().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:o().optional().describe(`Custom widget/component name`),dependsOn:o().optional().describe(`Parent field name for cascading`),visibleOn:o().optional().describe(`Visibility condition expression`)}),kj=l({label:G.optional(),collapsible:v().default(!1),collapsed:v().default(!1),columns:x([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:S(c([o(),Oj]))}),Aj=l({type:x([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:ij.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:S(kj).optional(),groups:S(kj).optional(),defaultSort:S(l({field:o().describe(`Field name to sort by`),order:x([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:WA.optional().describe(`Public sharing configuration for this form`),aria:QD.optional().describe(`ARIA accessibility attributes for the form view`)}),jj=l({list:Dj.optional(),form:Aj.optional(),listViews:u(o(),Dj).optional().describe(`Additional named list views`),formViews:u(o(),Aj).optional().describe(`Additional named form views`)});function Xse(e){return jj.parse(e)}var Mj=x([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`),Nj=x([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`),Pj=l({label:G.describe(`Action button label`),actionUrl:o().describe(`URL or target for the action`),actionType:Nj.optional().describe(`Type of action`),icon:o().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`),Fj=l({showTitle:v().default(!0).describe(`Show dashboard title in header`),showDescription:v().default(!0).describe(`Show dashboard description in header`),actions:S(Pj).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`),Ij=l({valueField:o().describe(`Field to aggregate`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:G.optional().describe(`Measure display label`),format:o().optional().describe(`Number format string`)}).describe(`Widget measure definition`),Lj=l({id:OE.describe(`Unique widget identifier (snake_case)`),title:G.optional().describe(`Widget title`),description:G.optional().describe(`Widget description text below the header`),type:NA.default(`metric`).describe(`Visualization type`),chartConfig:RA.optional().describe(`Chart visualization configuration`),colorVariant:Mj.optional().describe(`Widget color variant for theming`),actionUrl:o().optional().describe(`URL or target for the widget action button`),actionType:Nj.optional().describe(`Type of action for the widget action button`),actionIcon:o().optional().describe(`Icon identifier for the widget action button`),object:o().optional().describe(`Data source object name`),filter:gD.optional().describe(`Data filter criteria`),categoryField:o().optional().describe(`Field for grouping (X-Axis)`),valueField:o().optional().describe(`Field for values (Y-Axis)`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:S(Ij).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:l({x:A(),y:A(),w:A(),h:A()}).describe(`Grid layout position`),options:b().optional().describe(`Widget specific configuration`),responsive:HA.optional().describe(`Responsive layout configuration`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),Rj=l({object:o().describe(`Source object name`),valueField:o().describe(`Field to use as option value`),labelField:o().describe(`Field to use as option label`),filter:gD.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`),zj=l({field:o().describe(`Field name to filter on`),label:G.optional().describe(`Display label for the filter`),type:x([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:S(l({value:c([o(),A(),v()]).describe(`Option value`),label:G})).optional().describe(`Static filter options`),optionsFrom:Rj.optional().describe(`Dynamic filter options from object`),defaultValue:c([o(),A(),v()]).optional().describe(`Default filter value`),scope:x([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:S(o()).optional().describe(`Widget IDs to apply this filter to`)}),Bj=l({name:OE.describe(`Dashboard unique name`),label:G.describe(`Dashboard label`),description:G.optional().describe(`Dashboard description`),header:Fj.optional().describe(`Dashboard header configuration`),widgets:S(Lj).describe(`Widgets to display`),refreshInterval:A().optional().describe(`Auto-refresh interval in seconds`),dateRange:l({field:o().optional().describe(`Default date field name for time-based filtering`),defaultRange:x([`today`,`yesterday`,`this_week`,`last_week`,`this_month`,`last_month`,`this_quarter`,`last_quarter`,`this_year`,`last_year`,`last_7_days`,`last_30_days`,`last_90_days`,`custom`]).default(`this_month`).describe(`Default date range preset`),allowCustomRange:v().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:S(zj).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:QD.optional().describe(`ARIA accessibility attributes`),performance:UA.optional().describe(`Performance optimization settings`)}),Zse={create:e=>Bj.parse(e)},Vj=x([`tabular`,`summary`,`matrix`,`joined`]),Hj=l({field:o().describe(`Field name`),label:G.optional().describe(`Override label`),aggregate:x([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:HA.optional().describe(`Responsive visibility for this column`)}),Uj=l({field:o().describe(`Field to group by`),sortOrder:x([`asc`,`desc`]).default(`asc`),dateGranularity:x([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)}),Wj=RA.extend({xAxis:o().describe(`Grouping field for X-Axis`),yAxis:o().describe(`Summary field for Y-Axis`),groupBy:o().optional().describe(`Additional grouping field`)}),Gj=l({name:OE.describe(`Report unique name`),label:G.describe(`Report label`),description:G.optional(),objectName:o().describe(`Primary object`),type:Vj.default(`tabular`).describe(`Report format type`),columns:S(Hj).describe(`Columns to display`),groupingsDown:S(Uj).optional().describe(`Row groupings`),groupingsAcross:S(Uj).optional().describe(`Column groupings (Matrix only)`),filter:gD.optional().describe(`Filter criteria`),chart:Wj.optional().describe(`Embedded chart configuration`),aria:QD.optional().describe(`ARIA accessibility attributes`),performance:UA.optional().describe(`Performance optimization settings`)}),Qse={create:e=>Gj.parse(e)},Kj=l({name:o().describe(`Region name (e.g. "sidebar", "main", "header")`),width:x([`small`,`medium`,`large`,`full`]).optional(),components:S(j(()=>Yj)).describe(`Components in this region`)}),qj=x(`page:header.page:footer.page:sidebar.page:tabs.page:accordion.page:card.page:section.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.ai:chat_window.ai:suggestion.element:text.element:number.element:image.element:divider.element:button.element:filter.element:form.element:record_picker`.split(`.`)),Jj=l({object:o().describe(`Object to query`),view:o().optional().describe(`Named view to apply`),filter:gD.optional().describe(`Additional filter criteria`),sort:S(zE).optional().describe(`Sort order`),limit:A().int().positive().optional().describe(`Max records to display`)}),Yj=l({type:c([qj,o()]).describe(`Component Type (Standard enum or custom string)`),id:o().optional().describe(`Unique instance ID`),label:G.optional(),properties:u(o(),b()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:u(o(),o()).optional().describe(`Event handlers map`),style:u(o(),o()).optional().describe(`Inline styles or utility classes`),className:o().optional().describe(`CSS class names`),visibility:o().optional().describe(`Visibility filter/formula`),dataSource:Jj.optional().describe(`Per-element data binding for multi-object pages`),responsive:HA.optional().describe(`Responsive layout configuration`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),Xj=l({name:o().describe(`Variable name`),type:x([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:b().optional(),source:o().optional().describe(`Component ID that writes to this variable`)}),Zj=l({componentId:o().describe(`Reference to a PageComponent.id in the page`),x:A().int().min(0).describe(`Grid column position (0-based)`),y:A().int().min(0).describe(`Grid row position (0-based)`),width:A().int().min(1).describe(`Width in grid columns`),height:A().int().min(1).describe(`Height in grid rows`)}),Qj=l({columns:A().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:A().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:A().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:S(Zj).describe(`Positioned components on the canvas`)}),$j=x([`record`,`home`,`app`,`utility`,`dashboard`,`grid`,`list`,`gallery`,`kanban`,`calendar`,`timeline`,`form`,`record_detail`,`record_review`,`overview`,`blank`]).describe(`Page type — platform or interface page types`),eM=l({object:o().describe(`Target object for review`),filter:gD.optional().describe(`Filter criteria for review queue`),sort:S(zE).optional().describe(`Sort order for review queue`),displayFields:S(o()).optional().describe(`Fields to display on the review page`),actions:S(l({label:o().describe(`Action button label`),type:x([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:o().optional().describe(`Field to update on action`),value:c([o(),A(),v()]).optional().describe(`Value to set on action`),nextRecord:v().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:x([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:v().optional().default(!0).describe(`Show review progress indicator`)}),tM=l({source:o().optional().describe(`Source object name for the page`),levels:A().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:S(aj).optional().describe(`Page-level filter criteria`),appearance:yj.optional().describe(`Appearance and visualization configuration`),userFilters:l({elements:S(x([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:S(bj).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:vj.optional().describe(`User action toggles`),addRecord:xj.optional().describe(`Add record entry point configuration`),showRecordCount:v().optional().describe(`Show record count at page bottom`),allowPrinting:v().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`),nM=l({name:OE.describe(`Page unique name (lowercase snake_case)`),label:G,description:G.optional(),icon:o().optional().describe(`Page icon name`),type:$j.default(`record`).describe(`Page type`),variables:S(Xj).optional().describe(`Local page state variables`),object:o().optional().describe(`Bound object (for Record pages)`),recordReview:eM.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:Qj.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:o().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:S(Kj).describe(`Defined regions with components`),isDefault:v().default(!1),assignedProfiles:S(o()).optional(),interfaceConfig:tM.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:QD.optional().describe(`ARIA accessibility attributes`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:le.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:le.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`})}),rM=l({onMount:o().optional().describe(`Initialization code when widget mounts`),onUpdate:o().optional().describe(`Code to run when props change`),onUnmount:o().optional().describe(`Cleanup code when widget unmounts`),onValidate:o().optional().describe(`Custom validation logic`),onFocus:o().optional().describe(`Code to run on focus`),onBlur:o().optional().describe(`Code to run on blur`),onError:o().optional().describe(`Error handling code`)}),iM=l({name:o().describe(`Event name`),label:G.optional().describe(`Human-readable event label`),description:G.optional().describe(`Event description and usage`),bubbles:v().default(!1).describe(`Whether event bubbles`),cancelable:v().default(!1).describe(`Whether event is cancelable`),payload:u(o(),b()).optional().describe(`Event payload schema`)}),aM=l({name:o().describe(`Property name (camelCase)`),label:G.optional().describe(`Human-readable label`),type:x([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:v().default(!1).describe(`Whether property is required`),default:b().optional().describe(`Default value`),description:G.optional().describe(`Property description`),validation:u(o(),b()).optional().describe(`Validation rules`),category:o().optional().describe(`Property category`)}),oM=d(`type`,[l({type:p(`npm`),packageName:o().describe(`NPM package name`),version:o().default(`latest`),exportName:o().optional().describe(`Named export (default: default)`)}),l({type:p(`remote`),url:o().url().describe(`Remote entry URL (.js)`),moduleName:o().describe(`Exposed module name`),scope:o().describe(`Remote scope name`)}),l({type:p(`inline`),code:o().describe(`JavaScript code body`)})]),$se=l({name:OE.describe(`Widget identifier (snake_case)`),label:G.describe(`Widget display name`),description:G.optional().describe(`Widget description`),version:o().optional().describe(`Widget version (semver)`),author:o().optional().describe(`Widget author`),icon:o().optional().describe(`Widget icon`),fieldTypes:S(o()).optional().describe(`Supported field types`),category:x([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:rM.optional().describe(`Lifecycle hooks`),events:S(iM).optional().describe(`Custom events`),properties:S(aM).optional().describe(`Configuration properties`),implementation:oM.optional().describe(`Widget implementation source`),dependencies:S(l({name:o(),version:o().optional(),url:o().url().optional()})).optional().describe(`Widget dependencies`),screenshots:S(o().url()).optional().describe(`Screenshot URLs`),documentation:o().url().optional().describe(`Documentation URL`),license:o().optional().describe(`License (SPDX identifier)`),tags:S(o()).optional().describe(`Tags for categorization`),aria:QD.optional().describe(`ARIA accessibility attributes`),performance:UA.optional().describe(`Performance optimization settings`)}),ece=l({value:b().describe(`Current field value`),onChange:O().input(a([b()])).output(g()).describe(`Callback to update field value`),readonly:v().default(!1).describe(`Read-only mode flag`),required:v().default(!1).describe(`Required field flag`),error:o().optional().describe(`Validation error message`),field:tD.describe(`Field schema definition`),record:u(o(),b()).optional().describe(`Complete record data`),options:u(o(),b()).optional().describe(`Custom widget options`)}),sM=l({}),cM=l({title:G.describe(`Page title`),subtitle:G.optional().describe(`Page subtitle`),icon:o().optional().describe(`Icon name`),breadcrumb:v().default(!0).describe(`Show breadcrumb`),actions:S(o()).optional().describe(`Action IDs to show in header`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),lM=l({type:x([`line`,`card`,`pill`]).default(`line`),position:x([`top`,`left`]).default(`top`),items:S(l({label:G,icon:o().optional(),children:S(b()).describe(`Child components`)})),aria:QD.optional().describe(`ARIA accessibility attributes`)}),uM=l({title:G.optional(),bordered:v().default(!0),actions:S(o()).optional(),body:S(b()).optional().describe(`Card content components (slot)`),footer:S(b()).optional().describe(`Card footer components (slot)`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),dM=l({columns:x([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:x([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:S(o()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:S(o()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),fM=l({objectName:o().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:o().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:S(o()).describe(`Fields to display in the related list`),sort:c([o(),S(l({field:o(),order:x([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:A().int().positive().default(5).describe(`Number of records to display initially`),filter:S(aj).optional().describe(`Additional filter criteria for related records`),title:G.optional().describe(`Custom title for the related list`),showViewAll:v().default(!0).describe(`Show "View All" link to see all related records`),actions:S(o()).optional().describe(`Action IDs available for related records`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),pM=l({fields:S(o()).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards)`),layout:x([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),mM=l({types:S(qk).optional().describe(`Feed item types to show (default: all)`),filterMode:eA.default(`all`).describe(`Default activity filter`),showFilterToggle:v().default(!0).describe(`Show filter dropdown in panel header`),limit:A().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:v().default(!1).describe(`Include completed activities`),unifiedTimeline:v().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:v().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:v().default(!0).describe(`Enable @mentions in comments`),enableReactions:v().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:v().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:v().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),hM=l({position:x([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:c([o(),A()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:v().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:v().default(!1).describe(`Whether the panel starts collapsed`),feed:mM.optional().describe(`Embedded activity feed configuration`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),gM=l({statusField:o().describe(`Field name representing the current status/stage`),stages:S(l({value:o(),label:G})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),_M=l({items:S(l({label:G,icon:o().optional(),collapsed:v().default(!1),children:S(b()).describe(`Child components`)})),allowMultiple:v().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),vM=l({mode:x([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:o().optional().describe(`Specific AI agent to use`),context:u(o(),b()).optional().describe(`Contextual data to pass to the AI`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),yM=l({content:o().describe(`Text or Markdown content`),variant:x([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:x([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),bM=l({object:o().describe(`Source object`),field:o().optional().describe(`Field to aggregate`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:gD.optional().describe(`Filter criteria`),format:x([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:o().optional().describe(`Prefix text (e.g. "$")`),suffix:o().optional().describe(`Suffix text (e.g. "%")`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),xM=l({src:o().describe(`Image URL or attachment field`),alt:o().optional().describe(`Alt text for accessibility`),fit:x([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:A().optional().describe(`Fixed height in pixels`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),SM=l({label:G.describe(`Button display label`),variant:x([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:x([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:o().optional().describe(`Icon name (Lucide icon)`),iconPosition:x([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:v().optional().default(!1).describe(`Disable the button`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),CM=l({object:o().describe(`Object to filter`),fields:S(o()).describe(`Filterable field names`),targetVariable:o().optional().describe(`Page variable to store filter state`),layout:x([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:v().optional().default(!0).describe(`Show search input`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),wM=l({object:o().describe(`Object for the form`),fields:S(o()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:x([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:G.optional().describe(`Submit button label`),onSubmit:o().optional().describe(`Action expression on form submit`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),TM=l({object:o().describe(`Object to pick records from`),displayField:o().describe(`Field to display as the record label`),searchFields:S(o()).optional().describe(`Fields to search against`),filter:gD.optional().describe(`Filter criteria for available records`),multiple:v().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:o().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:G.optional().describe(`Placeholder text`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),tce={"page:header":cM,"page:tabs":lM,"page:card":uM,"page:footer":sM,"page:sidebar":sM,"page:accordion":_M,"page:section":sM,"record:details":dM,"record:related_list":fM,"record:highlights":pM,"record:activity":mM,"record:chatter":hM,"record:path":gM,"app:launcher":sM,"nav:menu":sM,"nav:breadcrumb":sM,"global:search":sM,"global:notifications":sM,"user:profile":sM,"ai:chat_window":vM,"ai:suggestion":l({context:o().optional()}),"element:text":yM,"element:number":bM,"element:image":xM,"element:divider":sM,"element:button":SM,"element:filter":CM,"element:form":wM,"element:record_picker":TM},EM=l({minWidth:A().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:A().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:A().optional().describe(`Additional padding around touch target in pixels`),hitSlop:l({top:A().optional().describe(`Extra hit area above the element`),right:A().optional().describe(`Extra hit area to the right of the element`),bottom:A().optional().describe(`Extra hit area below the element`),left:A().optional().describe(`Extra hit area to the left of the element`)}).optional().describe(`Invisible hit area extension beyond the visible bounds`)}).describe(`Touch target sizing configuration (WCAG accessible)`),DM=x([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`),OM=x([`up`,`down`,`left`,`right`]),kM=l({direction:S(OM).describe(`Allowed swipe directions`),threshold:A().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:A().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`),AM=l({minScale:A().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:A().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`),jM=l({duration:A().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:A().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`),MM=l({type:DM.describe(`Gesture type to configure`),label:G.optional().describe(`Descriptive label for the gesture action`),enabled:v().default(!0).describe(`Whether this gesture is active`),swipe:kM.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:AM.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:jM.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`),nce=l({gestures:S(MM).optional().describe(`Configured gesture recognizers`),touchTarget:EM.optional().describe(`Touch target sizing and hit area`),hapticFeedback:v().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(QD.partial()).describe(`Touch and gesture interaction configuration`),NM=l({enabled:v().default(!1).describe(`Enable focus trapping within this container`),initialFocus:o().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:v().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:v().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`),PM=l({key:o().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:o().describe(`Action identifier to invoke when shortcut is triggered`),description:G.optional().describe(`Human-readable description of what the shortcut does`),scope:x([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`),FM=l({tabOrder:x([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:v().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:v().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:NM.optional().describe(`Focus trap settings`),arrowNavigation:v().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`),rce=l({shortcuts:S(PM).optional().describe(`Registered keyboard shortcuts`),focusManagement:FM.optional().describe(`Focus and tab order management`),rovingTabindex:v().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(QD.partial()).describe(`Keyboard navigation and shortcut configuration`),IM=l({primary:o().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:o().optional().describe(`Secondary brand color`),accent:o().optional().describe(`Accent color for highlights`),success:o().optional().describe(`Success state color (default: green)`),warning:o().optional().describe(`Warning state color (default: yellow)`),error:o().optional().describe(`Error state color (default: red)`),info:o().optional().describe(`Info state color (default: blue)`),background:o().optional().describe(`Background color`),surface:o().optional().describe(`Surface/card background color`),text:o().optional().describe(`Primary text color`),textSecondary:o().optional().describe(`Secondary text color`),border:o().optional().describe(`Border color`),disabled:o().optional().describe(`Disabled state color`),primaryLight:o().optional().describe(`Lighter shade of primary`),primaryDark:o().optional().describe(`Darker shade of primary`),secondaryLight:o().optional().describe(`Lighter shade of secondary`),secondaryDark:o().optional().describe(`Darker shade of secondary`)}),LM=l({fontFamily:l({base:o().optional().describe(`Base font family (default: system fonts)`),heading:o().optional().describe(`Heading font family`),mono:o().optional().describe(`Monospace font family for code`)}).optional(),fontSize:l({xs:o().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:o().optional().describe(`Small font size (e.g., 0.875rem)`),base:o().optional().describe(`Base font size (e.g., 1rem)`),lg:o().optional().describe(`Large font size (e.g., 1.125rem)`),xl:o().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":o().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":o().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":o().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:l({light:A().optional().describe(`Light weight (default: 300)`),normal:A().optional().describe(`Normal weight (default: 400)`),medium:A().optional().describe(`Medium weight (default: 500)`),semibold:A().optional().describe(`Semibold weight (default: 600)`),bold:A().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:l({tight:o().optional().describe(`Tight line height (e.g., 1.25)`),normal:o().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:o().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:o().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:l({tighter:o().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:o().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:o().optional().describe(`Normal letter spacing (e.g., 0)`),wide:o().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:o().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()}),RM=l({0:o().optional().describe(`0 spacing (0)`),1:o().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:o().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:o().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:o().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:o().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:o().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:o().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:o().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:o().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:o().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:o().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:o().optional().describe(`Spacing unit 24 (e.g., 6rem)`)}),zM=l({none:o().optional().describe(`No border radius (0)`),sm:o().optional().describe(`Small border radius (e.g., 0.125rem)`),base:o().optional().describe(`Base border radius (e.g., 0.25rem)`),md:o().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:o().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:o().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":o().optional().describe(`2X large border radius (e.g., 1rem)`),full:o().optional().describe(`Full border radius (50%)`)}),BM=l({none:o().optional().describe(`No shadow`),sm:o().optional().describe(`Small shadow`),base:o().optional().describe(`Base shadow`),md:o().optional().describe(`Medium shadow`),lg:o().optional().describe(`Large shadow`),xl:o().optional().describe(`Extra large shadow`),"2xl":o().optional().describe(`2X large shadow`),inner:o().optional().describe(`Inner shadow (inset)`)}),VM=l({xs:o().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:o().optional().describe(`Small breakpoint (e.g., 640px)`),md:o().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:o().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:o().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":o().optional().describe(`2X large breakpoint (e.g., 1536px)`)}),HM=l({duration:l({fast:o().optional().describe(`Fast animation (e.g., 150ms)`),base:o().optional().describe(`Base animation (e.g., 300ms)`),slow:o().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:l({linear:o().optional().describe(`Linear timing function`),ease:o().optional().describe(`Ease timing function`),ease_in:o().optional().describe(`Ease-in timing function`),ease_out:o().optional().describe(`Ease-out timing function`),ease_in_out:o().optional().describe(`Ease-in-out timing function`)}).optional()}),UM=l({base:A().optional().describe(`Base z-index (e.g., 0)`),dropdown:A().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:A().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:A().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:A().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:A().optional().describe(`Modal z-index (e.g., 1050)`),popover:A().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:A().optional().describe(`Tooltip z-index (e.g., 1070)`)}),WM=x([`light`,`dark`,`auto`]),ice=WM,GM=x([`compact`,`regular`,`spacious`]),ace=GM,KM=x([`AA`,`AAA`]),oce=KM,qM=l({name:OE.describe(`Unique theme identifier (snake_case)`),label:o().describe(`Human-readable theme name`),description:o().optional().describe(`Theme description`),mode:WM.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:IM.describe(`Color palette configuration`),typography:LM.optional().describe(`Typography settings`),spacing:RM.optional().describe(`Spacing scale`),borderRadius:zM.optional().describe(`Border radius scale`),shadows:BM.optional().describe(`Box shadow effects`),breakpoints:VM.optional().describe(`Responsive breakpoints`),animation:HM.optional().describe(`Animation settings`),zIndex:UM.optional().describe(`Z-index scale for layering`),customVars:u(o(),o()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:l({light:o().optional().describe(`Logo URL for light mode`),dark:o().optional().describe(`Logo URL for dark mode`),favicon:o().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:o().optional().describe(`Base theme to extend from`),density:GM.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:KM.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:v().optional().describe(`Enable right-to-left layout direction`),touchTarget:EM.optional().describe(`Touch target sizing defaults`),keyboardNavigation:FM.optional().describe(`Keyboard focus management settings`)}),JM=x([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`),YM=x([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`),XM=l({strategy:JM.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:YM.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:A().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:A().optional().describe(`Maximum number of sync retry attempts`),batchSize:A().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`),ZM=x([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`),QM=x([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`),$M=l({maxSize:A().optional().describe(`Maximum cache size in bytes`),ttl:A().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:ZM.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:QM.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`),sce=l({enabled:v().default(!1).describe(`Enable offline support`),strategy:JM.default(`network_first`).describe(`Default offline fetch strategy`),cache:$M.optional().describe(`Cache settings for offline data`),sync:XM.optional().describe(`Sync settings for offline mutations`),offlineIndicator:v().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:G.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:A().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`),eN=x([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`),tN=x([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`),nN=l({preset:eN.optional().describe(`Transition preset to apply`),duration:A().optional().describe(`Transition duration in milliseconds`),easing:tN.optional().describe(`Easing function for the transition`),delay:A().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:o().optional().describe(`CSS @keyframes name for custom animations`),themeToken:o().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`),rN=x([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`),iN=l({label:G.optional().describe(`Descriptive label for this animation configuration`),enter:nN.optional().describe(`Enter/mount animation`),exit:nN.optional().describe(`Exit/unmount animation`),hover:nN.optional().describe(`Hover state animation`),trigger:rN.optional().describe(`When to trigger the animation`),reducedMotion:x([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(QD.partial()).describe(`Component-level animation configuration`),aN=l({type:eN.default(`fade`).describe(`Page transition type`),duration:A().default(300).describe(`Transition duration in milliseconds`),easing:tN.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:v().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`),cce=l({label:G.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:nN.optional().describe(`Default transition applied to all animations`),pageTransitions:aN.optional().describe(`Page navigation transition settings`),componentAnimations:u(o(),iN).optional().describe(`Component name to animation configuration mapping`),reducedMotion:v().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:v().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`),oN=x([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`),sN=x([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`),cN=x([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`),lN=l({label:G.describe(`Action button label`),action:o().describe(`Action identifier to execute`),variant:x([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`),lce=l({type:oN.default(`toast`).describe(`Notification presentation style`),severity:sN.default(`info`).describe(`Notification severity level`),title:G.optional().describe(`Notification title`),message:G.describe(`Notification message body`),icon:o().optional().describe(`Icon name override`),duration:A().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:v().default(!0).describe(`Allow user to dismiss the notification`),actions:S(lN).optional().describe(`Action buttons`),position:cN.optional().describe(`Override default position`)}).merge(QD.partial()).describe(`Notification instance definition`),uce=l({defaultPosition:cN.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:A().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:A().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:x([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:v().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`),uN=x([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`),dN=x([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`),fN=l({axis:x([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:x([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:a([A(),A()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`),pN=l({label:G.optional().describe(`Accessible label for the drop zone`),accept:S(o()).describe(`Accepted drag item types`),maxItems:A().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:v().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:dN.default(`move`).describe(`Visual effect on drop`)}).merge(QD.partial()).describe(`Drop zone configuration`),mN=l({type:o().describe(`Drag item type identifier for matching with drop zones`),label:G.optional().describe(`Accessible label describing the draggable item`),handle:uN.default(`element`).describe(`How to initiate drag`),constraint:fN.optional().describe(`Drag movement constraints`),preview:x([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:v().default(!1).describe(`Disable dragging`)}).merge(QD.partial()).describe(`Draggable item configuration`),dce=l({enabled:v().default(!1).describe(`Enable drag and drop`),dragItem:mN.optional().describe(`Configuration for draggable item`),dropZone:pN.optional().describe(`Configuration for drop target`),sortable:v().default(!1).describe(`Enable sortable list behavior`),autoScroll:v().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:A().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`);EE({},{AccessControlConfigSchema:()=>BN,AddFieldOperation:()=>sF,AdvancedAuthConfigSchema:()=>CF,AnalyzerConfigSchema:()=>qN,AppCompatibilityCheckSchema:()=>$ce,AppInstallRequestSchema:()=>ele,AppInstallResultSchema:()=>tle,AppManifestSchema:()=>Qce,AppTranslationBundleSchema:()=>LI,AuditConfigSchema:()=>Ace,AuditEventActorSchema:()=>nP,AuditEventChangeSchema:()=>iP,AuditEventFilterSchema:()=>kce,AuditEventSchema:()=>Oce,AuditEventSeverity:()=>tP,AuditEventTargetSchema:()=>rP,AuditEventType:()=>eP,AuditFindingSchema:()=>jF,AuditFindingSeveritySchema:()=>kF,AuditFindingStatusSchema:()=>AF,AuditLogConfigSchema:()=>OF,AuditRetentionPolicySchema:()=>aP,AuditScheduleSchema:()=>MF,AuditStorageConfigSchema:()=>sP,AuthConfigSchema:()=>wF,AuthPluginConfigSchema:()=>vF,AuthProviderConfigSchema:()=>_F,AwarenessEventSchema:()=>mL,AwarenessSessionSchema:()=>fL,AwarenessUpdateSchema:()=>pL,AwarenessUserStateSchema:()=>dL,BackupConfigSchema:()=>wN,BackupRetentionSchema:()=>CN,BackupStrategySchema:()=>SN,BatchProgressSchema:()=>mI,BatchTask:()=>bI,BatchTaskSchema:()=>pI,BucketConfigSchema:()=>UN,CRDTMergeResultSchema:()=>iL,CRDTStateSchema:()=>rL,CRDTType:()=>qI,CacheAvalanchePreventionSchema:()=>bN,CacheConfigSchema:()=>vN,CacheConsistencySchema:()=>yN,CacheInvalidationSchema:()=>_N,CacheStrategySchema:()=>hN,CacheTierSchema:()=>gN,CacheWarmupSchema:()=>xN,ChangeImpactSchema:()=>iF,ChangePrioritySchema:()=>nF,ChangeRequestSchema:()=>oF,ChangeSetSchema:()=>gF,ChangeStatusSchema:()=>rF,ChangeTypeSchema:()=>tF,CollaborationMode:()=>hL,CollaborationSessionConfigSchema:()=>gL,CollaborationSessionSchema:()=>_L,CollaborativeCursorSchema:()=>cL,ComplianceAuditRequirementSchema:()=>YP,ComplianceConfigSchema:()=>NF,ComplianceEncryptionRequirementSchema:()=>XP,ComplianceFrameworkSchema:()=>JP,ConsoleDestinationConfigSchema:()=>pP,ConsumerConfigSchema:()=>jN,CoreServiceName:()=>IL,CounterOperationSchema:()=>XI,CoverageBreakdownEntrySchema:()=>BI,CreateObjectOperation:()=>uF,CronScheduleSchema:()=>QF,CursorColorPreset:()=>aL,CursorSelectionSchema:()=>sL,CursorStyleSchema:()=>oL,CursorUpdateSchema:()=>lL,DEFAULT_SUSPICIOUS_ACTIVITY_RULES:()=>jce,DataClassificationPolicySchema:()=>$P,DataClassificationSchema:()=>qP,DatabaseLevelIsolationStrategySchema:()=>ZL,DatabaseProviderSchema:()=>UL,DeadLetterQueueSchema:()=>MN,DeleteObjectOperation:()=>fF,DeployBundleSchema:()=>Zce,DeployDiffSchema:()=>Jce,DeployManifestSchema:()=>cR,DeployStatusEnum:()=>qce,DeployValidationIssueSchema:()=>sR,DeployValidationResultSchema:()=>Xce,DisasterRecoveryPlanSchema:()=>pce,DistributedCacheConfigSchema:()=>fce,EmailAndPasswordConfigSchema:()=>xF,EmailTemplateSchema:()=>xI,EmailVerificationConfigSchema:()=>SF,EncryptionAlgorithmSchema:()=>HE,EncryptionConfigSchema:()=>GE,ExecuteSqlOperation:()=>pF,ExtendedLogLevel:()=>dP,ExternalServiceDestinationConfigSchema:()=>gP,FacetConfigSchema:()=>YN,FailoverConfigSchema:()=>EN,FailoverModeSchema:()=>TN,FeatureSchema:()=>Vce,FieldEncryptionSchema:()=>_se,FieldTranslationSchema:()=>OI,FileDestinationConfigSchema:()=>mP,FileMetadataSchema:()=>PN,GCounterSchema:()=>ZI,GDPRConfigSchema:()=>TF,HIPAAConfigSchema:()=>EF,HistogramBucketConfigSchema:()=>SP,HttpDestinationConfigSchema:()=>hP,HttpServerConfig:()=>Ece,HttpServerConfigSchema:()=>XN,InAppNotificationSchema:()=>wI,IncidentCategorySchema:()=>FF,IncidentNotificationMatrixSchema:()=>zF,IncidentNotificationRuleSchema:()=>RF,IncidentResponsePhaseSchema:()=>LF,IncidentResponsePolicySchema:()=>VF,IncidentSchema:()=>BF,IncidentSeveritySchema:()=>PF,IncidentStatusSchema:()=>IF,IntervalScheduleSchema:()=>$F,JobExecutionSchema:()=>aI,JobExecutionStatus:()=>iI,JobSchema:()=>rI,KernelServiceMapSchema:()=>BL,KeyManagementProviderSchema:()=>UE,KeyRotationPolicySchema:()=>WE,LWWRegisterSchema:()=>YI,LicenseMetricType:()=>QL,LicenseSchema:()=>Uce,LifecycleActionSchema:()=>RN,LifecyclePolicyConfigSchema:()=>HN,LifecyclePolicyRuleSchema:()=>VN,LocaleSchema:()=>DI,LogDestinationSchema:()=>_P,LogDestinationType:()=>fP,LogEnrichmentConfigSchema:()=>vP,LogEntrySchema:()=>Mce,LogFormat:()=>lP,LogLevel:()=>cP,LoggerConfigSchema:()=>uP,LoggingConfigSchema:()=>Pce,MaskingConfigSchema:()=>vse,MaskingRuleSchema:()=>qE,MaskingStrategySchema:()=>KE,MaskingVisibilityRuleSchema:()=>ZP,MessageFormatSchema:()=>NI,MessageQueueConfigSchema:()=>mce,MessageQueueProviderSchema:()=>kN,MetadataCollectionInfoSchema:()=>AL,MetadataExportOptionsSchema:()=>jL,MetadataFallbackStrategySchema:()=>NL,MetadataFormatSchema:()=>SL,MetadataImportOptionsSchema:()=>ML,MetadataLoadOptionsSchema:()=>TL,MetadataLoadResultSchema:()=>EL,MetadataLoaderContractSchema:()=>wL,MetadataManagerConfigSchema:()=>FL,MetadataRecordSchema:()=>bL,MetadataSaveOptionsSchema:()=>DL,MetadataSaveResultSchema:()=>OL,MetadataScopeSchema:()=>vL,MetadataSourceSchema:()=>PL,MetadataStateSchema:()=>yL,MetadataStatsSchema:()=>CL,MetadataWatchEventSchema:()=>kL,MetricAggregationConfigSchema:()=>EP,MetricAggregationType:()=>xP,MetricDataPointSchema:()=>Fce,MetricDefinitionSchema:()=>wP,MetricExportConfigSchema:()=>kP,MetricLabelsSchema:()=>CP,MetricType:()=>yP,MetricUnit:()=>bP,MetricsConfigSchema:()=>Lce,MiddlewareConfig:()=>Dce,MiddlewareConfigSchema:()=>QN,MiddlewareType:()=>ZN,MigrationDependencySchema:()=>hF,MigrationOperationSchema:()=>mF,MigrationPlanSchema:()=>Yce,MigrationStatementSchema:()=>oR,ModifyFieldOperation:()=>cF,MultipartUploadConfigSchema:()=>zN,MutualTLSConfigSchema:()=>yF,NotificationChannelSchema:()=>TI,NotificationConfigSchema:()=>EI,ORSetElementSchema:()=>$I,ORSetSchema:()=>eL,OTComponentSchema:()=>WI,OTOperationSchema:()=>GI,OTOperationType:()=>UI,OTTransformResultSchema:()=>KI,ObjectMetadataSchema:()=>hce,ObjectStorageConfigSchema:()=>GN,ObjectTranslationDataSchema:()=>kI,ObjectTranslationNodeSchema:()=>II,OnceScheduleSchema:()=>eI,OpenTelemetryCompatibilitySchema:()=>GP,OtelExporterType:()=>WP,PCIDSSConfigSchema:()=>DF,PKG_CONVENTIONS:()=>nle,PNCounterSchema:()=>QI,PackagePublishResultSchema:()=>xL,PlanSchema:()=>Hce,PresignedUrlConfigSchema:()=>gce,ProvisioningStepSchema:()=>iR,PushNotificationSchema:()=>CI,QueueConfig:()=>vI,QueueConfigSchema:()=>fI,QuotaEnforcementResultSchema:()=>qL,RPOSchema:()=>DN,RTOSchema:()=>ON,RegistryConfigSchema:()=>Wce,RegistrySyncPolicySchema:()=>$L,RegistryUpstreamSchema:()=>eR,RemoveFieldOperation:()=>lF,RenameObjectOperation:()=>dF,RetryPolicySchema:()=>nI,RollbackPlanSchema:()=>aF,RouteHandlerMetadataSchema:()=>Sce,RowLevelIsolationStrategySchema:()=>YL,SMSTemplateSchema:()=>SI,SamplingDecision:()=>zP,SamplingStrategyType:()=>BP,ScheduleSchema:()=>tI,SchemaChangeSchema:()=>aR,SchemaLevelIsolationStrategySchema:()=>XL,SearchConfigSchema:()=>xce,SearchIndexConfigSchema:()=>JN,SearchProviderSchema:()=>KN,SecurityContextConfigSchema:()=>eF,SecurityEventCorrelationSchema:()=>QP,ServerCapabilitiesSchema:()=>wce,ServerEventSchema:()=>Cce,ServerEventType:()=>$N,ServerStatusSchema:()=>Tce,ServiceConfigSchema:()=>VL,ServiceCriticalitySchema:()=>LL,ServiceLevelIndicatorSchema:()=>DP,ServiceLevelObjectiveSchema:()=>OP,ServiceRequirementDef:()=>RL,ServiceStatusSchema:()=>zL,SocialProviderConfigSchema:()=>bF,SpanAttributeValueSchema:()=>FP,SpanAttributesSchema:()=>IP,SpanEventSchema:()=>LP,SpanKind:()=>NP,SpanLinkSchema:()=>RP,SpanSchema:()=>Rce,SpanStatus:()=>PP,StorageAclSchema:()=>IN,StorageClassSchema:()=>LN,StorageConnectionSchema:()=>WN,StorageNameMapping:()=>ale,StorageProviderSchema:()=>FN,StorageScopeSchema:()=>NN,StructuredLogEntrySchema:()=>Nce,SupplierAssessmentStatusSchema:()=>UF,SupplierRiskLevelSchema:()=>HF,SupplierSecurityAssessmentSchema:()=>GF,SupplierSecurityPolicySchema:()=>KF,SupplierSecurityRequirementSchema:()=>WF,SuspiciousActivityRuleSchema:()=>oP,SystemFieldName:()=>ile,SystemObjectName:()=>rle,TASK_PRIORITY_VALUES:()=>sI,TRANSLATE_PLACEHOLDER:()=>HI,Task:()=>_I,TaskExecutionResultSchema:()=>dI,TaskPriority:()=>oI,TaskRetryPolicySchema:()=>lI,TaskSchema:()=>uI,TaskStatus:()=>cI,TenantConnectionConfigSchema:()=>WL,TenantIsolationConfigSchema:()=>zce,TenantIsolationLevel:()=>HL,TenantPlanSchema:()=>nR,TenantProvisioningRequestSchema:()=>Gce,TenantProvisioningResultSchema:()=>Kce,TenantProvisioningStatusEnum:()=>tR,TenantQuotaSchema:()=>GL,TenantRegionSchema:()=>rR,TenantSchema:()=>JL,TenantSecurityPolicySchema:()=>Bce,TenantUsageSchema:()=>KL,TextCRDTOperationSchema:()=>tL,TextCRDTStateSchema:()=>nL,TimeSeriesDataPointSchema:()=>TP,TimeSeriesSchema:()=>Ice,TopicConfigSchema:()=>AN,TraceContextPropagationSchema:()=>UP,TraceContextSchema:()=>MP,TraceFlagsSchema:()=>jP,TracePropagationFormat:()=>HP,TraceSamplingConfigSchema:()=>VP,TraceStateSchema:()=>AP,TracingConfigSchema:()=>KP,TrainingCategorySchema:()=>qF,TrainingCompletionStatusSchema:()=>JF,TrainingCourseSchema:()=>YF,TrainingPlanSchema:()=>ZF,TrainingRecordSchema:()=>XF,TranslationBundleSchema:()=>jI,TranslationConfigSchema:()=>PI,TranslationCoverageResultSchema:()=>VI,TranslationDataSchema:()=>AI,TranslationDiffItemSchema:()=>zI,TranslationDiffStatusSchema:()=>RI,TranslationFileOrganizationSchema:()=>MI,UserActivityStatus:()=>uL,VectorClockSchema:()=>JI,WorkerConfig:()=>yI,WorkerConfigSchema:()=>hI,WorkerStatsSchema:()=>gI,azureBlobStorageExample:()=>yce,gcsStorageExample:()=>bce,minioStorageExample:()=>vce,s3StorageExample:()=>_ce});var hN=x([`lru`,`lfu`,`fifo`,`ttl`,`adaptive`]).describe(`Cache eviction strategy`),gN=l({name:o().describe(`Unique cache tier name`),type:x([`memory`,`redis`,`memcached`,`cdn`]).describe(`Cache backend type`),maxSize:A().optional().describe(`Max size in MB`),ttl:A().default(300).describe(`Default TTL in seconds`),strategy:hN.default(`lru`).describe(`Eviction strategy`),warmup:v().default(!1).describe(`Pre-populate cache on startup`)}).describe(`Configuration for a single cache tier in the hierarchy`),_N=l({trigger:x([`create`,`update`,`delete`,`manual`]).describe(`Event that triggers invalidation`),scope:x([`key`,`pattern`,`tag`,`all`]).describe(`Invalidation scope`),pattern:o().optional().describe(`Key pattern for pattern-based invalidation`),tags:S(o()).optional().describe(`Cache tags to invalidate`)}).describe(`Rule defining when and how cached entries are invalidated`),vN=l({enabled:v().default(!1).describe(`Enable application-level caching`),tiers:S(gN).describe(`Ordered cache tier hierarchy`),invalidation:S(_N).describe(`Cache invalidation rules`),prefetch:v().default(!1).describe(`Enable cache prefetching`),compression:v().default(!1).describe(`Enable data compression in cache`),encryption:v().default(!1).describe(`Enable encryption for cached data`)}).describe(`Top-level application cache configuration`),yN=x([`write_through`,`write_behind`,`write_around`,`refresh_ahead`]).describe(`Distributed cache write consistency strategy`),bN=l({jitterTtl:l({enabled:v().default(!1).describe(`Add random jitter to TTL values`),maxJitterSeconds:A().default(60).describe(`Maximum jitter added to TTL in seconds`)}).optional().describe(`TTL jitter to prevent simultaneous expiration`),circuitBreaker:l({enabled:v().default(!1).describe(`Enable circuit breaker for backend protection`),failureThreshold:A().default(5).describe(`Failures before circuit opens`),resetTimeout:A().default(30).describe(`Seconds before half-open state`)}).optional().describe(`Circuit breaker for backend protection`),lockout:l({enabled:v().default(!1).describe(`Enable cache locking for key regeneration`),lockTimeoutMs:A().default(5e3).describe(`Maximum lock wait time in milliseconds`)}).optional().describe(`Lock-based stampede prevention`)}).describe(`Cache avalanche/stampede prevention configuration`),xN=l({enabled:v().default(!1).describe(`Enable cache warmup`),strategy:x([`eager`,`lazy`,`scheduled`]).default(`lazy`).describe(`Warmup strategy: eager (at startup), lazy (on first access), scheduled (cron)`),schedule:o().optional().describe(`Cron expression for scheduled warmup`),patterns:S(o()).optional().describe(`Key patterns to warm up (e.g., "user:*", "config:*")`),concurrency:A().default(10).describe(`Maximum concurrent warmup operations`)}).describe(`Cache warmup strategy`),fce=vN.extend({consistency:yN.optional().describe(`Distributed cache consistency strategy`),avalanchePrevention:bN.optional().describe(`Cache avalanche and stampede prevention`),warmup:xN.optional().describe(`Cache warmup strategy`)}).describe(`Distributed cache configuration with consistency and avalanche prevention`),SN=x([`full`,`incremental`,`differential`]).describe(`Backup strategy type`),CN=l({days:A().min(1).describe(`Retention period in days`),minCopies:A().min(1).default(3).describe(`Minimum backup copies to retain`),maxCopies:A().optional().describe(`Maximum backup copies to store`)}).describe(`Backup retention policy`),wN=l({strategy:SN.default(`incremental`).describe(`Backup strategy`),schedule:o().optional().describe(`Cron expression for backup schedule (e.g., "0 2 * * *")`),retention:CN.describe(`Backup retention policy`),destination:l({type:x([`s3`,`gcs`,`azure_blob`,`local`]).describe(`Storage backend type`),bucket:o().optional().describe(`Cloud storage bucket/container name`),path:o().optional().describe(`Storage path prefix`),region:o().optional().describe(`Cloud storage region`)}).describe(`Backup storage destination`),encryption:l({enabled:v().default(!0).describe(`Enable backup encryption`),algorithm:x([`AES-256-GCM`,`AES-256-CBC`,`ChaCha20-Poly1305`]).default(`AES-256-GCM`).describe(`Encryption algorithm`),keyId:o().optional().describe(`KMS key ID for encryption`)}).optional().describe(`Backup encryption settings`),compression:l({enabled:v().default(!0).describe(`Enable backup compression`),algorithm:x([`gzip`,`zstd`,`lz4`,`snappy`]).default(`zstd`).describe(`Compression algorithm`)}).optional().describe(`Backup compression settings`),verifyAfterBackup:v().default(!0).describe(`Verify backup integrity after creation`)}).describe(`Backup configuration`),TN=x([`active_passive`,`active_active`,`pilot_light`,`warm_standby`]).describe(`Failover mode`),EN=l({mode:TN.default(`active_passive`).describe(`Failover mode`),autoFailover:v().default(!0).describe(`Enable automatic failover`),healthCheckInterval:A().default(30).describe(`Health check interval in seconds`),failureThreshold:A().default(3).describe(`Consecutive failures before failover`),regions:S(l({name:o().describe(`Region identifier (e.g., "us-east-1", "eu-west-1")`),role:x([`primary`,`secondary`,`witness`]).describe(`Region role`),endpoint:o().optional().describe(`Region endpoint URL`),priority:A().optional().describe(`Failover priority (lower = higher priority)`)})).min(2).describe(`Multi-region configuration (minimum 2 regions)`),dns:l({ttl:A().default(60).describe(`DNS TTL in seconds for failover`),provider:x([`route53`,`cloudflare`,`azure_dns`,`custom`]).optional().describe(`DNS provider for automatic failover`)}).optional().describe(`DNS failover settings`)}).describe(`Failover configuration`),DN=l({value:A().min(0).describe(`RPO value`),unit:x([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RPO time unit`)}).describe(`Recovery Point Objective (maximum acceptable data loss)`),ON=l({value:A().min(0).describe(`RTO value`),unit:x([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RTO time unit`)}).describe(`Recovery Time Objective (maximum acceptable downtime)`),pce=l({enabled:v().default(!1).describe(`Enable disaster recovery plan`),rpo:DN.describe(`Recovery Point Objective`),rto:ON.describe(`Recovery Time Objective`),backup:wN.describe(`Backup configuration`),failover:EN.optional().describe(`Multi-region failover configuration`),replication:l({mode:x([`synchronous`,`asynchronous`,`semi_synchronous`]).default(`asynchronous`).describe(`Data replication mode`),maxLagSeconds:A().optional().describe(`Maximum acceptable replication lag in seconds`),includeObjects:S(o()).optional().describe(`Objects to replicate (empty = all)`),excludeObjects:S(o()).optional().describe(`Objects to exclude from replication`)}).optional().describe(`Data replication settings`),testing:l({enabled:v().default(!1).describe(`Enable automated DR testing`),schedule:o().optional().describe(`Cron expression for DR test schedule`),notificationChannel:o().optional().describe(`Notification channel for DR test results`)}).optional().describe(`Automated disaster recovery testing`),runbookUrl:o().optional().describe(`URL to disaster recovery runbook/playbook`),contacts:S(l({name:o().describe(`Contact name`),role:o().describe(`Contact role (e.g., "DBA", "SRE Lead")`),email:o().optional().describe(`Contact email`),phone:o().optional().describe(`Contact phone`)})).optional().describe(`Emergency contact list for DR incidents`)}).describe(`Complete disaster recovery plan configuration`),kN=x([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Supported message queue backend provider`),AN=l({name:o().describe(`Topic name identifier`),partitions:A().default(1).describe(`Number of partitions for parallel consumption`),replicationFactor:A().default(1).describe(`Number of replicas for fault tolerance`),retentionMs:A().optional().describe(`Message retention period in milliseconds`),compressionType:x([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression algorithm`)}).describe(`Configuration for a message queue topic`),jN=l({groupId:o().describe(`Consumer group identifier`),autoOffsetReset:x([`earliest`,`latest`]).default(`latest`).describe(`Where to start reading when no offset exists`),enableAutoCommit:v().default(!0).describe(`Automatically commit consumed offsets`),maxPollRecords:A().default(500).describe(`Maximum records returned per poll`)}).describe(`Consumer group configuration for topic consumption`),MN=l({enabled:v().default(!1).describe(`Enable dead letter queue for failed messages`),maxRetries:A().default(3).describe(`Maximum delivery attempts before sending to DLQ`),queueName:o().describe(`Name of the dead letter queue`)}).describe(`Dead letter queue configuration for unprocessable messages`),mce=l({provider:kN.describe(`Message queue backend provider`),topics:S(AN).describe(`List of topic configurations`),consumers:S(jN).optional().describe(`Consumer group configurations`),deadLetterQueue:MN.optional().describe(`Dead letter queue for failed messages`),ssl:v().default(!1).describe(`Enable SSL/TLS for broker connections`),sasl:l({mechanism:x([`plain`,`scram-sha-256`,`scram-sha-512`]).describe(`SASL authentication mechanism`),username:o().describe(`SASL username`),password:o().describe(`SASL password`)}).optional().describe(`SASL authentication configuration`)}).describe(`Top-level message queue configuration`),NN=x([`global`,`tenant`,`user`,`session`,`temp`,`cache`,`data`,`logs`,`config`,`public`]).describe(`Storage scope classification`),PN=l({path:o().describe(`File path`),name:o().describe(`File name`),size:A().int().describe(`File size in bytes`),mimeType:o().describe(`MIME type`),lastModified:o().datetime().describe(`Last modified timestamp`),created:o().datetime().describe(`Creation timestamp`),etag:o().optional().describe(`Entity tag`)}),FN=x([`s3`,`azure_blob`,`gcs`,`minio`,`r2`,`spaces`,`wasabi`,`backblaze`,`local`]).describe(`Storage provider type`),IN=x([`private`,`public_read`,`public_read_write`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full_control`]).describe(`Storage access control level`),LN=x([`standard`,`intelligent`,`infrequent_access`,`glacier`,`deep_archive`]).describe(`Storage class/tier for cost optimization`),RN=x([`transition`,`delete`,`abort`]).describe(`Lifecycle policy action type`),hce=l({contentType:o().describe(`MIME type (e.g., image/jpeg, application/pdf)`),contentLength:A().min(0).describe(`File size in bytes`),contentEncoding:o().optional().describe(`Content encoding (e.g., gzip)`),contentDisposition:o().optional().describe(`Content disposition header`),contentLanguage:o().optional().describe(`Content language`),cacheControl:o().optional().describe(`Cache control directives`),etag:o().optional().describe(`Entity tag for versioning/caching`),lastModified:o().datetime().optional().describe(`Last modification timestamp`),versionId:o().optional().describe(`Object version identifier`),storageClass:LN.optional().describe(`Storage class/tier`),encryption:l({algorithm:o().describe(`Encryption algorithm (e.g., AES256, aws:kms)`),keyId:o().optional().describe(`KMS key ID if using managed encryption`)}).optional().describe(`Server-side encryption configuration`),custom:u(o(),o()).optional().describe(`Custom user-defined metadata`)}),gce=l({operation:x([`get`,`put`,`delete`,`head`]).describe(`Allowed operation`),expiresIn:A().min(1).max(604800).describe(`Expiration time in seconds (max 7 days)`),contentType:o().optional().describe(`Required content type for PUT operations`),maxSize:A().min(0).optional().describe(`Maximum file size in bytes for PUT operations`),responseContentType:o().optional().describe(`Override content-type for GET operations`),responseContentDisposition:o().optional().describe(`Override content-disposition for GET operations`)}),zN=l({enabled:v().default(!0).describe(`Enable multipart uploads`),partSize:A().min(5*1024*1024).max(5*1024*1024*1024).default(10*1024*1024).describe(`Part size in bytes (min 5MB, max 5GB)`),maxParts:A().min(1).max(1e4).default(1e4).describe(`Maximum number of parts (max 10,000)`),threshold:A().min(0).default(100*1024*1024).describe(`File size threshold to trigger multipart upload (bytes)`),maxConcurrent:A().min(1).max(100).default(4).describe(`Maximum concurrent part uploads`),abortIncompleteAfterDays:A().min(1).optional().describe(`Auto-abort incomplete uploads after N days`)}),BN=l({acl:IN.default(`private`).describe(`Default access control level`),allowedOrigins:S(o()).optional().describe(`CORS allowed origins`),allowedMethods:S(x([`GET`,`PUT`,`POST`,`DELETE`,`HEAD`])).optional().describe(`CORS allowed HTTP methods`),allowedHeaders:S(o()).optional().describe(`CORS allowed headers`),exposeHeaders:S(o()).optional().describe(`CORS exposed headers`),maxAge:A().min(0).optional().describe(`CORS preflight cache duration in seconds`),corsEnabled:v().default(!1).describe(`Enable CORS configuration`),publicAccess:l({allowPublicRead:v().default(!1).describe(`Allow public read access`),allowPublicWrite:v().default(!1).describe(`Allow public write access`),allowPublicList:v().default(!1).describe(`Allow public bucket listing`)}).optional().describe(`Public access control`),allowedIps:S(o()).optional().describe(`Allowed IP addresses/CIDR blocks`),blockedIps:S(o()).optional().describe(`Blocked IP addresses/CIDR blocks`)}),VN=l({id:DE.describe(`Rule identifier`),enabled:v().default(!0).describe(`Enable this rule`),action:RN.describe(`Action to perform`),prefix:o().optional().describe(`Object key prefix filter (e.g., "uploads/")`),tags:u(o(),o()).optional().describe(`Object tag filters`),daysAfterCreation:A().min(0).optional().describe(`Days after object creation`),daysAfterModification:A().min(0).optional().describe(`Days after last modification`),targetStorageClass:LN.optional().describe(`Target storage class for transition action`)}).refine(e=>!(e.action===`transition`&&!e.targetStorageClass),{message:`targetStorageClass is required when action is "transition"`}),HN=l({enabled:v().default(!1).describe(`Enable lifecycle policies`),rules:S(VN).default([]).describe(`Lifecycle rules`)}),UN=l({name:DE.describe(`Bucket identifier in ObjectStack (snake_case)`),label:o().describe(`Display label`),bucketName:o().describe(`Actual bucket/container name in storage provider`),region:o().optional().describe(`Storage region (e.g., us-east-1, westus)`),provider:FN.describe(`Storage provider`),endpoint:o().optional().describe(`Custom endpoint URL (for S3-compatible providers)`),pathStyle:v().default(!1).describe(`Use path-style URLs (for S3-compatible providers)`),versioning:v().default(!1).describe(`Enable object versioning`),encryption:l({enabled:v().default(!1).describe(`Enable server-side encryption`),algorithm:x([`AES256`,`aws:kms`,`azure:kms`,`gcp:kms`]).default(`AES256`).describe(`Encryption algorithm`),kmsKeyId:o().optional().describe(`KMS key ID for managed encryption`)}).optional().describe(`Server-side encryption configuration`),accessControl:BN.optional().describe(`Access control configuration`),lifecyclePolicy:HN.optional().describe(`Lifecycle policy configuration`),multipartConfig:zN.optional().describe(`Multipart upload configuration`),tags:u(o(),o()).optional().describe(`Bucket tags for organization`),description:o().optional().describe(`Bucket description`),enabled:v().default(!0).describe(`Enable this bucket`)}),WN=l({accessKeyId:o().optional().describe(`AWS access key ID or MinIO access key`),secretAccessKey:o().optional().describe(`AWS secret access key or MinIO secret key`),sessionToken:o().optional().describe(`AWS session token for temporary credentials`),accountName:o().optional().describe(`Azure storage account name`),accountKey:o().optional().describe(`Azure storage account key`),sasToken:o().optional().describe(`Azure SAS token`),projectId:o().optional().describe(`GCP project ID`),credentials:o().optional().describe(`GCP service account credentials JSON`),endpoint:o().optional().describe(`Custom endpoint URL`),region:o().optional().describe(`Default region`),useSSL:v().default(!0).describe(`Use SSL/TLS for connections`),timeout:A().min(0).optional().describe(`Connection timeout in milliseconds`)}),GN=l({name:DE.describe(`Storage configuration identifier`),label:o().describe(`Display label`),provider:FN.describe(`Primary storage provider`),scope:NN.optional().default(`global`).describe(`Storage scope`),connection:WN.describe(`Connection credentials`),buckets:S(UN).default([]).describe(`Configured buckets`),defaultBucket:o().optional().describe(`Default bucket name for operations`),location:o().optional().describe(`Root path (local) or base location`),quota:A().int().positive().optional().describe(`Max size in bytes`),options:u(o(),b()).optional().describe(`Provider-specific configuration options`),enabled:v().default(!0).describe(`Enable this storage configuration`),description:o().optional().describe(`Configuration description`)}),_ce=GN.parse({name:`aws_s3_storage`,label:`AWS S3 Production Storage`,provider:`s3`,connection:{accessKeyId:"${AWS_ACCESS_KEY_ID}",secretAccessKey:"${AWS_SECRET_ACCESS_KEY}",region:`us-east-1`},buckets:[{name:`user_uploads`,label:`User Uploads`,bucketName:`my-app-user-uploads`,region:`us-east-1`,provider:`s3`,versioning:!0,encryption:{enabled:!0,algorithm:`aws:kms`,kmsKeyId:"${AWS_KMS_KEY_ID}"},accessControl:{acl:`private`,corsEnabled:!0,allowedOrigins:[`https://app.example.com`],allowedMethods:[`GET`,`PUT`,`POST`]},lifecyclePolicy:{enabled:!0,rules:[{id:`archive_old_uploads`,enabled:!0,action:`transition`,daysAfterCreation:90,targetStorageClass:`glacier`}]},multipartConfig:{enabled:!0,partSize:10*1024*1024,threshold:100*1024*1024,maxConcurrent:4}}],defaultBucket:`user_uploads`,enabled:!0}),vce=GN.parse({name:`minio_local`,label:`MinIO Local Storage`,provider:`minio`,connection:{accessKeyId:`minioadmin`,secretAccessKey:`minioadmin`,endpoint:`http://localhost:9000`,useSSL:!1},buckets:[{name:`development_files`,label:`Development Files`,bucketName:`dev-files`,provider:`minio`,endpoint:`http://localhost:9000`,pathStyle:!0,accessControl:{acl:`private`}}],defaultBucket:`development_files`,enabled:!0}),yce=GN.parse({name:`azure_blob_storage`,label:`Azure Blob Storage`,provider:`azure_blob`,connection:{accountName:`mystorageaccount`,accountKey:"${AZURE_STORAGE_KEY}",endpoint:`https://mystorageaccount.blob.core.windows.net`},buckets:[{name:`media_files`,label:`Media Files`,bucketName:`media`,provider:`azure_blob`,region:`eastus`,accessControl:{acl:`public_read`,publicAccess:{allowPublicRead:!0,allowPublicWrite:!1,allowPublicList:!1}}}],defaultBucket:`media_files`,enabled:!0}),bce=GN.parse({name:`gcs_storage`,label:`Google Cloud Storage`,provider:`gcs`,connection:{projectId:`my-gcp-project`,credentials:"${GCP_SERVICE_ACCOUNT_JSON}"},buckets:[{name:`backup_storage`,label:`Backup Storage`,bucketName:`my-app-backups`,region:`us-central1`,provider:`gcs`,lifecyclePolicy:{enabled:!0,rules:[{id:`delete_old_backups`,enabled:!0,action:`delete`,daysAfterCreation:30}]}}],defaultBucket:`backup_storage`,enabled:!0}),KN=x([`elasticsearch`,`algolia`,`meilisearch`,`typesense`,`opensearch`]).describe(`Supported full-text search engine provider`),qN=l({type:x([`standard`,`simple`,`whitespace`,`keyword`,`pattern`,`language`]).describe(`Text analyzer type`),language:o().optional().describe(`Language for language-specific analysis`),stopwords:S(o()).optional().describe(`Custom stopwords to filter during analysis`),customFilters:S(o()).optional().describe(`Additional token filter names to apply`)}).describe(`Text analyzer configuration for index tokenization and normalization`),JN=l({indexName:o().describe(`Name of the search index`),objectName:o().describe(`Source ObjectQL object`),fields:S(l({name:o().describe(`Field name to index`),type:x([`text`,`keyword`,`number`,`date`,`boolean`,`geo`]).describe(`Index field data type`),analyzer:o().optional().describe(`Named analyzer to use for this field`),searchable:v().default(!0).describe(`Include field in full-text search`),filterable:v().default(!1).describe(`Allow filtering on this field`),sortable:v().default(!1).describe(`Allow sorting by this field`),boost:A().default(1).describe(`Relevance boost factor for this field`)})).describe(`Fields to include in the search index`),replicas:A().default(1).describe(`Number of index replicas for availability`),shards:A().default(1).describe(`Number of index shards for distribution`)}).describe(`Search index definition mapping an ObjectQL object to a search engine index`),YN=l({field:o().describe(`Field name to generate facets from`),maxValues:A().default(10).describe(`Maximum number of facet values to return`),sort:x([`count`,`alpha`]).default(`count`).describe(`Facet value sort order`)}).describe(`Faceted search configuration for a single field`),xce=l({provider:KN.describe(`Search engine backend provider`),indexes:S(JN).describe(`Search index definitions`),analyzers:u(o(),qN).optional().describe(`Named text analyzer configurations`),facets:S(YN).optional().describe(`Faceted search configurations`),typoTolerance:v().default(!0).describe(`Enable typo-tolerant search`),synonyms:u(o(),S(o())).optional().describe(`Synonym mappings for search expansion`),ranking:S(x([`typo`,`geo`,`words`,`filters`,`proximity`,`attribute`,`exact`,`custom`])).optional().describe(`Custom ranking rule order`)}).describe(`Top-level full-text search engine configuration`),XN=l({port:A().int().min(1).max(65535).default(3e3).describe(`Port number to listen on`),host:o().default(`0.0.0.0`).describe(`Host address to bind to`),cors:FE.optional().describe(`CORS configuration`),requestTimeout:A().int().default(3e4).describe(`Request timeout in milliseconds`),bodyLimit:o().default(`10mb`).describe(`Maximum request body size`),compression:v().default(!0).describe(`Enable response compression`),security:l({helmet:v().default(!0).describe(`Enable security headers via helmet`),rateLimit:IE.optional().describe(`Global rate limiting configuration`)}).optional().describe(`Security configuration`),static:S(LE).optional().describe(`Static file serving configuration`),trustProxy:v().default(!1).describe(`Trust X-Forwarded-* headers`)}),Sce=l({method:ME.describe(`HTTP method`),path:o().describe(`URL path pattern`),handler:o().describe(`Handler identifier or name`),metadata:l({summary:o().optional().describe(`Route summary for documentation`),description:o().optional().describe(`Route description`),tags:S(o()).optional().describe(`Tags for grouping`),operationId:o().optional().describe(`Unique operation identifier`)}).optional(),security:l({authRequired:v().default(!0).describe(`Require authentication`),permissions:S(o()).optional().describe(`Required permissions`),rateLimit:o().optional().describe(`Rate limit policy override`)}).optional()}),ZN=x([`authentication`,`authorization`,`logging`,`validation`,`transformation`,`error`,`custom`]),QN=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Middleware name (snake_case)`),type:ZN.describe(`Middleware type`),enabled:v().default(!0).describe(`Whether middleware is enabled`),order:A().int().default(100).describe(`Execution order priority`),config:u(o(),b()).optional().describe(`Middleware configuration object`),paths:l({include:S(o()).optional().describe(`Include path patterns (glob)`),exclude:S(o()).optional().describe(`Exclude path patterns (glob)`)}).optional().describe(`Path filtering`)}),$N=x([`starting`,`started`,`stopping`,`stopped`,`request`,`response`,`error`]),Cce=l({type:$N.describe(`Event type`),timestamp:o().datetime().describe(`Event timestamp (ISO 8601)`),data:u(o(),b()).optional().describe(`Event-specific data`)}),wce=l({httpVersions:S(x([`1.0`,`1.1`,`2.0`,`3.0`])).default([`1.1`]).describe(`Supported HTTP versions`),websocket:v().default(!1).describe(`WebSocket support`),sse:v().default(!1).describe(`Server-Sent Events support`),serverPush:v().default(!1).describe(`HTTP/2 Server Push support`),streaming:v().default(!0).describe(`Response streaming support`),middleware:v().default(!0).describe(`Middleware chain support`),routeParams:v().default(!0).describe(`URL parameter support (/users/:id)`),compression:v().default(!0).describe(`Built-in compression support`)}),Tce=l({state:x([`stopped`,`starting`,`running`,`stopping`,`error`]).describe(`Current server state`),uptime:A().int().optional().describe(`Server uptime in milliseconds`),server:l({port:A().int().describe(`Listening port`),host:o().describe(`Bound host`),url:o().optional().describe(`Full server URL`)}).optional(),connections:l({active:A().int().describe(`Active connections`),total:A().int().describe(`Total connections handled`)}).optional(),requests:l({total:A().int().describe(`Total requests processed`),success:A().int().describe(`Successful requests`),errors:A().int().describe(`Failed requests`)}).optional()}),Ece=Object.assign(XN,{create:e=>e}),Dce=Object.assign(QN,{create:e=>e}),eP=x(`data.create,data.read,data.update,data.delete,data.export,data.import,data.bulk_update,data.bulk_delete,auth.login,auth.login_failed,auth.logout,auth.session_created,auth.session_expired,auth.password_reset,auth.password_changed,auth.email_verified,auth.mfa_enabled,auth.mfa_disabled,auth.account_locked,auth.account_unlocked,authz.permission_granted,authz.permission_revoked,authz.role_assigned,authz.role_removed,authz.role_created,authz.role_updated,authz.role_deleted,authz.policy_created,authz.policy_updated,authz.policy_deleted,system.config_changed,system.plugin_installed,system.plugin_uninstalled,system.backup_created,system.backup_restored,system.integration_added,system.integration_removed,security.access_denied,security.suspicious_activity,security.data_breach,security.api_key_created,security.api_key_revoked`.split(`,`)),tP=x([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),nP=l({type:x([`user`,`system`,`service`,`api_client`,`integration`]).describe(`Actor type`),id:o().describe(`Actor identifier`),name:o().optional().describe(`Actor display name`),email:o().email().optional().describe(`Actor email address`),ipAddress:o().optional().describe(`Actor IP address`),userAgent:o().optional().describe(`User agent string`)}),rP=l({type:o().describe(`Target type`),id:o().describe(`Target identifier`),name:o().optional().describe(`Target display name`),metadata:u(o(),b()).optional().describe(`Target metadata`)}),iP=l({field:o().describe(`Changed field name`),oldValue:b().optional().describe(`Previous value`),newValue:b().optional().describe(`New value`)}),Oce=l({id:o().describe(`Audit event ID`),eventType:eP.describe(`Event type`),severity:tP.default(`info`).describe(`Event severity`),timestamp:o().datetime().describe(`Event timestamp`),actor:nP.describe(`Event actor`),target:rP.optional().describe(`Event target`),description:o().describe(`Event description`),changes:S(iP).optional().describe(`List of changes`),result:x([`success`,`failure`,`partial`]).default(`success`).describe(`Action result`),errorMessage:o().optional().describe(`Error message`),tenantId:o().optional().describe(`Tenant identifier`),requestId:o().optional().describe(`Request ID for tracing`),metadata:u(o(),b()).optional().describe(`Additional metadata`),location:l({country:o().optional(),region:o().optional(),city:o().optional()}).optional().describe(`Geographic location`)}),aP=l({retentionDays:A().int().min(1).default(180).describe(`Retention period in days`),archiveAfterRetention:v().default(!0).describe(`Archive logs after retention period`),archiveStorage:l({type:x([`s3`,`gcs`,`azure_blob`,`filesystem`]).describe(`Archive storage type`),endpoint:o().optional().describe(`Storage endpoint URL`),bucket:o().optional().describe(`Storage bucket/container name`),path:o().optional().describe(`Storage path prefix`),credentials:u(o(),b()).optional().describe(`Storage credentials`)}).optional().describe(`Archive storage configuration`),customRetention:u(o(),A().int().positive()).optional().describe(`Custom retention by event type`),minimumRetentionDays:A().int().positive().optional().describe(`Minimum retention for compliance`)}),oP=l({id:o().describe(`Rule identifier`),name:o().describe(`Rule name`),description:o().optional().describe(`Rule description`),enabled:v().default(!0).describe(`Rule enabled status`),eventTypes:S(eP).describe(`Event types to monitor`),condition:l({threshold:A().int().positive().describe(`Event threshold`),windowSeconds:A().int().positive().describe(`Time window in seconds`),groupBy:S(o()).optional().describe(`Grouping criteria`),filters:u(o(),b()).optional().describe(`Additional filters`)}).describe(`Detection condition`),actions:S(x([`alert`,`lock_account`,`block_ip`,`require_mfa`,`log_critical`,`webhook`])).describe(`Actions to take`),alertSeverity:tP.default(`warning`).describe(`Alert severity`),notifications:l({email:S(o().email()).optional().describe(`Email recipients`),slack:o().url().optional().describe(`Slack webhook URL`),webhook:o().url().optional().describe(`Custom webhook URL`)}).optional().describe(`Notification configuration`)}),sP=l({type:x([`database`,`elasticsearch`,`mongodb`,`clickhouse`,`s3`,`gcs`,`azure_blob`,`custom`]).describe(`Storage backend type`),connectionString:o().optional().describe(`Connection string`),config:u(o(),b()).optional().describe(`Storage-specific configuration`),bufferEnabled:v().default(!0).describe(`Enable buffering`),bufferSize:A().int().positive().default(100).describe(`Buffer size`),flushIntervalSeconds:A().int().positive().default(5).describe(`Flush interval in seconds`),compression:v().default(!0).describe(`Enable compression`)}),kce=l({eventTypes:S(eP).optional().describe(`Event types to include`),severities:S(tP).optional().describe(`Severity levels to include`),actorId:o().optional().describe(`Actor identifier`),tenantId:o().optional().describe(`Tenant identifier`),timeRange:l({from:o().datetime().describe(`Start time`),to:o().datetime().describe(`End time`)}).optional().describe(`Time range filter`),result:x([`success`,`failure`,`partial`]).optional().describe(`Result status`),searchQuery:o().optional().describe(`Search query`),customFilters:u(o(),b()).optional().describe(`Custom filters`)}),Ace=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:o().describe(`Display label`),enabled:v().default(!0).describe(`Enable audit logging`),eventTypes:S(eP).optional().describe(`Event types to audit`),excludeEventTypes:S(eP).optional().describe(`Event types to exclude`),minimumSeverity:tP.default(`info`).describe(`Minimum severity level`),storage:sP.describe(`Storage configuration`),retentionPolicy:aP.optional().describe(`Retention policy`),suspiciousActivityRules:S(oP).default([]).describe(`Suspicious activity rules`),includeSensitiveData:v().default(!1).describe(`Include sensitive data`),redactFields:S(o()).default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`]).describe(`Fields to redact`),logReads:v().default(!1).describe(`Log read operations`),readSamplingRate:A().min(0).max(1).default(.1).describe(`Read sampling rate`),logSystemEvents:v().default(!0).describe(`Log system events`),customHandlers:S(l({eventType:eP.describe(`Event type to handle`),handlerId:o().describe(`Unique identifier for the handler`)})).optional().describe(`Custom event handler references`),compliance:l({standards:S(x([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),immutableLogs:v().default(!0).describe(`Enforce immutable logs`),requireSigning:v().default(!1).describe(`Require log signing`),signingKey:o().optional().describe(`Signing key`)}).optional().describe(`Compliance configuration`)}),jce=[{id:`multiple_failed_logins`,name:`Multiple Failed Login Attempts`,description:`Detects multiple failed login attempts from the same user or IP`,enabled:!0,eventTypes:[`auth.login_failed`],condition:{threshold:5,windowSeconds:600,groupBy:[`actor.id`,`actor.ipAddress`]},actions:[`alert`,`lock_account`],alertSeverity:`warning`},{id:`bulk_data_export`,name:`Bulk Data Export`,description:`Detects large data export operations`,enabled:!0,eventTypes:[`data.export`],condition:{threshold:3,windowSeconds:3600,groupBy:[`actor.id`]},actions:[`alert`,`log_critical`],alertSeverity:`warning`},{id:`suspicious_permission_changes`,name:`Rapid Permission Changes`,description:`Detects rapid permission or role changes`,enabled:!0,eventTypes:[`authz.permission_granted`,`authz.role_assigned`],condition:{threshold:10,windowSeconds:300,groupBy:[`actor.id`]},actions:[`alert`,`log_critical`],alertSeverity:`critical`},{id:`after_hours_access`,name:`After Hours Access`,description:`Detects access during non-business hours`,enabled:!1,eventTypes:[`auth.login`],condition:{threshold:1,windowSeconds:86400},actions:[`alert`],alertSeverity:`notice`}],cP=x([`debug`,`info`,`warn`,`error`,`fatal`,`silent`]).describe(`Log severity level`),lP=x([`json`,`text`,`pretty`]).describe(`Log output format`),uP=l({name:o().optional().describe(`Logger name identifier`),level:cP.optional().default(`info`),format:lP.optional().default(`json`),redact:S(o()).optional().default([`password`,`token`,`secret`,`key`]).describe(`Keys to redact from log context`),sourceLocation:v().optional().default(!1).describe(`Include file and line number`),file:o().optional().describe(`Path to log file`),rotation:l({maxSize:o().optional().default(`10m`),maxFiles:A().optional().default(5)}).optional()}),Mce=l({timestamp:o().datetime().describe(`ISO 8601 timestamp`),level:cP,message:o().describe(`Log message`),context:u(o(),b()).optional().describe(`Structured context data`),error:u(o(),b()).optional().describe(`Error object if present`),traceId:o().optional().describe(`Distributed trace ID`),spanId:o().optional().describe(`Span ID`),service:o().optional().describe(`Service name`),component:o().optional().describe(`Component name (e.g. plugin id)`)}),dP=x([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]).describe(`Extended log severity level`),fP=x([`console`,`file`,`syslog`,`elasticsearch`,`cloudwatch`,`stackdriver`,`azure_monitor`,`datadog`,`splunk`,`loki`,`http`,`kafka`,`redis`,`custom`]).describe(`Log destination type`),pP=l({stream:x([`stdout`,`stderr`]).optional().default(`stdout`),colors:v().optional().default(!0),prettyPrint:v().optional().default(!1)}).describe(`Console destination configuration`),mP=l({path:o().describe(`Log file path`),rotation:l({maxSize:o().optional().default(`10m`),maxFiles:A().int().positive().optional().default(5),compress:v().optional().default(!0),interval:x([`hourly`,`daily`,`weekly`,`monthly`]).optional()}).optional(),encoding:o().optional().default(`utf8`),append:v().optional().default(!0)}).describe(`File destination configuration`),hP=l({url:o().url().describe(`HTTP endpoint URL`),method:x([`POST`,`PUT`]).optional().default(`POST`),headers:u(o(),o()).optional(),auth:l({type:x([`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:o().optional(),password:o().optional(),token:o().optional(),apiKey:o().optional(),apiKeyHeader:o().optional().default(`X-API-Key`)}).optional(),batch:l({maxSize:A().int().positive().optional().default(100),flushInterval:A().int().positive().optional().default(5e3)}).optional(),retry:l({maxAttempts:A().int().positive().optional().default(3),initialDelay:A().int().positive().optional().default(1e3),backoffMultiplier:A().positive().optional().default(2)}).optional(),timeout:A().int().positive().optional().default(3e4)}).describe(`HTTP destination configuration`),gP=l({endpoint:o().url().optional(),region:o().optional(),credentials:l({accessKeyId:o().optional(),secretAccessKey:o().optional(),apiKey:o().optional(),projectId:o().optional()}).optional(),logGroup:o().optional(),logStream:o().optional(),index:o().optional(),config:u(o(),b()).optional()}).describe(`External service destination configuration`),_P=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Destination name (snake_case)`),type:fP.describe(`Destination type`),level:dP.optional().default(`info`),enabled:v().optional().default(!0),console:pP.optional(),file:mP.optional(),http:hP.optional(),externalService:gP.optional(),format:x([`json`,`text`,`pretty`]).optional().default(`json`),filterId:o().optional().describe(`Filter function identifier`)}).describe(`Log destination configuration`),vP=l({staticFields:u(o(),b()).optional().describe(`Static fields added to every log`),dynamicEnrichers:S(o()).optional().describe(`Dynamic enricher function IDs`),addHostname:v().optional().default(!0),addProcessId:v().optional().default(!0),addEnvironment:v().optional().default(!0),addTimestampFormats:l({unix:v().optional().default(!1),iso:v().optional().default(!0)}).optional(),addCaller:v().optional().default(!1),addCorrelationIds:v().optional().default(!0)}).describe(`Log enrichment configuration`),Nce=l({timestamp:o().datetime().describe(`ISO 8601 timestamp`),level:dP.describe(`Log severity level`),message:o().describe(`Log message`),context:u(o(),b()).optional().describe(`Structured context`),error:l({name:o().optional(),message:o().optional(),stack:o().optional(),code:o().optional(),details:u(o(),b()).optional()}).optional().describe(`Error details`),trace:l({traceId:o().describe(`Trace ID`),spanId:o().describe(`Span ID`),parentSpanId:o().optional().describe(`Parent span ID`),traceFlags:A().int().optional().describe(`Trace flags`)}).optional().describe(`Distributed tracing context`),source:l({service:o().optional().describe(`Service name`),component:o().optional().describe(`Component name`),file:o().optional().describe(`Source file`),line:A().int().optional().describe(`Line number`),function:o().optional().describe(`Function name`)}).optional().describe(`Source information`),host:l({hostname:o().optional(),pid:A().int().optional(),ip:o().optional()}).optional().describe(`Host information`),environment:o().optional().describe(`Environment (e.g., production, staging)`),user:l({id:o().optional(),username:o().optional(),email:o().optional()}).optional().describe(`User context`),request:l({id:o().optional(),method:o().optional(),path:o().optional(),userAgent:o().optional(),ip:o().optional()}).optional().describe(`Request context`),labels:u(o(),o()).optional().describe(`Custom labels`),metadata:u(o(),b()).optional().describe(`Additional metadata`)}).describe(`Structured log entry`),Pce=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:o().describe(`Display label`),enabled:v().optional().default(!0),level:dP.optional().default(`info`),default:uP.optional().describe(`Default logger configuration`),loggers:u(o(),uP).optional().describe(`Named logger configurations`),destinations:S(_P).describe(`Log destinations`),enrichment:vP.optional(),redact:S(o()).optional().default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`,`authorization`]).describe(`Fields to redact`),sampling:l({enabled:v().optional().default(!1),rate:A().min(0).max(1).optional().default(1),rateByLevel:u(o(),A().min(0).max(1)).optional()}).optional(),buffer:l({enabled:v().optional().default(!0),size:A().int().positive().optional().default(1e3),flushInterval:A().int().positive().optional().default(1e3),flushOnShutdown:v().optional().default(!0)}).optional(),performance:l({async:v().optional().default(!0),workers:A().int().positive().optional().default(1)}).optional()}).describe(`Logging configuration`),yP=x([`counter`,`gauge`,`histogram`,`summary`]).describe(`Metric type`),bP=x([`nanoseconds`,`microseconds`,`milliseconds`,`seconds`,`minutes`,`hours`,`days`,`bytes`,`kilobytes`,`megabytes`,`gigabytes`,`terabytes`,`requests_per_second`,`events_per_second`,`bytes_per_second`,`percent`,`ratio`,`count`,`operations`,`custom`]).describe(`Metric unit`),xP=x([`sum`,`avg`,`min`,`max`,`count`,`p50`,`p75`,`p90`,`p95`,`p99`,`p999`,`rate`,`stddev`]).describe(`Metric aggregation type`),SP=l({type:x([`linear`,`exponential`,`explicit`]).describe(`Bucket type`),linear:l({start:A().describe(`Start value`),width:A().positive().describe(`Bucket width`),count:A().int().positive().describe(`Number of buckets`)}).optional(),exponential:l({start:A().positive().describe(`Start value`),factor:A().positive().describe(`Growth factor`),count:A().int().positive().describe(`Number of buckets`)}).optional(),explicit:l({boundaries:S(A()).describe(`Bucket boundaries`)}).optional()}).describe(`Histogram bucket configuration`),CP=u(o(),o()).describe(`Metric labels`),wP=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Metric name (snake_case)`),label:o().optional().describe(`Display label`),type:yP.describe(`Metric type`),unit:bP.optional().describe(`Metric unit`),description:o().optional().describe(`Metric description`),labelNames:S(o()).optional().default([]).describe(`Label names`),histogram:SP.optional(),summary:l({quantiles:S(A().min(0).max(1)).optional().default([.5,.9,.99]),maxAge:A().int().positive().optional().default(600),ageBuckets:A().int().positive().optional().default(5)}).optional(),enabled:v().optional().default(!0)}).describe(`Metric definition`),Fce=l({name:o().describe(`Metric name`),type:yP.describe(`Metric type`),timestamp:o().datetime().describe(`Observation timestamp`),value:A().optional().describe(`Metric value`),labels:CP.optional().describe(`Metric labels`),histogram:l({count:A().int().nonnegative().describe(`Total count`),sum:A().describe(`Sum of all values`),buckets:S(l({upperBound:A().describe(`Upper bound of bucket`),count:A().int().nonnegative().describe(`Count in bucket`)})).describe(`Histogram buckets`)}).optional(),summary:l({count:A().int().nonnegative().describe(`Total count`),sum:A().describe(`Sum of all values`),quantiles:S(l({quantile:A().min(0).max(1).describe(`Quantile (0-1)`),value:A().describe(`Quantile value`)})).describe(`Summary quantiles`)}).optional()}).describe(`Metric data point`),TP=l({timestamp:o().datetime().describe(`Timestamp`),value:A().describe(`Value`),labels:u(o(),o()).optional().describe(`Labels`)}).describe(`Time series data point`),Ice=l({name:o().describe(`Series name`),labels:u(o(),o()).optional().describe(`Series labels`),dataPoints:S(TP).describe(`Data points`),startTime:o().datetime().optional().describe(`Start time`),endTime:o().datetime().optional().describe(`End time`)}).describe(`Time series`),EP=l({type:xP.describe(`Aggregation type`),window:l({size:A().int().positive().describe(`Window size in seconds`),sliding:v().optional().default(!1),slideInterval:A().int().positive().optional()}).optional(),groupBy:S(o()).optional().describe(`Group by label names`),filters:u(o(),b()).optional().describe(`Filter criteria`)}).describe(`Metric aggregation configuration`),DP=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLI name (snake_case)`),label:o().describe(`Display label`),description:o().optional().describe(`SLI description`),metric:o().describe(`Base metric name`),type:x([`availability`,`latency`,`throughput`,`error_rate`,`saturation`,`custom`]).describe(`SLI type`),successCriteria:l({threshold:A().describe(`Threshold value`),operator:x([`lt`,`lte`,`gt`,`gte`,`eq`]).describe(`Comparison operator`),percentile:A().min(0).max(1).optional().describe(`Percentile (0-1)`)}).describe(`Success criteria`),window:l({size:A().int().positive().describe(`Window size in seconds`),rolling:v().optional().default(!0)}).describe(`Measurement window`),enabled:v().optional().default(!0)}).describe(`Service Level Indicator`),OP=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLO name (snake_case)`),label:o().describe(`Display label`),description:o().optional().describe(`SLO description`),sli:o().describe(`SLI name`),target:A().min(0).max(100).describe(`Target percentage`),period:l({type:x([`rolling`,`calendar`]).describe(`Period type`),duration:A().int().positive().optional().describe(`Duration in seconds`),calendar:x([`daily`,`weekly`,`monthly`,`quarterly`,`yearly`]).optional()}).describe(`Time period`),errorBudget:l({enabled:v().optional().default(!0),alertThreshold:A().min(0).max(100).optional().default(80),burnRateWindows:S(l({window:A().int().positive().describe(`Window size`),threshold:A().positive().describe(`Burn rate threshold`)})).optional()}).optional(),alerts:S(l({name:o().describe(`Alert name`),severity:x([`info`,`warning`,`critical`]).describe(`Alert severity`),condition:l({type:x([`slo_breach`,`error_budget`,`burn_rate`]).describe(`Condition type`),threshold:A().optional().describe(`Threshold value`)}).describe(`Alert condition`)})).optional().default([]),enabled:v().optional().default(!0)}).describe(`Service Level Objective`),kP=l({type:x([`prometheus`,`openmetrics`,`graphite`,`statsd`,`influxdb`,`datadog`,`cloudwatch`,`stackdriver`,`azure_monitor`,`http`,`custom`]).describe(`Export type`),endpoint:o().optional().describe(`Export endpoint`),interval:A().int().positive().optional().default(60),batch:l({enabled:v().optional().default(!0),size:A().int().positive().optional().default(1e3)}).optional(),auth:l({type:x([`none`,`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:o().optional(),password:o().optional(),token:o().optional(),apiKey:o().optional()}).optional(),config:u(o(),b()).optional().describe(`Additional configuration`)}).describe(`Metric export configuration`),Lce=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:o().describe(`Display label`),enabled:v().optional().default(!0),metrics:S(wP).optional().default([]),defaultLabels:CP.optional().default({}),aggregations:S(EP).optional().default([]),slis:S(DP).optional().default([]),slos:S(OP).optional().default([]),exports:S(kP).optional().default([]),collectionInterval:A().int().positive().optional().default(15),retention:l({period:A().int().positive().optional().default(604800),downsampling:S(l({afterSeconds:A().int().positive().describe(`Downsample after seconds`),resolution:A().int().positive().describe(`Downsampled resolution`)})).optional()}).optional(),cardinalityLimits:l({maxLabelCombinations:A().int().positive().optional().default(1e4),onLimitExceeded:x([`drop`,`sample`,`alert`]).optional().default(`alert`)}).optional()}).describe(`Metrics configuration`),AP=l({entries:u(o(),o()).describe(`Trace state entries`)}).describe(`Trace state`),jP=A().int().min(0).max(255).describe(`Trace flags bitmap`),MP=l({traceId:o().regex(/^[0-9a-f]{32}$/).describe(`Trace ID (32 hex chars)`),spanId:o().regex(/^[0-9a-f]{16}$/).describe(`Span ID (16 hex chars)`),traceFlags:jP.optional().default(1),traceState:AP.optional(),parentSpanId:o().regex(/^[0-9a-f]{16}$/).optional().describe(`Parent span ID (16 hex chars)`),sampled:v().optional().default(!0),remote:v().optional().default(!1)}).describe(`Trace context (W3C Trace Context)`),NP=x([`internal`,`server`,`client`,`producer`,`consumer`]).describe(`Span kind`),PP=x([`unset`,`ok`,`error`]).describe(`Span status`),FP=c([o(),A(),v(),S(o()),S(A()),S(v())]).describe(`Span attribute value`),IP=u(o(),FP).describe(`Span attributes`),LP=l({name:o().describe(`Event name`),timestamp:o().datetime().describe(`Event timestamp`),attributes:IP.optional().describe(`Event attributes`)}).describe(`Span event`),RP=l({context:MP.describe(`Linked trace context`),attributes:IP.optional().describe(`Link attributes`)}).describe(`Span link`),Rce=l({context:MP.describe(`Trace context`),name:o().describe(`Span name`),kind:NP.optional().default(`internal`),startTime:o().datetime().describe(`Span start time`),endTime:o().datetime().optional().describe(`Span end time`),duration:A().nonnegative().optional().describe(`Duration in milliseconds`),status:l({code:PP.describe(`Status code`),message:o().optional().describe(`Status message`)}).optional(),attributes:IP.optional().default({}),events:S(LP).optional().default([]),links:S(RP).optional().default([]),resource:IP.optional().describe(`Resource attributes`),instrumentationLibrary:l({name:o().describe(`Library name`),version:o().optional().describe(`Library version`)}).optional()}).describe(`OpenTelemetry span`),zP=x([`drop`,`record_only`,`record_and_sample`]).describe(`Sampling decision`),BP=x([`always_on`,`always_off`,`trace_id_ratio`,`rate_limiting`,`parent_based`,`probability`,`composite`,`custom`]).describe(`Sampling strategy type`),VP=l({type:BP.describe(`Sampling strategy`),ratio:A().min(0).max(1).optional().describe(`Sample ratio (0-1)`),rateLimit:A().positive().optional().describe(`Traces per second`),parentBased:l({whenParentSampled:BP.optional().default(`always_on`),whenParentNotSampled:BP.optional().default(`always_off`),root:BP.optional().default(`trace_id_ratio`),rootRatio:A().min(0).max(1).optional().default(.1)}).optional(),composite:S(l({strategy:BP.describe(`Strategy type`),ratio:A().min(0).max(1).optional(),condition:u(o(),b()).optional().describe(`Condition for this strategy`)})).optional(),rules:S(l({name:o().describe(`Rule name`),match:l({service:o().optional(),spanName:o().optional(),attributes:u(o(),b()).optional()}).optional(),decision:zP.describe(`Sampling decision`),rate:A().min(0).max(1).optional()})).optional().default([]),customSamplerId:o().optional().describe(`Custom sampler identifier`)}).describe(`Trace sampling configuration`),HP=x([`w3c`,`b3`,`b3_multi`,`jaeger`,`xray`,`ottrace`,`custom`]).describe(`Trace propagation format`),UP=l({formats:S(HP).optional().default([`w3c`]),extract:v().optional().default(!0),inject:v().optional().default(!0),headers:l({traceId:o().optional(),spanId:o().optional(),traceFlags:o().optional(),traceState:o().optional()}).optional(),baggage:l({enabled:v().optional().default(!0),maxSize:A().int().positive().optional().default(8192),allowedKeys:S(o()).optional()}).optional()}).describe(`Trace context propagation`),WP=x([`otlp_http`,`otlp_grpc`,`jaeger`,`zipkin`,`console`,`datadog`,`honeycomb`,`lightstep`,`newrelic`,`custom`]).describe(`OpenTelemetry exporter type`),GP=l({sdkVersion:o().optional().describe(`OTel SDK version`),exporter:l({type:WP.describe(`Exporter type`),endpoint:o().url().optional().describe(`Exporter endpoint`),protocol:o().optional().describe(`Protocol version`),headers:u(o(),o()).optional().describe(`HTTP headers`),timeout:A().int().positive().optional().default(1e4),compression:x([`none`,`gzip`]).optional().default(`none`),batch:l({maxBatchSize:A().int().positive().optional().default(512),maxQueueSize:A().int().positive().optional().default(2048),exportTimeout:A().int().positive().optional().default(3e4),scheduledDelay:A().int().positive().optional().default(5e3)}).optional()}).describe(`Exporter configuration`),resource:l({serviceName:o().describe(`Service name`),serviceVersion:o().optional().describe(`Service version`),serviceInstanceId:o().optional().describe(`Service instance ID`),serviceNamespace:o().optional().describe(`Service namespace`),deploymentEnvironment:o().optional().describe(`Deployment environment`),attributes:IP.optional().describe(`Additional resource attributes`)}).describe(`Resource attributes`),instrumentation:l({autoInstrumentation:v().optional().default(!0),libraries:S(o()).optional().describe(`Enabled libraries`),disabledLibraries:S(o()).optional().describe(`Disabled libraries`)}).optional(),semanticConventionsVersion:o().optional().describe(`Semantic conventions version`)}).describe(`OpenTelemetry compatibility configuration`),KP=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:o().describe(`Display label`),enabled:v().optional().default(!0),sampling:VP.optional().default({type:`always_on`,rules:[]}),propagation:UP.optional().default({formats:[`w3c`],extract:!0,inject:!0}),openTelemetry:GP.optional(),spanLimits:l({maxAttributes:A().int().positive().optional().default(128),maxEvents:A().int().positive().optional().default(128),maxLinks:A().int().positive().optional().default(128),maxAttributeValueLength:A().int().positive().optional().default(4096)}).optional(),traceIdGenerator:x([`random`,`uuid`,`custom`]).optional().default(`random`),customTraceIdGeneratorId:o().optional().describe(`Custom generator identifier`),performance:l({asyncExport:v().optional().default(!0),exportInterval:A().int().positive().optional().default(5e3)}).optional()}).describe(`Tracing configuration`),qP=x([`pii`,`phi`,`pci`,`financial`,`confidential`,`internal`,`public`]).describe(`Data classification level`),JP=x([`gdpr`,`hipaa`,`sox`,`pci_dss`,`ccpa`,`iso27001`]).describe(`Compliance framework identifier`),YP=l({framework:JP.describe(`Compliance framework identifier`),requiredEvents:S(o()).describe(`Audit event types required by this framework (e.g., "data.delete", "auth.login")`),retentionDays:A().min(1).describe(`Minimum audit log retention period required by this framework (in days)`),alertOnMissing:v().default(!0).describe(`Raise alert if a required audit event is not being captured`)}).describe(`Compliance framework audit event requirements`),XP=l({framework:JP.describe(`Compliance framework identifier`),dataClassifications:S(qP).describe(`Data classifications that must be encrypted under this framework`),minimumAlgorithm:x([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).default(`aes-256-gcm`).describe(`Minimum encryption algorithm strength required`),keyRotationMaxDays:A().min(1).default(90).describe(`Maximum key rotation interval required (in days)`)}).describe(`Compliance framework encryption requirements`),ZP=l({dataClassification:qP.describe(`Data classification this rule applies to`),defaultMasked:v().default(!0).describe(`Whether data is masked by default`),unmaskRoles:S(o()).optional().describe(`Roles allowed to view unmasked data`),auditUnmask:v().default(!0).describe(`Log an audit event when data is unmasked`),requireApproval:v().default(!1).describe(`Require explicit approval before unmasking`),approvalRoles:S(o()).optional().describe(`Roles that can approve unmasking requests`)}).describe(`Masking visibility and audit rule per data classification`),QP=l({enabled:v().default(!0).describe(`Enable cross-subsystem security event correlation`),correlationId:v().default(!0).describe(`Inject a shared correlation ID into audit, encryption, and masking events`),linkAuthToAudit:v().default(!0).describe(`Link authentication events to subsequent data operation audit trails`),linkEncryptionToAudit:v().default(!0).describe(`Log encryption/decryption operations in the audit trail`),linkMaskingToAudit:v().default(!0).describe(`Log masking/unmasking operations in the audit trail`)}).describe(`Cross-subsystem security event correlation configuration`),$P=l({classification:qP.describe(`Data classification level`),requireEncryption:v().default(!1).describe(`Encryption required for this classification`),requireMasking:v().default(!1).describe(`Masking required for this classification`),requireAudit:v().default(!1).describe(`Audit trail required for access to this classification`),retentionDays:A().optional().describe(`Data retention limit in days (for compliance)`)}).describe(`Security policy for a specific data classification level`),eF=l({enabled:v().default(!0).describe(`Enable unified security context governance`),complianceAuditRequirements:S(YP).optional().describe(`Compliance-driven audit event requirements`),complianceEncryptionRequirements:S(XP).optional().describe(`Compliance-driven encryption requirements by data classification`),maskingVisibility:S(ZP).optional().describe(`Masking visibility rules per data classification`),dataClassifications:S($P).optional().describe(`Data classification policies for unified security enforcement`),eventCorrelation:QP.optional().describe(`Cross-subsystem security event correlation settings`),enforceOnWrite:v().default(!0).describe(`Enforce encryption and masking requirements on data write operations`),enforceOnRead:v().default(!0).describe(`Enforce masking and audit requirements on data read operations`),failOpen:v().default(!1).describe(`When false (default), deny access if security context cannot be evaluated`)}).describe(`Unified security context governance configuration`),tF=x([`standard`,`normal`,`emergency`,`major`]),nF=x([`critical`,`high`,`medium`,`low`]),rF=x([`draft`,`submitted`,`in-review`,`approved`,`scheduled`,`in-progress`,`completed`,`failed`,`rolled-back`,`cancelled`]),iF=l({level:x([`low`,`medium`,`high`,`critical`]).describe(`Impact level`),affectedSystems:S(o()).describe(`Affected systems`),affectedUsers:A().optional().describe(`Affected user count`),downtime:l({required:v().describe(`Downtime required`),durationMinutes:A().optional().describe(`Downtime duration`)}).optional().describe(`Downtime information`)}),aF=l({description:o().describe(`Rollback description`),steps:S(l({order:A().describe(`Step order`),description:o().describe(`Step description`),estimatedMinutes:A().describe(`Estimated duration`)})).describe(`Rollback steps`),testProcedure:o().optional().describe(`Test procedure`)}),oF=l({id:o().describe(`Change request ID`),title:o().describe(`Change title`),description:o().describe(`Change description`),type:tF.describe(`Change type`),priority:nF.describe(`Change priority`),status:rF.describe(`Change status`),requestedBy:o().describe(`Requester user ID`),requestedAt:A().describe(`Request timestamp`),impact:iF.describe(`Impact assessment`),implementation:l({description:o().describe(`Implementation description`),steps:S(l({order:A().describe(`Step order`),description:o().describe(`Step description`),estimatedMinutes:A().describe(`Estimated duration`)})).describe(`Implementation steps`),testing:o().optional().describe(`Testing procedure`)}).describe(`Implementation plan`),rollbackPlan:aF.describe(`Rollback plan`),schedule:l({plannedStart:A().describe(`Planned start time`),plannedEnd:A().describe(`Planned end time`),actualStart:A().optional().describe(`Actual start time`),actualEnd:A().optional().describe(`Actual end time`)}).optional().describe(`Schedule`),securityImpact:l({assessed:v().describe(`Whether security impact has been assessed`),riskLevel:x([`none`,`low`,`medium`,`high`,`critical`]).optional().describe(`Security risk level`),affectedDataClassifications:S(qP).optional().describe(`Affected data classifications`),requiresSecurityApproval:v().default(!1).describe(`Whether security team approval is required`),reviewedBy:o().optional().describe(`Security reviewer user ID`),reviewedAt:A().optional().describe(`Security review timestamp`),reviewNotes:o().optional().describe(`Security review notes or conditions`)}).optional().describe(`Security impact assessment per ISO 27001:2022 A.8.32`),approval:l({required:v().describe(`Approval required`),approvers:S(l({userId:o().describe(`Approver user ID`),approvedAt:A().optional().describe(`Approval timestamp`),comments:o().optional().describe(`Approver comments`)})).describe(`Approvers`)}).optional().describe(`Approval workflow`),attachments:S(l({name:o().describe(`Attachment name`),url:o().url().describe(`Attachment URL`)})).optional().describe(`Attachments`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}),sF=l({type:p(`add_field`),objectName:o().describe(`Target object name`),fieldName:o().describe(`Name of the field to add`),field:tD.describe(`Full field definition to add`)}).describe(`Add a new field to an existing object`),cF=l({type:p(`modify_field`),objectName:o().describe(`Target object name`),fieldName:o().describe(`Name of the field to modify`),changes:u(o(),b()).describe(`Partial field definition updates`)}).describe(`Modify properties of an existing field`),lF=l({type:p(`remove_field`),objectName:o().describe(`Target object name`),fieldName:o().describe(`Name of the field to remove`)}).describe(`Remove a field from an existing object`),uF=l({type:p(`create_object`),object:mO.describe(`Full object definition to create`)}).describe(`Create a new object`),dF=l({type:p(`rename_object`),oldName:o().describe(`Current object name`),newName:o().describe(`New object name`)}).describe(`Rename an existing object`),fF=l({type:p(`delete_object`),objectName:o().describe(`Name of the object to delete`)}).describe(`Delete an existing object`),pF=l({type:p(`execute_sql`),sql:o().describe(`Raw SQL statement to execute`),description:o().optional().describe(`Human-readable description of the SQL`)}).describe(`Execute a raw SQL statement`),mF=d(`type`,[sF,cF,lF,uF,dF,fF,pF]),hF=l({migrationId:o().describe(`ID of the migration this depends on`),package:o().optional().describe(`Package that owns the dependency migration`)}).describe(`Dependency reference to another migration that must run first`),gF=l({id:o().uuid().describe(`Unique identifier for this change set`),name:o().describe(`Human readable name for the migration`),description:o().optional().describe(`Detailed description of what this migration does`),author:o().optional().describe(`Author who created this migration`),createdAt:o().datetime().optional().describe(`ISO 8601 timestamp when the migration was created`),dependencies:S(hF).optional().describe(`Migrations that must run before this one`),operations:S(mF).describe(`Ordered list of atomic migration operations`),rollback:S(mF).optional().describe(`Operations to reverse this migration`)}).describe(`A versioned set of atomic schema migration operations`),_F=l({id:o().describe(`Provider ID (github, google)`),clientId:o().describe(`OAuth Client ID`),clientSecret:o().describe(`OAuth Client Secret`),scope:S(o()).optional().describe(`Requested permissions`)}),vF=l({organization:v().default(!1).describe(`Enable Organization/Teams support`),twoFactor:v().default(!1).describe(`Enable 2FA`),passkeys:v().default(!1).describe(`Enable Passkey support`),magicLink:v().default(!1).describe(`Enable Magic Link login`)}),yF=l({enabled:v().default(!1).describe(`Enable mutual TLS authentication`),clientCertRequired:v().default(!1).describe(`Require client certificates for all connections`),trustedCAs:S(o()).describe(`PEM-encoded CA certificates or file paths`),crlUrl:o().optional().describe(`Certificate Revocation List (CRL) URL`),ocspUrl:o().optional().describe(`Online Certificate Status Protocol (OCSP) URL`),certificateValidation:x([`strict`,`relaxed`,`none`]).describe(`Certificate validation strictness level`),allowedCNs:S(o()).optional().describe(`Allowed Common Names (CN) on client certificates`),allowedOUs:S(o()).optional().describe(`Allowed Organizational Units (OU) on client certificates`),pinning:l({enabled:v().describe(`Enable certificate pinning`),pins:S(o()).describe(`Pinned certificate hashes`)}).optional().describe(`Certificate pinning configuration`)}),bF=u(o(),l({clientId:o().describe(`OAuth Client ID`),clientSecret:o().describe(`OAuth Client Secret`),enabled:v().optional().default(!0).describe(`Enable this provider`),scope:S(o()).optional().describe(`Additional OAuth scopes`)}).catchall(b())).optional().describe(`Social/OAuth provider map forwarded to better-auth socialProviders. Keys are provider ids (google, github, apple, …).`),xF=l({enabled:v().default(!0).describe(`Enable email/password auth`),disableSignUp:v().optional().describe(`Disable new user registration via email/password`),requireEmailVerification:v().optional().describe(`Require email verification before creating a session`),minPasswordLength:A().optional().describe(`Minimum password length (default 8)`),maxPasswordLength:A().optional().describe(`Maximum password length (default 128)`),resetPasswordTokenExpiresIn:A().optional().describe(`Reset-password token TTL in seconds (default 3600)`),autoSignIn:v().optional().describe(`Auto sign-in after sign-up (default true)`),revokeSessionsOnPasswordReset:v().optional().describe(`Revoke all other sessions on password reset`)}).optional().describe(`Email and password authentication options forwarded to better-auth`),SF=l({sendOnSignUp:v().optional().describe(`Automatically send verification email after sign-up`),sendOnSignIn:v().optional().describe(`Send verification email on sign-in when not yet verified`),autoSignInAfterVerification:v().optional().describe(`Auto sign-in the user after email verification`),expiresIn:A().optional().describe(`Verification token TTL in seconds (default 3600)`)}).optional().describe(`Email verification options forwarded to better-auth`),CF=l({crossSubDomainCookies:l({enabled:v().describe(`Enable cross-subdomain cookies`),additionalCookies:S(o()).optional().describe(`Extra cookies shared across subdomains`),domain:o().optional().describe(`Cookie domain override — defaults to root domain derived from baseUrl`)}).optional().describe(`Share auth cookies across subdomains (critical for *.example.com multi-tenant)`),useSecureCookies:v().optional().describe(`Force Secure flag on cookies`),disableCSRFCheck:v().optional().describe(`⚠ Disable CSRF check — security risk, use with caution`),cookiePrefix:o().optional().describe(`Prefix for auth cookie names`)}).optional().describe(`Advanced / low-level Better-Auth options`),wF=l({secret:o().optional().describe(`Encryption secret`),baseUrl:o().optional().describe(`Base URL for auth routes`),databaseUrl:o().optional().describe(`Database connection string`),providers:S(_F).optional(),plugins:vF.optional(),session:l({expiresIn:A().default(3600*24*7).describe(`Session duration in seconds`),updateAge:A().default(3600*24).describe(`Session update frequency`)}).optional(),trustedOrigins:S(o()).optional().describe(`Trusted origins for CSRF protection. Supports wildcards (e.g. "https://*.example.com"). The baseUrl origin is always trusted implicitly.`),socialProviders:bF,emailAndPassword:xF,emailVerification:SF,advanced:CF,mutualTls:yF.optional().describe(`Mutual TLS (mTLS) configuration`)}).catchall(b()),TF=l({enabled:v().describe(`Enable GDPR compliance controls`),dataSubjectRights:l({rightToAccess:v().default(!0).describe(`Allow data subjects to access their data`),rightToRectification:v().default(!0).describe(`Allow data subjects to correct their data`),rightToErasure:v().default(!0).describe(`Allow data subjects to request deletion`),rightToRestriction:v().default(!0).describe(`Allow data subjects to restrict processing`),rightToPortability:v().default(!0).describe(`Allow data subjects to export their data`),rightToObjection:v().default(!0).describe(`Allow data subjects to object to processing`)}).describe(`Data subject rights configuration per GDPR Articles 15-21`),legalBasis:x([`consent`,`contract`,`legal-obligation`,`vital-interests`,`public-task`,`legitimate-interests`]).describe(`Legal basis for data processing under GDPR Article 6`),consentTracking:v().default(!0).describe(`Track and record user consent`),dataRetentionDays:A().optional().describe(`Maximum data retention period in days`),dataProcessingAgreement:o().optional().describe(`URL or reference to the data processing agreement`)}).describe(`GDPR (General Data Protection Regulation) compliance configuration`),EF=l({enabled:v().describe(`Enable HIPAA compliance controls`),phi:l({encryption:v().default(!0).describe(`Encrypt Protected Health Information at rest`),accessControl:v().default(!0).describe(`Enforce role-based access to PHI`),auditTrail:v().default(!0).describe(`Log all PHI access events`),backupAndRecovery:v().default(!0).describe(`Enable PHI backup and disaster recovery`)}).describe(`Protected Health Information safeguards`),businessAssociateAgreement:v().default(!1).describe(`BAA is in place with third-party processors`)}).describe(`HIPAA (Health Insurance Portability and Accountability Act) compliance configuration`),DF=l({enabled:v().describe(`Enable PCI-DSS compliance controls`),level:x([`1`,`2`,`3`,`4`]).describe(`PCI-DSS compliance level (1 = highest)`),cardDataFields:S(o()).describe(`Field names containing cardholder data`),tokenization:v().default(!0).describe(`Replace card data with secure tokens`),encryptionInTransit:v().default(!0).describe(`Encrypt cardholder data during transmission`),encryptionAtRest:v().default(!0).describe(`Encrypt stored cardholder data`)}).describe(`PCI-DSS (Payment Card Industry Data Security Standard) compliance configuration`),OF=l({enabled:v().default(!0).describe(`Enable audit logging`),retentionDays:A().default(365).describe(`Number of days to retain audit logs`),immutable:v().default(!0).describe(`Prevent modification or deletion of audit logs`),signLogs:v().default(!1).describe(`Cryptographically sign log entries for tamper detection`),events:S(x([`create`,`read`,`update`,`delete`,`export`,`permission-change`,`login`,`logout`,`failed-login`])).describe(`Event types to capture in the audit log`)}).describe(`Audit log configuration for compliance and security monitoring`),kF=x([`critical`,`major`,`minor`,`observation`]),AF=x([`open`,`in_remediation`,`remediated`,`verified`,`accepted_risk`,`closed`]),jF=l({id:o().describe(`Unique finding identifier`),title:o().describe(`Finding title`),description:o().describe(`Finding description`),severity:kF.describe(`Finding severity`),status:AF.describe(`Finding status`),controlReference:o().optional().describe(`ISO 27001 control reference`),framework:JP.optional().describe(`Related compliance framework`),identifiedAt:A().describe(`Identification timestamp`),identifiedBy:o().describe(`Identifier (auditor name or system)`),remediationPlan:o().optional().describe(`Remediation plan`),remediationDeadline:A().optional().describe(`Remediation deadline timestamp`),verifiedAt:A().optional().describe(`Verification timestamp`),verifiedBy:o().optional().describe(`Verifier name or role`),notes:o().optional().describe(`Additional notes`)}).describe(`Audit finding with remediation tracking per ISO 27001:2022 A.5.35`),MF=l({id:o().describe(`Unique audit schedule identifier`),title:o().describe(`Audit title`),scope:S(o()).describe(`Audit scope areas`),framework:JP.describe(`Target compliance framework`),scheduledAt:A().describe(`Scheduled audit timestamp`),completedAt:A().optional().describe(`Completion timestamp`),assessor:o().describe(`Assessor or audit team`),isExternal:v().default(!1).describe(`Whether this is an external audit`),recurrenceMonths:A().default(0).describe(`Recurrence interval in months (0 = one-time)`),findings:S(jF).optional().describe(`Audit findings`)}).describe(`Audit schedule for independent security reviews per ISO 27001:2022 A.5.35`),NF=l({gdpr:TF.optional().describe(`GDPR compliance settings`),hipaa:EF.optional().describe(`HIPAA compliance settings`),pciDss:DF.optional().describe(`PCI-DSS compliance settings`),auditLog:OF.describe(`Audit log configuration`),auditSchedules:S(MF).optional().describe(`Scheduled compliance audits (A.5.35)`)}).describe(`Unified compliance configuration spanning GDPR, HIPAA, PCI-DSS, and audit governance`),PF=x([`critical`,`high`,`medium`,`low`]),FF=x([`data_breach`,`malware`,`unauthorized_access`,`denial_of_service`,`social_engineering`,`insider_threat`,`physical_security`,`configuration_error`,`vulnerability_exploit`,`policy_violation`,`other`]),IF=x([`reported`,`triaged`,`investigating`,`containing`,`eradicating`,`recovering`,`resolved`,`closed`]),LF=l({phase:x([`identification`,`containment`,`eradication`,`recovery`,`lessons_learned`]).describe(`Response phase name`),description:o().describe(`Phase description and objectives`),assignedTo:o().describe(`Responsible team or role`),targetHours:A().min(0).describe(`Target completion time in hours`),completedAt:A().optional().describe(`Actual completion timestamp`),notes:o().optional().describe(`Phase notes and findings`)}).describe(`Incident response phase with timing and assignment`),RF=l({severity:PF.describe(`Minimum severity to trigger notification`),channels:S(x([`email`,`sms`,`slack`,`pagerduty`,`webhook`])).describe(`Notification channels`),recipients:S(o()).describe(`Roles or teams to notify`),withinMinutes:A().min(1).describe(`Notification deadline in minutes from detection`),notifyRegulators:v().default(!1).describe(`Whether to notify regulatory authorities`),regulatorDeadlineHours:A().optional().describe(`Regulatory notification deadline in hours`)}).describe(`Incident notification rule per severity level`),zF=l({rules:S(RF).describe(`Notification rules by severity level`),escalationTimeoutMinutes:A().default(30).describe(`Auto-escalation timeout in minutes`),escalationChain:S(o()).default([]).describe(`Ordered escalation chain of roles`)}).describe(`Incident notification matrix with escalation policies`),BF=l({id:o().describe(`Unique incident identifier`),title:o().describe(`Incident title`),description:o().describe(`Detailed incident description`),severity:PF.describe(`Incident severity level`),category:FF.describe(`Incident category`),status:IF.describe(`Current incident status`),reportedBy:o().describe(`Reporter user ID or system name`),reportedAt:A().describe(`Report timestamp`),detectedAt:A().optional().describe(`Detection timestamp`),resolvedAt:A().optional().describe(`Resolution timestamp`),affectedSystems:S(o()).describe(`Affected systems`),affectedDataClassifications:S(qP).optional().describe(`Affected data classifications`),responsePhases:S(LF).optional().describe(`Incident response phases`),rootCause:o().optional().describe(`Root cause analysis`),correctiveActions:S(o()).optional().describe(`Corrective actions taken or planned`),lessonsLearned:o().optional().describe(`Lessons learned from the incident`),relatedChangeRequestIds:S(o()).optional().describe(`Related change request IDs`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Security incident record per ISO 27001:2022 A.5.24–A.5.28`),VF=l({enabled:v().default(!0).describe(`Enable incident response management`),notificationMatrix:zF.describe(`Notification and escalation matrix`),defaultResponseTeam:o().describe(`Default incident response team or role`),triageDeadlineHours:A().default(1).describe(`Maximum hours to begin triage after detection`),requirePostIncidentReview:v().default(!0).describe(`Require post-incident review for all incidents`),regulatoryNotificationThreshold:PF.default(`high`).describe(`Minimum severity requiring regulatory notification`),retentionDays:A().default(2555).describe(`Incident record retention period in days (default ~7 years)`)}).describe(`Organization-level incident response policy per ISO 27001:2022`),HF=x([`critical`,`high`,`medium`,`low`]),UF=x([`pending`,`in_progress`,`completed`,`expired`,`failed`]),WF=l({id:o().describe(`Requirement identifier`),description:o().describe(`Requirement description`),controlReference:o().optional().describe(`ISO 27001 control reference`),mandatory:v().default(!0).describe(`Whether this requirement is mandatory`),compliant:v().optional().describe(`Whether the supplier meets this requirement`),evidence:o().optional().describe(`Compliance evidence or assessment notes`)}).describe(`Individual supplier security requirement`),GF=l({supplierId:o().describe(`Unique supplier identifier`),supplierName:o().describe(`Supplier display name`),riskLevel:HF.describe(`Supplier risk classification`),status:UF.describe(`Assessment status`),assessedBy:o().describe(`Assessor user ID or team`),assessedAt:A().describe(`Assessment timestamp`),validUntil:A().describe(`Assessment validity expiry timestamp`),requirements:S(WF).describe(`Security requirements and their compliance status`),overallCompliant:v().describe(`Whether supplier meets all mandatory requirements`),dataClassificationsShared:S(qP).optional().describe(`Data classifications shared with supplier`),servicesProvided:S(o()).optional().describe(`Services provided by this supplier`),certifications:S(o()).optional().describe(`Supplier certifications (e.g., ISO 27001, SOC 2)`),remediationItems:S(l({requirementId:o().describe(`Non-compliant requirement ID`),action:o().describe(`Required remediation action`),deadline:A().describe(`Remediation deadline timestamp`),status:x([`pending`,`in_progress`,`completed`]).default(`pending`).describe(`Remediation status`)})).optional().describe(`Remediation items for non-compliant requirements`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Supplier security assessment record per ISO 27001:2022 A.5.19–A.5.21`),KF=l({enabled:v().default(!0).describe(`Enable supplier security management`),reassessmentIntervalDays:A().default(365).describe(`Supplier reassessment interval in days`),requirePreOnboardingAssessment:v().default(!0).describe(`Require security assessment before supplier onboarding`),formalAssessmentThreshold:HF.default(`medium`).describe(`Minimum risk level requiring formal assessment`),monitorChanges:v().default(!0).describe(`Monitor supplier security posture changes`),requiredCertifications:S(o()).default([]).describe(`Required certifications for critical-risk suppliers`)}).describe(`Organization-level supplier security management policy per ISO 27001:2022`),qF=x([`security_awareness`,`data_protection`,`incident_response`,`access_control`,`phishing_awareness`,`compliance`,`secure_development`,`physical_security`,`business_continuity`,`other`]),JF=x([`not_started`,`in_progress`,`completed`,`failed`,`expired`]),YF=l({id:o().describe(`Unique course identifier`),title:o().describe(`Course title`),description:o().describe(`Course description and learning objectives`),category:qF.describe(`Training category`),durationMinutes:A().min(1).describe(`Estimated course duration in minutes`),mandatory:v().default(!1).describe(`Whether training is mandatory`),targetRoles:S(o()).describe(`Target roles or groups`),validityDays:A().optional().describe(`Certification validity period in days`),passingScore:A().min(0).max(100).optional().describe(`Minimum passing score percentage`),version:o().optional().describe(`Course content version`)}).describe(`Security training course definition`),XF=l({courseId:o().describe(`Training course identifier`),userId:o().describe(`User identifier`),status:JF.describe(`Training completion status`),assignedAt:A().describe(`Assignment timestamp`),completedAt:A().optional().describe(`Completion timestamp`),score:A().min(0).max(100).optional().describe(`Assessment score percentage`),expiresAt:A().optional().describe(`Certification expiry timestamp`),notes:o().optional().describe(`Training notes or comments`)}).describe(`Individual training completion record`),ZF=l({enabled:v().default(!0).describe(`Enable training management`),courses:S(YF).describe(`Training courses`),recertificationIntervalDays:A().default(365).describe(`Default recertification interval in days`),trackCompletion:v().default(!0).describe(`Track training completion for compliance`),gracePeriodDays:A().default(30).describe(`Grace period in days after certification expiry`),sendReminders:v().default(!0).describe(`Send reminders for upcoming training deadlines`),reminderDaysBefore:A().default(14).describe(`Days before deadline to send first reminder`)}).describe(`Organizational training plan per ISO 27001:2022 A.6.3`),QF=l({type:p(`cron`),expression:o().describe(`Cron expression (e.g., "0 0 * * *" for daily at midnight)`),timezone:o().optional().default(`UTC`).describe(`Timezone for cron execution (e.g., "America/New_York")`)}),$F=l({type:p(`interval`),intervalMs:A().int().positive().describe(`Interval in milliseconds`)}),eI=l({type:p(`once`),at:o().datetime().describe(`ISO 8601 datetime when to execute`)}),tI=d(`type`,[QF,$F,eI]),nI=l({maxRetries:A().int().min(0).default(3).describe(`Maximum number of retry attempts`),backoffMs:A().int().positive().default(1e3).describe(`Initial backoff delay in milliseconds`),backoffMultiplier:A().positive().default(2).describe(`Multiplier for exponential backoff`)}),rI=l({id:o().describe(`Unique job identifier`),name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Job name (snake_case)`),schedule:tI.describe(`Job schedule configuration`),handler:o().describe(`Handler path (e.g. "path/to/file:functionName") or script ID`),retryPolicy:nI.optional().describe(`Retry policy configuration`),timeout:A().int().positive().optional().describe(`Timeout in milliseconds`),enabled:v().default(!0).describe(`Whether the job is enabled`)}),iI=x([`running`,`success`,`failed`,`timeout`]),aI=l({jobId:o().describe(`Job identifier`),startedAt:o().datetime().describe(`ISO 8601 datetime when execution started`),completedAt:o().datetime().optional().describe(`ISO 8601 datetime when execution completed`),status:iI.describe(`Execution status`),error:o().optional().describe(`Error message if failed`),duration:A().int().optional().describe(`Execution duration in milliseconds`)}),oI=x([`critical`,`high`,`normal`,`low`,`background`]),sI={critical:0,high:1,normal:2,low:3,background:4},cI=x([`pending`,`queued`,`processing`,`completed`,`failed`,`cancelled`,`timeout`,`dead`]),lI=l({maxRetries:A().int().min(0).default(3).describe(`Maximum retry attempts`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy between retries`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:A().int().positive().default(6e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:A().positive().default(2).describe(`Multiplier for exponential backoff`)}),uI=l({id:o().describe(`Unique task identifier`),type:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),payload:b().describe(`Task payload data`),queue:o().default(`default`).describe(`Queue name`),priority:oI.default(`normal`).describe(`Task priority level`),retryPolicy:lI.optional().describe(`Retry policy configuration`),timeoutMs:A().int().positive().optional().describe(`Task timeout in milliseconds`),scheduledAt:o().datetime().optional().describe(`ISO 8601 datetime to execute task`),attempts:A().int().min(0).default(0).describe(`Number of execution attempts`),status:cI.default(`pending`).describe(`Current task status`),metadata:l({createdAt:o().datetime().optional().describe(`When task was created`),updatedAt:o().datetime().optional().describe(`Last update time`),createdBy:o().optional().describe(`User who created task`),tags:S(o()).optional().describe(`Task tags for filtering`)}).optional().describe(`Task metadata`)}),dI=l({taskId:o().describe(`Task identifier`),status:cI.describe(`Execution status`),result:b().optional().describe(`Execution result data`),error:l({message:o().describe(`Error message`),stack:o().optional().describe(`Error stack trace`),code:o().optional().describe(`Error code`)}).optional().describe(`Error details if failed`),durationMs:A().int().optional().describe(`Execution duration in milliseconds`),startedAt:o().datetime().describe(`When execution started`),completedAt:o().datetime().optional().describe(`When execution completed`),attempt:A().int().min(1).describe(`Attempt number (1-indexed)`),willRetry:v().describe(`Whether task will be retried`)}),fI=l({name:o().describe(`Queue name (snake_case)`),concurrency:A().int().min(1).default(5).describe(`Max concurrent task executions`),rateLimit:l({max:A().int().positive().describe(`Maximum tasks per duration`),duration:A().int().positive().describe(`Duration in milliseconds`)}).optional().describe(`Rate limit configuration`),defaultRetryPolicy:lI.optional().describe(`Default retry policy for tasks`),deadLetterQueue:o().optional().describe(`Dead letter queue name`),priority:A().int().min(0).default(0).describe(`Queue priority (lower = higher priority)`),autoScale:l({enabled:v().default(!1).describe(`Enable auto-scaling`),minWorkers:A().int().min(1).default(1).describe(`Minimum workers`),maxWorkers:A().int().min(1).default(10).describe(`Maximum workers`),scaleUpThreshold:A().int().positive().default(100).describe(`Queue size to scale up`),scaleDownThreshold:A().int().min(0).default(10).describe(`Queue size to scale down`)}).optional().describe(`Auto-scaling configuration`)}),pI=l({id:o().describe(`Unique batch job identifier`),type:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),items:S(b()).describe(`Array of items to process`),batchSize:A().int().min(1).default(100).describe(`Number of items per batch`),queue:o().default(`batch`).describe(`Queue for batch tasks`),priority:oI.default(`normal`).describe(`Batch task priority`),parallel:v().default(!0).describe(`Process batches in parallel`),stopOnError:v().default(!1).describe(`Stop batch if any item fails`),onProgress:O().input(a([l({processed:A(),total:A(),failed:A()})])).output(g()).optional().describe(`Progress callback function (called after each batch)`)}),mI=l({batchId:o().describe(`Batch job identifier`),total:A().int().min(0).describe(`Total number of items`),processed:A().int().min(0).default(0).describe(`Items processed`),succeeded:A().int().min(0).default(0).describe(`Items succeeded`),failed:A().int().min(0).default(0).describe(`Items failed`),percentage:A().min(0).max(100).describe(`Progress percentage`),status:x([`pending`,`running`,`completed`,`failed`,`cancelled`]).describe(`Batch status`),startedAt:o().datetime().optional().describe(`When batch started`),completedAt:o().datetime().optional().describe(`When batch completed`)}),hI=l({name:o().describe(`Worker name`),queues:S(o()).min(1).describe(`Queue names to process`),queueConfigs:S(fI).optional().describe(`Queue configurations`),pollIntervalMs:A().int().positive().default(1e3).describe(`Queue polling interval in milliseconds`),visibilityTimeoutMs:A().int().positive().default(3e4).describe(`How long a task is invisible after being claimed`),defaultTimeoutMs:A().int().positive().default(3e5).describe(`Default task timeout in milliseconds`),shutdownTimeoutMs:A().int().positive().default(3e4).describe(`Graceful shutdown timeout in milliseconds`),handlers:u(o(),O()).optional().describe(`Task type handlers`)}),gI=l({workerName:o().describe(`Worker name`),totalProcessed:A().int().min(0).describe(`Total tasks processed`),succeeded:A().int().min(0).describe(`Successful tasks`),failed:A().int().min(0).describe(`Failed tasks`),active:A().int().min(0).describe(`Currently active tasks`),avgExecutionMs:A().min(0).optional().describe(`Average execution time in milliseconds`),uptimeMs:A().int().min(0).describe(`Worker uptime in milliseconds`),queues:u(o(),l({pending:A().int().min(0).describe(`Pending tasks`),active:A().int().min(0).describe(`Active tasks`),completed:A().int().min(0).describe(`Completed tasks`),failed:A().int().min(0).describe(`Failed tasks`)})).optional().describe(`Per-queue statistics`)}),_I=Object.assign(uI,{create:e=>e}),vI=Object.assign(fI,{create:e=>e}),yI=Object.assign(hI,{create:e=>e}),bI=Object.assign(pI,{create:e=>e}),xI=l({id:o().describe(`Template identifier`),subject:o().describe(`Email subject`),body:o().describe(`Email body content`),bodyType:x([`text`,`html`,`markdown`]).optional().default(`html`).describe(`Body content type`),variables:S(o()).optional().describe(`Template variables`),attachments:S(l({name:o().describe(`Attachment filename`),url:o().url().describe(`Attachment URL`)})).optional().describe(`Email attachments`)}),SI=l({id:o().describe(`Template identifier`),message:o().describe(`SMS message content`),maxLength:A().optional().default(160).describe(`Maximum message length`),variables:S(o()).optional().describe(`Template variables`)}),CI=l({title:o().describe(`Notification title`),body:o().describe(`Notification body`),icon:o().url().optional().describe(`Notification icon URL`),badge:A().optional().describe(`Badge count`),data:u(o(),b()).optional().describe(`Custom data`),actions:S(l({action:o().describe(`Action identifier`),title:o().describe(`Action button title`)})).optional().describe(`Notification actions`)}),wI=l({title:o().describe(`Notification title`),message:o().describe(`Notification message`),type:x([`info`,`success`,`warning`,`error`]).describe(`Notification type`),actionUrl:o().optional().describe(`Action URL`),dismissible:v().optional().default(!0).describe(`User dismissible`),expiresAt:A().optional().describe(`Expiration timestamp`)}),TI=x([`email`,`sms`,`push`,`in-app`,`slack`,`teams`,`webhook`]),EI=l({id:o().describe(`Notification ID`),name:o().describe(`Notification name`),channel:TI.describe(`Notification channel`),template:c([xI,SI,CI,wI]).describe(`Notification template`),recipients:l({to:S(o()).describe(`Primary recipients`),cc:S(o()).optional().describe(`CC recipients`),bcc:S(o()).optional().describe(`BCC recipients`)}).describe(`Recipients`),schedule:l({type:x([`immediate`,`delayed`,`scheduled`]).describe(`Schedule type`),delay:A().optional().describe(`Delay in milliseconds`),scheduledAt:A().optional().describe(`Scheduled timestamp`)}).optional().describe(`Scheduling`),retryPolicy:l({enabled:v().optional().default(!0).describe(`Enable retries`),maxRetries:A().optional().default(3).describe(`Max retry attempts`),backoffStrategy:x([`exponential`,`linear`,`fixed`]).describe(`Backoff strategy`)}).optional().describe(`Retry policy`),tracking:l({trackOpens:v().optional().default(!1).describe(`Track opens`),trackClicks:v().optional().default(!1).describe(`Track clicks`),trackDelivery:v().optional().default(!0).describe(`Track delivery`)}).optional().describe(`Tracking configuration`)}),DI=o().describe(`BCP-47 Language Tag (e.g. en-US, zh-CN)`),OI=l({label:o().optional().describe(`Translated field label`),help:o().optional().describe(`Translated help text`),placeholder:o().optional().describe(`Translated placeholder text for form inputs`),options:u(o(),o()).optional().describe(`Option value to translated label map`)}).describe(`Translation data for a single field`),kI=l({label:o().describe(`Translated singular label`),pluralLabel:o().optional().describe(`Translated plural label`),fields:u(o(),OI).optional().describe(`Field-level translations`)}).describe(`Translation data for a single object`),AI=l({objects:u(o(),kI).optional().describe(`Object translations keyed by object name`),apps:u(o(),l({label:o().describe(`Translated app label`),description:o().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),messages:u(o(),o()).optional().describe(`UI message translations keyed by message ID`),validationMessages:u(o(),o()).optional().describe(`Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})`)}).describe(`Translation data for objects, apps, and UI messages`),jI=u(DI,AI).describe(`Map of locale codes to translation data`),MI=x([`bundled`,`per_locale`,`per_namespace`]).describe(`Translation file organization strategy`),NI=x([`icu`,`simple`]).describe(`Message interpolation format: ICU MessageFormat or simple {variable} replacement`),PI=l({defaultLocale:DI.describe(`Default locale (e.g., "en")`),supportedLocales:S(DI).describe(`Supported BCP-47 locale codes`),fallbackLocale:DI.optional().describe(`Fallback locale code`),fileOrganization:MI.default(`per_locale`).describe(`File organization strategy`),messageFormat:NI.default(`simple`).describe(`Message interpolation format (ICU MessageFormat or simple)`),lazyLoad:v().default(!1).describe(`Load translations on demand`),cache:v().default(!0).describe(`Cache loaded translations`)}).describe(`Internationalization configuration`),FI=u(o(),o()).describe(`Option value to translated label map`),II=l({label:o().describe(`Translated singular label`),pluralLabel:o().optional().describe(`Translated plural label`),description:o().optional().describe(`Translated object description`),helpText:o().optional().describe(`Translated help text for the object`),fields:u(o(),OI).optional().describe(`Field translations keyed by field name`),_options:u(o(),FI).optional().describe(`Object-scoped picklist option translations keyed by field name`),_views:u(o(),l({label:o().optional().describe(`Translated view label`),description:o().optional().describe(`Translated view description`)})).optional().describe(`View translations keyed by view name`),_sections:u(o(),l({label:o().optional().describe(`Translated section label`)})).optional().describe(`Section translations keyed by section name`),_actions:u(o(),l({label:o().optional().describe(`Translated action label`),confirmMessage:o().optional().describe(`Translated confirmation message`)})).optional().describe(`Action translations keyed by action name`),_notifications:u(o(),l({title:o().optional().describe(`Translated notification title`),body:o().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Notification translations keyed by notification name`),_errors:u(o(),o()).optional().describe(`Error message translations keyed by error code`)}).describe(`Object-first aggregated translation node`),LI=l({_meta:l({locale:o().optional().describe(`BCP-47 locale code for this bundle`),direction:x([`ltr`,`rtl`]).optional().describe(`Text direction: left-to-right or right-to-left`)}).optional().describe(`Bundle-level metadata (locale, bidi direction)`),namespace:o().optional().describe(`Namespace for plugin isolation to avoid translation key collisions`),o:u(o(),II).optional().describe(`Object-first translations keyed by object name`),_globalOptions:u(o(),FI).optional().describe(`Global picklist option translations keyed by option set name`),app:u(o(),l({label:o().describe(`Translated app label`),description:o().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),nav:u(o(),o()).optional().describe(`Navigation item translations keyed by nav item name`),dashboard:u(o(),l({label:o().optional().describe(`Translated dashboard label`),description:o().optional().describe(`Translated dashboard description`)})).optional().describe(`Dashboard translations keyed by dashboard name`),reports:u(o(),l({label:o().optional().describe(`Translated report label`),description:o().optional().describe(`Translated report description`)})).optional().describe(`Report translations keyed by report name`),pages:u(o(),l({title:o().optional().describe(`Translated page title`),description:o().optional().describe(`Translated page description`)})).optional().describe(`Page translations keyed by page name`),messages:u(o(),o()).optional().describe(`UI message translations keyed by message ID (supports ICU MessageFormat)`),validationMessages:u(o(),o()).optional().describe(`Validation error message translations keyed by rule name (supports ICU MessageFormat)`),notifications:u(o(),l({title:o().optional().describe(`Translated notification title`),body:o().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Global notification translations keyed by notification name`),errors:u(o(),o()).optional().describe(`Global error message translations keyed by error code`)}).describe(`Object-first application translation bundle for a single locale`),RI=x([`missing`,`redundant`,`stale`]).describe(`Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)`),zI=l({key:o().describe(`Dot-path translation key`),status:RI.describe(`Diff status of this translation key`),objectName:o().optional().describe(`Associated object name (snake_case)`),locale:o().describe(`BCP-47 locale code`),sourceHash:o().optional().describe(`Hash of source metadata for precise stale detection`),aiSuggested:o().optional().describe(`AI-suggested translation for this key`),aiConfidence:A().min(0).max(1).optional().describe(`AI suggestion confidence score (0–1)`)}).describe(`A single translation diff item`),BI=l({group:o().describe(`Translation group category`),totalKeys:A().int().nonnegative().describe(`Total keys in this group`),translatedKeys:A().int().nonnegative().describe(`Translated keys in this group`),coveragePercent:A().min(0).max(100).describe(`Coverage percentage for this group`)}).describe(`Coverage breakdown for a single translation group`),VI=l({locale:o().describe(`BCP-47 locale code`),objectName:o().optional().describe(`Object name scope (omit for full bundle)`),totalKeys:A().int().nonnegative().describe(`Total translatable keys from metadata`),translatedKeys:A().int().nonnegative().describe(`Number of translated keys`),missingKeys:A().int().nonnegative().describe(`Number of missing translations`),redundantKeys:A().int().nonnegative().describe(`Number of redundant translations`),staleKeys:A().int().nonnegative().describe(`Number of stale translations`),coveragePercent:A().min(0).max(100).describe(`Translation coverage percentage`),items:S(zI).describe(`Detailed diff items`),breakdown:S(BI).optional().describe(`Per-group coverage breakdown`)}).describe(`Aggregated translation coverage result`),HI=`__TRANSLATE__`,UI=x([`insert`,`delete`,`retain`]),WI=d(`type`,[l({type:p(`insert`),text:o().describe(`Text to insert`),attributes:u(o(),b()).optional().describe(`Text formatting attributes (e.g., bold, italic)`)}),l({type:p(`delete`),count:A().int().positive().describe(`Number of characters to delete`)}),l({type:p(`retain`),count:A().int().positive().describe(`Number of characters to retain`),attributes:u(o(),b()).optional().describe(`Attribute changes to apply`)})]),GI=l({operationId:o().uuid().describe(`Unique operation identifier`),documentId:o().describe(`Document identifier`),userId:o().describe(`User who created the operation`),sessionId:o().uuid().describe(`Session identifier`),components:S(WI).describe(`Operation components`),baseVersion:A().int().nonnegative().describe(`Document version this operation is based on`),timestamp:o().datetime().describe(`ISO 8601 datetime when operation was created`),metadata:u(o(),b()).optional().describe(`Additional operation metadata`)}),KI=l({operation:GI.describe(`Transformed operation`),transformed:v().describe(`Whether transformation was applied`),conflicts:S(o()).optional().describe(`Conflict descriptions if any`)}),qI=x([`lww-register`,`g-counter`,`pn-counter`,`g-set`,`or-set`,`lww-map`,`text`,`tree`,`json`]),JI=l({clock:u(o(),A().int().nonnegative()).describe(`Map of replica ID to logical timestamp`)}),YI=l({type:p(`lww-register`),value:b().describe(`Current register value`),timestamp:o().datetime().describe(`ISO 8601 datetime of last write`),replicaId:o().describe(`ID of replica that performed last write`),vectorClock:JI.optional().describe(`Optional vector clock for causality tracking`)}),XI=l({replicaId:o().describe(`Replica identifier`),delta:A().int().describe(`Change amount (positive for increment, negative for decrement)`),timestamp:o().datetime().describe(`ISO 8601 datetime of operation`)}),ZI=l({type:p(`g-counter`),counts:u(o(),A().int().nonnegative()).describe(`Map of replica ID to count`)}),QI=l({type:p(`pn-counter`),positive:u(o(),A().int().nonnegative()).describe(`Positive increments per replica`),negative:u(o(),A().int().nonnegative()).describe(`Negative increments per replica`)}),$I=l({value:b().describe(`Element value`),timestamp:o().datetime().describe(`Addition timestamp`),replicaId:o().describe(`Replica that added the element`),uid:o().uuid().describe(`Unique identifier for this addition`),removed:v().optional().default(!1).describe(`Whether element has been removed`)}),eL=l({type:p(`or-set`),elements:S($I).describe(`Set elements with metadata`)}),tL=l({operationId:o().uuid().describe(`Unique operation identifier`),replicaId:o().describe(`Replica identifier`),position:A().int().nonnegative().describe(`Position in document`),insert:o().optional().describe(`Text to insert`),delete:A().int().positive().optional().describe(`Number of characters to delete`),timestamp:o().datetime().describe(`ISO 8601 datetime of operation`),lamportTimestamp:A().int().nonnegative().describe(`Lamport timestamp for ordering`)}),nL=l({type:p(`text`),documentId:o().describe(`Document identifier`),content:o().describe(`Current text content`),operations:S(tL).describe(`History of operations`),lamportClock:A().int().nonnegative().describe(`Current Lamport clock value`),vectorClock:JI.describe(`Vector clock for causality`)}),rL=d(`type`,[YI,ZI,QI,eL,nL]),iL=l({state:rL.describe(`Merged CRDT state`),conflicts:S(l({type:o().describe(`Conflict type`),description:o().describe(`Conflict description`),resolved:v().describe(`Whether conflict was automatically resolved`)})).optional().describe(`Conflicts encountered during merge`)}),aL=x([`blue`,`green`,`red`,`yellow`,`purple`,`orange`,`pink`,`teal`,`indigo`,`cyan`]),oL=l({color:c([aL,o()]).describe(`Cursor color (preset or custom hex)`),opacity:A().min(0).max(1).optional().default(1).describe(`Cursor opacity (0-1)`),label:o().optional().describe(`Label to display with cursor (usually username)`),showLabel:v().optional().default(!0).describe(`Whether to show label`),pulseOnUpdate:v().optional().default(!0).describe(`Whether to pulse when cursor moves`)}),sL=l({anchor:l({line:A().int().nonnegative().describe(`Anchor line number`),column:A().int().nonnegative().describe(`Anchor column number`)}).describe(`Selection anchor (start point)`),focus:l({line:A().int().nonnegative().describe(`Focus line number`),column:A().int().nonnegative().describe(`Focus column number`)}).describe(`Selection focus (end point)`),direction:x([`forward`,`backward`]).optional().describe(`Selection direction`)}),cL=l({userId:o().describe(`User identifier`),sessionId:o().uuid().describe(`Session identifier`),documentId:o().describe(`Document identifier`),userName:o().describe(`Display name of user`),position:l({line:A().int().nonnegative().describe(`Cursor line number (0-indexed)`),column:A().int().nonnegative().describe(`Cursor column number (0-indexed)`)}).describe(`Current cursor position`),selection:sL.optional().describe(`Current text selection`),style:oL.describe(`Visual style for this cursor`),isTyping:v().optional().default(!1).describe(`Whether user is currently typing`),lastUpdate:o().datetime().describe(`ISO 8601 datetime of last cursor update`),metadata:u(o(),b()).optional().describe(`Additional cursor metadata`)}),lL=l({position:l({line:A().int().nonnegative(),column:A().int().nonnegative()}).optional().describe(`Updated cursor position`),selection:sL.optional().describe(`Updated selection`),isTyping:v().optional().describe(`Updated typing state`),metadata:u(o(),b()).optional().describe(`Updated metadata`)}),uL=x([`active`,`idle`,`viewing`,`disconnected`]),dL=l({userId:o().describe(`User identifier`),sessionId:o().uuid().describe(`Session identifier`),userName:o().describe(`Display name`),userAvatar:o().optional().describe(`User avatar URL`),status:uL.describe(`Current activity status`),currentDocument:o().optional().describe(`Document ID user is currently editing`),currentView:o().optional().describe(`Current view/page user is on`),lastActivity:o().datetime().describe(`ISO 8601 datetime of last activity`),joinedAt:o().datetime().describe(`ISO 8601 datetime when user joined session`),permissions:S(o()).optional().describe(`User permissions in this session`),metadata:u(o(),b()).optional().describe(`Additional user state metadata`)}),fL=l({sessionId:o().uuid().describe(`Session identifier`),documentId:o().optional().describe(`Document ID this session is for`),users:S(dL).describe(`Active users in session`),startedAt:o().datetime().describe(`ISO 8601 datetime when session started`),lastUpdate:o().datetime().describe(`ISO 8601 datetime of last update`),metadata:u(o(),b()).optional().describe(`Session metadata`)}),pL=l({status:uL.optional().describe(`Updated status`),currentDocument:o().optional().describe(`Updated current document`),currentView:o().optional().describe(`Updated current view`),metadata:u(o(),b()).optional().describe(`Updated metadata`)}),mL=l({eventId:o().uuid().describe(`Event identifier`),sessionId:o().uuid().describe(`Session identifier`),eventType:x([`user.joined`,`user.left`,`user.updated`,`session.created`,`session.ended`]).describe(`Type of awareness event`),userId:o().optional().describe(`User involved in event`),timestamp:o().datetime().describe(`ISO 8601 datetime of event`),payload:b().describe(`Event payload`)}),hL=x([`ot`,`crdt`,`lock`,`hybrid`]),gL=l({mode:hL.describe(`Collaboration mode to use`),enableCursorSharing:v().optional().default(!0).describe(`Enable cursor sharing`),enablePresence:v().optional().default(!0).describe(`Enable presence tracking`),enableAwareness:v().optional().default(!0).describe(`Enable awareness state`),maxUsers:A().int().positive().optional().describe(`Maximum concurrent users`),idleTimeout:A().int().positive().optional().default(3e5).describe(`Idle timeout in milliseconds`),conflictResolution:x([`ot`,`crdt`,`manual`]).optional().default(`ot`).describe(`Conflict resolution strategy`),persistence:v().optional().default(!0).describe(`Enable operation persistence`),snapshot:l({enabled:v().describe(`Enable periodic snapshots`),interval:A().int().positive().describe(`Snapshot interval in milliseconds`)}).optional().describe(`Snapshot configuration`)}),_L=l({sessionId:o().uuid().describe(`Session identifier`),documentId:o().describe(`Document identifier`),config:gL.describe(`Session configuration`),users:S(dL).describe(`Active users`),cursors:S(cL).describe(`Active cursors`),version:A().int().nonnegative().describe(`Current document version`),operations:S(c([GI,tL])).optional().describe(`Recent operations`),createdAt:o().datetime().describe(`ISO 8601 datetime when session was created`),lastActivity:o().datetime().describe(`ISO 8601 datetime of last activity`),status:x([`active`,`idle`,`ended`]).describe(`Session status`)}),vL=x([`system`,`platform`,`user`]),yL=x([`draft`,`active`,`archived`,`deprecated`]),bL=l({id:o(),name:o(),type:o(),namespace:o().default(`default`),packageId:o().optional().describe(`Package ID that owns/delivered this metadata`),managedBy:x([`package`,`platform`,`user`]).optional().describe(`Who manages this metadata record lifecycle`),scope:vL.default(`platform`),metadata:u(o(),b()),extends:o().optional().describe(`Name of the parent metadata to extend/override`),strategy:x([`merge`,`replace`]).default(`merge`),owner:o().optional(),state:yL.default(`active`),tenantId:o().optional().describe(`Tenant identifier for multi-tenant isolation`),version:A().default(1).describe(`Record version for optimistic concurrency control`),checksum:o().optional().describe(`Content checksum for change detection`),source:x([`filesystem`,`database`,`api`,`migration`]).optional().describe(`Origin of this metadata record`),tags:S(o()).optional().describe(`Classification tags for filtering and grouping`),publishedDefinition:b().optional().describe(`Snapshot of the last published definition`),publishedAt:o().datetime().optional().describe(`When this metadata was last published`),publishedBy:o().optional().describe(`Who published this version`),createdBy:o().optional(),createdAt:o().datetime().optional().describe(`Creation timestamp`),updatedBy:o().optional(),updatedAt:o().datetime().optional().describe(`Last update timestamp`)}),xL=l({success:v().describe(`Whether the publish succeeded`),packageId:o().describe(`The package ID that was published`),version:A().int().describe(`New version number after publish`),publishedAt:o().datetime().describe(`Publish timestamp`),itemsPublished:A().int().describe(`Total metadata items published`),validationErrors:S(l({type:o().describe(`Metadata type that failed validation`),name:o().describe(`Item name that failed validation`),message:o().describe(`Validation error message`)})).optional().describe(`Validation errors if publish failed`)}),SL=x([`json`,`yaml`,`yml`,`ts`,`js`,`typescript`,`javascript`]),CL=l({path:o().optional(),size:A().optional(),mtime:o().datetime().optional(),hash:o().optional(),etag:o().optional(),modifiedAt:o().datetime().optional(),format:SL.optional()}),wL=l({name:o(),protocol:x([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Loader protocol identifier`),description:o().optional(),supportedFormats:S(o()).optional(),supportsWatch:v().optional(),supportsWrite:v().optional(),supportsCache:v().optional(),capabilities:l({read:v().default(!0),write:v().default(!1),watch:v().default(!1),list:v().default(!0)})}),TL=l({scope:vL.optional(),namespace:o().optional(),raw:v().optional().describe(`Return raw file content instead of parsed JSON`),cache:v().optional(),useCache:v().optional(),validate:v().optional(),ifNoneMatch:o().optional(),recursive:v().optional(),limit:A().optional(),patterns:S(o()).optional(),loader:o().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),EL=l({data:b(),stats:CL.optional(),format:SL.optional(),source:o().optional(),fromCache:v().optional(),etag:o().optional(),notModified:v().optional(),loadTime:A().optional()}),DL=l({format:SL.optional(),create:v().default(!0),overwrite:v().default(!0),path:o().optional(),prettify:v().optional(),indent:A().optional(),sortKeys:v().optional(),backup:v().optional(),atomic:v().optional(),loader:o().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),OL=l({success:v(),path:o().optional(),stats:CL.optional(),etag:o().optional(),size:A().optional(),saveTime:A().optional(),backupPath:o().optional()}),kL=l({type:x([`add`,`change`,`unlink`,`added`,`changed`,`deleted`]),path:o(),name:o().optional(),stats:CL.optional(),metadataType:o().optional(),data:b().optional(),timestamp:o().datetime().optional()}),AL=l({type:o(),count:A(),namespaces:S(o())}),jL=l({types:S(o()).optional(),namespaces:S(o()).optional(),output:o().describe(`Output directory or file`),format:SL.default(`json`)}),ML=l({source:o().describe(`Input directory or file`),strategy:x([`merge`,`replace`,`skip`]).default(`merge`),validate:v().default(!0)}),NL=x([`filesystem`,`memory`,`none`]),PL=x([`filesystem`,`database`,`api`,`migration`]),FL=l({datasource:o().optional().describe(`Datasource name reference for database persistence`),tableName:o().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:NL.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:o().optional().describe(`Root directory for filesystem-based metadata`),formats:S(SL).optional().describe(`Enabled metadata formats`),watch:v().optional().describe(`Enable file watching for filesystem loaders`),cache:v().optional().describe(`Enable metadata caching`),watchOptions:l({ignored:S(o()).optional().describe(`Patterns to ignore`),persistent:v().default(!0).describe(`Keep process running`)}).optional().describe(`File watcher options`)}),IL=x([`metadata`,`data`,`auth`,`file-storage`,`search`,`cache`,`queue`,`automation`,`graphql`,`analytics`,`realtime`,`job`,`notification`,`ai`,`i18n`,`ui`,`workflow`]),LL=x([`required`,`core`,`optional`]),RL={metadata:`required`,data:`required`,auth:`core`,cache:`core`,queue:`core`,job:`core`,i18n:`core`,"file-storage":`optional`,search:`optional`,automation:`optional`,graphql:`optional`,analytics:`optional`,realtime:`optional`,notification:`optional`,ai:`optional`,ui:`optional`,workflow:`optional`},zL=l({name:IL,enabled:v(),status:x([`running`,`stopped`,`degraded`,`initializing`]),version:o().optional(),provider:o().optional().describe(`Implementation provider (e.g. "s3" for storage)`),features:S(o()).optional().describe(`List of supported sub-features`)}),BL=u(IL,b().describe(`Service Instance implementing the protocol interface`)),VL=l({id:o(),name:IL,options:u(o(),b()).optional()}),HL=x([`shared_schema`,`isolated_schema`,`isolated_db`]),UL=x([`turso`,`postgres`,`memory`]).describe(`Database provider for tenant data`),WL=l({url:o().min(1).describe(`Database connection URL`),authToken:o().optional().describe(`Database auth token (encrypted at rest)`),group:o().optional().describe(`Turso database group name`)}).describe(`Tenant database connection configuration`),GL=l({maxUsers:A().int().positive().optional().describe(`Maximum number of users`),maxStorage:A().int().positive().optional().describe(`Maximum storage in bytes`),apiRateLimit:A().int().positive().optional().describe(`API requests per minute`),maxObjects:A().int().positive().optional().describe(`Maximum number of custom objects`),maxRecordsPerObject:A().int().positive().optional().describe(`Maximum records per object`),maxDeploymentsPerDay:A().int().positive().optional().describe(`Maximum deployments per day`),maxStorageBytes:A().int().positive().optional().describe(`Maximum storage in bytes`)}),KL=l({currentObjectCount:A().int().min(0).default(0).describe(`Current number of custom objects`),currentRecordCount:A().int().min(0).default(0).describe(`Total records across all objects`),currentStorageBytes:A().int().min(0).default(0).describe(`Current storage usage in bytes`),deploymentsToday:A().int().min(0).default(0).describe(`Deployments executed today`),currentUsers:A().int().min(0).default(0).describe(`Current number of active users`),apiRequestsThisMinute:A().int().min(0).default(0).describe(`API requests in the current minute`),lastUpdatedAt:o().datetime().optional().describe(`Last usage update time`)}).describe(`Current tenant resource usage`),qL=l({allowed:v().describe(`Whether the operation is within quota`),exceededQuota:o().optional().describe(`Name of the exceeded quota`),currentUsage:A().optional().describe(`Current usage value`),limit:A().optional().describe(`Quota limit`),message:o().optional().describe(`Human-readable quota message`)}).describe(`Quota enforcement check result`),JL=l({id:o().describe(`Unique tenant identifier`),name:o().describe(`Tenant display name`),isolationLevel:HL,databaseProvider:UL.optional().describe(`Database provider`),connectionConfig:WL.optional().describe(`Database connection config`),provisioningStatus:x([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).optional().describe(`Current provisioning lifecycle status`),plan:x([`free`,`pro`,`enterprise`]).optional().describe(`Subscription plan`),customizations:u(o(),b()).optional().describe(`Custom configuration values`),quotas:GL.optional()}),YL=l({strategy:p(`shared_schema`).describe(`Row-level isolation strategy`),database:l({enableRLS:v().default(!0).describe(`Enable PostgreSQL Row-Level Security`),contextMethod:x([`session_variable`,`search_path`,`application_name`]).default(`session_variable`).describe(`How to set tenant context`),contextVariable:o().default(`app.current_tenant`).describe(`Session variable name`),applicationValidation:v().default(!0).describe(`Application-level tenant validation`)}).optional().describe(`Database configuration`),performance:l({usePartialIndexes:v().default(!0).describe(`Use partial indexes per tenant`),usePartitioning:v().default(!1).describe(`Use table partitioning by tenant_id`),poolSizePerTenant:A().int().positive().optional().describe(`Connection pool size per tenant`)}).optional().describe(`Performance settings`)}),XL=l({strategy:p(`isolated_schema`).describe(`Schema-level isolation strategy`),schema:l({namingPattern:o().default(`tenant_{tenant_id}`).describe(`Schema naming pattern`),includePublicSchema:v().default(!0).describe(`Include public schema`),sharedSchema:o().default(`public`).describe(`Schema for shared resources`),autoCreateSchema:v().default(!0).describe(`Auto-create schema`)}).optional().describe(`Schema configuration`),migrations:l({strategy:x([`parallel`,`sequential`,`on_demand`]).default(`parallel`).describe(`Migration strategy`),maxConcurrent:A().int().positive().default(10).describe(`Max concurrent migrations`),rollbackOnError:v().default(!0).describe(`Rollback on error`)}).optional().describe(`Migration configuration`),performance:l({poolPerSchema:v().default(!1).describe(`Separate pool per schema`),schemaCacheTTL:A().int().positive().default(3600).describe(`Schema cache TTL`)}).optional().describe(`Performance settings`)}),ZL=l({strategy:p(`isolated_db`).describe(`Database-level isolation strategy`),database:l({namingPattern:o().default(`tenant_{tenant_id}`).describe(`Database naming pattern`),serverStrategy:x([`shared`,`sharded`,`dedicated`]).default(`shared`).describe(`Server assignment strategy`),separateCredentials:v().default(!0).describe(`Separate credentials per tenant`),autoCreateDatabase:v().default(!0).describe(`Auto-create database`)}).optional().describe(`Database configuration`),connectionPool:l({poolSize:A().int().positive().default(10).describe(`Connection pool size`),maxActivePools:A().int().positive().default(100).describe(`Max active pools`),idleTimeout:A().int().positive().default(300).describe(`Idle pool timeout`),usePooler:v().default(!0).describe(`Use connection pooler`)}).optional().describe(`Connection pool configuration`),backup:l({strategy:x([`individual`,`consolidated`,`on_demand`]).default(`individual`).describe(`Backup strategy`),frequencyHours:A().int().positive().default(24).describe(`Backup frequency`),retentionDays:A().int().positive().default(30).describe(`Backup retention days`)}).optional().describe(`Backup configuration`),encryption:l({perTenantKeys:v().default(!1).describe(`Per-tenant encryption keys`),algorithm:o().default(`AES-256-GCM`).describe(`Encryption algorithm`),keyManagement:x([`aws_kms`,`azure_key_vault`,`gcp_kms`,`hashicorp_vault`,`custom`]).optional().describe(`Key management service`)}).optional().describe(`Encryption configuration`)}),zce=d(`strategy`,[YL,XL,ZL]),Bce=l({encryption:l({atRest:v().default(!0).describe(`Require encryption at rest`),inTransit:v().default(!0).describe(`Require encryption in transit`),fieldLevel:v().default(!1).describe(`Require field-level encryption`)}).optional().describe(`Encryption requirements`),accessControl:l({requireMFA:v().default(!1).describe(`Require MFA`),requireSSO:v().default(!1).describe(`Require SSO`),ipWhitelist:S(o()).optional().describe(`Allowed IP addresses`),sessionTimeout:A().int().positive().default(3600).describe(`Session timeout`)}).optional().describe(`Access control requirements`),compliance:l({standards:S(x([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),requireAuditLog:v().default(!0).describe(`Require audit logging`),auditRetentionDays:A().int().positive().default(365).describe(`Audit retention days`),dataResidency:l({region:o().optional().describe(`Required region (e.g., US, EU, APAC)`),excludeRegions:S(o()).optional().describe(`Prohibited regions`)}).optional().describe(`Data residency requirements`)}).optional().describe(`Compliance requirements`)}),QL=x([`boolean`,`counter`,`gauge`]).describe(`License metric type`),Vce=l({code:o().regex(/^[a-z_][a-z0-9_.]*$/).describe(`Feature code (e.g. core.api_access)`),label:o(),description:o().optional(),type:QL.default(`boolean`),unit:x([`count`,`bytes`,`seconds`,`percent`]).optional(),requires:S(o()).optional()}),Hce=l({code:o().describe(`Plan code (e.g. pro_v1)`),label:o(),active:v().default(!0),features:S(o()).describe(`List of enabled boolean features`),limits:u(o(),A()).describe(`Map of metric codes to limit values (e.g. { storage_gb: 10 })`),currency:o().default(`USD`).optional(),priceMonthly:A().optional(),priceYearly:A().optional()}),Uce=l({spaceId:o().describe(`Target Space ID`),planCode:o(),issuedAt:o().datetime(),expiresAt:o().datetime().optional(),status:x([`active`,`expired`,`suspended`,`trial`]),customFeatures:S(o()).optional(),customLimits:u(o(),A()).optional(),plugins:S(o()).optional().describe(`List of enabled plugin package IDs`),signature:o().optional().describe(`Cryptographic signature of the license`)}),$L=x([`manual`,`auto`,`proxy`]).describe(`Registry synchronization strategy`),eR=l({url:o().url().describe(`Upstream registry endpoint`),syncPolicy:$L.default(`auto`),syncInterval:A().int().min(60).optional().describe(`Auto-sync interval in seconds`),auth:l({type:x([`none`,`basic`,`bearer`,`api-key`,`oauth2`]).default(`none`),username:o().optional(),password:o().optional(),token:o().optional(),apiKey:o().optional()}).optional(),tls:l({enabled:v().default(!0),verifyCertificate:v().default(!0),certificate:o().optional(),privateKey:o().optional()}).optional(),timeout:A().int().min(1e3).default(3e4).describe(`Request timeout in milliseconds`),retry:l({maxAttempts:A().int().min(0).default(3),backoff:x([`fixed`,`linear`,`exponential`]).default(`exponential`)}).optional()}),Wce=l({type:x([`public`,`private`,`hybrid`]).describe(`Registry deployment type`),upstream:S(eR).optional().describe(`Upstream registries to sync from or proxy to`),scope:S(o()).optional().describe(`npm-style scopes managed by this registry (e.g., @my-corp, @enterprise)`),defaultScope:o().optional().describe(`Default scope prefix for new plugins`),storage:l({backend:x([`local`,`s3`,`gcs`,`azure-blob`,`oss`]).default(`local`),path:o().optional(),credentials:u(o(),b()).optional()}).optional(),visibility:x([`public`,`private`,`internal`]).default(`private`).describe(`Who can access this registry`),accessControl:l({requireAuthForRead:v().default(!1),requireAuthForWrite:v().default(!0),allowedPrincipals:S(o()).optional()}).optional(),cache:l({enabled:v().default(!0),ttl:A().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:A().int().optional().describe(`Maximum cache size in bytes`)}).optional(),mirrors:S(l({url:o().url(),priority:A().int().min(1).default(1)})).optional().describe(`Mirror registries for redundancy`)}),tR=x([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).describe(`Tenant provisioning lifecycle status`),nR=x([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),rR=x([`us-east`,`us-west`,`eu-west`,`eu-central`,`ap-southeast`,`ap-northeast`]).describe(`Available deployment region`),iR=l({name:o().min(1).describe(`Step name (e.g., create_database, sync_schema)`),status:x([`pending`,`running`,`completed`,`failed`,`skipped`]).describe(`Step status`),startedAt:o().datetime().optional().describe(`Step start time`),completedAt:o().datetime().optional().describe(`Step completion time`),durationMs:A().int().min(0).optional().describe(`Step duration in ms`),error:o().optional().describe(`Error message on failure`)}).describe(`Individual provisioning step status`),Gce=l({orgId:o().min(1).describe(`Organization ID`),plan:nR.default(`free`),region:rR.default(`us-east`),displayName:o().optional().describe(`Tenant display name`),adminEmail:o().email().optional().describe(`Initial admin user email`),metadata:u(o(),b()).optional().describe(`Additional metadata`)}).describe(`Tenant provisioning request`),Kce=l({tenantId:o().min(1).describe(`Provisioned tenant ID`),connectionUrl:o().min(1).describe(`Database connection URL`),status:tR,region:rR,plan:nR,steps:S(iR).default([]).describe(`Pipeline step statuses`),totalDurationMs:A().int().min(0).optional().describe(`Total provisioning duration`),provisionedAt:o().datetime().optional().describe(`Provisioning completion time`),error:o().optional().describe(`Error message on failure`)}).describe(`Tenant provisioning result`),qce=x([`validating`,`diffing`,`migrating`,`registering`,`ready`,`failed`,`rolling_back`]).describe(`Deployment lifecycle status`),aR=l({entityType:x([`object`,`field`,`index`,`view`,`flow`,`permission`]).describe(`Entity type`),entityName:o().min(1).describe(`Entity name`),parentEntity:o().optional().describe(`Parent entity name`),changeType:x([`added`,`modified`,`removed`]).describe(`Change type`),oldValue:b().optional().describe(`Previous value`),newValue:b().optional().describe(`New value`)}).describe(`Individual schema change`),Jce=l({changes:S(aR).default([]).describe(`List of schema changes`),summary:l({added:A().int().min(0).default(0).describe(`Number of added entities`),modified:A().int().min(0).default(0).describe(`Number of modified entities`),removed:A().int().min(0).default(0).describe(`Number of removed entities`)}).describe(`Change summary counts`),hasBreakingChanges:v().default(!1).describe(`Whether diff contains breaking changes`)}).describe(`Schema diff between current and desired state`),oR=l({sql:o().min(1).describe(`SQL DDL statement`),reversible:v().default(!0).describe(`Whether the statement can be reversed`),rollbackSql:o().optional().describe(`Reverse SQL for rollback`),order:A().int().min(0).describe(`Execution order`)}).describe(`Single DDL migration statement`),Yce=l({statements:S(oR).default([]).describe(`Ordered DDL statements`),dialect:o().min(1).describe(`Target SQL dialect`),reversible:v().default(!0).describe(`Whether the plan can be fully rolled back`),estimatedDurationMs:A().int().min(0).optional().describe(`Estimated execution time`)}).describe(`Ordered migration plan`),sR=l({severity:x([`error`,`warning`,`info`]).describe(`Issue severity`),path:o().describe(`Entity path (e.g., objects.project_task.fields.name)`),message:o().describe(`Issue description`),code:o().optional().describe(`Validation error code`)}).describe(`Validation issue`),Xce=l({valid:v().describe(`Whether the bundle is valid`),issues:S(sR).default([]).describe(`Validation issues`),errorCount:A().int().min(0).default(0).describe(`Number of errors`),warningCount:A().int().min(0).default(0).describe(`Number of warnings`)}).describe(`Bundle validation result`),cR=l({version:o().min(1).describe(`Deployment version`),checksum:o().optional().describe(`SHA256 checksum`),objects:S(o()).default([]).describe(`Object names included`),views:S(o()).default([]).describe(`View names included`),flows:S(o()).default([]).describe(`Flow names included`),permissions:S(o()).default([]).describe(`Permission names included`),createdAt:o().datetime().optional().describe(`Bundle creation time`)}).describe(`Deployment manifest`),Zce=l({manifest:cR,objects:S(u(o(),b())).default([]).describe(`Object definitions`),views:S(u(o(),b())).default([]).describe(`View definitions`),flows:S(u(o(),b())).default([]).describe(`Flow definitions`),permissions:S(u(o(),b())).default([]).describe(`Permission definitions`),seedData:S(u(o(),b())).default([]).describe(`Seed data records`)}).describe(`Deploy bundle containing all metadata for deployment`),Qce=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`App identifier (snake_case)`),label:o().min(1).describe(`App display label`),version:o().min(1).describe(`App version (semver)`),description:o().optional().describe(`App description`),minKernelVersion:o().optional().describe(`Minimum required kernel version`),objects:S(o()).default([]).describe(`Object names provided`),views:S(o()).default([]).describe(`View names provided`),flows:S(o()).default([]).describe(`Flow names provided`),hasSeedData:v().default(!1).describe(`Whether app includes seed data`),seedData:S(u(o(),b())).default([]).describe(`Seed data records`),dependencies:S(o()).default([]).describe(`Required app dependencies`)}).describe(`App manifest for marketplace installation`),$ce=l({compatible:v().describe(`Whether the app is compatible`),issues:S(l({severity:x([`error`,`warning`]).describe(`Issue severity`),message:o().describe(`Issue description`),category:x([`kernel_version`,`object_conflict`,`dependency_missing`,`quota_exceeded`]).describe(`Issue category`)})).default([]).describe(`Compatibility issues`)}).describe(`App compatibility check result`),ele=l({tenantId:o().min(1).describe(`Target tenant ID`),appId:o().min(1).describe(`App identifier`),configOverrides:u(o(),b()).optional().describe(`Configuration overrides`),skipSeedData:v().default(!1).describe(`Skip seed data population`)}).describe(`App install request`),tle=l({success:v().describe(`Whether installation succeeded`),appId:o().describe(`Installed app identifier`),version:o().describe(`Installed app version`),installedObjects:S(o()).default([]).describe(`Objects created/updated`),createdTables:S(o()).default([]).describe(`Database tables created`),seededRecords:A().int().min(0).default(0).describe(`Seed records inserted`),durationMs:A().int().min(0).optional().describe(`Installation duration`),error:o().optional().describe(`Error message on failure`)}).describe(`App install result`),nle={DIRS:{SCHEMA:`src/schemas`,SERVER:`src/server`,TRIGGERS:`src/triggers`,CLIENT:`src/client`,PAGES:`src/client/pages`,ASSETS:`assets`},FILES:{MANIFEST:`objectstack.config.ts`,ENTRY:`src/index.ts`}},rle={USER:`sys_user`,SESSION:`sys_session`,ACCOUNT:`sys_account`,VERIFICATION:`sys_verification`,ORGANIZATION:`sys_organization`,MEMBER:`sys_member`,INVITATION:`sys_invitation`,TEAM:`sys_team`,TEAM_MEMBER:`sys_team_member`,API_KEY:`sys_api_key`,TWO_FACTOR:`sys_two_factor`,ROLE:`sys_role`,PERMISSION_SET:`sys_permission_set`,AUDIT_LOG:`sys_audit_log`,METADATA:`sys_metadata`},ile={ID:`id`,CREATED_AT:`created_at`,UPDATED_AT:`updated_at`,OWNER_ID:`owner_id`,TENANT_ID:`tenant_id`,USER_ID:`user_id`,DELETED_AT:`deleted_at`},ale={resolveTableName(e){return e.tableName??(e.namespace?`${e.namespace}_${e.name}`:e.name)},resolveColumnName(e,t){return t.columnName??e},buildColumnMap(e){let t={};for(let n of Object.keys(e))t[n]=e[n].columnName??n;return t},buildReverseColumnMap(e){let t={};for(let n of Object.keys(e)){let r=e[n].columnName??n;t[r]=n}return t}};EE({},{ActivationEventSchema:()=>nB,AdvancedPluginLifecycleConfigSchema:()=>Qle,ArtifactChecksumSchema:()=>dR,ArtifactFileEntrySchema:()=>uR,ArtifactSignatureSchema:()=>fR,BreakingChangeSchema:()=>SB,CLICommandContributionSchema:()=>ole,CORE_PLUGIN_TYPES:()=>sz,CapabilityConformanceLevelSchema:()=>BR,CompatibilityLevelSchema:()=>xB,CompatibilityMatrixEntrySchema:()=>wB,CustomizationOriginSchema:()=>Ole,CustomizationPolicySchema:()=>pz,DEFAULT_METADATA_TYPE_REGISTRY:()=>Vle,DeadLetterQueueEntrySchema:()=>yle,DependencyConflictSchema:()=>TB,DependencyGraphNodeSchema:()=>LB,DependencyGraphSchema:()=>RB,DependencyResolutionResultSchema:()=>SR,DependencyStatusEnum:()=>yR,DeprecationNoticeSchema:()=>CB,DevFixtureConfigSchema:()=>wR,DevPluginConfigSchema:()=>hle,DevPluginPreset:()=>ER,DevServiceOverrideSchema:()=>CR,DevToolsConfigSchema:()=>TR,DisablePackageRequestSchema:()=>Rz,DisablePackageResponseSchema:()=>zz,DistributedStateConfigSchema:()=>qz,DynamicLoadRequestSchema:()=>lue,DynamicLoadingConfigSchema:()=>fue,DynamicPluginOperationSchema:()=>eB,DynamicPluginResultSchema:()=>due,DynamicUnloadRequestSchema:()=>uue,EVENT_PRIORITY_VALUES:()=>gle,EnablePackageRequestSchema:()=>Iz,EnablePackageResponseSchema:()=>Lz,EventBusConfigSchema:()=>xle,EventHandlerSchema:()=>jR,EventLogEntrySchema:()=>ble,EventMessageQueueConfigSchema:()=>IR,EventMetadataSchema:()=>OR,EventPersistenceSchema:()=>MR,EventPhaseSchema:()=>Zz,EventPriority:()=>DR,EventQueueConfigSchema:()=>NR,EventReplayConfigSchema:()=>vle,EventRouteSchema:()=>_le,EventSchema:()=>AR,EventSourcingConfigSchema:()=>PR,EventTypeDefinitionSchema:()=>kR,EventWebhookConfigSchema:()=>FR,ExecutionContextSchema:()=>xO,ExtensionPointSchema:()=>qR,FeatureFlag:()=>Sle,FeatureFlagSchema:()=>zR,FeatureStrategy:()=>RR,FieldChangeSchema:()=>lz,GetPackageRequestSchema:()=>Az,GetPackageResponseSchema:()=>jz,GracefulDegradationSchema:()=>Yz,HealthStatusSchema:()=>DB,HookRegisteredEventSchema:()=>iue,HookTriggeredEventSchema:()=>aue,HotReloadConfigSchema:()=>Jz,InstallPackageRequestSchema:()=>Mz,InstallPackageResponseSchema:()=>Nz,InstalledPackageSchema:()=>Dz,KernelContextSchema:()=>vR,KernelEventBaseSchema:()=>$z,KernelReadyEventSchema:()=>oue,KernelSecurityPolicySchema:()=>mB,KernelSecurityScanResultSchema:()=>pB,KernelSecurityVulnerabilitySchema:()=>fB,KernelShutdownEventSchema:()=>sue,ListPackagesRequestSchema:()=>Oz,ListPackagesResponseSchema:()=>kz,ManifestSchema:()=>cz,MergeConflictSchema:()=>dz,MergeResultSchema:()=>kle,MergeStrategyConfigSchema:()=>fz,MetadataBulkRegisterRequestSchema:()=>Hle,MetadataBulkResultSchema:()=>wz,MetadataCategoryEnum:()=>lR,MetadataChangeTypeSchema:()=>Bz,MetadataCollectionInfoSchema:()=>Lle,MetadataDependencySchema:()=>Tz,MetadataDiffItemSchema:()=>Vz,MetadataEventSchema:()=>zle,MetadataExportOptionsSchema:()=>Mle,MetadataFallbackStrategySchema:()=>gz,MetadataFormatSchema:()=>mz,MetadataImportOptionsSchema:()=>Nle,MetadataLoadOptionsSchema:()=>Ale,MetadataLoadResultSchema:()=>Ple,MetadataLoaderContractSchema:()=>Rle,MetadataManagerConfigSchema:()=>_z,MetadataOverlaySchema:()=>uz,MetadataPluginConfigSchema:()=>Cz,MetadataPluginManifestSchema:()=>Ble,MetadataQueryResultSchema:()=>xz,MetadataQuerySchema:()=>bz,MetadataSaveOptionsSchema:()=>jle,MetadataSaveResultSchema:()=>Fle,MetadataStatsSchema:()=>hz,MetadataTypeRegistryEntrySchema:()=>yz,MetadataTypeSchema:()=>vz,MetadataValidationResultSchema:()=>Sz,MetadataWatchEventSchema:()=>Ile,MultiVersionSupportSchema:()=>xue,NamespaceConflictErrorSchema:()=>Wle,NamespaceRegistryEntrySchema:()=>Ule,OclifPluginConfigSchema:()=>sle,OpsDomainModuleSchema:()=>mue,OpsFilePathSchema:()=>_B,OpsPluginStructureSchema:()=>hue,PackageArtifactSchema:()=>pR,PackageDependencyConflictSchema:()=>zB,PackageDependencyResolutionResultSchema:()=>BB,PackageDependencySchema:()=>IB,PackageStatusEnum:()=>Ez,PermissionActionSchema:()=>oB,PermissionSchema:()=>cB,PermissionScopeSchema:()=>aB,PermissionSetSchema:()=>lB,PluginBuildOptionsSchema:()=>cle,PluginBuildResultSchema:()=>lle,PluginCachingSchema:()=>nz,PluginCapabilityManifestSchema:()=>JR,PluginCapabilitySchema:()=>WR,PluginCodeSplittingSchema:()=>ZR,PluginCompatibilityMatrixSchema:()=>yue,PluginContextSchema:()=>Tle,PluginDependencyResolutionResultSchema:()=>bue,PluginDependencyResolutionSchema:()=>ez,PluginDependencySchema:()=>KR,PluginDiscoveryConfigSchema:()=>iB,PluginDiscoverySourceSchema:()=>rB,PluginDynamicImportSchema:()=>QR,PluginErrorEventSchema:()=>tue,PluginEventBaseSchema:()=>Qz,PluginHealthCheckSchema:()=>Kz,PluginHealthReportSchema:()=>Xle,PluginHealthStatusSchema:()=>Gz,PluginHotReloadSchema:()=>tz,PluginInitializationSchema:()=>$R,PluginInstallConfigSchema:()=>Mue,PluginInterfaceSchema:()=>GR,PluginLifecycleEventType:()=>cue,PluginLifecyclePhaseEventSchema:()=>eue,PluginLifecycleSchema:()=>oz,PluginLoadingConfigSchema:()=>az,PluginLoadingEventSchema:()=>Cle,PluginLoadingStateSchema:()=>wle,PluginLoadingStrategySchema:()=>YR,PluginMetadataSchema:()=>_ue,PluginPerformanceMonitoringSchema:()=>iz,PluginPreloadConfigSchema:()=>XR,PluginProvenanceSchema:()=>UB,PluginPublishOptionsSchema:()=>fle,PluginPublishResultSchema:()=>ple,PluginQualityMetricsSchema:()=>AB,PluginRegisteredEventSchema:()=>$le,PluginRegistryEntrySchema:()=>Aue,PluginSandboxingSchema:()=>rz,PluginSchema:()=>Dle,PluginSearchFiltersSchema:()=>jue,PluginSecurityManifestSchema:()=>pue,PluginSecurityProtocol:()=>Nue,PluginSourceSchema:()=>tB,PluginStartupResultSchema:()=>OB,PluginStateSnapshotSchema:()=>Zle,PluginStatisticsSchema:()=>jB,PluginTrustLevelSchema:()=>hB,PluginTrustScoreSchema:()=>WB,PluginUpdateStrategySchema:()=>Xz,PluginValidateOptionsSchema:()=>ule,PluginValidateResultSchema:()=>dle,PluginVendorSchema:()=>kB,PluginVersionMetadataSchema:()=>Sue,PreviewModeConfigSchema:()=>_R,ProtocolFeatureSchema:()=>UR,ProtocolReferenceSchema:()=>HR,ProtocolVersionSchema:()=>VR,RealTimeNotificationConfigSchema:()=>LR,RequiredActionSchema:()=>xR,ResolvedDependencySchema:()=>bR,ResourceTypeSchema:()=>sB,RollbackPackageRequestSchema:()=>Jle,RollbackPackageResponseSchema:()=>Yle,RuntimeConfigSchema:()=>uB,RuntimeMode:()=>gR,SBOMEntrySchema:()=>VB,SBOMSchema:()=>HB,SandboxConfigSchema:()=>dB,ScopeConfigSchema:()=>Eue,ScopeInfoSchema:()=>Due,SecurityPolicySchema:()=>FB,SecurityScanResultSchema:()=>PB,SecurityVulnerabilitySchema:()=>NB,SemanticVersionSchema:()=>bB,ServiceFactoryRegistrationSchema:()=>Tue,ServiceMetadataSchema:()=>Cue,ServiceRegisteredEventSchema:()=>nue,ServiceRegistryConfigSchema:()=>wue,ServiceScopeType:()=>EB,ServiceUnregisteredEventSchema:()=>rue,StartupOptionsSchema:()=>Oue,StartupOrchestrationResultSchema:()=>kue,TenantRuntimeContextSchema:()=>mle,UninstallPackageRequestSchema:()=>Pz,UninstallPackageResponseSchema:()=>Fz,UpgradeContextSchema:()=>Ele,UpgradeImpactLevelSchema:()=>Hz,UpgradePackageRequestSchema:()=>Kle,UpgradePackageResponseSchema:()=>qle,UpgradePhaseSchema:()=>Wz,UpgradePlanSchema:()=>Uz,UpgradeSnapshotSchema:()=>Gle,ValidationErrorSchema:()=>vB,ValidationFindingSchema:()=>hR,ValidationResultSchema:()=>gue,ValidationSeverityEnum:()=>mR,ValidationWarningSchema:()=>yB,VersionConstraintSchema:()=>vue,VulnerabilitySeverity:()=>MB});var ole=l({name:o().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:o().optional().describe(`Command description for help text`),module:o().optional().describe(`Module path exporting oclif Command classes`)}),sle=l({commands:l({strategy:x([`pattern`,`explicit`,`single`]).optional().describe(`Command discovery strategy`),target:o().optional().describe(`Target directory for command files`),glob:o().optional().describe(`Glob pattern for command file matching`)}).optional().describe(`Command discovery configuration`),topicSeparator:o().optional().describe(`Character separating topic and command names`)}).describe(`oclif plugin configuration section`),lR=x([`objects`,`views`,`pages`,`flows`,`dashboards`,`permissions`,`agents`,`reports`,`actions`,`translations`,`themes`,`datasets`,`apis`,`triggers`,`workflows`]).describe(`Metadata category within the artifact`),uR=l({path:o().describe(`Relative file path within the artifact`),size:A().int().nonnegative().describe(`File size in bytes`),category:lR.optional().describe(`Metadata category this file belongs to`)}).describe(`A single file entry within the artifact`),dR=l({algorithm:x([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm used for checksums`),files:u(o(),o().regex(/^[a-f0-9]+$/)).describe(`File path to hash value mapping`)}).describe(`Checksum manifest for artifact integrity verification`),fR=l({algorithm:x([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).default(`RSA-SHA256`).describe(`Signing algorithm used`),publicKeyRef:o().describe(`Public key reference (URL or fingerprint) for signature verification`),signature:o().describe(`Base64-encoded digital signature`),signedAt:o().datetime().optional().describe(`ISO 8601 timestamp of when the artifact was signed`),signedBy:o().optional().describe(`Identity of the signer (publisher ID or email)`)}).describe(`Digital signature for artifact authenticity verification`),pR=l({formatVersion:o().regex(/^\d+\.\d+$/).default(`1.0`).describe(`Artifact format version (e.g. "1.0")`),packageId:o().describe(`Package identifier from manifest`),version:o().describe(`Package version from manifest`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Archive format of the artifact`),size:A().int().positive().optional().describe(`Total artifact file size in bytes`),builtAt:o().datetime().describe(`ISO 8601 timestamp of when the artifact was built`),builtWith:o().optional().describe(`Build tool identifier (e.g. "os-cli@3.2.0")`),files:S(uR).optional().describe(`List of files contained in the artifact`),metadataCategories:S(lR).optional().describe(`Metadata categories included in this artifact`),checksums:dR.optional().describe(`SHA256 checksums for artifact integrity verification`),signature:fR.optional().describe(`Digital signature for artifact authenticity verification`)}).describe(`Package artifact structure and metadata`),cle=l({directory:o().optional().describe(`Project root directory (defaults to current working directory)`),outDir:o().optional().describe(`Output directory for the built artifact (defaults to ./dist)`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Archive format for the artifact`),sign:v().default(!1).describe(`Whether to digitally sign the artifact`),privateKeyPath:o().optional().describe(`Path to RSA/ECDSA private key file for signing`),signAlgorithm:x([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).optional().describe(`Signing algorithm to use`),checksumAlgorithm:x([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm for file checksums`),includeData:v().default(!0).describe(`Whether to include seed data in the artifact`),includeLocales:v().default(!0).describe(`Whether to include locale/translation files`)}).describe(`Options for the os plugin build command`),lle=l({success:v().describe(`Whether the build succeeded`),artifactPath:o().optional().describe(`Absolute path to the generated artifact file`),artifact:pR.optional().describe(`Artifact metadata`),fileCount:A().int().min(0).optional().describe(`Total number of files in the artifact`),size:A().int().min(0).optional().describe(`Total artifact size in bytes`),durationMs:A().optional().describe(`Build duration in milliseconds`),errorMessage:o().optional().describe(`Error message if build failed`),warnings:S(o()).optional().describe(`Warnings emitted during build`)}).describe(`Result of the os plugin build command`),mR=x([`error`,`warning`,`info`]).describe(`Validation issue severity`),hR=l({severity:mR.describe(`Issue severity level`),rule:o().describe(`Validation rule identifier`),message:o().describe(`Human-readable finding description`),path:o().optional().describe(`Relative file path within the artifact`)}).describe(`A single validation finding`),ule=l({artifactPath:o().describe(`Path to the artifact file to validate`),verifySignature:v().default(!0).describe(`Whether to verify the digital signature`),publicKeyPath:o().optional().describe(`Path to the public key for signature verification`),verifyChecksums:v().default(!0).describe(`Whether to verify checksums of all files`),validateMetadata:v().default(!0).describe(`Whether to validate metadata against schemas`),platformVersion:o().optional().describe(`Platform version for compatibility verification`)}).describe(`Options for the os plugin validate command`),dle=l({valid:v().describe(`Whether the artifact passed validation`),artifact:pR.optional().describe(`Extracted artifact metadata`),checksumVerification:l({passed:v().describe(`Whether all checksums match`),checksums:dR.optional().describe(`Verified checksums`),mismatches:S(o()).optional().describe(`Files with checksum mismatches`)}).optional().describe(`Checksum verification result`),signatureVerification:l({passed:v().describe(`Whether the signature is valid`),signature:fR.optional().describe(`Signature details`),failureReason:o().optional().describe(`Signature verification failure reason`)}).optional().describe(`Signature verification result`),platformCompatibility:l({compatible:v().describe(`Whether artifact is compatible`),requiredRange:o().optional().describe(`Required platform version range`),targetVersion:o().optional().describe(`Target platform version`)}).optional().describe(`Platform compatibility check result`),findings:S(hR).describe(`All validation findings`),summary:l({errors:A().int().min(0).describe(`Error count`),warnings:A().int().min(0).describe(`Warning count`),infos:A().int().min(0).describe(`Info count`)}).optional().describe(`Finding counts by severity`)}).describe(`Result of the os plugin validate command`),fle=l({artifactPath:o().describe(`Path to the artifact file to publish`),registryUrl:o().url().optional().describe(`Marketplace API base URL`),token:o().optional().describe(`Authentication token for marketplace API`),releaseNotes:o().optional().describe(`Release notes for this version`),preRelease:v().default(!1).describe(`Whether this is a pre-release version`),skipValidation:v().default(!1).describe(`Whether to skip local validation before publish`),access:x([`public`,`restricted`]).default(`public`).describe(`Package access level on the marketplace`),tags:S(o()).optional().describe(`Tags for marketplace categorization`)}).describe(`Options for the os plugin publish command`),ple=l({success:v().describe(`Whether the publish succeeded`),packageId:o().optional().describe(`Published package identifier`),version:o().optional().describe(`Published version string`),artifactUrl:o().url().optional().describe(`URL of the published artifact in the marketplace`),sha256:o().optional().describe(`SHA256 checksum of the uploaded artifact`),submissionId:o().optional().describe(`Marketplace submission ID for review tracking`),errorMessage:o().optional().describe(`Error message if publish failed`),message:o().optional().describe(`Human-readable status message`)}).describe(`Result of the os plugin publish command`),gR=x([`development`,`production`,`test`,`provisioning`,`preview`]).describe(`Kernel operating mode`),_R=l({autoLogin:v().default(!0).describe(`Auto-login as simulated user, skipping login/registration pages`),simulatedRole:x([`admin`,`user`,`viewer`]).default(`admin`).describe(`Permission role for the simulated preview user`),simulatedUserName:o().default(`Preview User`).describe(`Display name for the simulated preview user`),readOnly:v().default(!1).describe(`Restrict the preview session to read-only operations`),expiresInSeconds:A().int().min(0).default(0).describe(`Preview session duration in seconds (0 = no expiration)`),bannerMessage:o().optional().describe(`Banner message displayed in the UI during preview mode`)}),vR=l({instanceId:o().uuid().describe(`Unique UUID for this running kernel process`),mode:gR.default(`production`),version:o().describe(`Kernel version`),appName:o().optional().describe(`Host application name`),cwd:o().describe(`Current working directory`),workspaceRoot:o().optional().describe(`Workspace root if different from cwd`),startTime:A().int().describe(`Boot timestamp (ms)`),features:u(o(),v()).default({}).describe(`Global feature toggles`),previewMode:_R.optional().describe(`Preview/demo mode configuration (used when mode is "preview")`)}),mle=vR.extend({tenantId:o().min(1).describe(`Resolved tenant identifier`),tenantPlan:x([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),tenantRegion:o().optional().describe(`Tenant deployment region`),tenantDbUrl:o().min(1).describe(`Tenant database connection URL`),tenantQuotas:GL.optional().describe(`Tenant resource quotas`)}).describe(`Tenant-aware kernel runtime context`),yR=x([`satisfied`,`needs_install`,`needs_upgrade`,`conflict`]).describe(`Resolution status for a dependency`),bR=l({packageId:o().describe(`Dependency package identifier`),requiredRange:o().describe(`SemVer range required (e.g. "^2.0.0")`),resolvedVersion:o().optional().describe(`Actual version resolved from registry`),installedVersion:o().optional().describe(`Currently installed version`),status:yR.describe(`Resolution status`),conflictReason:o().optional().describe(`Explanation of the conflict`)}).describe(`Resolution result for a single dependency`),xR=l({type:x([`install`,`upgrade`,`confirm_conflict`]).describe(`Type of action required`),packageId:o().describe(`Target package identifier`),description:o().describe(`Human-readable action description`)}).describe(`Action required before installation can proceed`),SR=l({dependencies:S(bR).describe(`Resolution result for each dependency`),canProceed:v().describe(`Whether installation can proceed`),requiredActions:S(xR).describe(`Actions required before proceeding`),installOrder:S(o()).describe(`Topologically sorted package IDs for installation`),circularDependencies:S(S(o())).optional().describe(`Circular dependency chains detected (e.g. [["A", "B", "A"]])`)}).describe(`Complete dependency resolution result`),CR=l({service:o().min(1).describe(`Target service identifier`),enabled:v().default(!0).describe(`Enable or disable this service`),strategy:x([`mock`,`memory`,`stub`,`passthrough`]).default(`memory`).describe(`Implementation strategy for development`),config:u(o(),b()).optional().describe(`Strategy-specific configuration for this service override`)}),wR=l({enabled:v().default(!0).describe(`Load fixture data on startup`),paths:S(o()).optional().describe(`Glob patterns for fixture files`),resetBeforeLoad:v().default(!0).describe(`Clear existing data before loading fixtures`),envFilter:S(o()).optional().describe(`Only load fixtures matching these environment tags`)}),TR=l({hotReload:v().default(!0).describe(`Enable HMR / live-reload`),requestInspector:v().default(!1).describe(`Enable request inspector`),dbExplorer:v().default(!1).describe(`Enable database explorer UI`),verboseLogging:v().default(!0).describe(`Enable verbose logging`),apiDocs:v().default(!0).describe(`Serve OpenAPI docs at /_dev/docs`),mailCatcher:v().default(!1).describe(`Capture outbound emails in dev`)}),ER=x([`minimal`,`standard`,`full`]).describe(`Predefined dev configuration profile`),hle=l({preset:ER.default(`standard`).describe(`Base configuration preset`),services:u(o().min(1),CR.omit({service:!0})).optional().describe(`Per-service dev overrides keyed by service name`),fixtures:wR.optional().describe(`Fixture data loading configuration`),tools:TR.optional().describe(`Developer tooling settings`),port:A().int().min(1).max(65535).default(4400).describe(`Port for the dev-tools dashboard`),open:v().default(!1).describe(`Auto-open dev dashboard in browser`),seedAdminUser:v().default(!0).describe(`Create a default admin user for development`),simulatedLatency:A().int().min(0).default(0).describe(`Artificial latency (ms) added to service calls`)}),DR=x([`critical`,`high`,`normal`,`low`,`background`]),gle={critical:0,high:1,normal:2,low:3,background:4},OR=l({source:o().describe(`Event source (e.g., plugin name, system component)`),timestamp:o().datetime().describe(`ISO 8601 datetime when event was created`),userId:o().optional().describe(`User who triggered the event`),tenantId:o().optional().describe(`Tenant identifier for multi-tenant systems`),correlationId:o().optional().describe(`Correlation ID for event tracing`),causationId:o().optional().describe(`ID of the event that caused this event`),priority:DR.optional().default(`normal`).describe(`Event priority`)}),kR=l({name:kE.describe(`Event type name (lowercase with dots)`),version:o().default(`1.0.0`).describe(`Event schema version`),schema:b().optional().describe(`JSON Schema for event payload validation`),description:o().optional().describe(`Event type description`),deprecated:v().optional().default(!1).describe(`Whether this event type is deprecated`),tags:S(o()).optional().describe(`Event type tags`)}),AR=l({id:o().optional().describe(`Unique event identifier`),name:kE.describe(`Event name (lowercase with dots, e.g., user.created, order.paid)`),payload:b().describe(`Event payload schema`),metadata:OR.describe(`Event metadata`)}),jR=l({id:o().optional().describe(`Unique handler identifier`),eventName:o().describe(`Name of event to handle (supports wildcards like user.*)`),handler:b().describe(`Handler function`),priority:A().int().default(0).describe(`Execution priority (lower numbers execute first)`),async:v().default(!0).describe(`Execute in background (true) or block (false)`),retry:l({maxRetries:A().int().min(0).default(3).describe(`Maximum retry attempts`),backoffMs:A().int().positive().default(1e3).describe(`Initial backoff delay`),backoffMultiplier:A().positive().default(2).describe(`Backoff multiplier`)}).optional().describe(`Retry policy for failed handlers`),timeoutMs:A().int().positive().optional().describe(`Handler timeout in milliseconds`),filter:b().optional().describe(`Optional filter to determine if handler should execute`)}),_le=l({from:o().describe(`Source event pattern (supports wildcards, e.g., user.* or *.created)`),to:S(o()).describe(`Target event names to route to`),transform:b().optional().describe(`Optional function to transform payload`)}),MR=l({enabled:v().default(!1).describe(`Enable event persistence`),retention:A().int().positive().describe(`Days to retain persisted events`),filter:b().optional().describe(`Optional filter function to select which events to persist`),storage:x([`database`,`file`,`s3`,`custom`]).default(`database`).describe(`Storage backend for persisted events`)}),NR=l({name:o().default(`events`).describe(`Event queue name`),concurrency:A().int().min(1).default(10).describe(`Max concurrent event handlers`),retryPolicy:l({maxRetries:A().int().min(0).default(3).describe(`Max retries for failed events`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:A().int().positive().default(6e4).describe(`Maximum retry delay`)}).optional().describe(`Default retry policy for events`),deadLetterQueue:o().optional().describe(`Dead letter queue name for failed events`),priorityEnabled:v().default(!0).describe(`Process events based on priority`)}),vle=l({fromTimestamp:o().datetime().describe(`Start timestamp for replay (ISO 8601)`),toTimestamp:o().datetime().optional().describe(`End timestamp for replay (ISO 8601)`),eventTypes:S(o()).optional().describe(`Event types to replay (empty = all)`),filters:u(o(),b()).optional().describe(`Additional filters for event selection`),speed:A().positive().default(1).describe(`Replay speed multiplier (1 = real-time)`),targetHandlers:S(o()).optional().describe(`Handler IDs to execute (empty = all)`)}),PR=l({enabled:v().default(!1).describe(`Enable event sourcing`),snapshotInterval:A().int().positive().default(100).describe(`Create snapshot every N events`),snapshotRetention:A().int().positive().default(10).describe(`Number of snapshots to retain`),retention:A().int().positive().default(365).describe(`Days to retain events`),aggregateTypes:S(o()).optional().describe(`Aggregate types to enable event sourcing for`),storage:l({type:x([`database`,`file`,`s3`,`eventstore`]).default(`database`).describe(`Storage backend`),options:u(o(),b()).optional().describe(`Storage-specific options`)}).optional().describe(`Event store configuration`)}),yle=l({id:o().describe(`Unique entry identifier`),event:AR.describe(`Original event`),error:l({message:o().describe(`Error message`),stack:o().optional().describe(`Error stack trace`),code:o().optional().describe(`Error code`)}).describe(`Failure details`),retries:A().int().min(0).describe(`Number of retry attempts`),firstFailedAt:o().datetime().describe(`When event first failed`),lastFailedAt:o().datetime().describe(`When event last failed`),failedHandler:o().optional().describe(`Handler ID that failed`)}),ble=l({id:o().describe(`Unique log entry identifier`),event:AR.describe(`The event`),status:x([`pending`,`processing`,`completed`,`failed`]).describe(`Processing status`),handlersExecuted:S(l({handlerId:o().describe(`Handler identifier`),status:x([`success`,`failed`,`timeout`]).describe(`Handler execution status`),durationMs:A().int().optional().describe(`Execution duration`),error:o().optional().describe(`Error message if failed`)})).optional().describe(`Handlers that processed this event`),receivedAt:o().datetime().describe(`When event was received`),processedAt:o().datetime().optional().describe(`When event was processed`),totalDurationMs:A().int().optional().describe(`Total processing time`)}),FR=l({id:o().optional().describe(`Unique webhook identifier`),eventPattern:o().describe(`Event name pattern (supports wildcards)`),url:o().url().describe(`Webhook endpoint URL`),method:x([`GET`,`POST`,`PUT`,`PATCH`]).default(`POST`).describe(`HTTP method`),headers:u(o(),o()).optional().describe(`HTTP headers`),authentication:l({type:x([`none`,`bearer`,`basic`,`api-key`]).describe(`Auth type`),credentials:u(o(),o()).optional().describe(`Auth credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:l({maxRetries:A().int().min(0).default(3).describe(`Max retry attempts`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:A().int().positive().default(6e4).describe(`Max retry delay`)}).optional().describe(`Retry policy`),timeoutMs:A().int().positive().default(3e4).describe(`Request timeout in milliseconds`),transform:b().optional().describe(`Transform event before sending`),enabled:v().default(!0).describe(`Whether webhook is enabled`)}),IR=l({provider:x([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Message queue provider`),topic:o().describe(`Topic or queue name`),eventPattern:o().default(`*`).describe(`Event name pattern to publish (supports wildcards)`),partitionKey:o().optional().describe(`JSON path for partition key (e.g., "metadata.tenantId")`),format:x([`json`,`avro`,`protobuf`]).default(`json`).describe(`Message serialization format`),includeMetadata:v().default(!0).describe(`Include event metadata in message`),compression:x([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression`),batchSize:A().int().min(1).default(1).describe(`Batch size for publishing`),flushIntervalMs:A().int().positive().default(1e3).describe(`Flush interval for batching`)}),LR=l({enabled:v().default(!0).describe(`Enable real-time notifications`),protocol:x([`websocket`,`sse`,`long-polling`]).default(`websocket`).describe(`Real-time protocol`),eventPattern:o().default(`*`).describe(`Event pattern to broadcast`),userFilter:v().default(!0).describe(`Filter events by user`),tenantFilter:v().default(!0).describe(`Filter events by tenant`),channels:S(l({name:o().describe(`Channel name`),eventPattern:o().describe(`Event pattern for channel`),filter:b().optional().describe(`Additional filter function`)})).optional().describe(`Named channels for event broadcasting`),rateLimit:l({maxEventsPerSecond:A().int().positive().describe(`Max events per second per client`),windowMs:A().int().positive().default(1e3).describe(`Rate limit window`)}).optional().describe(`Rate limiting configuration`)}),xle=l({persistence:MR.optional().describe(`Event persistence configuration`),queue:NR.optional().describe(`Event queue configuration`),eventSourcing:PR.optional().describe(`Event sourcing configuration`),replay:l({enabled:v().default(!0).describe(`Enable event replay capability`)}).optional().describe(`Event replay configuration`),webhooks:S(FR).optional().describe(`Webhook configurations`),messageQueue:IR.optional().describe(`Message queue integration`),realtime:LR.optional().describe(`Real-time notification configuration`),eventTypes:S(kR).optional().describe(`Event type definitions`),handlers:S(jR).optional().describe(`Global event handlers`)}),RR=x([`boolean`,`percentage`,`user_list`,`group`,`custom`]),zR=l({name:OE.describe(`Feature key (snake_case)`),label:o().optional().describe(`Display label`),description:o().optional(),enabled:v().default(!1).describe(`Is globally enabled`),strategy:RR.default(`boolean`),conditions:l({percentage:A().min(0).max(100).optional(),users:S(o()).optional(),groups:S(o()).optional(),expression:o().optional().describe(`Custom formula expression`)}).optional(),environment:x([`dev`,`staging`,`prod`,`all`]).default(`all`).describe(`Environment validity`),expiresAt:o().datetime().optional().describe(`Feature flag expiration date`)}),Sle=Object.assign(zR,{create:e=>e}),BR=x([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),VR=l({major:A().int().min(0),minor:A().int().min(0),patch:A().int().min(0)}).describe(`Semantic version of the protocol`),HR=l({id:o().regex(/^([a-z][a-z0-9]*\.)+protocol\.[a-z][a-z0-9._]*\.v\d+$/).describe(`Unique protocol identifier (e.g., com.objectstack.protocol.storage.v1)`),label:o(),version:VR,specification:o().optional().describe(`URL or path to protocol specification`),description:o().optional()}),UR=l({name:o().describe(`Feature identifier within the protocol`),enabled:v().default(!0),description:o().optional(),sinceVersion:o().optional().describe(`Version when this feature was added`),deprecatedSince:o().optional().describe(`Version when deprecated`)}),WR=l({protocol:HR,conformance:BR.default(`full`),implementedFeatures:S(o()).optional().describe(`List of implemented feature names`),features:S(UR).optional(),metadata:u(o(),b()).optional(),certified:v().default(!1).describe(`Has passed official conformance tests`),certificationDate:o().datetime().optional()}),GR=l({id:o().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:o(),description:o().optional(),version:VR,methods:S(l({name:o().describe(`Method name`),description:o().optional(),parameters:S(l({name:o(),type:o().describe(`Type notation (e.g., string, number, User)`),required:v().default(!0),description:o().optional()})).optional(),returnType:o().optional().describe(`Return value type`),async:v().default(!1).describe(`Whether method returns a Promise`)})),events:S(l({name:o().describe(`Event name`),description:o().optional(),payload:o().optional().describe(`Event payload type`)})).optional(),stability:x([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),KR=l({pluginId:o().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:o().describe(`Semantic version constraint`),optional:v().default(!1),reason:o().optional(),requiredCapabilities:S(o()).optional().describe(`Protocol IDs the dependency must support`)}),qR=l({id:o().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:o(),description:o().optional(),type:x([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:l({input:o().optional().describe(`Input type/schema`),output:o().optional().describe(`Output type/schema`),signature:o().optional().describe(`Function signature if applicable`)}).optional(),cardinality:x([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),JR=l({implements:S(WR).optional().describe(`List of protocols this plugin conforms to`),provides:S(GR).optional().describe(`Services/APIs this plugin offers to others`),requires:S(KR).optional().describe(`Required plugins and their capabilities`),extensionPoints:S(qR).optional().describe(`Points where other plugins can extend this plugin`),extensions:S(l({targetPluginId:o().describe(`Plugin ID being extended`),extensionPointId:o().describe(`Extension point identifier`),implementation:o().describe(`Path to implementation module`),priority:A().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),YR=x([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),XR=l({enabled:v().default(!1),priority:A().int().min(0).default(100),resources:S(x([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:l({routes:S(o()).optional(),roles:S(o()).optional(),deviceType:S(x([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:x([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),ZR=l({enabled:v().default(!0),strategy:x([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:x([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:A().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:l({enabled:v().default(!0),minChunks:A().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),QR=l({enabled:v().default(!0),mode:x([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:v().default(!1).describe(`Prefetch module in idle time`),preload:v().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:o().optional().describe(`Custom chunk name for webpack`),timeout:A().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:l({enabled:v().default(!0),maxAttempts:A().int().min(1).max(10).default(3),backoffMs:A().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),$R=l({mode:x([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:A().int().min(100).default(3e4),priority:A().int().min(0).default(100),critical:v().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:l({enabled:v().default(!1),maxAttempts:A().int().min(1).max(5).default(3),backoffMs:A().int().min(0).default(1e3)}).optional(),healthCheckInterval:A().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),ez=l({strategy:x([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:l({resolve:v().default(!0),onMissing:x([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:x([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:l({load:v().default(!0),onFailure:x([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:x([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:x([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),tz=l({enabled:v().default(!1),environment:x([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:x([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:S(o()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:S(o()).optional().describe(`Glob patterns for files to ignore`),debounceMs:A().int().min(0).default(300),preserveState:v().default(!1),stateSerialization:l({enabled:v().default(!1),handler:o().optional()}).optional(),hooks:l({beforeReload:o().optional().describe(`Function to call before reload`),afterReload:o().optional().describe(`Function to call after reload`),onError:o().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:l({healthValidation:v().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:v().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:A().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:v().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:A().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:A().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:A().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),nz=l({enabled:v().default(!0),storage:x([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:x([`version`,`hash`,`timestamp`]).default(`version`),ttl:A().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:A().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:S(x([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:l({enabled:v().default(!1),algorithm:x([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),rz=l({enabled:v().default(!1),scope:x([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:x([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:S(o()).optional().describe(`List of allowed capability IDs`),resourceQuotas:l({maxMemoryMB:A().int().min(1).optional(),maxCpuTimeMs:A().int().min(100).optional(),maxFileDescriptors:A().int().min(1).optional(),maxNetworkKBps:A().int().min(1).optional()}).optional(),permissions:l({allowedAPIs:S(o()).optional(),allowedPaths:S(o()).optional(),allowedEndpoints:S(o()).optional(),allowedEnvVars:S(o()).optional()}).optional(),ipc:l({enabled:v().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:x([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:A().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:A().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:S(o()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),iz=l({enabled:v().default(!1),metrics:S(x([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:A().min(0).max(1).default(1),reportingInterval:A().int().min(1).default(60),budgets:l({maxLoadTimeMs:A().int().min(0).optional(),maxInitTimeMs:A().int().min(0).optional(),maxMemoryMB:A().int().min(0).optional()}).optional(),onBudgetViolation:x([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),az=l({strategy:YR.default(`lazy`),preload:XR.optional(),codeSplitting:ZR.optional(),dynamicImport:QR.optional(),initialization:$R.optional(),dependencyResolution:ez.optional(),hotReload:tz.optional(),caching:nz.optional(),sandboxing:rz.optional(),monitoring:iz.optional()}).describe(`Complete plugin loading configuration`),Cle=l({type:x([`load-started`,`load-completed`,`load-failed`,`init-started`,`init-completed`,`init-failed`,`preload-started`,`preload-completed`,`cache-hit`,`cache-miss`,`hot-reload`,`dynamic-load`,`dynamic-unload`,`dynamic-discover`]),pluginId:o(),timestamp:A().int().min(0),durationMs:A().int().min(0).optional(),metadata:u(o(),b()).optional(),error:l({message:o(),code:o().optional(),stack:o().optional()}).optional()}).describe(`Plugin loading lifecycle event`),wle=l({pluginId:o(),state:x([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:A().min(0).max(100).default(0),startedAt:A().int().min(0).optional(),completedAt:A().int().min(0).optional(),lastError:o().optional(),retryCount:A().int().min(0).default(0)}).describe(`Plugin loading state`),Tle=l({ql:l({object:O().describe(`Get object handle for method chaining`),query:O().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:l({getCurrentUser:O().describe(`Get the current authenticated user`),getConfig:O().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:l({debug:O().describe(`Log debug message`),info:O().describe(`Log info message`),warn:O().describe(`Log warning message`),error:O().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:l({get:O().describe(`Get a value from storage`),set:O().describe(`Set a value in storage`),delete:O().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:l({t:O().describe(`Translate a key`),getLocale:O().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:u(o(),b()),events:u(o(),b()),app:l({router:l({get:O().describe(`Register GET route handler`),post:O().describe(`Register POST route handler`),use:O().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:l({register:O().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),Ele=l({previousVersion:o().describe(`Version before upgrade`),newVersion:o().describe(`Version after upgrade`),isMajorUpgrade:v().describe(`Whether this is a major version bump`),previousMetadata:u(o(),b()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`),oz=l({onInstall:O().optional().describe(`Called when plugin is installed`),onEnable:O().optional().describe(`Called when plugin is enabled`),onDisable:O().optional().describe(`Called when plugin is disabled`),onUninstall:O().optional().describe(`Called when plugin is uninstalled`),onUpgrade:O().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),sz=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`],Dle=oz.extend({id:o().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:x([`standard`,...sz]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:o().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:o().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:v().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:o().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:o().optional(),author:o().optional(),homepage:o().url().optional()}),cz=l({id:o().describe(`Unique package identifier (reverse domain style)`),namespace:o().regex(/^[a-z][a-z0-9_]{1,19}$/,`Namespace must be 2-20 chars, lowercase alphanumeric + underscore`).optional().describe(`Short namespace identifier for metadata scoping (e.g. "crm", "todo")`),version:o().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:x([`plugin`,...sz,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:o().describe(`Human-readable package name`),description:o().optional().describe(`Package description`),permissions:S(o()).optional().describe(`Array of required permission strings`),objects:S(o()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:S(o()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:u(o(),o()).optional().describe(`Package dependencies`),configuration:l({title:o().optional(),properties:u(o(),l({type:x([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:b().optional().describe(`Default value`),description:o().optional().describe(`Tooltip description`),required:v().optional().describe(`Is this setting required?`),secret:v().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:S(o()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:l({kinds:S(l({id:o().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:S(o()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:o().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:S(o()).optional().describe(`Events this plugin listens to`),menus:u(o(),S(l({id:o(),label:o(),command:o().optional()}))).optional().describe(`UI Menu contributions`),themes:S(l({id:o(),label:o(),path:o()})).optional().describe(`Theme contributions`),translations:S(l({locale:o(),path:o()})).optional().describe(`Translation resources`),actions:S(l({name:o().describe(`Unique action name`),label:o().optional(),description:o().optional(),input:b().optional().describe(`Input validation schema`),output:b().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:S(l({id:o().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:o().describe(`Human readable name`),description:o().optional()})).optional().describe(`Driver contributions`),fieldTypes:S(l({name:o().describe(`Unique field type name (e.g. "vector")`),label:o().describe(`Display label`),description:o().optional()})).optional().describe(`Field Type contributions`),functions:S(l({name:o().describe(`Function name (e.g. "distance")`),description:o().optional(),args:S(o()).optional().describe(`Argument types`),returnType:o().optional()})).optional().describe(`Query Function contributions`),routes:S(l({prefix:o().regex(/^\//).describe(`API path prefix`),service:o().describe(`Service name this plugin provides`),methods:S(o()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:S(l({name:o().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:o().optional().describe(`Command description for help text`),module:o().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:S(yk).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:JR.optional().describe(`Plugin capability declarations for interoperability`),extensions:u(o(),b()).optional().describe(`Extension points and contributions`),loading:az.optional().describe(`Plugin loading and runtime behavior configuration`),engine:l({objectstack:o().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)}),Ole=x([`package`,`admin`,`user`,`migration`,`api`]),lz=l({path:o().describe(`JSON path to the changed field`),originalValue:b().optional().describe(`Original value from the package`),currentValue:b().describe(`Current customized value`),changedBy:o().optional().describe(`User or admin who made this change`),changedAt:o().datetime().optional().describe(`Timestamp of the change`)}),uz=l({id:o().describe(`Overlay record ID (UUID)`),baseType:o().describe(`Metadata type being customized`),baseName:o().describe(`Metadata name being customized`),packageId:o().optional().describe(`Package ID that delivered the base metadata`),packageVersion:o().optional().describe(`Package version when overlay was created`),scope:x([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:o().optional().describe(`Tenant identifier`),owner:o().optional().describe(`Owner user ID for user-scope overlays`),patch:u(o(),b()).describe(`JSON Merge Patch payload (changed fields only)`),changes:S(lz).optional().describe(`Field-level change tracking for conflict detection`),active:v().default(!0).describe(`Whether this overlay is active`),createdAt:o().datetime().optional(),createdBy:o().optional(),updatedAt:o().datetime().optional(),updatedBy:o().optional()}),dz=l({path:o().describe(`JSON path to the conflicting field`),baseValue:b().describe(`Value in the old package version`),incomingValue:b().describe(`Value in the new package version`),customValue:b().describe(`Customer customized value`),suggestedResolution:x([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:o().optional().describe(`Explanation for the suggested resolution`)}),fz=l({defaultStrategy:x([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:S(o()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:S(o()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:v().default(!0).describe(`Auto-resolve changes that do not conflict`)}),kle=l({success:v().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:u(o(),b()).optional().describe(`Merged metadata result`),updatedOverlay:u(o(),b()).optional().describe(`Updated overlay after merge`),conflicts:S(dz).optional().describe(`Unresolved merge conflicts`),autoResolved:S(l({path:o(),resolution:o(),description:o().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:l({totalFields:A().int().min(0).describe(`Total fields evaluated`),unchanged:A().int().min(0).describe(`Fields with no changes`),autoResolved:A().int().min(0).describe(`Fields auto-resolved`),conflicts:A().int().min(0).describe(`Fields with conflicts`)}).optional()}),pz=l({metadataType:o().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:v().default(!0),lockedFields:S(o()).optional().describe(`Field paths that cannot be customized`),customizableFields:S(o()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:v().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:v().default(!1).describe(`Whether admins can delete package-delivered fields`)}),mz=x([`json`,`yaml`,`typescript`,`javascript`]),hz=l({size:A().int().min(0).describe(`File size in bytes`),modifiedAt:o().datetime().describe(`Last modified date`),etag:o().describe(`Entity tag for cache validation`),format:mz.describe(`Serialization format`),path:o().optional().describe(`File system path`),metadata:u(o(),b()).optional().describe(`Provider-specific metadata`)}),Ale=l({patterns:S(o()).optional().describe(`File glob patterns`),ifNoneMatch:o().optional().describe(`ETag for conditional request`),ifModifiedSince:o().datetime().optional().describe(`Only load if modified after this date`),validate:v().default(!0).describe(`Validate against schema`),useCache:v().default(!0).describe(`Enable caching`),filter:o().optional().describe(`Filter predicate as string`),limit:A().int().min(1).optional().describe(`Maximum items to load`),recursive:v().default(!0).describe(`Search subdirectories`)}),jle=l({format:mz.default(`typescript`).describe(`Output format`),prettify:v().default(!0).describe(`Format with indentation`),indent:A().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:v().default(!1).describe(`Sort object keys`),includeDefaults:v().default(!1).describe(`Include default values`),backup:v().default(!1).describe(`Create backup file`),overwrite:v().default(!0).describe(`Overwrite existing file`),atomic:v().default(!0).describe(`Use atomic write operation`),path:o().optional().describe(`Custom output path`)}),Mle=l({output:o().describe(`Output file path`),format:mz.default(`json`).describe(`Export format`),filter:o().optional().describe(`Filter items to export`),includeStats:v().default(!1).describe(`Include metadata statistics`),compress:v().default(!1).describe(`Compress output (gzip)`),prettify:v().default(!0).describe(`Pretty print output`)}),Nle=l({conflictResolution:x([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:v().default(!0).describe(`Validate before import`),dryRun:v().default(!1).describe(`Simulate import without saving`),continueOnError:v().default(!1).describe(`Continue if validation fails`),transform:o().optional().describe(`Transform items before import`)}),Ple=l({data:b().nullable().describe(`Loaded metadata`),fromCache:v().default(!1).describe(`Loaded from cache`),notModified:v().default(!1).describe(`Not modified since last request`),etag:o().optional().describe(`Entity tag`),stats:hz.optional().describe(`Metadata statistics`),loadTime:A().min(0).optional().describe(`Load duration in ms`)}),Fle=l({success:v().describe(`Save successful`),path:o().describe(`Output path`),etag:o().optional().describe(`Generated entity tag`),size:A().int().min(0).optional().describe(`File size`),saveTime:A().min(0).optional().describe(`Save duration in ms`),backupPath:o().optional().describe(`Backup file path`)}),Ile=l({type:x([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:o().describe(`Type of metadata`),name:o().describe(`Item identifier`),path:o().describe(`File path`),data:b().optional().describe(`Item data`),timestamp:o().datetime().describe(`Event timestamp`)}),Lle=l({type:o().describe(`Collection type`),count:A().int().min(0).describe(`Number of items`),formats:S(mz).describe(`Formats in collection`),totalSize:A().int().min(0).optional().describe(`Total size in bytes`),lastModified:o().datetime().optional().describe(`Last modification date`),location:o().optional().describe(`Collection location`)}),Rle=l({name:o().describe(`Loader identifier`),protocol:x([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:l({read:v().default(!0),write:v().default(!1),watch:v().default(!1),list:v().default(!0)}).describe(`Loader capabilities`),supportedFormats:S(mz).describe(`Supported formats`),supportsWatch:v().default(!1).describe(`Supports file watching`),supportsWrite:v().default(!0).describe(`Supports write operations`),supportsCache:v().default(!0).describe(`Supports caching`)}),gz=x([`filesystem`,`memory`,`none`]),_z=l({datasource:o().optional().describe(`Datasource name reference for database persistence`),tableName:o().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:gz.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:o().optional().describe(`Root directory path`),formats:S(mz).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:l({enabled:v().default(!0).describe(`Enable caching`),ttl:A().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:A().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:v().default(!1).describe(`Enable file watching`),watchOptions:l({ignored:S(o()).optional().describe(`Patterns to ignore`),persistent:v().default(!0).describe(`Keep process running`),ignoreInitial:v().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:l({strict:v().default(!0).describe(`Strict validation`),throwOnError:v().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:u(o(),b()).optional().describe(`Loader-specific configuration`)}),vz=x([`object`,`field`,`trigger`,`validation`,`hook`,`view`,`page`,`dashboard`,`app`,`action`,`report`,`flow`,`workflow`,`approval`,`datasource`,`translation`,`router`,`function`,`service`,`permission`,`profile`,`role`,`agent`,`tool`,`skill`]),yz=l({type:vz.describe(`Metadata type identifier`),label:o().describe(`Display label for the metadata type`),description:o().optional().describe(`Description of the metadata type`),filePatterns:S(o()).describe(`Glob patterns to discover files of this type`),supportsOverlay:v().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:v().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:v().default(!1).describe(`Whether version history is tracked`),loadOrder:A().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:x([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)}),bz=l({types:S(vz).optional().describe(`Filter by metadata types`),namespaces:S(o()).optional().describe(`Filter by namespaces`),packageId:o().optional().describe(`Filter by owning package`),search:o().optional().describe(`Full-text search query`),scope:x([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:x([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:S(o()).optional().describe(`Filter by tags`),sortBy:x([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:x([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:A().int().min(1).default(1).describe(`Page number`),pageSize:A().int().min(1).max(500).default(50).describe(`Items per page`)}),xz=l({items:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),namespace:o().optional().describe(`Namespace`),label:o().optional().describe(`Display label`),scope:x([`system`,`platform`,`user`]).optional(),state:x([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:o().optional(),updatedAt:o().datetime().optional()})).describe(`Matched metadata items`),total:A().int().min(0).describe(`Total matching items`),page:A().int().min(1).describe(`Current page`),pageSize:A().int().min(1).describe(`Page size`)}),zle=l({event:x([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:vz.describe(`Metadata type`),name:o().describe(`Metadata item name`),namespace:o().optional().describe(`Namespace`),packageId:o().optional().describe(`Owning package ID`),timestamp:o().datetime().describe(`Event timestamp`),actor:o().optional().describe(`User or system that triggered the event`),payload:u(o(),b()).optional().describe(`Event-specific payload`)}),Sz=l({valid:v().describe(`Whether the metadata is valid`),errors:S(l({path:o().describe(`JSON path to the invalid field`),message:o().describe(`Error description`),code:o().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:S(l({path:o().describe(`JSON path to the field`),message:o().describe(`Warning description`)})).optional().describe(`Validation warnings`)}),Cz=l({storage:_z.describe(`Storage backend configuration`),customizationPolicies:S(pz).optional().describe(`Default customization policies per type`),mergeStrategy:fz.optional().describe(`Merge strategy for package upgrades`),additionalTypes:S(yz.omit({type:!0}).extend({type:o().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:v().default(!0).describe(`Emit metadata change events`),validateOnWrite:v().default(!0).describe(`Validate metadata on write`),enableVersioning:v().default(!1).describe(`Track metadata version history`),cacheMaxItems:A().int().min(0).default(1e4).describe(`Max items in memory cache`)}),Ble=l({id:p(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:p(`ObjectStack Metadata Service`).describe(`Plugin name`),version:o().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:p(`standard`).describe(`Plugin type`),description:o().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:l({crud:v().default(!0).describe(`Supports metadata CRUD`),query:v().default(!0).describe(`Supports metadata query`),overlay:v().default(!0).describe(`Supports customization overlays`),watch:v().default(!1).describe(`Supports file watching`),importExport:v().default(!0).describe(`Supports import/export`),validation:v().default(!0).describe(`Supports schema validation`),versioning:v().default(!1).describe(`Supports version history`),events:v().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:Cz.optional().describe(`Plugin configuration`)}),Vle=[{type:`object`,label:`Object`,filePatterns:[`**/*.object.ts`,`**/*.object.yml`,`**/*.object.json`],supportsOverlay:!0,allowRuntimeCreate:!1,supportsVersioning:!0,loadOrder:10,domain:`data`},{type:`field`,label:`Field`,filePatterns:[`**/*.field.ts`,`**/*.field.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:20,domain:`data`},{type:`trigger`,label:`Trigger`,filePatterns:[`**/*.trigger.ts`,`**/*.trigger.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:30,domain:`data`},{type:`validation`,label:`Validation Rule`,filePatterns:[`**/*.validation.ts`,`**/*.validation.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:30,domain:`data`},{type:`hook`,label:`Hook`,filePatterns:[`**/*.hook.ts`,`**/*.hook.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:30,domain:`data`},{type:`view`,label:`View`,filePatterns:[`**/*.view.ts`,`**/*.view.yml`,`**/*.view.json`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:50,domain:`ui`},{type:`page`,label:`Page`,filePatterns:[`**/*.page.ts`,`**/*.page.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:50,domain:`ui`},{type:`dashboard`,label:`Dashboard`,filePatterns:[`**/*.dashboard.ts`,`**/*.dashboard.yml`,`**/*.dashboard.json`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:60,domain:`ui`},{type:`app`,label:`Application`,filePatterns:[`**/*.app.ts`,`**/*.app.yml`,`**/*.app.json`],supportsOverlay:!0,allowRuntimeCreate:!1,supportsVersioning:!0,loadOrder:70,domain:`ui`},{type:`action`,label:`Action`,filePatterns:[`**/*.action.ts`,`**/*.action.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:50,domain:`ui`},{type:`report`,label:`Report`,filePatterns:[`**/*.report.ts`,`**/*.report.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:60,domain:`ui`},{type:`flow`,label:`Flow`,filePatterns:[`**/*.flow.ts`,`**/*.flow.yml`,`**/*.flow.json`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!0,loadOrder:80,domain:`automation`},{type:`workflow`,label:`Workflow`,filePatterns:[`**/*.workflow.ts`,`**/*.workflow.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!0,loadOrder:80,domain:`automation`},{type:`approval`,label:`Approval Process`,filePatterns:[`**/*.approval.ts`,`**/*.approval.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:80,domain:`automation`},{type:`datasource`,label:`Datasource`,filePatterns:[`**/*.datasource.ts`,`**/*.datasource.yml`],supportsOverlay:!1,allowRuntimeCreate:!1,supportsVersioning:!1,loadOrder:5,domain:`system`},{type:`translation`,label:`Translation`,filePatterns:[`**/*.translation.ts`,`**/*.translation.yml`,`**/*.translation.json`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:90,domain:`system`},{type:`router`,label:`Router`,filePatterns:[`**/*.router.ts`],supportsOverlay:!1,allowRuntimeCreate:!1,supportsVersioning:!1,loadOrder:40,domain:`system`},{type:`function`,label:`Function`,filePatterns:[`**/*.function.ts`],supportsOverlay:!1,allowRuntimeCreate:!1,supportsVersioning:!1,loadOrder:40,domain:`system`},{type:`service`,label:`Service`,filePatterns:[`**/*.service.ts`],supportsOverlay:!1,allowRuntimeCreate:!1,supportsVersioning:!1,loadOrder:40,domain:`system`},{type:`permission`,label:`Permission Set`,filePatterns:[`**/*.permission.ts`,`**/*.permission.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!0,loadOrder:15,domain:`security`},{type:`profile`,label:`Profile`,filePatterns:[`**/*.profile.ts`,`**/*.profile.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:15,domain:`security`},{type:`role`,label:`Role`,filePatterns:[`**/*.role.ts`,`**/*.role.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:15,domain:`security`},{type:`agent`,label:`AI Agent`,filePatterns:[`**/*.agent.ts`,`**/*.agent.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!0,loadOrder:90,domain:`ai`},{type:`tool`,label:`AI Tool`,filePatterns:[`**/*.tool.ts`,`**/*.tool.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:85,domain:`ai`},{type:`skill`,label:`AI Skill`,filePatterns:[`**/*.skill.ts`,`**/*.skill.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:88,domain:`ai`}],Hle=l({items:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),data:u(o(),b()).describe(`Metadata payload`),namespace:o().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:v().default(!1).describe(`Continue if individual item fails`),validate:v().default(!0).describe(`Validate before register`)}),wz=l({total:A().int().min(0).describe(`Total items processed`),succeeded:A().int().min(0).describe(`Successfully processed`),failed:A().int().min(0).describe(`Failed items`),errors:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),error:o().describe(`Error message`)})).optional().describe(`Per-item errors`)}),Tz=l({sourceType:o().describe(`Dependent metadata type`),sourceName:o().describe(`Dependent metadata name`),targetType:o().describe(`Referenced metadata type`),targetName:o().describe(`Referenced metadata name`),kind:x([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)}),Ez=x([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),Dz=l({manifest:cz.describe(`Full package manifest`),status:Ez.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:v().default(!0).describe(`Whether the package is currently enabled`),installedAt:o().datetime().optional().describe(`Installation timestamp`),updatedAt:o().datetime().optional().describe(`Last update timestamp`),installedVersion:o().optional().describe(`Currently installed version for quick access`),previousVersion:o().optional().describe(`Version before the last upgrade`),statusChangedAt:o().datetime().optional().describe(`Status change timestamp`),errorMessage:o().optional().describe(`Error message when status is error`),settings:u(o(),b()).optional().describe(`User-provided configuration settings`),upgradeHistory:S(l({fromVersion:o().describe(`Version before upgrade`),toVersion:o().describe(`Version after upgrade`),upgradedAt:o().datetime().describe(`Upgrade timestamp`),status:x([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:S(o()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:S(o()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`),Ule=l({namespace:o().describe(`Namespace prefix`),packageId:o().describe(`Owning package ID`),registeredAt:o().datetime().describe(`Registration timestamp`),status:x([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),Wle=l({type:p(`namespace_conflict`).describe(`Error type`),requestedNamespace:o().describe(`Requested namespace`),conflictingPackageId:o().describe(`Conflicting package ID`),conflictingPackageName:o().describe(`Conflicting package display name`),suggestion:o().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),Oz=l({status:Ez.optional().describe(`Filter by package status`),type:cz.shape.type.optional().describe(`Filter by package type`),enabled:v().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),kz=l({packages:S(Dz).describe(`List of installed packages`),total:A().describe(`Total package count`)}).describe(`List packages response`),Az=l({id:o().describe(`Package identifier`)}).describe(`Get package request`),jz=l({package:Dz.describe(`Package details`)}).describe(`Get package response`),Mz=l({manifest:cz.describe(`Package manifest to install`),settings:u(o(),b()).optional().describe(`User-provided settings at install time`),enableOnInstall:v().default(!0).describe(`Whether to enable immediately after install`),platformVersion:o().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),Nz=l({package:Dz.describe(`Installed package details`),message:o().optional().describe(`Installation status message`),dependencyResolution:SR.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),Pz=l({id:o().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),Fz=l({id:o().describe(`Uninstalled package ID`),success:v().describe(`Whether uninstall succeeded`),message:o().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),Iz=l({id:o().describe(`Package ID to enable`)}).describe(`Enable package request`),Lz=l({package:Dz.describe(`Enabled package details`),message:o().optional().describe(`Enable status message`)}).describe(`Enable package response`),Rz=l({id:o().describe(`Package ID to disable`)}).describe(`Disable package request`),zz=l({package:Dz.describe(`Disabled package details`),message:o().optional().describe(`Disable status message`)}).describe(`Disable package response`),Bz=x([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),Vz=l({type:o().describe(`Metadata type`),name:o().describe(`Metadata name`),changeType:Bz.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:v().default(!1).describe(`Whether this change may conflict with customizations`),summary:o().optional().describe(`Human-readable change summary`),previousName:o().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),Hz=x([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),Uz=l({packageId:o().describe(`Package identifier`),fromVersion:o().describe(`Currently installed version`),toVersion:o().describe(`Target upgrade version`),impactLevel:Hz.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:S(Vz).describe(`All metadata changes`),affectedCustomizations:A().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:v().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:S(o()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:S(l({packageId:o(),fromVersion:o(),toVersion:o()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:A().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:o().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`),Gle=l({id:o().describe(`Snapshot identifier`),packageId:o().describe(`Package identifier`),fromVersion:o().describe(`Version before upgrade`),toVersion:o().describe(`Target upgrade version`),tenantId:o().optional().describe(`Tenant identifier`),previousManifest:cz.describe(`Complete manifest of the previous package version`),metadataSnapshot:S(l({type:o(),name:o(),metadata:u(o(),b())})).describe(`Snapshot of all package metadata`),customizationSnapshot:S(u(o(),b())).optional().describe(`Snapshot of customer customizations`),createdAt:o().datetime().describe(`Snapshot creation timestamp`),expiresAt:o().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),Kle=l({packageId:o().describe(`Package ID to upgrade`),targetVersion:o().optional().describe(`Target version (defaults to latest)`),manifest:cz.optional().describe(`New manifest (if installing from local)`),createSnapshot:v().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:x([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:v().default(!1).describe(`Preview upgrade without making changes`),skipValidation:v().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`),Wz=x([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`),qle=l({success:v().describe(`Whether the upgrade succeeded`),phase:Wz.describe(`Current upgrade phase`),plan:Uz.optional().describe(`Upgrade plan`),snapshotId:o().optional().describe(`Snapshot ID for rollback`),conflicts:S(l({path:o(),baseValue:b(),incomingValue:b(),customValue:b()})).optional().describe(`Unresolved merge conflicts`),errorMessage:o().optional().describe(`Error message if upgrade failed`),message:o().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),Jle=l({packageId:o().describe(`Package ID to rollback`),snapshotId:o().describe(`Snapshot ID to restore from`),rollbackCustomizations:v().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),Yle=l({success:v().describe(`Whether the rollback succeeded`),restoredVersion:o().optional().describe(`Version restored to`),message:o().optional().describe(`Rollback status message`)}).describe(`Rollback package response`),Gz=x([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),Kz=l({interval:A().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:A().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:A().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:A().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:o().optional().describe(`Method name to call for health check`),autoRestart:v().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:A().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)}),Xle=l({status:Gz,timestamp:o().datetime(),message:o().optional(),metrics:l({uptime:A().describe(`Plugin uptime in milliseconds`),memoryUsage:A().optional().describe(`Memory usage in bytes`),cpuUsage:A().optional().describe(`CPU usage percentage`),activeConnections:A().optional().describe(`Number of active connections`),errorRate:A().optional().describe(`Error rate (errors per minute)`),responseTime:A().optional().describe(`Average response time in ms`)}).partial().optional(),checks:S(l({name:o().describe(`Check name`),status:x([`passed`,`failed`,`warning`]),message:o().optional(),data:u(o(),b()).optional()})).optional(),dependencies:S(l({pluginId:o(),status:Gz,message:o().optional()})).optional()}),qz=l({provider:x([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:S(o()).optional().describe(`Backend connection endpoints`),keyPrefix:o().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:A().int().min(0).optional().describe(`State expiration time in seconds`),auth:l({username:o().optional(),password:o().optional(),token:o().optional(),certificate:o().optional()}).optional(),replication:l({enabled:v().default(!0),minReplicas:A().int().min(1).default(1)}).optional(),customConfig:u(o(),b()).optional().describe(`Provider-specific configuration`)}),Jz=l({enabled:v().default(!1),watchPatterns:S(o()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:A().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:v().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:x([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:qz.optional().describe(`Configuration for distributed state management`),shutdownTimeout:A().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:S(o()).optional().describe(`Hook names to call before reload`),afterReload:S(o()).optional().describe(`Hook names to call after reload`)}),Yz=l({enabled:v().default(!0),fallbackMode:x([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:S(o()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:S(o()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:S(l({feature:o().describe(`Feature name`),enabled:v().describe(`Whether feature is available in degraded mode`),reason:o().optional()})).optional(),autoRecovery:l({enabled:v().default(!0),retryInterval:A().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:A().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),Xz=l({mode:x([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:l({major:v().default(!1).describe(`Allow major version updates`),minor:v().default(!0).describe(`Allow minor version updates`),patch:v().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:l({cron:o().optional(),timezone:o().default(`UTC`),maintenanceWindow:A().int().min(1).default(60)}).optional(),rollback:l({enabled:v().default(!0),automatic:v().default(!0),keepVersions:A().int().min(1).default(3),timeout:A().int().min(1e3).default(3e4)}).optional(),validation:l({checkCompatibility:v().default(!0),runTests:v().default(!1),testSuite:o().optional()}).optional()}),Zle=l({pluginId:o(),version:o(),timestamp:o().datetime(),state:u(o(),b()),metadata:l({checksum:o().optional().describe(`State checksum for verification`),compressed:v().default(!1),encryption:o().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),Qle=l({health:Kz.optional(),hotReload:Jz.optional(),degradation:Yz.optional(),updates:Xz.optional(),resources:l({maxMemory:A().int().optional().describe(`Maximum memory in bytes`),maxCpu:A().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:A().int().optional().describe(`Maximum concurrent connections`),timeout:A().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:l({enableMetrics:v().default(!0),enableTracing:v().default(!0),enableProfiling:v().default(!1),metricsInterval:A().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()}),Zz=x([`init`,`start`,`destroy`]).describe(`Plugin lifecycle phase`),Qz=l({pluginName:o().describe(`Name of the plugin`),timestamp:A().int().describe(`Unix timestamp in milliseconds when event occurred`)}),$le=Qz.extend({version:o().optional().describe(`Plugin version`)}),eue=Qz.extend({duration:A().min(0).optional().describe(`Duration of the lifecycle phase in milliseconds`),phase:Zz.optional().describe(`Lifecycle phase`)}),tue=Qz.extend({error:l({name:o().describe(`Error class name`),message:o().describe(`Error message`),stack:o().optional().describe(`Stack trace`),code:o().optional().describe(`Error code`)}).describe(`Serializable error representation`),phase:Zz.describe(`Lifecycle phase where error occurred`),errorMessage:o().optional().describe(`Error message`),errorStack:o().optional().describe(`Error stack trace`)}),nue=l({serviceName:o().describe(`Name of the registered service`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),serviceType:o().optional().describe(`Type or interface name of the service`)}),rue=l({serviceName:o().describe(`Name of the unregistered service`),timestamp:A().int().describe(`Unix timestamp in milliseconds`)}),iue=l({hookName:o().describe(`Name of the hook`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),handlerCount:A().int().min(0).describe(`Number of handlers registered for this hook`)}),aue=l({hookName:o().describe(`Name of the hook`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),args:S(b()).describe(`Arguments passed to the hook handlers`),handlerCount:A().int().min(0).optional().describe(`Number of handlers that will handle this event`)}),$z=l({timestamp:A().int().describe(`Unix timestamp in milliseconds`)}),oue=$z.extend({duration:A().min(0).optional().describe(`Total initialization duration in milliseconds`),pluginCount:A().int().min(0).optional().describe(`Number of plugins initialized`)}),sue=$z.extend({reason:o().optional().describe(`Reason for kernel shutdown`)}),cue=x([`kernel:ready`,`kernel:shutdown`,`kernel:before-init`,`kernel:after-init`,`plugin:registered`,`plugin:before-init`,`plugin:init`,`plugin:after-init`,`plugin:before-start`,`plugin:started`,`plugin:after-start`,`plugin:before-destroy`,`plugin:destroyed`,`plugin:after-destroy`,`plugin:error`,`service:registered`,`service:unregistered`,`hook:registered`,`hook:triggered`]).describe(`Plugin lifecycle event type`),eB=x([`load`,`unload`,`reload`,`enable`,`disable`]).describe(`Runtime plugin operation type`),tB=l({type:x([`npm`,`local`,`url`,`registry`,`git`]).describe(`Plugin source type`),location:o().describe(`Package name, file path, URL, or git repository`),version:o().optional().describe(`Semver version range (e.g., "^1.0.0")`),integrity:o().optional().describe(`Subresource Integrity hash (e.g., "sha384-...")`)}).describe(`Plugin source location for dynamic resolution`),nB=l({type:x([`onCommand`,`onRoute`,`onObject`,`onEvent`,`onService`,`onSchedule`,`onStartup`]).describe(`Trigger type for lazy activation`),pattern:o().describe(`Match pattern for the activation trigger`)}).describe(`Lazy activation trigger for a dynamic plugin`),lue=l({pluginId:o().describe(`Unique plugin identifier`),source:tB,activationEvents:S(nB).optional().describe(`Lazy activation triggers; if omitted plugin starts immediately`),config:u(o(),b()).optional().describe(`Runtime configuration overrides`),priority:A().int().min(0).default(100).describe(`Loading priority (lower is higher)`),sandbox:v().default(!1).describe(`Run in an isolated sandbox`),timeout:A().int().min(1e3).default(6e4).describe(`Maximum time to complete loading in ms`)}).describe(`Request to dynamically load a plugin at runtime`),uue=l({pluginId:o().describe(`Plugin to unload`),strategy:x([`graceful`,`forceful`,`drain`]).default(`graceful`).describe(`How to handle in-flight work during unload`),timeout:A().int().min(1e3).default(3e4).describe(`Maximum time to complete unloading in ms`),cleanupCache:v().default(!1).describe(`Remove cached code and assets after unload`),dependentAction:x([`cascade`,`warn`,`block`]).default(`block`).describe(`How to handle plugins that depend on this one`)}).describe(`Request to dynamically unload a plugin at runtime`),due=l({success:v(),operation:eB,pluginId:o(),durationMs:A().int().min(0).optional(),version:o().optional(),error:l({code:o().describe(`Machine-readable error code`),message:o().describe(`Human-readable error message`),details:u(o(),b()).optional()}).optional(),warnings:S(o()).optional()}).describe(`Result of a dynamic plugin operation`),rB=l({type:x([`registry`,`npm`,`directory`,`url`]).describe(`Discovery source type`),endpoint:o().describe(`Registry URL, directory path, or manifest URL`),pollInterval:A().int().min(0).default(0).describe(`How often to re-scan for new plugins (0 = manual)`),filter:l({tags:S(o()).optional(),vendors:S(o()).optional(),minTrustLevel:x([`verified`,`trusted`,`community`,`untrusted`]).optional()}).optional()}).describe(`Source for runtime plugin discovery`),iB=l({enabled:v().default(!1),sources:S(rB).default([]),autoLoad:v().default(!1).describe(`Automatically load newly discovered plugins`),requireApproval:v().default(!0).describe(`Require admin approval before loading discovered plugins`)}).describe(`Runtime plugin discovery configuration`),fue=l({enabled:v().default(!1).describe(`Enable runtime load/unload of plugins`),maxDynamicPlugins:A().int().min(1).default(50).describe(`Upper limit on runtime-loaded plugins`),discovery:iB.optional(),defaultSandbox:v().default(!0).describe(`Sandbox dynamically loaded plugins by default`),allowedSources:S(x([`npm`,`local`,`url`,`registry`,`git`])).optional().describe(`Restrict which source types are permitted`),requireIntegrity:v().default(!0).describe(`Require integrity hash verification for remote sources`),operationTimeout:A().int().min(1e3).default(6e4).describe(`Default timeout for load/unload operations in ms`)}).describe(`Dynamic plugin loading subsystem configuration`),aB=x([`global`,`tenant`,`user`,`resource`,`plugin`]).describe(`Scope of permission application`),oB=x([`create`,`read`,`update`,`delete`,`execute`,`manage`,`configure`,`share`,`export`,`import`,`admin`]).describe(`Type of action being permitted`),sB=x([`data.object`,`data.record`,`data.field`,`ui.view`,`ui.dashboard`,`ui.report`,`system.config`,`system.plugin`,`system.api`,`system.service`,`storage.file`,`storage.database`,`network.http`,`network.websocket`,`process.spawn`,`process.env`]).describe(`Type of resource being accessed`),cB=l({id:o().describe(`Unique permission identifier`),resource:sB,actions:S(oB),scope:aB.default(`plugin`),filter:l({resourceIds:S(o()).optional(),condition:o().optional().describe(`Filter expression (e.g., owner = currentUser)`),fields:S(o()).optional().describe(`Allowed fields for data resources`)}).optional(),description:o(),required:v().default(!0),justification:o().optional().describe(`Why this permission is needed`)}),lB=l({permissions:S(cB),groups:S(l({name:o().describe(`Group name`),description:o(),permissions:S(o()).describe(`Permission IDs in this group`)})).optional(),defaultGrant:x([`prompt`,`allow`,`deny`,`inherit`]).default(`prompt`)}),uB=l({engine:x([`v8-isolate`,`wasm`,`container`,`process`]).default(`v8-isolate`).describe(`Execution environment engine`),engineConfig:l({wasm:l({maxMemoryPages:A().int().min(1).max(65536).optional().describe(`Maximum WASM memory pages (64KB each)`),instructionLimit:A().int().min(1).optional().describe(`Maximum instructions before timeout`),enableSimd:v().default(!1).describe(`Enable WebAssembly SIMD support`),enableThreads:v().default(!1).describe(`Enable WebAssembly threads`),enableBulkMemory:v().default(!0).describe(`Enable bulk memory operations`)}).optional(),container:l({image:o().optional().describe(`Container image to use`),runtime:x([`docker`,`podman`,`containerd`]).default(`docker`),resources:l({cpuLimit:o().optional().describe(`CPU limit (e.g., "0.5", "2")`),memoryLimit:o().optional().describe(`Memory limit (e.g., "512m", "1g")`)}).optional(),networkMode:x([`none`,`bridge`,`host`]).default(`bridge`)}).optional(),v8Isolate:l({heapSizeMb:A().int().min(1).optional(),enableSnapshot:v().default(!0)}).optional()}).optional(),resourceLimits:l({maxMemory:A().int().optional().describe(`Maximum memory allocation`),maxCpu:A().min(0).max(100).optional().describe(`Maximum CPU usage percentage`),timeout:A().int().min(0).optional().describe(`Maximum execution time`)}).optional()}),dB=l({enabled:v().default(!0),level:x([`none`,`minimal`,`standard`,`strict`,`paranoid`]).default(`standard`),runtime:uB.optional().describe(`Execution environment and isolation settings`),filesystem:l({mode:x([`none`,`readonly`,`restricted`,`full`]).default(`restricted`),allowedPaths:S(o()).optional().describe(`Whitelisted paths`),deniedPaths:S(o()).optional().describe(`Blacklisted paths`),maxFileSize:A().int().optional().describe(`Maximum file size in bytes`)}).optional(),network:l({mode:x([`none`,`local`,`restricted`,`full`]).default(`restricted`),allowedHosts:S(o()).optional().describe(`Whitelisted hosts`),deniedHosts:S(o()).optional().describe(`Blacklisted hosts`),allowedPorts:S(A()).optional().describe(`Allowed port numbers`),maxConnections:A().int().optional()}).optional(),process:l({allowSpawn:v().default(!1).describe(`Allow spawning child processes`),allowedCommands:S(o()).optional().describe(`Whitelisted commands`),timeout:A().int().optional().describe(`Process timeout in ms`)}).optional(),memory:l({maxHeap:A().int().optional().describe(`Maximum heap size in bytes`),maxStack:A().int().optional().describe(`Maximum stack size in bytes`)}).optional(),cpu:l({maxCpuPercent:A().min(0).max(100).optional(),maxThreads:A().int().optional()}).optional(),environment:l({mode:x([`none`,`readonly`,`restricted`,`full`]).default(`readonly`),allowedVars:S(o()).optional(),deniedVars:S(o()).optional()}).optional()}),fB=l({cve:o().optional(),id:o(),severity:x([`critical`,`high`,`medium`,`low`,`info`]),category:o().optional(),title:o(),location:o().optional(),remediation:o().optional(),description:o(),affectedVersions:S(o()),fixedIn:S(o()).optional(),cvssScore:A().min(0).max(10).optional(),exploitAvailable:v().default(!1),patchAvailable:v().default(!1),workaround:o().optional(),references:S(o()).optional(),discoveredDate:o().datetime().optional(),publishedDate:o().datetime().optional()}),pB=l({timestamp:o().datetime(),scanner:l({name:o(),version:o()}),status:x([`passed`,`failed`,`warning`]),vulnerabilities:S(fB).optional(),codeIssues:S(l({severity:x([`error`,`warning`,`info`]),type:o().describe(`Issue type (e.g., sql-injection, xss)`),file:o(),line:A().int().optional(),message:o(),suggestion:o().optional()})).optional(),dependencyVulnerabilities:S(l({package:o(),version:o(),vulnerability:fB})).optional(),licenseCompliance:l({status:x([`compliant`,`non-compliant`,`unknown`]),issues:S(l({package:o(),license:o(),reason:o()})).optional()}).optional(),summary:l({totalVulnerabilities:A().int(),criticalCount:A().int(),highCount:A().int(),mediumCount:A().int(),lowCount:A().int(),infoCount:A().int()})}),mB=l({csp:l({directives:u(o(),S(o())).optional(),reportOnly:v().default(!1)}).optional(),cors:l({allowedOrigins:S(o()),allowedMethods:S(o()),allowedHeaders:S(o()),allowCredentials:v().default(!1),maxAge:A().int().optional()}).optional(),rateLimit:l({enabled:v().default(!0),maxRequests:A().int(),windowMs:A().int().describe(`Time window in milliseconds`),strategy:x([`fixed`,`sliding`,`token-bucket`]).default(`sliding`)}).optional(),authentication:l({required:v().default(!0),methods:S(x([`jwt`,`oauth2`,`api-key`,`session`,`certificate`])),tokenExpiration:A().int().optional().describe(`Token expiration in seconds`)}).optional(),encryption:l({dataAtRest:v().default(!1).describe(`Encrypt data at rest`),dataInTransit:v().default(!0).describe(`Enforce HTTPS/TLS`),algorithm:o().optional().describe(`Encryption algorithm`),minKeyLength:A().int().optional().describe(`Minimum key length in bits`)}).optional(),auditLog:l({enabled:v().default(!0),events:S(o()).optional().describe(`Events to log`),retention:A().int().optional().describe(`Log retention in days`)}).optional()}),hB=x([`verified`,`trusted`,`community`,`untrusted`,`blocked`]).describe(`Trust level of the plugin`),pue=l({pluginId:o(),trustLevel:hB,permissions:lB,sandbox:dB,policy:mB.optional(),scanResults:S(pB).optional(),vulnerabilities:S(fB).optional(),codeSigning:l({signed:v(),signature:o().optional(),certificate:o().optional(),algorithm:o().optional(),timestamp:o().datetime().optional()}).optional(),certifications:S(l({name:o().describe(`Certification name (e.g., SOC 2, ISO 27001)`),issuer:o(),issuedDate:o().datetime(),expiryDate:o().datetime().optional(),certificateUrl:o().url().optional()})).optional(),securityContact:l({email:o().email().optional(),url:o().url().optional(),pgpKey:o().optional()}).optional(),vulnerabilityDisclosure:l({policyUrl:o().url().optional(),responseTime:A().int().optional().describe(`Expected response time in hours`),bugBounty:v().default(!1)}).optional()}),gB=/^[a-z][a-z0-9_]*$/,_B=o().describe(`Validates a file path against OPS naming conventions`).superRefine((e,t)=>{if(!e.startsWith(`src/`))return;let n=e.split(`/`);if(n.length>2){let e=n[1];gB.test(e)||t.addIssue({code:le.custom,message:`Domain directory '${e}' must be lowercase snake_case`})}let r=n[n.length-1];r===`index.ts`||r===`main.ts`||gB.test(r.split(`.`)[0])||t.addIssue({code:le.custom,message:`Filename '${r}' base name must be lowercase snake_case`})}),mue=l({name:o().regex(gB).describe(`Module name (snake_case)`),files:S(o()).describe(`List of files in this module`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}).describe(`Scanned domain module representing a plugin folder`).superRefine((e,t)=>{e.files.includes(`index.ts`)||t.addIssue({code:le.custom,message:`Module '${e.name}' is missing an 'index.ts' entry point.`})}),hue=l({root:o().describe(`Root directory path of the plugin project`),files:S(o()).describe(`List of all file paths relative to root`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}).describe(`Full plugin project layout validated against OPS conventions`).superRefine((e,t)=>{e.files.includes(`objectstack.config.ts`)||t.addIssue({code:le.custom,message:`Missing 'objectstack.config.ts' configuration file.`}),e.files.filter(e=>e.startsWith(`src/`)).forEach(e=>{let n=_B.safeParse(e);n.success||n.error.issues.forEach(n=>{t.addIssue({...n,path:[e]})})})}),vB=l({field:o().describe(`Field name that failed validation`),message:o().describe(`Human-readable error message`),code:o().optional().describe(`Machine-readable error code`)}),yB=l({field:o().describe(`Field name with warning`),message:o().describe(`Human-readable warning message`),code:o().optional().describe(`Machine-readable warning code`)}),gue=l({valid:v().describe(`Whether the plugin passed validation`),errors:S(vB).optional().describe(`Validation errors`),warnings:S(yB).optional().describe(`Validation warnings`)}),_ue=l({name:o().min(1).describe(`Unique plugin identifier`),version:o().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic version (e.g., 1.0.0)`),dependencies:S(o()).optional().describe(`Array of plugin names this plugin depends on`),signature:o().optional().describe(`Cryptographic signature for plugin verification`)}).passthrough().describe(`Plugin metadata for validation`),bB=l({major:A().int().min(0).describe(`Major version (breaking changes)`),minor:A().int().min(0).describe(`Minor version (backward compatible features)`),patch:A().int().min(0).describe(`Patch version (backward compatible fixes)`),preRelease:o().optional().describe(`Pre-release identifier (alpha, beta, rc.1)`),build:o().optional().describe(`Build metadata`)}).describe(`Semantic version number`),vue=c([o().regex(/^[\d.]+$/).describe("Exact version: `1.2.3`"),o().regex(/^\^[\d.]+$/).describe("Compatible with: `^1.2.3` (`>=1.2.3 <2.0.0`)"),o().regex(/^~[\d.]+$/).describe("Approximately: `~1.2.3` (`>=1.2.3 <1.3.0`)"),o().regex(/^>=[\d.]+$/).describe("Greater than or equal: `>=1.2.3`"),o().regex(/^>[\d.]+$/).describe("Greater than: `>1.2.3`"),o().regex(/^<=[\d.]+$/).describe("Less than or equal: `<=1.2.3`"),o().regex(/^<[\d.]+$/).describe("Less than: `<1.2.3`"),o().regex(/^[\d.]+ - [\d.]+$/).describe("Range: `1.2.3 - 2.3.4`"),p(`*`).describe(`Any version`),p(`latest`).describe(`Latest stable version`)]),xB=x([`fully-compatible`,`backward-compatible`,`deprecated-compatible`,`breaking-changes`,`incompatible`]).describe(`Compatibility level between versions`),SB=l({introducedIn:o().describe(`Version that introduced this breaking change`),type:x([`api-removed`,`api-renamed`,`api-signature-changed`,`behavior-changed`,`dependency-changed`,`configuration-changed`,`protocol-changed`]),description:o(),migrationGuide:o().optional().describe(`How to migrate from old to new`),deprecatedIn:o().optional().describe(`Version where old API was deprecated`),removedIn:o().optional().describe(`Version where old API will be removed`),automatedMigration:v().default(!1).describe(`Whether automated migration tool is available`),severity:x([`critical`,`major`,`minor`]).describe(`Impact severity`)}),CB=l({feature:o().describe(`Deprecated feature identifier`),deprecatedIn:o(),removeIn:o().optional(),reason:o(),alternative:o().optional().describe(`What to use instead`),migrationPath:o().optional().describe(`How to migrate to alternative`)}),wB=l({from:o().describe(`Version being upgraded from`),to:o().describe(`Version being upgraded to`),compatibility:xB,breakingChanges:S(SB).optional(),migrationRequired:v().default(!1),migrationComplexity:x([`trivial`,`simple`,`moderate`,`complex`,`major`]).optional(),estimatedMigrationTime:A().optional(),migrationScript:o().optional().describe(`Path to migration script`),testCoverage:A().min(0).max(100).optional().describe(`Percentage of migration covered by tests`)}),yue=l({pluginId:o(),currentVersion:o(),compatibilityMatrix:S(wB),supportedVersions:S(l({version:o(),supported:v(),endOfLife:o().datetime().optional().describe(`End of support date`),securitySupport:v().default(!1).describe(`Still receives security updates`)})),minimumCompatibleVersion:o().optional().describe(`Oldest version that can be directly upgraded`)}),TB=l({type:x([`version-mismatch`,`missing-dependency`,`circular-dependency`,`incompatible-versions`,`conflicting-interfaces`]),plugins:S(l({pluginId:o(),version:o(),requirement:o().optional().describe(`What this plugin requires`)})),description:o(),resolutions:S(l({strategy:x([`upgrade`,`downgrade`,`replace`,`disable`,`manual`]),description:o(),automaticResolution:v().default(!1),riskLevel:x([`low`,`medium`,`high`])})).optional(),severity:x([`critical`,`error`,`warning`,`info`])}),bue=l({success:v(),resolved:S(l({pluginId:o(),version:o(),resolvedVersion:o()})).optional(),conflicts:S(TB).optional(),warnings:S(o()).optional(),installationOrder:S(o()).optional().describe(`Plugin IDs in order they should be installed`),dependencyGraph:u(o(),S(o())).optional().describe(`Map of plugin ID to its dependencies`)}),xue=l({enabled:v().default(!1),maxConcurrentVersions:A().int().min(1).default(2).describe(`How many versions can run at the same time`),selectionStrategy:x([`latest`,`stable`,`compatible`,`pinned`,`canary`,`custom`]).default(`latest`),routing:S(l({condition:o().describe(`Routing condition (e.g., tenant, user, feature flag)`),version:o().describe(`Version to use when condition matches`),priority:A().int().default(100).describe(`Rule priority`)})).optional(),rollout:l({enabled:v().default(!1),strategy:x([`percentage`,`blue-green`,`canary`]),percentage:A().min(0).max(100).optional().describe(`Percentage of traffic to new version`),duration:A().int().optional().describe(`Rollout duration in milliseconds`)}).optional()}),Sue=l({pluginId:o(),version:bB,versionString:o().describe(`Full version string (e.g., 1.2.3-beta.1+build.123)`),releaseDate:o().datetime(),releaseNotes:o().optional(),breakingChanges:S(SB).optional(),deprecations:S(CB).optional(),compatibilityMatrix:S(wB).optional(),securityFixes:S(l({cve:o().optional().describe(`CVE identifier`),severity:x([`critical`,`high`,`medium`,`low`]),description:o(),fixedIn:o().describe(`Version where vulnerability was fixed`)})).optional(),statistics:l({downloads:A().int().min(0).optional(),installations:A().int().min(0).optional(),ratings:A().min(0).max(5).optional()}).optional(),support:l({status:x([`active`,`maintenance`,`deprecated`,`eol`]),endOfLife:o().datetime().optional(),securitySupport:v().default(!0)})}),EB=x([`singleton`,`transient`,`scoped`]).describe(`Service scope type`),Cue=l({name:o().min(1).describe(`Unique service name identifier`),scope:EB.optional().default(`singleton`).describe(`Service scope type`),type:o().optional().describe(`Service type or interface name`),registeredAt:A().int().optional().describe(`Unix timestamp in milliseconds when service was registered`),metadata:u(o(),b()).optional().describe(`Additional service-specific metadata`)}),wue=l({strictMode:v().optional().default(!0).describe(`Throw errors on invalid operations (duplicate registration, service not found, etc.)`),allowOverwrite:v().optional().default(!1).describe(`Allow overwriting existing service registrations`),enableLogging:v().optional().default(!1).describe(`Enable logging for service registration and retrieval`),scopeTypes:S(o()).optional().describe(`Supported scope types`),maxServices:A().int().min(1).optional().describe(`Maximum number of services that can be registered`)}),Tue=l({name:o().min(1).describe(`Unique service name identifier`),scope:EB.optional().default(`singleton`).describe(`Service scope type`),factoryType:x([`sync`,`async`]).optional().default(`sync`).describe(`Whether factory is synchronous or asynchronous`),singleton:v().optional().default(!0).describe(`Whether to cache the factory result (singleton pattern)`)}),Eue=l({scopeType:o().describe(`Type of scope`),scopeId:o().optional().describe(`Unique scope identifier`),metadata:u(o(),b()).optional().describe(`Scope-specific context metadata`)}),Due=l({scopeId:o().describe(`Unique scope identifier`),scopeType:o().describe(`Type of scope`),createdAt:A().int().describe(`Unix timestamp in milliseconds when scope was created`),serviceCount:A().int().min(0).optional().describe(`Number of services registered in this scope`),metadata:u(o(),b()).optional().describe(`Scope-specific context metadata`)}),Oue=l({timeout:A().int().min(0).optional().default(3e4).describe(`Maximum time in milliseconds to wait for each plugin to start`),rollbackOnFailure:v().optional().default(!0).describe(`Whether to rollback already-started plugins if any plugin fails`),healthCheck:v().optional().default(!1).describe(`Whether to run health checks after plugin startup`),parallel:v().optional().default(!1).describe(`Whether to start plugins in parallel when dependencies allow`),context:b().optional().describe(`Custom context object to pass to plugin lifecycle methods`)}),DB=l({healthy:v().describe(`Whether the plugin is healthy`),timestamp:A().int().describe(`Unix timestamp in milliseconds when health check was performed`),details:u(o(),b()).optional().describe(`Optional plugin-specific health details`),message:o().optional().describe(`Error message if plugin is unhealthy`)}),OB=l({plugin:l({name:o(),version:o().optional()}).passthrough().describe(`Plugin metadata`),success:v().describe(`Whether the plugin started successfully`),duration:A().min(0).describe(`Time taken to start the plugin in milliseconds`),error:l({name:o().describe(`Error class name`),message:o().describe(`Error message`),stack:o().optional().describe(`Stack trace`),code:o().optional().describe(`Error code`)}).optional().describe(`Serializable error representation if startup failed`),health:DB.optional().describe(`Health status after startup if health check was enabled`)}),kue=l({results:S(OB).describe(`Startup results for each plugin`),totalDuration:A().min(0).describe(`Total time taken for all plugins in milliseconds`),allSuccessful:v().describe(`Whether all plugins started successfully`),rolledBack:S(o()).optional().describe(`Names of plugins that were rolled back`)}),kB=l({id:o().regex(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/).describe(`Vendor identifier (reverse domain)`),name:o(),website:o().url().optional(),email:o().email().optional(),verified:v().default(!1).describe(`Whether vendor is verified by ObjectStack`),trustLevel:x([`official`,`verified`,`community`,`unverified`]).default(`unverified`)}),AB=l({testCoverage:A().min(0).max(100).optional(),documentationScore:A().min(0).max(100).optional(),codeQuality:A().min(0).max(100).optional(),securityScan:l({lastScanDate:o().datetime().optional(),vulnerabilities:l({critical:A().int().min(0).default(0),high:A().int().min(0).default(0),medium:A().int().min(0).default(0),low:A().int().min(0).default(0)}).optional(),passed:v().default(!1)}).optional(),conformanceTests:S(l({protocolId:o().describe(`Protocol being tested`),passed:v(),totalTests:A().int().min(0),passedTests:A().int().min(0),lastRunDate:o().datetime().optional()})).optional()}),jB=l({downloads:A().int().min(0).default(0),downloadsLastMonth:A().int().min(0).default(0),activeInstallations:A().int().min(0).default(0),ratings:l({average:A().min(0).max(5).default(0),count:A().int().min(0).default(0),distribution:l({5:A().int().min(0).default(0),4:A().int().min(0).default(0),3:A().int().min(0).default(0),2:A().int().min(0).default(0),1:A().int().min(0).default(0)}).optional()}).optional(),stars:A().int().min(0).optional(),dependents:A().int().min(0).default(0)}),Aue=l({id:o().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Plugin identifier (reverse domain notation)`),version:o().regex(/^\d+\.\d+\.\d+$/),name:o(),description:o().optional(),readme:o().optional(),category:x([`data`,`integration`,`ui`,`analytics`,`security`,`automation`,`ai`,`utility`,`driver`,`gateway`,`adapter`]).optional(),tags:S(o()).optional(),vendor:kB,capabilities:JR.optional(),compatibility:l({minObjectStackVersion:o().optional(),maxObjectStackVersion:o().optional(),nodeVersion:o().optional(),platforms:S(x([`linux`,`darwin`,`win32`,`browser`])).optional()}).optional(),links:l({homepage:o().url().optional(),repository:o().url().optional(),documentation:o().url().optional(),bugs:o().url().optional(),changelog:o().url().optional()}).optional(),media:l({icon:o().url().optional(),logo:o().url().optional(),screenshots:S(o().url()).optional(),video:o().url().optional()}).optional(),quality:AB.optional(),statistics:jB.optional(),license:o().optional().describe(`SPDX license identifier`),pricing:l({model:x([`free`,`freemium`,`paid`,`enterprise`]),price:A().min(0).optional(),currency:o().default(`USD`).optional(),billingPeriod:x([`one-time`,`monthly`,`yearly`]).optional()}).optional(),publishedAt:o().datetime().optional(),updatedAt:o().datetime().optional(),deprecated:v().default(!1),deprecationMessage:o().optional(),replacedBy:o().optional().describe(`Plugin ID that replaces this one`),flags:l({experimental:v().default(!1),beta:v().default(!1),featured:v().default(!1),verified:v().default(!1)}).optional()}),jue=l({query:o().optional(),category:S(o()).optional(),tags:S(o()).optional(),trustLevel:S(x([`official`,`verified`,`community`,`unverified`])).optional(),implementsProtocols:S(o()).optional(),pricingModel:S(x([`free`,`freemium`,`paid`,`enterprise`])).optional(),minRating:A().min(0).max(5).optional(),sortBy:x([`relevance`,`downloads`,`rating`,`updated`,`name`]).optional(),sortOrder:x([`asc`,`desc`]).default(`desc`).optional(),page:A().int().min(1).default(1).optional(),limit:A().int().min(1).max(100).default(20).optional()}),Mue=l({pluginId:o(),version:o().optional().describe(`Defaults to latest`),config:u(o(),b()).optional(),autoUpdate:v().default(!1).optional(),options:l({skipDependencies:v().default(!1).optional(),force:v().default(!1).optional(),target:x([`system`,`space`,`user`]).default(`space`).optional()}).optional()}),MB=x([`critical`,`high`,`medium`,`low`,`info`]).describe(`Severity level of a security vulnerability`),NB=l({cve:o().regex(/^CVE-\d{4}-\d+$/).optional().describe(`CVE identifier`),id:o().describe(`Vulnerability ID`),title:o().describe(`Short title summarizing the vulnerability`),description:o().describe(`Detailed description of the vulnerability`),severity:MB.describe(`Severity level of this vulnerability`),cvss:A().min(0).max(10).optional().describe(`CVSS score ranging from 0 to 10`),package:l({name:o().describe(`Name of the affected package`),version:o().describe(`Version of the affected package`),ecosystem:o().optional().describe(`Package ecosystem (e.g., npm, pip, maven)`)}).describe(`Affected package information`),vulnerableVersions:o().describe(`Semver range of vulnerable versions`),patchedVersions:o().optional().describe(`Semver range of patched versions`),references:S(l({type:x([`advisory`,`article`,`report`,`web`]).describe(`Type of reference source`),url:o().url().describe(`URL of the reference`)})).default([]).describe(`External references related to the vulnerability`),cwe:S(o()).default([]).describe(`CWE identifiers associated with this vulnerability`),publishedAt:o().datetime().optional().describe(`ISO 8601 date when the vulnerability was published`),mitigation:o().optional().describe(`Recommended steps to mitigate the vulnerability`)}).describe(`A known security vulnerability in a package dependency`),PB=l({scanId:o().uuid().describe(`Unique identifier for this security scan`),plugin:l({id:o().describe(`Plugin identifier`),version:o().describe(`Plugin version that was scanned`)}).describe(`Plugin that was scanned`),scannedAt:o().datetime().describe(`ISO 8601 timestamp when the scan was performed`),scanner:l({name:o().describe(`Scanner name (e.g., snyk, osv, trivy)`),version:o().describe(`Version of the scanner tool`)}).describe(`Information about the scanner tool used`),status:x([`passed`,`failed`,`warning`]).describe(`Overall result status of the security scan`),vulnerabilities:S(NB).describe(`List of vulnerabilities discovered during the scan`),summary:l({critical:A().int().min(0).default(0).describe(`Count of critical severity vulnerabilities`),high:A().int().min(0).default(0).describe(`Count of high severity vulnerabilities`),medium:A().int().min(0).default(0).describe(`Count of medium severity vulnerabilities`),low:A().int().min(0).default(0).describe(`Count of low severity vulnerabilities`),info:A().int().min(0).default(0).describe(`Count of informational severity vulnerabilities`),total:A().int().min(0).default(0).describe(`Total count of all vulnerabilities`)}).describe(`Summary counts of vulnerabilities by severity`),licenseIssues:S(l({package:o().describe(`Name of the package with a license issue`),license:o().describe(`License identifier of the package`),reason:o().describe(`Reason the license is flagged`),severity:x([`error`,`warning`,`info`]).describe(`Severity of the license compliance issue`)})).default([]).describe(`License compliance issues found during the scan`),codeQuality:l({score:A().min(0).max(100).optional().describe(`Overall code quality score from 0 to 100`),issues:S(l({type:x([`security`,`quality`,`style`]).describe(`Category of the code quality issue`),severity:x([`error`,`warning`,`info`]).describe(`Severity of the code quality issue`),message:o().describe(`Description of the code quality issue`),file:o().optional().describe(`File path where the issue was found`),line:A().int().optional().describe(`Line number where the issue was found`)})).default([]).describe(`List of individual code quality issues`)}).optional().describe(`Code quality analysis results`),nextScanAt:o().datetime().optional().describe(`ISO 8601 timestamp for the next scheduled scan`)}).describe(`Result of a security scan performed on a plugin`),FB=l({id:o().describe(`Unique identifier for the security policy`),name:o().describe(`Human-readable name of the security policy`),autoScan:l({enabled:v().default(!0).describe(`Whether automatic scanning is enabled`),frequency:x([`on-publish`,`daily`,`weekly`,`monthly`]).default(`daily`).describe(`How often automatic scans are performed`)}).describe(`Automatic security scanning configuration`),thresholds:l({maxCritical:A().int().min(0).default(0).describe(`Maximum allowed critical vulnerabilities before blocking`),maxHigh:A().int().min(0).default(0).describe(`Maximum allowed high vulnerabilities before blocking`),maxMedium:A().int().min(0).default(5).describe(`Maximum allowed medium vulnerabilities before warning`)}).describe(`Vulnerability count thresholds for policy enforcement`),allowedLicenses:S(o()).default([`MIT`,`Apache-2.0`,`BSD-3-Clause`,`BSD-2-Clause`,`ISC`]).describe(`List of SPDX license identifiers that are permitted`),prohibitedLicenses:S(o()).default([`GPL-3.0`,`AGPL-3.0`]).describe(`List of SPDX license identifiers that are prohibited`),codeSigning:l({required:v().default(!1).describe(`Whether code signing is required for plugins`),allowedSigners:S(o()).default([]).describe(`List of trusted signer identities`)}).optional().describe(`Code signing requirements for plugin artifacts`),sandbox:l({networkAccess:x([`none`,`localhost`,`allowlist`,`all`]).default(`all`).describe(`Level of network access granted to the plugin`),allowedDestinations:S(o()).default([]).describe(`Permitted network destinations when using allowlist mode`),filesystemAccess:x([`none`,`read-only`,`temp-only`,`full`]).default(`full`).describe(`Level of file system access granted to the plugin`),maxMemoryMB:A().int().positive().optional().describe(`Maximum memory allocation in megabytes`),maxCPUSeconds:A().int().positive().optional().describe(`Maximum CPU time allowed in seconds`)}).optional().describe(`Sandbox restrictions for plugin execution`)}).describe(`Security policy governing plugin scanning and enforcement`),IB=l({name:o().describe(`Package name or identifier`),versionConstraint:o().describe("Semver range (e.g., `^1.0.0`, `>=2.0.0 <3.0.0`)"),type:x([`required`,`optional`,`peer`,`dev`]).default(`required`).describe(`Category of the dependency relationship`),resolvedVersion:o().optional().describe(`Concrete version resolved during dependency resolution`)}).describe(`A package dependency with its version constraint`),LB=l({id:o().describe(`Unique identifier of the package`),version:o().describe(`Resolved version of the package`),dependencies:S(IB).default([]).describe(`Dependencies required by this package`),depth:A().int().min(0).describe(`Depth level in the dependency tree (0 = root)`),isDirect:v().describe(`Whether this is a direct (top-level) dependency`),metadata:l({name:o().describe(`Display name of the package`),description:o().optional().describe(`Short description of the package`),license:o().optional().describe(`SPDX license identifier of the package`),homepage:o().url().optional().describe(`Homepage URL of the package`)}).optional().describe(`Additional metadata about the package`)}).describe(`A node in the dependency graph representing a resolved package`),RB=l({root:l({id:o().describe(`Identifier of the root package`),version:o().describe(`Version of the root package`)}).describe(`Root package of the dependency graph`),nodes:S(LB).describe(`All resolved package nodes in the dependency graph`),edges:S(l({from:o().describe(`Package ID`),to:o().describe(`Package ID`),constraint:o().describe(`Version constraint`)})).describe(`Directed edges representing dependency relationships`),stats:l({totalDependencies:A().int().min(0).describe(`Total number of resolved dependencies`),directDependencies:A().int().min(0).describe(`Number of direct (top-level) dependencies`),maxDepth:A().int().min(0).describe(`Maximum depth of the dependency tree`)}).describe(`Summary statistics for the dependency graph`)}).describe(`Complete dependency graph for a package and its transitive dependencies`),zB=l({package:o().describe(`Name of the package with conflicting version requirements`),conflicts:S(l({version:o().describe(`Conflicting version of the package`),requestedBy:S(o()).describe(`Packages that require this version`),constraint:o().describe(`Semver constraint that produced this version requirement`)})).describe(`List of conflicting version requirements`),resolution:l({strategy:x([`pick-highest`,`pick-lowest`,`manual`]).describe(`Strategy used to resolve the conflict`),version:o().optional().describe(`Resolved version selected by the strategy`),reason:o().optional().describe(`Explanation of why this resolution was chosen`)}).optional().describe(`Suggested resolution for the conflict`),severity:x([`error`,`warning`,`info`]).describe(`Severity level of the dependency conflict`)}).describe(`A detected conflict between dependency version requirements`),BB=l({status:x([`success`,`conflict`,`error`]).describe(`Overall status of the dependency resolution`),graph:RB.optional().describe(`Resolved dependency graph if resolution succeeded`),conflicts:S(zB).default([]).describe(`List of dependency conflicts detected during resolution`),errors:S(l({package:o().describe(`Name of the package that caused the error`),error:o().describe(`Error message describing what went wrong`)})).default([]).describe(`Errors encountered during dependency resolution`),installOrder:S(o()).default([]).describe(`Topologically sorted list of package IDs for installation`),resolvedIn:A().int().min(0).optional().describe(`Time taken to resolve dependencies in milliseconds`)}).describe(`Result of a dependency resolution process`),VB=l({name:o().describe(`Name of the software component`),version:o().describe(`Version of the software component`),purl:o().optional().describe(`Package URL identifier`),license:o().optional().describe(`SPDX license identifier of the component`),hashes:l({sha256:o().optional().describe(`SHA-256 hash of the component artifact`),sha512:o().optional().describe(`SHA-512 hash of the component artifact`)}).optional().describe(`Cryptographic hashes for integrity verification`),supplier:l({name:o().describe(`Name of the component supplier`),url:o().url().optional().describe(`URL of the component supplier`)}).optional().describe(`Supplier information for the component`),externalRefs:S(l({type:x([`website`,`repository`,`documentation`,`issue-tracker`]).describe(`Type of external reference`),url:o().url().describe(`URL of the external reference`)})).default([]).describe(`External references related to the component`)}).describe(`A single entry in a Software Bill of Materials`),HB=l({format:x([`spdx`,`cyclonedx`]).default(`cyclonedx`).describe(`SBOM standard format used`),version:o().describe(`Version of the SBOM specification`),plugin:l({id:o().describe(`Plugin identifier`),version:o().describe(`Plugin version`),name:o().describe(`Human-readable plugin name`)}).describe(`Metadata about the plugin this SBOM describes`),components:S(VB).describe(`List of software components included in the plugin`),generatedAt:o().datetime().describe(`ISO 8601 timestamp when the SBOM was generated`),generator:l({name:o().describe(`Name of the SBOM generator tool`),version:o().describe(`Version of the SBOM generator tool`)}).optional().describe(`Tool used to generate this SBOM`)}).describe(`Software Bill of Materials for a plugin`),UB=l({pluginId:o().describe(`Unique identifier of the plugin`),version:o().describe(`Version of the plugin artifact`),build:l({timestamp:o().datetime().describe(`ISO 8601 timestamp when the build was produced`),environment:l({os:o().describe(`Operating system used for the build`),arch:o().describe(`CPU architecture used for the build`),nodeVersion:o().describe(`Node.js version used for the build`)}).optional().describe(`Environment details where the build was executed`),source:l({repository:o().url().describe(`URL of the source repository`),commit:o().regex(/^[a-f0-9]{40}$/).describe(`Full SHA-1 commit hash of the source`),branch:o().optional().describe(`Branch name the build was produced from`),tag:o().optional().describe(`Git tag associated with the build`)}).optional().describe(`Source repository information for the build`),builder:l({name:o().describe(`Name of the person or system that produced the build`),email:o().email().optional().describe(`Email address of the builder`)}).optional().describe(`Identity of the builder who produced the artifact`)}).describe(`Build provenance information`),artifacts:S(l({filename:o().describe(`Name of the artifact file`),sha256:o().describe(`SHA-256 hash of the artifact`),size:A().int().positive().describe(`Size of the artifact in bytes`)})).describe(`List of build artifacts with integrity hashes`),signatures:S(l({algorithm:x([`rsa`,`ecdsa`,`ed25519`]).describe(`Cryptographic algorithm used for signing`),publicKey:o().describe(`Public key used to verify the signature`),signature:o().describe(`Digital signature value`),signedBy:o().describe(`Identity of the signer`),timestamp:o().datetime().describe(`ISO 8601 timestamp when the signature was created`)})).default([]).describe(`Cryptographic signatures for the plugin artifact`),attestations:S(l({type:x([`code-review`,`security-scan`,`test-results`,`ci-build`]).describe(`Type of attestation`),status:x([`passed`,`failed`]).describe(`Result status of the attestation`),url:o().url().optional().describe(`URL with details about the attestation`),timestamp:o().datetime().describe(`ISO 8601 timestamp when the attestation was issued`)})).default([]).describe(`Verification attestations for the plugin`)}).describe(`Verifiable provenance and chain of custody for a plugin artifact`),WB=l({pluginId:o().describe(`Unique identifier of the plugin`),score:A().min(0).max(100).describe(`Overall trust score from 0 to 100`),components:l({vendorReputation:A().min(0).max(100).describe(`Vendor reputation score from 0 to 100`),securityScore:A().min(0).max(100).describe(`Security scan results score from 0 to 100`),codeQuality:A().min(0).max(100).describe(`Code quality score from 0 to 100`),communityScore:A().min(0).max(100).describe(`Community engagement score from 0 to 100`),maintenanceScore:A().min(0).max(100).describe(`Maintenance and update frequency score from 0 to 100`)}).describe(`Individual score components contributing to the overall trust score`),level:x([`verified`,`trusted`,`neutral`,`untrusted`,`blocked`]).describe(`Computed trust level based on the overall score`),badges:S(x([`official`,`verified-vendor`,`security-scanned`,`code-signed`,`open-source`,`popular`])).default([]).describe(`Verification badges earned by the plugin`),updatedAt:o().datetime().describe(`ISO 8601 timestamp when the trust score was last updated`)}).describe(`Trust score and verification status for a plugin`),Nue={VulnerabilitySeverity:MB,SecurityVulnerability:NB,SecurityScanResult:PB,SecurityPolicy:FB,PackageDependency:IB,DependencyGraphNode:LB,DependencyGraph:RB,DependencyConflict:zB,DependencyResolutionResult:BB,SBOMEntry:VB,SBOM:HB,PluginProvenance:UB,PluginTrustScore:WB};EE({},{AnalyticsTimeRangeSchema:()=>QB,AppDiscoveryRequestSchema:()=>rde,AppDiscoveryResponseSchema:()=>ide,AppSubscriptionSchema:()=>ade,ArtifactDownloadResponseSchema:()=>Fue,ArtifactReferenceSchema:()=>KB,CreateListingRequestSchema:()=>Uue,CuratedCollectionSchema:()=>Xue,FeaturedListingSchema:()=>Yue,InstalledAppSummarySchema:()=>lV,ListInstalledAppsRequestSchema:()=>ode,ListInstalledAppsResponseSchema:()=>sde,ListReviewsRequestSchema:()=>tde,ListReviewsResponseSchema:()=>nde,ListingActionRequestSchema:()=>Gue,ListingStatusSchema:()=>JB,MarketplaceCategorySchema:()=>qB,MarketplaceHealthMetricsSchema:()=>Que,MarketplaceInstallRequestSchema:()=>zue,MarketplaceInstallResponseSchema:()=>Bue,MarketplaceListingSchema:()=>XB,MarketplaceSearchRequestSchema:()=>Lue,MarketplaceSearchResponseSchema:()=>Rue,PackageSubmissionSchema:()=>Iue,PolicyActionSchema:()=>Zue,PolicyViolationTypeSchema:()=>rV,PricingModelSchema:()=>YB,PublisherProfileSchema:()=>Vue,PublisherSchema:()=>Pue,PublisherVerificationSchema:()=>GB,PublishingAnalyticsRequestSchema:()=>Kue,PublishingAnalyticsResponseSchema:()=>que,RecommendationReasonSchema:()=>oV,RecommendedAppSchema:()=>sV,RejectionReasonSchema:()=>nV,ReleaseChannelSchema:()=>ZB,ReviewCriterionSchema:()=>eV,ReviewDecisionSchema:()=>tV,ReviewModerationStatusSchema:()=>iV,SubmissionReviewSchema:()=>Jue,SubmitReviewRequestSchema:()=>ede,SubscriptionStatusSchema:()=>cV,TimeSeriesPointSchema:()=>$B,TrendingListingSchema:()=>$ue,UpdateListingRequestSchema:()=>Wue,UserReviewSchema:()=>aV,VersionReleaseSchema:()=>Hue});var GB=x([`unverified`,`pending`,`verified`,`trusted`,`partner`]).describe(`Publisher verification status`),Pue=l({id:o().describe(`Publisher ID`),name:o().describe(`Publisher display name`),type:x([`individual`,`organization`]).describe(`Publisher type`),verification:GB.default(`unverified`).describe(`Publisher verification status`),email:o().email().optional().describe(`Contact email`),website:o().url().optional().describe(`Publisher website`),logoUrl:o().url().optional().describe(`Publisher logo URL`),description:o().optional().describe(`Publisher description`),registeredAt:o().datetime().optional().describe(`Publisher registration timestamp`)}).describe(`Developer or organization that publishes packages`),KB=l({url:o().url().describe(`Artifact download URL`),sha256:o().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum`),size:A().int().positive().describe(`Artifact size in bytes`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Artifact format`),uploadedAt:o().datetime().describe(`Upload timestamp`)}).describe(`Reference to a downloadable package artifact`),Fue=l({downloadUrl:o().url().describe(`Artifact download URL (may be pre-signed)`),sha256:o().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum for verification`),size:A().int().positive().describe(`Artifact size in bytes`),format:x([`tgz`,`zip`]).describe(`Artifact format`),expiresAt:o().datetime().optional().describe(`URL expiration timestamp for pre-signed URLs`)}).describe(`Artifact download response with integrity metadata`),qB=x([`crm`,`erp`,`hr`,`finance`,`project`,`collaboration`,`analytics`,`integration`,`automation`,`ai`,`security`,`developer-tools`,`ui-theme`,`storage`,`other`]).describe(`Marketplace package category`),JB=x([`draft`,`submitted`,`in-review`,`approved`,`published`,`rejected`,`suspended`,`deprecated`,`unlisted`]).describe(`Marketplace listing status`),YB=x([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).describe(`Package pricing model`),XB=l({id:o().describe(`Listing ID (matches package manifest ID)`),packageId:o().describe(`Package identifier`),publisherId:o().describe(`Publisher ID`),status:JB.default(`draft`).describe(`Publication state: draft, published, under-review, suspended, deprecated, or unlisted`),name:o().describe(`Display name`),tagline:o().max(120).optional().describe(`Short tagline (max 120 chars)`),description:o().optional().describe(`Full description (Markdown)`),category:qB.describe(`Package category`),tags:S(o()).optional().describe(`Search tags`),iconUrl:o().url().optional().describe(`Package icon URL`),screenshots:S(l({url:o().url(),caption:o().optional()})).optional().describe(`Screenshots`),documentationUrl:o().url().optional().describe(`Documentation URL`),supportUrl:o().url().optional().describe(`Support URL`),repositoryUrl:o().url().optional().describe(`Source repository URL`),pricing:YB.default(`free`).describe(`Pricing model`),priceInCents:A().int().min(0).optional().describe(`Price in cents (e.g. 999 = $9.99)`),latestVersion:o().describe(`Latest published version`),minPlatformVersion:o().optional().describe(`Minimum ObjectStack platform version`),versions:S(l({version:o().describe(`Version string`),releaseDate:o().datetime().describe(`Release date`),releaseNotes:o().optional().describe(`Release notes`),minPlatformVersion:o().optional().describe(`Minimum platform version`),deprecated:v().default(!1).describe(`Whether this version is deprecated`),artifact:KB.optional().describe(`Downloadable artifact for this version`)})).optional().describe(`Published versions`),stats:l({totalInstalls:A().int().min(0).default(0).describe(`Total installs`),activeInstalls:A().int().min(0).default(0).describe(`Active installs`),averageRating:A().min(0).max(5).optional().describe(`Average user rating (0-5)`),totalRatings:A().int().min(0).default(0).describe(`Total ratings count`),totalReviews:A().int().min(0).default(0).describe(`Total reviews count`)}).optional().describe(`Aggregate marketplace statistics`),publishedAt:o().datetime().optional().describe(`First published timestamp`),updatedAt:o().datetime().optional().describe(`Last updated timestamp`)}).describe(`Public-facing package listing on the marketplace`),Iue=l({id:o().describe(`Submission ID`),packageId:o().describe(`Package identifier`),version:o().describe(`Version being submitted`),publisherId:o().describe(`Publisher submitting`),status:x([`pending`,`scanning`,`in-review`,`changes-requested`,`approved`,`rejected`]).default(`pending`).describe(`Review status`),artifactUrl:o().describe(`Package artifact URL for review`),releaseNotes:o().optional().describe(`Release notes for this version`),isNewListing:v().default(!1).describe(`Whether this is a new listing submission`),scanResults:l({passed:v(),securityScore:A().min(0).max(100).optional(),compatibilityCheck:v().optional(),issues:S(l({severity:x([`critical`,`high`,`medium`,`low`,`info`]),message:o(),file:o().optional(),line:A().optional()})).optional()}).optional().describe(`Automated scan results`),reviewerNotes:o().optional().describe(`Notes from the platform reviewer`),submittedAt:o().datetime().optional().describe(`Submission timestamp`),reviewedAt:o().datetime().optional().describe(`Review completion timestamp`)}).describe(`Developer submission of a package version for review`),Lue=l({query:o().optional().describe(`Full-text search query`),category:qB.optional().describe(`Filter by category`),tags:S(o()).optional().describe(`Filter by tags`),pricing:YB.optional().describe(`Filter by pricing model`),publisherVerification:GB.optional().describe(`Filter by publisher verification level`),sortBy:x([`relevance`,`popularity`,`rating`,`newest`,`updated`,`name`]).default(`relevance`).describe(`Sort field`),sortDirection:x([`asc`,`desc`]).default(`desc`).describe(`Sort direction`),page:A().int().min(1).default(1).describe(`Page number`),pageSize:A().int().min(1).max(100).default(20).describe(`Items per page`),platformVersion:o().optional().describe(`Filter by platform version compatibility`)}).describe(`Marketplace search request`),Rue=l({items:S(XB).describe(`Search result listings`),total:A().int().min(0).describe(`Total matching results`),page:A().int().min(1).describe(`Current page number`),pageSize:A().int().min(1).describe(`Items per page`),facets:l({categories:S(l({category:qB,count:A().int().min(0)})).optional(),pricing:S(l({model:YB,count:A().int().min(0)})).optional()}).optional().describe(`Aggregation facets for refining search`)}).describe(`Marketplace search response`),zue=l({listingId:o().describe(`Marketplace listing ID`),version:o().optional().describe(`Version to install`),licenseKey:o().optional().describe(`License key for paid packages`),settings:u(o(),b()).optional().describe(`User-provided settings at install time`),enableOnInstall:v().default(!0).describe(`Whether to enable immediately after install`),artifactRef:KB.optional().describe(`Artifact reference for direct installation`),tenantId:o().optional().describe(`Tenant identifier`)}).describe(`Install from marketplace request`),Bue=l({success:v().describe(`Whether installation succeeded`),packageId:o().optional().describe(`Installed package identifier`),version:o().optional().describe(`Installed version`),message:o().optional().describe(`Installation status message`)}).describe(`Install from marketplace response`),Vue=l({organizationId:o().describe(`Identity Organization ID`),publisherId:o().describe(`Marketplace publisher ID`),verification:GB.default(`unverified`),agreementVersion:o().optional().describe(`Accepted developer agreement version`),website:o().url().optional().describe(`Publisher website`),supportEmail:o().email().optional().describe(`Publisher support email`),registeredAt:o().datetime()}),ZB=x([`alpha`,`beta`,`rc`,`stable`]),Hue=l({version:o().describe(`Semver version (e.g., 2.1.0-beta.1)`),channel:ZB.default(`stable`),releaseNotes:o().optional().describe(`Release notes (Markdown)`),changelog:S(l({type:x([`added`,`changed`,`fixed`,`removed`,`deprecated`,`security`]),description:o()})).optional().describe(`Structured changelog entries`),minPlatformVersion:o().optional(),artifactUrl:o().optional().describe(`Built package artifact URL`),artifactChecksum:o().optional().describe(`SHA-256 checksum`),deprecated:v().default(!1),deprecationMessage:o().optional(),releasedAt:o().datetime().optional()}),Uue=l({packageId:o().describe(`Package identifier`),name:o().describe(`App display name`),tagline:o().max(120).optional(),description:o().optional(),category:o().describe(`Marketplace category`),tags:S(o()).optional(),iconUrl:o().url().optional(),screenshots:S(l({url:o().url(),caption:o().optional()})).optional(),documentationUrl:o().url().optional(),supportUrl:o().url().optional(),repositoryUrl:o().url().optional(),pricing:x([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).default(`free`),priceInCents:A().int().min(0).optional()}),Wue=l({listingId:o().describe(`Listing ID to update`),name:o().optional(),tagline:o().max(120).optional(),description:o().optional(),category:o().optional(),tags:S(o()).optional(),iconUrl:o().url().optional(),screenshots:S(l({url:o().url(),caption:o().optional()})).optional(),documentationUrl:o().url().optional(),supportUrl:o().url().optional(),repositoryUrl:o().url().optional(),pricing:x([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).optional(),priceInCents:A().int().min(0).optional()}),Gue=l({listingId:o().describe(`Listing ID`),action:x([`submit`,`unlist`,`deprecate`,`reactivate`]).describe(`Action to perform on listing`),reason:o().optional()}),QB=x([`last_7d`,`last_30d`,`last_90d`,`last_365d`,`all_time`]),Kue=l({listingId:o().describe(`Listing to get analytics for`),timeRange:QB.default(`last_30d`),metrics:S(x([`installs`,`uninstalls`,`active_installs`,`ratings`,`revenue`,`page_views`])).optional().describe(`Metrics to include (default: all)`)}),$B=l({date:o(),value:A()}),que=l({listingId:o(),timeRange:QB,summary:l({totalInstalls:A().int().min(0),activeInstalls:A().int().min(0),totalUninstalls:A().int().min(0),averageRating:A().min(0).max(5).optional(),totalRatings:A().int().min(0),totalRevenue:A().min(0).optional().describe(`Revenue in cents`),pageViews:A().int().min(0)}),timeSeries:u(o(),S($B)).optional().describe(`Time series keyed by metric name`),ratingDistribution:l({1:A().int().min(0).default(0),2:A().int().min(0).default(0),3:A().int().min(0).default(0),4:A().int().min(0).default(0),5:A().int().min(0).default(0)}).optional()}),eV=l({id:o().describe(`Criterion ID`),category:x([`security`,`performance`,`quality`,`ux`,`documentation`,`policy`,`compatibility`]),description:o(),required:v().default(!0),passed:v().optional(),notes:o().optional()}),tV=x([`approved`,`rejected`,`changes-requested`]),nV=x([`security-vulnerability`,`policy-violation`,`quality-below-standard`,`misleading-metadata`,`incompatible`,`duplicate`,`insufficient-documentation`,`other`]),Jue=l({id:o().describe(`Review ID`),submissionId:o().describe(`Submission being reviewed`),reviewerId:o().describe(`Platform reviewer ID`),decision:tV.optional().describe(`Final decision`),criteria:S(eV).optional().describe(`Review checklist results`),rejectionReasons:S(nV).optional(),feedback:o().optional().describe(`Detailed review feedback (Markdown)`),internalNotes:o().optional().describe(`Internal reviewer notes`),startedAt:o().datetime().optional(),completedAt:o().datetime().optional()}),Yue=l({listingId:o().describe(`Featured listing ID`),priority:A().int().min(0).default(0),bannerUrl:o().url().optional(),editorialNote:o().optional(),startDate:o().datetime(),endDate:o().datetime().optional(),active:v().default(!0)}),Xue=l({id:o().describe(`Collection ID`),name:o().describe(`Collection name`),description:o().optional(),coverImageUrl:o().url().optional(),listingIds:S(o()).min(1).describe(`Ordered listing IDs`),published:v().default(!1),sortOrder:A().int().min(0).default(0),createdBy:o().optional(),createdAt:o().datetime().optional(),updatedAt:o().datetime().optional()}),rV=x([`malware`,`data-harvesting`,`spam`,`copyright`,`inappropriate-content`,`terms-of-service`,`security-risk`,`abandoned`]),Zue=l({id:o().describe(`Action ID`),listingId:o().describe(`Target listing ID`),violationType:rV,action:x([`warning`,`suspend`,`takedown`,`restrict`]),reason:o().describe(`Explanation of the violation`),actionBy:o().describe(`Admin user ID`),actionAt:o().datetime(),resolution:o().optional(),resolved:v().default(!1)}),Que=l({totalListings:A().int().min(0),listingsByStatus:u(o(),A().int().min(0)).optional(),listingsByCategory:u(o(),A().int().min(0)).optional(),totalPublishers:A().int().min(0),verifiedPublishers:A().int().min(0),totalInstalls:A().int().min(0),averageReviewTime:A().min(0).optional(),pendingReviews:A().int().min(0),listingsByPricing:u(o(),A().int().min(0)).optional(),snapshotAt:o().datetime()}),$ue=l({listingId:o(),rank:A().int().min(1),trendScore:A().min(0),installVelocity:A().min(0),period:o()}),iV=x([`pending`,`approved`,`flagged`,`rejected`]),aV=l({id:o().describe(`Review ID`),listingId:o().describe(`Listing being reviewed`),userId:o().describe(`Review author user ID`),displayName:o().optional().describe(`Reviewer display name`),rating:A().int().min(1).max(5).describe(`Star rating (1-5)`),title:o().max(200).optional().describe(`Review title`),body:o().max(5e3).optional().describe(`Review text`),appVersion:o().optional().describe(`App version being reviewed`),moderationStatus:iV.default(`pending`),helpfulCount:A().int().min(0).default(0),publisherResponse:l({body:o(),respondedAt:o().datetime()}).optional().describe(`Publisher response to review`),submittedAt:o().datetime(),updatedAt:o().datetime().optional()}),ede=l({listingId:o().describe(`Listing to review`),rating:A().int().min(1).max(5).describe(`Star rating`),title:o().max(200).optional(),body:o().max(5e3).optional()}),tde=l({listingId:o().describe(`Listing to get reviews for`),sortBy:x([`newest`,`oldest`,`highest`,`lowest`,`most-helpful`]).default(`newest`),rating:A().int().min(1).max(5).optional(),page:A().int().min(1).default(1),pageSize:A().int().min(1).max(50).default(10)}),nde=l({items:S(aV),total:A().int().min(0),page:A().int().min(1),pageSize:A().int().min(1),ratingSummary:l({averageRating:A().min(0).max(5),totalRatings:A().int().min(0),distribution:l({1:A().int().min(0).default(0),2:A().int().min(0).default(0),3:A().int().min(0).default(0),4:A().int().min(0).default(0),5:A().int().min(0).default(0)})}).optional()}),oV=x([`popular-in-category`,`similar-users`,`complements-installed`,`trending`,`new-release`,`editor-pick`]),sV=l({listingId:o(),name:o(),tagline:o().optional(),iconUrl:o().url().optional(),category:qB,pricing:YB,averageRating:A().min(0).max(5).optional(),activeInstalls:A().int().min(0).optional(),reason:oV}),rde=l({tenantId:o().optional(),categories:S(qB).optional(),platformVersion:o().optional(),limit:A().int().min(1).max(50).default(10)}),ide=l({featured:S(sV).optional(),recommended:S(sV).optional(),trending:S(sV).optional(),newArrivals:S(sV).optional(),collections:S(l({id:o(),name:o(),description:o().optional(),coverImageUrl:o().url().optional(),apps:S(sV)})).optional()}),cV=x([`active`,`trialing`,`past-due`,`cancelled`,`expired`]),ade=l({id:o().describe(`Subscription ID`),listingId:o().describe(`App listing ID`),tenantId:o().describe(`Customer tenant ID`),status:cV,licenseKey:o().optional(),plan:o().optional().describe(`Subscription plan name`),billingCycle:x([`monthly`,`annual`]).optional(),priceInCents:A().int().min(0).optional(),currentPeriodStart:o().datetime().optional(),currentPeriodEnd:o().datetime().optional(),trialEndDate:o().datetime().optional(),autoRenew:v().default(!0),createdAt:o().datetime()}),lV=l({listingId:o(),packageId:o(),name:o(),iconUrl:o().url().optional(),installedVersion:o(),latestVersion:o().optional(),updateAvailable:v().default(!1),enabled:v().default(!0),subscriptionStatus:cV.optional(),installedAt:o().datetime()}),ode=l({tenantId:o().optional(),enabled:v().optional(),updateAvailable:v().optional(),sortBy:x([`name`,`installed-date`,`updated-date`]).default(`name`),page:A().int().min(1).default(1),pageSize:A().int().min(1).max(100).default(20)}),sde=l({items:S(lV),total:A().int().min(0),page:A().int().min(1),pageSize:A().int().min(1)});EE({},{TestActionSchema:()=>dV,TestActionTypeSchema:()=>uV,TestAssertionSchema:()=>pV,TestAssertionTypeSchema:()=>fV,TestContextSchema:()=>cde,TestScenarioSchema:()=>hV,TestStepSchema:()=>mV,TestSuiteSchema:()=>lde});var cde=u(o(),b()).describe(`Initial context or variables for the test`),uV=x([`create_record`,`update_record`,`delete_record`,`read_record`,`query_records`,`api_call`,`run_script`,`wait`]).describe(`Type of test action to perform`),dV=l({type:uV.describe(`The action type to execute`),target:o().describe(`Target Object, API Endpoint, or Function Name`),payload:u(o(),b()).optional().describe(`Data to send or use`),user:o().optional().describe(`Run as specific user/role for impersonation testing`)}).describe(`A single test action to execute against the system`),fV=x([`equals`,`not_equals`,`contains`,`not_contains`,`is_null`,`not_null`,`gt`,`gte`,`lt`,`lte`,`error`]).describe(`Comparison operator for test assertions`),pV=l({field:o().describe(`Field path in the result to check (e.g. "body.data.0.status")`),operator:fV.describe(`Comparison operator to use`),expectedValue:b().describe(`Expected value to compare against`)}).describe(`A test assertion that validates the result of a test action`),mV=l({name:o().describe(`Step name for identification in test reports`),description:o().optional().describe(`Human-readable description of what this step tests`),action:dV.describe(`The action to execute in this step`),assertions:S(pV).optional().describe(`Assertions to validate after the action completes`),capture:u(o(),o()).optional().describe(`Map result fields to context variables: { "newId": "body.id" }`)}).describe(`A single step in a test scenario, consisting of an action and optional assertions`),hV=l({id:o().describe(`Unique scenario identifier`),name:o().describe(`Scenario name for test reports`),description:o().optional().describe(`Detailed description of the test scenario`),tags:S(o()).optional().describe(`Tags for filtering and categorization (e.g. "critical", "regression", "crm")`),setup:S(mV).optional().describe(`Steps to run before main test (preconditions)`),steps:S(mV).describe(`Main test sequence to execute`),teardown:S(mV).optional().describe(`Steps to cleanup after test execution`),requires:l({params:S(o()).optional().describe(`Required environment variables or parameters`),plugins:S(o()).optional().describe(`Required plugins that must be loaded`)}).optional().describe(`Environment requirements for this scenario`)}).describe(`A complete test scenario with setup, execution steps, and teardown`),lde=l({name:o().describe(`Test suite name`),scenarios:S(hV).describe(`List of test scenarios in this suite`)}).describe(`A collection of test scenarios grouped into a test suite`);EE({},{AUTH_CONSTANTS:()=>hde,AUTH_ERROR_CODES:()=>gde,AccountSchema:()=>dde,ApiKeySchema:()=>mde,InvitationSchema:()=>yde,InvitationStatus:()=>_V,MemberSchema:()=>vde,OrganizationSchema:()=>_de,RoleSchema:()=>gV,SCIM:()=>Cde,SCIMAddressSchema:()=>CV,SCIMBulkOperationSchema:()=>AV,SCIMBulkRequestSchema:()=>wde,SCIMBulkResponseOperationSchema:()=>jV,SCIMBulkResponseSchema:()=>Tde,SCIMEmailSchema:()=>xV,SCIMEnterpriseUserSchema:()=>TV,SCIMErrorSchema:()=>xde,SCIMGroupReferenceSchema:()=>wV,SCIMGroupSchema:()=>OV,SCIMListResponseSchema:()=>bde,SCIMMemberReferenceSchema:()=>DV,SCIMMetaSchema:()=>yV,SCIMNameSchema:()=>bV,SCIMPatchOperationSchema:()=>kV,SCIMPatchRequestSchema:()=>Sde,SCIMPhoneNumberSchema:()=>SV,SCIMUserSchema:()=>EV,SCIM_SCHEMAS:()=>vV,SessionSchema:()=>fde,UserSchema:()=>ude,VerificationTokenSchema:()=>pde});var ude=l({id:o().describe(`Unique user identifier`),email:o().email().describe(`User email address`),emailVerified:v().default(!1).describe(`Whether email is verified`),name:o().optional().describe(`User display name`),image:o().url().optional().describe(`Profile image URL`),createdAt:o().datetime().describe(`Account creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),dde=l({id:o().describe(`Unique account identifier`),userId:o().describe(`Associated user ID`),type:x([`oauth`,`oidc`,`email`,`credentials`,`saml`,`ldap`]).describe(`Account type`),provider:o().describe(`Provider name`),providerAccountId:o().describe(`Provider account ID`),refreshToken:o().optional().describe(`OAuth refresh token`),accessToken:o().optional().describe(`OAuth access token`),expiresAt:A().optional().describe(`Token expiry timestamp (Unix)`),tokenType:o().optional().describe(`OAuth token type`),scope:o().optional().describe(`OAuth scope`),idToken:o().optional().describe(`OAuth ID token`),sessionState:o().optional().describe(`Session state`),createdAt:o().datetime().describe(`Account creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),fde=l({id:o().describe(`Unique session identifier`),sessionToken:o().describe(`Session token`),userId:o().describe(`Associated user ID`),activeOrganizationId:o().optional().describe(`Active organization ID for context switching`),expires:o().datetime().describe(`Session expiry timestamp`),createdAt:o().datetime().describe(`Session creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`),ipAddress:o().optional().describe(`IP address`),userAgent:o().optional().describe(`User agent string`),fingerprint:o().optional().describe(`Device fingerprint`)}),pde=l({identifier:o().describe(`Token identifier (email or phone)`),token:o().describe(`Verification token`),expires:o().datetime().describe(`Token expiry timestamp`),createdAt:o().datetime().describe(`Token creation timestamp`)}),mde=l({id:o().describe(`API key identifier`),name:o().describe(`API key display name`),start:o().optional().describe(`Key prefix for identification`),prefix:o().optional().describe(`Custom key prefix`),userId:o().describe(`Owner user ID`),organizationId:o().optional().describe(`Scoped organization ID`),expiresAt:o().datetime().optional().describe(`Expiration timestamp`),createdAt:o().datetime().describe(`Creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`),lastUsedAt:o().datetime().optional().describe(`Last used timestamp`),lastRefetchAt:o().datetime().optional().describe(`Last refetch timestamp`),enabled:v().default(!0).describe(`Whether the key is active`),rateLimitEnabled:v().optional().describe(`Whether rate limiting is enabled`),rateLimitTimeWindow:A().int().min(0).optional().describe(`Rate limit window (ms)`),rateLimitMax:A().int().min(0).optional().describe(`Max requests per window`),remaining:A().int().min(0).optional().describe(`Remaining requests`),permissions:u(o(),v()).optional().describe(`Granular permission flags`),scopes:S(o()).optional().describe(`High-level access scopes`),metadata:u(o(),b()).optional().describe(`Custom metadata`)}),hde={HEADER_KEY:`Authorization`,TOKEN_PREFIX:`Bearer `,COOKIE_PREFIX:`os_`,CSRF_HEADER:`x-os-csrf-token`,SESSION_COOKIE:`os_session_token`,CSRF_COOKIE:`os_csrf_token`,REFRESH_TOKEN_COOKIE:`os_refresh_token`},gde={INVALID_CREDENTIALS:`invalid_credentials`,INVALID_TOKEN:`invalid_token`,TOKEN_EXPIRED:`token_expired`,INSUFFICIENT_PERMISSIONS:`insufficient_permissions`,ACCOUNT_LOCKED:`account_locked`,ACCOUNT_NOT_VERIFIED:`account_not_verified`,TOO_MANY_REQUESTS:`too_many_requests`,INVALID_CSRF_TOKEN:`invalid_csrf_token`,SESSION_EXPIRED:`session_expired`,OAUTH_ERROR:`oauth_error`,PROVIDER_ERROR:`provider_error`},gV=l({name:OE.describe(`Unique role name (lowercase snake_case)`),label:o().describe(`Display label (e.g. VP of Sales)`),parent:o().optional().describe(`Parent Role ID (Reports To)`),description:o().optional()}),_de=l({id:o().describe(`Unique organization identifier`),name:o().describe(`Organization display name`),slug:o().regex(/^[a-z0-9_-]+$/).describe(`Unique URL-friendly slug (lowercase alphanumeric, hyphens, underscores)`),logo:o().url().optional().describe(`Organization logo URL`),metadata:u(o(),b()).optional().describe(`Custom metadata`),createdAt:o().datetime().describe(`Organization creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),vde=l({id:o().describe(`Unique member identifier`),organizationId:o().describe(`Organization ID`),userId:o().describe(`User ID`),role:o().describe(`Member role (e.g., owner, admin, member, guest)`),createdAt:o().datetime().describe(`Member creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),_V=x([`pending`,`accepted`,`rejected`,`expired`]),yde=l({id:o().describe(`Unique invitation identifier`),organizationId:o().describe(`Organization ID`),email:o().email().describe(`Invitee email address`),role:o().describe(`Role to assign upon acceptance`),status:_V.default(`pending`).describe(`Invitation status`),expiresAt:o().datetime().describe(`Invitation expiry timestamp`),inviterId:o().describe(`User ID of the inviter`),createdAt:o().datetime().describe(`Invitation creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),vV={USER:`urn:ietf:params:scim:schemas:core:2.0:User`,GROUP:`urn:ietf:params:scim:schemas:core:2.0:Group`,ENTERPRISE_USER:`urn:ietf:params:scim:schemas:extension:enterprise:2.0:User`,RESOURCE_TYPE:`urn:ietf:params:scim:schemas:core:2.0:ResourceType`,SERVICE_PROVIDER_CONFIG:`urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig`,SCHEMA:`urn:ietf:params:scim:schemas:core:2.0:Schema`,LIST_RESPONSE:`urn:ietf:params:scim:api:messages:2.0:ListResponse`,PATCH_OP:`urn:ietf:params:scim:api:messages:2.0:PatchOp`,BULK_REQUEST:`urn:ietf:params:scim:api:messages:2.0:BulkRequest`,BULK_RESPONSE:`urn:ietf:params:scim:api:messages:2.0:BulkResponse`,ERROR:`urn:ietf:params:scim:api:messages:2.0:Error`},yV=l({resourceType:o().optional().describe(`Resource type`),created:o().datetime().optional().describe(`Creation timestamp`),lastModified:o().datetime().optional().describe(`Last modification timestamp`),location:o().url().optional().describe(`Resource location URI`),version:o().optional().describe(`Entity tag (ETag) for concurrency control`)}),bV=l({formatted:o().optional().describe(`Formatted full name`),familyName:o().optional().describe(`Family name (last name)`),givenName:o().optional().describe(`Given name (first name)`),middleName:o().optional().describe(`Middle name`),honorificPrefix:o().optional().describe(`Honorific prefix (Mr., Ms., Dr.)`),honorificSuffix:o().optional().describe(`Honorific suffix (Jr., Sr.)`)}),xV=l({value:o().email().describe(`Email address`),type:x([`work`,`home`,`other`]).optional().describe(`Email type`),display:o().optional().describe(`Display label`),primary:v().optional().default(!1).describe(`Primary email indicator`)}),SV=l({value:o().describe(`Phone number`),type:x([`work`,`home`,`mobile`,`fax`,`pager`,`other`]).optional().describe(`Phone number type`),display:o().optional().describe(`Display label`),primary:v().optional().default(!1).describe(`Primary phone indicator`)}),CV=l({formatted:o().optional().describe(`Formatted address`),streetAddress:o().optional().describe(`Street address`),locality:o().optional().describe(`City/Locality`),region:o().optional().describe(`State/Region`),postalCode:o().optional().describe(`Postal code`),country:o().optional().describe(`Country`),type:x([`work`,`home`,`other`]).optional().describe(`Address type`),primary:v().optional().default(!1).describe(`Primary address indicator`)}),wV=l({value:o().describe(`Group ID`),$ref:o().url().optional().describe(`URI reference to the group`),display:o().optional().describe(`Group display name`),type:x([`direct`,`indirect`]).optional().describe(`Membership type`)}),TV=l({employeeNumber:o().optional().describe(`Employee number`),costCenter:o().optional().describe(`Cost center`),organization:o().optional().describe(`Organization`),division:o().optional().describe(`Division`),department:o().optional().describe(`Department`),manager:l({value:o().describe(`Manager ID`),$ref:o().url().optional().describe(`Manager URI`),displayName:o().optional().describe(`Manager name`)}).optional().describe(`Manager reference`)}),EV=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.USER),`Must include core User schema URI`).default([vV.USER]).describe(`SCIM schema URIs (must include User schema)`),id:o().optional().describe(`Unique resource identifier`),externalId:o().optional().describe(`External identifier from client system`),userName:o().describe(`Unique username (REQUIRED)`),name:bV.optional().describe(`Structured name components`),displayName:o().optional().describe(`Display name for UI`),nickName:o().optional().describe(`Nickname`),profileUrl:o().url().optional().describe(`Profile page URL`),title:o().optional().describe(`Job title`),userType:o().optional().describe(`User type (employee, contractor)`),preferredLanguage:o().optional().describe(`Preferred language (ISO 639-1)`),locale:o().optional().describe(`Locale (e.g., en-US)`),timezone:o().optional().describe(`Timezone`),active:v().optional().default(!0).describe(`Account active status`),password:o().optional().describe(`Password (write-only)`),emails:S(xV).optional().describe(`Email addresses`),phoneNumbers:S(SV).optional().describe(`Phone numbers`),ims:S(l({value:o(),type:o().optional(),primary:v().optional()})).optional().describe(`IM addresses`),photos:S(l({value:o().url(),type:x([`photo`,`thumbnail`]).optional(),primary:v().optional()})).optional().describe(`Photo URLs`),addresses:S(CV).optional().describe(`Physical addresses`),groups:S(wV).optional().describe(`Group memberships`),entitlements:S(l({value:o(),type:o().optional(),primary:v().optional()})).optional().describe(`Entitlements`),roles:S(l({value:o(),type:o().optional(),primary:v().optional()})).optional().describe(`Roles`),x509Certificates:S(l({value:o(),type:o().optional(),primary:v().optional()})).optional().describe(`X509 certificates`),meta:yV.optional().describe(`Resource metadata`),[vV.ENTERPRISE_USER]:TV.optional().describe(`Enterprise user attributes`)}).superRefine((e,t)=>{e[vV.ENTERPRISE_USER]!=null&&((e.schemas||[]).includes(vV.ENTERPRISE_USER)||t.addIssue({code:le.custom,path:[`schemas`],message:`schemas must include "${vV.ENTERPRISE_USER}" when enterprise user extension attributes are present`}))}),DV=l({value:o().describe(`Member ID`),$ref:o().url().optional().describe(`URI reference to the member`),type:x([`User`,`Group`]).optional().describe(`Member type`),display:o().optional().describe(`Member display name`)}),OV=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.GROUP),`Must include core Group schema URI`).default([vV.GROUP]).describe(`SCIM schema URIs (must include Group schema)`),id:o().optional().describe(`Unique resource identifier`),externalId:o().optional().describe(`External identifier from client system`),displayName:o().describe(`Group display name (REQUIRED)`),members:S(DV).optional().describe(`Group members`),meta:yV.optional().describe(`Resource metadata`)}),bde=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.LIST_RESPONSE),{message:`schemas must include ${vV.LIST_RESPONSE}`}).default([vV.LIST_RESPONSE]).describe(`SCIM schema URIs`),totalResults:A().int().min(0).describe(`Total results count`),Resources:S(c([EV,OV,u(o(),b())])).describe(`Resources array (Users, Groups, or custom resources)`),startIndex:A().int().min(1).optional().describe(`Start index (1-based)`),itemsPerPage:A().int().min(0).optional().describe(`Items per page`)}),xde=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.ERROR),{message:`schemas must include ${vV.ERROR}`}).default([vV.ERROR]).describe(`SCIM schema URIs`),status:A().int().min(400).max(599).describe(`HTTP status code`),scimType:x([`invalidFilter`,`tooMany`,`uniqueness`,`mutability`,`invalidSyntax`,`invalidPath`,`noTarget`,`invalidValue`,`invalidVers`,`sensitive`]).optional().describe(`SCIM error type`),detail:o().optional().describe(`Error detail message`)}),kV=l({op:x([`add`,`remove`,`replace`]).describe(`Operation type`),path:o().optional().describe(`Attribute path (optional for add)`),value:b().optional().describe(`Value to set`)}),Sde=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.PATCH_OP),{message:`SCIM PATCH requests must include the PatchOp schema URI`}).default([vV.PATCH_OP]).describe(`SCIM schema URIs`),Operations:S(kV).min(1).describe(`Patch operations`)}),Cde={user:(e,t,n,r)=>({schemas:[vV.USER],userName:e,emails:[{value:t,type:`work`,primary:!0}],name:{givenName:n,familyName:r},active:!0}),group:(e,t)=>({schemas:[vV.GROUP],displayName:e,members:t||[]}),listResponse:(e,t)=>({schemas:[vV.LIST_RESPONSE],totalResults:t??e.length,Resources:e,startIndex:1,itemsPerPage:e.length}),error:(e,t,n)=>({schemas:[vV.ERROR],status:e,detail:t,scimType:n})},AV=l({method:x([`POST`,`PUT`,`PATCH`,`DELETE`]).describe(`HTTP method for the bulk operation`),path:o().describe(`Resource endpoint path (e.g. /Users, /Groups/{id})`),bulkId:o().optional().describe(`Client-assigned ID for cross-referencing between operations`),data:u(o(),b()).optional().describe(`Request body for POST/PUT/PATCH operations`),version:o().optional().describe(`ETag for optimistic concurrency control`)}),wde=l({schemas:S(p(vV.BULK_REQUEST)).default([vV.BULK_REQUEST]).describe(`SCIM schema URIs (BulkRequest)`),operations:S(AV).min(1).describe(`Bulk operations to execute (minimum 1)`),failOnErrors:A().int().optional().describe(`Stop processing after this many errors`)}),jV=l({method:x([`POST`,`PUT`,`PATCH`,`DELETE`]).describe(`HTTP method that was executed`),bulkId:o().optional().describe(`Client-assigned bulk operation ID`),location:o().optional().describe(`URL of the created or modified resource`),status:o().describe(`HTTP status code as string (e.g. "201", "400")`),response:b().optional().describe(`Response body (typically present for errors)`)}),Tde=l({schemas:S(p(vV.BULK_RESPONSE)).default([vV.BULK_RESPONSE]).describe(`SCIM schema URIs (BulkResponse)`),operations:S(jV).describe(`Results for each bulk operation`)});EE({},{AICodeReviewResultSchema:()=>zde,AIKnowledgeSchema:()=>PV,AIModelConfigSchema:()=>MV,AIOperationCostSchema:()=>rfe,AIOpsAgentConfigSchema:()=>qde,AIOrchestrationExecutionResultSchema:()=>Sfe,AIOrchestrationSchema:()=>bfe,AIOrchestrationTriggerSchema:()=>EU,AITaskSchema:()=>OU,AITaskTypeSchema:()=>DU,AIToolSchema:()=>NV,AgentActionResultSchema:()=>lH,AgentActionSchema:()=>nH,AgentActionSequenceResultSchema:()=>jde,AgentActionSequenceSchema:()=>Ade,AgentCommunicationProtocolSchema:()=>MU,AgentGroupMemberSchema:()=>PU,AgentGroupRoleSchema:()=>NU,AgentSchema:()=>RV,AnomalyDetectionConfigSchema:()=>SH,AutoScalingPolicySchema:()=>TH,BatchAIOrchestrationExecutionSchema:()=>xfe,BillingPeriodSchema:()=>$H,BudgetLimitSchema:()=>ofe,BudgetStatusSchema:()=>tU,BudgetTypeSchema:()=>eU,CICDPipelineConfigSchema:()=>mH,ChunkingStrategySchema:()=>uU,CodeContentSchema:()=>WU,CodeGenerationConfigSchema:()=>dH,CodeGenerationRequestSchema:()=>Ide,CodeGenerationTargetSchema:()=>uH,ComponentActionParamsSchema:()=>tH,ComponentActionTypeSchema:()=>JV,ComponentAgentActionSchema:()=>cH,ConversationAnalyticsSchema:()=>Mfe,ConversationContextSchema:()=>QU,ConversationMessageSchema:()=>JU,ConversationSessionSchema:()=>kfe,ConversationSummarySchema:()=>Afe,CostAlertSchema:()=>rU,CostAlertTypeSchema:()=>nU,CostAnalyticsSchema:()=>oU,CostBreakdownDimensionSchema:()=>iU,CostBreakdownEntrySchema:()=>aU,CostEntrySchema:()=>afe,CostMetricTypeSchema:()=>ife,CostOptimizationRecommendationSchema:()=>sU,CostQueryFiltersSchema:()=>cfe,CostReportSchema:()=>sfe,DataActionParamsSchema:()=>$V,DataActionTypeSchema:()=>KV,DataAgentActionSchema:()=>oH,DeploymentStrategySchema:()=>gH,DevOpsAgentSchema:()=>Nde,DevOpsToolSchema:()=>Pde,DevelopmentConfigSchema:()=>vH,DocumentChunkSchema:()=>lfe,DocumentLoaderConfigSchema:()=>hU,DocumentMetadataSchema:()=>dU,EmbeddingModelSchema:()=>lU,EntitySchema:()=>xU,EvaluationMetricsSchema:()=>zU,FeedbackLoopSchema:()=>Nfe,FieldSynonymConfigSchema:()=>vfe,FileContentSchema:()=>UU,FilterExpressionSchema:()=>gU,FilterGroupSchema:()=>_U,FormActionParamsSchema:()=>QV,FormActionTypeSchema:()=>GV,FormAgentActionSchema:()=>aH,FunctionCallSchema:()=>KU,GeneratedCodeSchema:()=>Lde,GitHubIntegrationSchema:()=>yH,HyperparametersSchema:()=>LU,ImageContentSchema:()=>HU,IntegrationConfigSchema:()=>xH,IntentActionMappingSchema:()=>Mde,IssueSchema:()=>eW,MCPCapabilitySchema:()=>YH,MCPClientConfigSchema:()=>nfe,MCPPromptArgumentSchema:()=>VH,MCPPromptMessageSchema:()=>HH,MCPPromptRequestSchema:()=>efe,MCPPromptResponseSchema:()=>tfe,MCPPromptSchema:()=>UH,MCPResourceRequestSchema:()=>Xde,MCPResourceResponseSchema:()=>Zde,MCPResourceSchema:()=>LH,MCPResourceTemplateSchema:()=>RH,MCPResourceTypeSchema:()=>IH,MCPRootEntrySchema:()=>qH,MCPRootsConfigSchema:()=>JH,MCPSamplingConfigSchema:()=>KH,MCPServerConfigSchema:()=>ZH,MCPServerInfoSchema:()=>XH,MCPStreamingConfigSchema:()=>WH,MCPToolApprovalSchema:()=>GH,MCPToolCallRequestSchema:()=>Qde,MCPToolCallResponseSchema:()=>$de,MCPToolParameterSchema:()=>zH,MCPToolSchema:()=>BH,MCPTransportConfigSchema:()=>FH,MCPTransportTypeSchema:()=>PH,MessageContentSchema:()=>GU,MessageContentTypeSchema:()=>Ofe,MessagePruningEventSchema:()=>jfe,MessageRoleSchema:()=>BU,MetadataFilterSchema:()=>vU,MetadataSourceSchema:()=>$U,ModelCapabilitySchema:()=>DH,ModelConfigSchema:()=>AH,ModelDriftSchema:()=>Dfe,ModelFeatureSchema:()=>IU,ModelLimitsSchema:()=>OH,ModelPricingSchema:()=>kH,ModelProviderSchema:()=>EH,ModelRegistryEntrySchema:()=>NH,ModelRegistrySchema:()=>Jde,ModelSelectionCriteriaSchema:()=>Yde,MonitoringConfigSchema:()=>_H,MultiAgentGroupSchema:()=>Cfe,NLQAnalyticsSchema:()=>_fe,NLQFieldMappingSchema:()=>CU,NLQModelConfigSchema:()=>gfe,NLQParseResultSchema:()=>TU,NLQRequestSchema:()=>pfe,NLQResponseSchema:()=>mfe,NLQTrainingExampleSchema:()=>hfe,NavigationActionParamsSchema:()=>XV,NavigationActionTypeSchema:()=>UV,NavigationAgentActionSchema:()=>rH,PerformanceOptimizationSchema:()=>Kde,PipelineStageSchema:()=>pH,PluginCompositionRequestSchema:()=>Bde,PluginCompositionResultSchema:()=>Vde,PluginRecommendationRequestSchema:()=>Hde,PluginRecommendationSchema:()=>Ude,PluginScaffoldingTemplateSchema:()=>Rde,PostProcessingActionSchema:()=>jU,PredictionRequestSchema:()=>Tfe,PredictionResultSchema:()=>Efe,PredictiveModelSchema:()=>wfe,PredictiveModelTypeSchema:()=>FU,PromptTemplateSchema:()=>MH,PromptVariableSchema:()=>jH,QueryContextSchema:()=>wU,QueryIntentSchema:()=>bU,QueryTemplateSchema:()=>yfe,RAGPipelineConfigSchema:()=>yU,RAGPipelineStatusSchema:()=>ffe,RAGQueryRequestSchema:()=>ufe,RAGQueryResponseSchema:()=>dfe,RerankingConfigSchema:()=>pU,ResolutionSchema:()=>tW,RetrievalStrategySchema:()=>fU,RootCauseAnalysisRequestSchema:()=>Wde,RootCauseAnalysisResultSchema:()=>Gde,SelfHealingActionSchema:()=>CH,SelfHealingConfigSchema:()=>wH,SkillSchema:()=>HV,SkillTriggerConditionSchema:()=>VV,StructuredOutputConfigSchema:()=>LV,StructuredOutputFormatSchema:()=>FV,TestingConfigSchema:()=>fH,TextContentSchema:()=>VU,TimeframeSchema:()=>SU,TokenBudgetConfigSchema:()=>XU,TokenBudgetStrategySchema:()=>YU,TokenUsageSchema:()=>QH,TokenUsageStatsSchema:()=>ZU,ToolCallSchema:()=>qU,ToolCategorySchema:()=>zV,ToolSchema:()=>BV,TrainingConfigSchema:()=>RU,TransformPipelineStepSchema:()=>IV,TypedAgentActionSchema:()=>kde,UIActionTypeSchema:()=>YV,VectorStoreConfigSchema:()=>mU,VectorStoreProviderSchema:()=>cU,VercelIntegrationSchema:()=>bH,VersionManagementSchema:()=>hH,ViewActionParamsSchema:()=>ZV,ViewActionTypeSchema:()=>WV,ViewAgentActionSchema:()=>iH,WorkflowActionParamsSchema:()=>eH,WorkflowActionTypeSchema:()=>qV,WorkflowAgentActionSchema:()=>sH,WorkflowFieldConditionSchema:()=>kU,WorkflowScheduleSchema:()=>AU,defineAgent:()=>Ede,defineSkill:()=>Ode,defineTool:()=>Dde,fullStackDevOpsAgentExample:()=>Fde});var MV=l({provider:x([`openai`,`azure_openai`,`anthropic`,`local`]).default(`openai`),model:o().describe(`Model name (e.g. gpt-4, claude-3-opus)`),temperature:A().min(0).max(2).default(.7),maxTokens:A().optional(),topP:A().optional()}),NV=l({type:x([`action`,`flow`,`query`,`vector_search`]),name:o().describe(`Reference name (Action Name, Flow Name)`),description:o().optional().describe(`Override description for the LLM`)}),PV=l({topics:S(o()).describe(`Topics/Tags to recruit knowledge from`),indexes:S(o()).describe(`Vector Store Indexes`)}),FV=x([`json_object`,`json_schema`,`regex`,`grammar`,`xml`]).describe(`Output format for structured agent responses`),IV=x([`trim`,`parse_json`,`validate`,`coerce_types`]).describe(`Post-processing step for structured output`),LV=l({format:FV.describe(`Expected output format`),schema:u(o(),b()).optional().describe(`JSON Schema definition for output`),strict:v().default(!1).describe(`Enforce exact schema compliance`),retryOnValidationFailure:v().default(!0).describe(`Retry generation when output fails validation`),maxRetries:A().int().min(0).default(3).describe(`Maximum retries on validation failure`),fallbackFormat:FV.optional().describe(`Fallback format if primary format fails`),transformPipeline:S(IV).optional().describe(`Post-processing steps applied to output`)}).describe(`Structured output configuration for agent responses`),RV=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Agent unique identifier`),label:o().describe(`Agent display name`),avatar:o().optional(),role:o().describe(`The persona/role (e.g. "Senior Support Engineer")`),instructions:o().describe(`System Prompt / Prime Directives`),model:MV.optional(),lifecycle:XD.optional().describe(`State machine defining the agent conversation follow and constraints`),skills:S(o().regex(/^[a-z_][a-z0-9_]*$/)).optional().describe(`Skill names to attach (Agent→Skill→Tool architecture)`),tools:S(NV).optional().describe(`Direct tool references (legacy fallback)`),knowledge:PV.optional().describe(`RAG access`),active:v().default(!0),access:S(o()).optional().describe(`Who can chat with this agent`),permissions:S(o()).optional().describe(`Required permissions or roles`),tenantId:o().optional().describe(`Tenant/Organization ID`),visibility:x([`global`,`organization`,`private`]).default(`organization`),planning:l({strategy:x([`react`,`plan_and_execute`,`reflexion`,`tree_of_thought`]).default(`react`).describe(`Autonomous reasoning strategy`),maxIterations:A().int().min(1).max(100).default(10).describe(`Maximum planning loop iterations`),allowReplan:v().default(!0).describe(`Allow dynamic re-planning based on intermediate results`)}).optional().describe(`Autonomous reasoning and planning configuration`),memory:l({shortTerm:l({maxMessages:A().int().min(1).default(50).describe(`Max recent messages in working memory`),maxTokens:A().int().min(100).optional().describe(`Max tokens for short-term context window`)}).optional().describe(`Short-term / working memory`),longTerm:l({enabled:v().default(!1).describe(`Enable long-term memory persistence`),store:x([`vector`,`database`,`redis`]).default(`vector`).describe(`Long-term memory storage backend`),maxEntries:A().int().min(1).optional().describe(`Max entries in long-term memory`)}).optional().describe(`Long-term / persistent memory`),reflectionInterval:A().int().min(1).optional().describe(`Reflect every N interactions to improve behavior`)}).optional().describe(`Agent memory management`),guardrails:l({maxTokensPerInvocation:A().int().min(1).optional().describe(`Token budget per single invocation`),maxExecutionTimeSec:A().int().min(1).optional().describe(`Max execution time in seconds`),blockedTopics:S(o()).optional().describe(`Forbidden topics or action names`)}).optional().describe(`Safety guardrails for the agent`),structuredOutput:LV.optional().describe(`Structured output format and validation configuration`)});function Ede(e){return RV.parse(e)}var zV=x([`data`,`action`,`flow`,`integration`,`vector_search`,`analytics`,`utility`]).describe(`Tool operational category`),BV=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool unique identifier (snake_case)`),label:o().describe(`Tool display name`),description:o().describe(`Tool description for LLM function calling`),category:zV.optional().describe(`Tool category for grouping and filtering`),parameters:u(o(),b()).describe(`JSON Schema for tool parameters`),outputSchema:u(o(),b()).optional().describe(`JSON Schema for tool output`),objectName:o().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object name (snake_case)`),requiresConfirmation:v().default(!1).describe(`Require user confirmation before execution`),permissions:S(o()).optional().describe(`Required permissions or roles`),active:v().default(!0).describe(`Whether the tool is enabled`),builtIn:v().default(!1).describe(`Platform built-in tool flag`)});function Dde(e){return BV.parse(e)}var VV=l({field:o().describe(`Context field to evaluate`),operator:x([`eq`,`neq`,`in`,`not_in`,`contains`]).describe(`Comparison operator`),value:c([o(),S(o())]).describe(`Expected value or values`)}),HV=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Skill unique identifier (snake_case)`),label:o().describe(`Skill display name`),description:o().optional().describe(`Skill description`),instructions:o().optional().describe(`LLM instructions when skill is active`),tools:S(o().regex(/^[a-z_][a-z0-9_]*$/)).describe(`Tool names belonging to this skill`),triggerPhrases:S(o()).optional().describe(`Phrases that activate this skill`),triggerConditions:S(VV).optional().describe(`Programmatic activation conditions`),permissions:S(o()).optional().describe(`Required permissions or roles`),active:v().default(!0).describe(`Whether the skill is enabled`)});function Ode(e){return HV.parse(e)}var UV=x([`navigate_to_object_list`,`navigate_to_object_form`,`navigate_to_record_detail`,`navigate_to_dashboard`,`navigate_to_report`,`navigate_to_app`,`navigate_back`,`navigate_home`,`open_tab`,`close_tab`]),WV=x([`change_view_mode`,`apply_filter`,`clear_filter`,`apply_sort`,`change_grouping`,`show_columns`,`expand_record`,`collapse_record`,`refresh_view`,`export_data`]),GV=x([`create_record`,`update_record`,`delete_record`,`fill_field`,`clear_field`,`submit_form`,`cancel_form`,`validate_form`,`save_draft`]),KV=x([`select_record`,`deselect_record`,`select_all`,`deselect_all`,`bulk_update`,`bulk_delete`,`bulk_export`]),qV=x([`trigger_flow`,`trigger_approval`,`trigger_webhook`,`run_report`,`send_email`,`send_notification`,`schedule_task`]),JV=x([`open_modal`,`close_modal`,`open_sidebar`,`close_sidebar`,`show_notification`,`hide_notification`,`open_dropdown`,`close_dropdown`,`toggle_section`]),YV=c([UV,WV,GV,KV,qV,JV]),XV=l({object:o().optional().describe(`Object name (for object-specific navigation)`),recordId:o().optional().describe(`Record ID (for detail page)`),viewType:x([`list`,`form`,`detail`,`kanban`,`calendar`,`gantt`]).optional(),dashboardId:o().optional().describe(`Dashboard ID`),reportId:o().optional().describe(`Report ID`),appName:o().optional().describe(`App name`),mode:x([`new`,`edit`,`view`]).optional().describe(`Form mode`),openInNewTab:v().optional().describe(`Open in new tab`)}),ZV=l({viewMode:x([`list`,`kanban`,`calendar`,`gantt`,`pivot`]).optional(),filters:u(o(),b()).optional().describe(`Filter conditions`),sort:S(l({field:o(),order:x([`asc`,`desc`])})).optional(),groupBy:o().optional().describe(`Field to group by`),columns:S(o()).optional().describe(`Columns to show/hide`),recordId:o().optional().describe(`Record to expand/collapse`),exportFormat:x([`csv`,`xlsx`,`pdf`,`json`]).optional()}),QV=l({object:o().optional().describe(`Object name`),recordId:o().optional().describe(`Record ID (for edit/delete)`),fieldValues:u(o(),b()).optional().describe(`Field name-value pairs`),fieldName:o().optional().describe(`Specific field to fill/clear`),fieldValue:b().optional().describe(`Value to set`),validateOnly:v().optional().describe(`Validate without saving`)}),$V=l({recordIds:S(o()).optional().describe(`Record IDs to select/operate on`),filters:u(o(),b()).optional().describe(`Filter for bulk operations`),updateData:u(o(),b()).optional().describe(`Data for bulk update`),exportFormat:x([`csv`,`xlsx`,`pdf`,`json`]).optional()}),eH=l({flowName:o().optional().describe(`Flow/workflow name`),approvalProcessName:o().optional().describe(`Approval process name`),webhookUrl:o().optional().describe(`Webhook URL`),reportName:o().optional().describe(`Report name`),emailTemplate:o().optional().describe(`Email template`),recipients:S(o()).optional().describe(`Email recipients`),subject:o().optional().describe(`Email subject`),message:o().optional().describe(`Notification/email message`),taskData:u(o(),b()).optional().describe(`Task creation data`),scheduleTime:o().optional().describe(`Schedule time (ISO 8601)`),contextData:u(o(),b()).optional().describe(`Additional context data`)}),tH=l({componentId:o().optional().describe(`Component ID`),modalConfig:l({title:o().optional(),content:b().optional(),size:x([`small`,`medium`,`large`,`fullscreen`]).optional()}).optional(),notificationConfig:l({type:x([`info`,`success`,`warning`,`error`]).optional(),message:o(),duration:A().optional().describe(`Duration in ms`)}).optional(),sidebarConfig:l({position:x([`left`,`right`]).optional(),width:o().optional(),content:b().optional()}).optional()}),nH=l({id:o().optional().describe(`Unique action ID`),type:YV.describe(`Type of UI action to perform`),params:c([XV,ZV,QV,$V,eH,tH]).describe(`Action-specific parameters`),requireConfirmation:v().default(!1).describe(`Require user confirmation before executing`),confirmationMessage:o().optional().describe(`Message to show in confirmation dialog`),successMessage:o().optional().describe(`Message to show on success`),onError:x([`retry`,`skip`,`abort`]).default(`abort`).describe(`Error handling strategy`),metadata:l({intent:o().optional().describe(`Original user intent/query`),confidence:A().min(0).max(1).optional().describe(`Confidence score (0-1)`),agentName:o().optional().describe(`Agent that generated this action`),timestamp:o().datetime().optional().describe(`Generation timestamp (ISO 8601)`)}).optional()}),rH=nH.extend({type:UV,params:XV}),iH=nH.extend({type:WV,params:ZV}),aH=nH.extend({type:GV,params:QV}),oH=nH.extend({type:KV,params:$V}),sH=nH.extend({type:qV,params:eH}),cH=nH.extend({type:JV,params:tH}),kde=c([rH,iH,aH,oH,sH,cH]),Ade=l({id:o().optional().describe(`Unique sequence ID`),actions:S(nH).describe(`Ordered list of actions`),mode:x([`sequential`,`parallel`]).default(`sequential`).describe(`Execution mode`),stopOnError:v().default(!0).describe(`Stop sequence on first error`),atomic:v().default(!1).describe(`Transaction mode (all-or-nothing)`),startTime:o().datetime().optional().describe(`Execution start time (ISO 8601)`),endTime:o().datetime().optional().describe(`Execution end time (ISO 8601)`),metadata:l({intent:o().optional().describe(`Original user intent`),confidence:A().min(0).max(1).optional().describe(`Overall confidence score`),agentName:o().optional().describe(`Agent that generated this sequence`)}).optional()}),lH=l({actionId:o().describe(`ID of the executed action`),status:x([`success`,`error`,`cancelled`,`pending`]).describe(`Execution status`),data:b().optional().describe(`Action result data`),error:l({code:o(),message:o(),details:b().optional()}).optional().describe(`Error details if status is "error"`),metadata:l({startTime:o().optional().describe(`Execution start time (ISO 8601)`),endTime:o().optional().describe(`Execution end time (ISO 8601)`),duration:A().optional().describe(`Execution duration in ms`)}).optional()}),jde=l({sequenceId:o().describe(`ID of the executed sequence`),status:x([`success`,`partial_success`,`error`,`cancelled`]).describe(`Overall execution status`),results:S(lH).describe(`Results for each action`),summary:l({total:A().describe(`Total number of actions`),successful:A().describe(`Number of successful actions`),failed:A().describe(`Number of failed actions`),cancelled:A().describe(`Number of cancelled actions`)}),metadata:l({startTime:o().optional(),endTime:o().optional(),totalDuration:A().optional().describe(`Total execution time in ms`)}).optional()}),Mde=l({intent:o().describe(`Intent pattern (e.g., "open_new_record_form")`),examples:S(o()).optional().describe(`Example user queries`),actionTemplate:nH.describe(`Action to execute`),paramExtraction:u(o(),l({type:x([`entity`,`slot`,`context`]),required:v().default(!1),default:b().optional()})).optional().describe(`Rules for extracting parameters from user input`),minConfidence:A().min(0).max(1).default(.7).describe(`Minimum confidence to execute`)}),uH=x([`frontend`,`backend`,`api`,`database`,`tests`,`documentation`,`infrastructure`]).describe(`Code generation target`),dH=l({enabled:v().optional().default(!0).describe(`Enable code generation`),targets:S(uH).describe(`Code generation targets`),templateRepo:o().optional().describe(`Template repository for scaffolding`),styleGuide:o().optional().describe(`Code style guide to follow`),includeTests:v().optional().default(!0).describe(`Generate tests with code`),includeDocumentation:v().optional().default(!0).describe(`Generate documentation`),validationMode:x([`strict`,`moderate`,`permissive`]).optional().default(`strict`).describe(`Code validation strictness`)}),fH=l({enabled:v().optional().default(!0).describe(`Enable automated testing`),testTypes:S(x([`unit`,`integration`,`e2e`,`performance`,`security`,`accessibility`])).optional().default([`unit`,`integration`]).describe(`Types of tests to run`),coverageThreshold:A().min(0).max(100).optional().default(80).describe(`Minimum test coverage percentage`),framework:o().optional().describe(`Testing framework (e.g., vitest, jest, playwright)`),preCommitTests:v().optional().default(!0).describe(`Run tests before committing`),autoFix:v().optional().default(!1).describe(`Attempt to auto-fix failing tests`)}),pH=l({name:o().describe(`Pipeline stage name`),type:x([`build`,`test`,`lint`,`security_scan`,`deploy`,`smoke_test`,`rollback`]).describe(`Stage type`),order:A().int().min(0).describe(`Execution order`),parallel:v().optional().default(!1).describe(`Can run in parallel with other stages`),commands:S(o()).describe(`Commands to execute`),env:u(o(),o()).optional().describe(`Stage-specific environment variables`),timeout:A().int().min(60).optional().default(600).describe(`Stage timeout in seconds`),retryOnFailure:v().optional().default(!1).describe(`Retry stage on failure`),maxRetries:A().int().min(0).max(5).optional().default(0).describe(`Maximum retry attempts`)}),mH=l({name:o().describe(`Pipeline name`),trigger:x([`push`,`pull_request`,`release`,`schedule`,`manual`]).describe(`Pipeline trigger`),branches:S(o()).optional().describe(`Branches to run pipeline on`),stages:S(pH).describe(`Pipeline stages`),notifications:l({onSuccess:v().optional().default(!1),onFailure:v().optional().default(!0),channels:S(o()).optional().describe(`Notification channels (e.g., slack, email)`)}).optional().describe(`Pipeline notifications`)}),hH=l({scheme:x([`semver`,`calver`,`custom`]).optional().default(`semver`).describe(`Versioning scheme`),autoIncrement:x([`major`,`minor`,`patch`,`none`]).optional().default(`patch`).describe(`Auto-increment strategy`),prefix:o().optional().default(`v`).describe(`Version tag prefix`),generateChangelog:v().optional().default(!0).describe(`Generate changelog automatically`),changelogFormat:x([`conventional`,`keepachangelog`,`custom`]).optional().default(`conventional`).describe(`Changelog format`),tagReleases:v().optional().default(!0).describe(`Create Git tags for releases`)}),gH=l({type:x([`rolling`,`blue_green`,`canary`,`recreate`]).optional().default(`rolling`).describe(`Deployment strategy`),canaryPercentage:A().min(0).max(100).optional().default(10).describe(`Canary deployment percentage`),healthCheckUrl:o().optional().describe(`Health check endpoint`),healthCheckTimeout:A().int().min(10).optional().default(60).describe(`Health check timeout in seconds`),autoRollback:v().optional().default(!0).describe(`Automatically rollback on failure`),smokeTests:S(o()).optional().describe(`Smoke test commands to run post-deployment`)}),_H=l({enabled:v().optional().default(!0).describe(`Enable monitoring`),metrics:S(x([`performance`,`errors`,`usage`,`availability`,`latency`])).optional().default([`performance`,`errors`,`availability`]).describe(`Metrics to monitor`),alerts:S(l({name:o().describe(`Alert name`),metric:o().describe(`Metric to monitor`),threshold:A().describe(`Alert threshold`),severity:x([`info`,`warning`,`critical`]).describe(`Alert severity`)})).optional().describe(`Alert configurations`),integrations:S(o()).optional().describe(`Monitoring service integrations`)}),vH=l({specificationSource:o().describe(`Path to ObjectStack specification`),codeGeneration:dH.describe(`Code generation settings`),testing:fH.optional().describe(`Testing configuration`),linting:l({enabled:v().optional().default(!0),autoFix:v().optional().default(!0),rules:u(o(),b()).optional()}).optional().describe(`Code linting configuration`),formatting:l({enabled:v().optional().default(!0),autoFormat:v().optional().default(!0),config:u(o(),b()).optional()}).optional().describe(`Code formatting configuration`)}),yH=l({connector:o().describe(`GitHub connector name`),repository:l({owner:o().describe(`Repository owner`),name:o().describe(`Repository name`)}).describe(`Repository configuration`),featureBranch:o().optional().default(`develop`).describe(`Default feature branch`),pullRequest:l({autoCreate:v().optional().default(!0).describe(`Automatically create PRs`),autoMerge:v().optional().default(!1).describe(`Automatically merge PRs when checks pass`),requireReviews:v().optional().default(!0).describe(`Require reviews before merge`),deleteBranchOnMerge:v().optional().default(!0).describe(`Delete feature branch after merge`)}).optional().describe(`Pull request settings`)}),bH=l({connector:o().describe(`Vercel connector name`),project:o().describe(`Vercel project name`),environments:l({production:o().optional().default(`main`).describe(`Production branch`),preview:S(o()).optional().default([`develop`,`feature/*`]).describe(`Preview branches`)}).optional().describe(`Environment mapping`),deployment:l({autoDeployProduction:v().optional().default(!1).describe(`Auto-deploy to production`),autoDeployPreview:v().optional().default(!0).describe(`Auto-deploy preview environments`),requireApproval:v().optional().default(!0).describe(`Require approval for production deployments`)}).optional().describe(`Deployment settings`)}),xH=l({github:yH.describe(`GitHub integration configuration`),vercel:bH.describe(`Vercel integration configuration`),additional:u(o(),b()).optional().describe(`Additional integration configurations`)}),Nde=RV.extend({developmentConfig:vH.describe(`Development configuration`),pipelines:S(mH).optional().describe(`CI/CD pipelines`),versionManagement:hH.optional().describe(`Version management configuration`),deploymentStrategy:gH.optional().describe(`Deployment strategy`),monitoring:_H.optional().describe(`Monitoring configuration`),integrations:xH.describe(`Integration configurations`),selfIteration:l({enabled:v().optional().default(!0).describe(`Enable self-iteration`),iterationFrequency:o().optional().describe(`Iteration frequency (cron expression)`),optimizationGoals:S(x([`performance`,`security`,`code_quality`,`test_coverage`,`documentation`])).optional().describe(`Optimization goals`),learningMode:x([`conservative`,`balanced`,`aggressive`]).optional().default(`balanced`).describe(`Learning mode`)}).optional().describe(`Self-iteration configuration`)}),Pde=NV.extend({type:x([`action`,`flow`,`query`,`vector_search`,`git_operation`,`code_generation`,`test_execution`,`deployment`,`monitoring`])}),Fde={name:`devops_automation_agent`,label:`DevOps Automation Agent`,visibility:`organization`,avatar:`/avatars/devops-bot.png`,role:`Senior Full-Stack DevOps Engineer`,instructions:`You are an autonomous DevOps agent specialized in enterprise management software development.
|
|
67
|
+
`)}`}function wse(e,t,n){let r=e.safeParse(t,{error:oD});return r.success?{success:!0,data:r.data}:{success:!1,error:r.error,formatted:cD(r.error,n)}}var lD=[`objects`,`apps`,`pages`,`dashboards`,`reports`,`actions`,`themes`,`workflows`,`approvals`,`flows`,`roles`,`permissions`,`sharingRules`,`policies`,`apis`,`webhooks`,`agents`,`ragPipelines`,`hooks`,`mappings`,`analyticsCubes`,`connectors`,`datasources`];function uD(e,t=`name`){return e==null||Array.isArray(e)?e:typeof e==`object`?Object.entries(e).map(([e,n])=>{if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n;return!(t in r)||r[t]===void 0?{...r,[t]:e}:r}return n}):e}function dD(e){let t={...e};for(let e of lD)e in t&&(t[e]=uD(t[e]));return t}var fD={triggers:`hooks`};function pD(e){let t={...e};for(let[e,n]of Object.entries(fD))if(e in t){let r=uD(t[e]),i=uD(t[n]);Array.isArray(r)&&(t[n]=Array.isArray(i)?[...i,...r]:r),delete t[e]}for(let e of lD)e in t&&(t[e]=uD(t[e]));return Array.isArray(t.plugins)&&(t.plugins=t.plugins.map(e=>e&&typeof e==`object`&&!Array.isArray(e)?pD(e):e)),t}EE({},{ALL_OPERATORS:()=>Pse,AddressSchema:()=>xse,AggregationFunction:()=>wD,AggregationMetricType:()=>zk,AggregationNodeSchema:()=>TD,AggregationPipelineSchema:()=>hk,AggregationStageSchema:()=>mk,AnalyticsQuerySchema:()=>Kk,ApiMethod:()=>iO,AsyncValidationSchema:()=>HD,BaseEngineOptionsSchema:()=>wO,CDCConfigSchema:()=>fO,ComparisonOperatorSchema:()=>Ese,ComputedFieldCacheSchema:()=>eD,ConditionalValidationSchema:()=>GD,ConsistencyLevelSchema:()=>ok,CrossFieldValidationSchema:()=>BD,CubeJoinSchema:()=>Wk,CubeSchema:()=>Gk,CurrencyConfigSchema:()=>XE,CurrencyValueSchema:()=>bse,CustomValidatorSchema:()=>UD,DataEngineAggregateOptionsSchema:()=>AO,DataEngineAggregateRequestSchema:()=>HO,DataEngineBatchRequestSchema:()=>GO,DataEngineContractSchema:()=>NO,DataEngineCountOptionsSchema:()=>MO,DataEngineCountRequestSchema:()=>VO,DataEngineDeleteOptionsSchema:()=>Gse,DataEngineDeleteRequestSchema:()=>BO,DataEngineExecuteRequestSchema:()=>UO,DataEngineFilterSchema:()=>SO,DataEngineFindOneRequestSchema:()=>LO,DataEngineFindRequestSchema:()=>IO,DataEngineInsertOptionsSchema:()=>EO,DataEngineInsertRequestSchema:()=>RO,DataEngineQueryOptionsSchema:()=>Use,DataEngineRequestSchema:()=>KO,DataEngineSortSchema:()=>CO,DataEngineUpdateOptionsSchema:()=>Wse,DataEngineUpdateRequestSchema:()=>zO,DataEngineVectorFindRequestSchema:()=>WO,DataQualityRulesSchema:()=>$E,DataTypeMappingSchema:()=>$O,DatasetLoadResultSchema:()=>Tk,DatasetMode:()=>vk,DatasetSchema:()=>yk,DatasourceCapabilities:()=>Lk,DatasourceSchema:()=>Rk,DimensionSchema:()=>Uk,DimensionType:()=>Bk,DocumentSchema:()=>jk,DocumentSchemaValidationSchema:()=>uk,DocumentTemplateSchema:()=>kk,DocumentVersionSchema:()=>Ok,DriverCapabilitiesSchema:()=>JO,DriverConfigSchema:()=>ZO,DriverDefinitionSchema:()=>Ik,DriverInterfaceSchema:()=>YO,DriverOptionsSchema:()=>qO,DriverType:()=>Fk,ESignatureConfigSchema:()=>Ak,EngineAggregateOptionsSchema:()=>kO,EngineCountOptionsSchema:()=>jO,EngineDeleteOptionsSchema:()=>OO,EngineQueryOptionsSchema:()=>TO,EngineUpdateOptionsSchema:()=>DO,EqualityOperatorSchema:()=>Tse,ExternalDataSourceSchema:()=>Mk,ExternalFieldMappingSchema:()=>Nk,ExternalLookupSchema:()=>Pk,FILTER_OPERATORS:()=>xD,FeedActorSchema:()=>Zk,FeedFilterMode:()=>eA,FeedItemSchema:()=>$k,FeedItemType:()=>qk,FeedVisibility:()=>Qk,Field:()=>Sse,FieldChangeEntrySchema:()=>Yk,FieldMappingSchema:()=>yO,FieldNodeSchema:()=>MD,FieldOperatorsSchema:()=>hD,FieldReferenceSchema:()=>mD,FieldSchema:()=>tD,FieldType:()=>JE,FileAttachmentConfigSchema:()=>QE,FilterConditionSchema:()=>gD,FormatValidationSchema:()=>zD,FullTextSearchSchema:()=>ND,HookContextSchema:()=>Hse,HookEvent:()=>gO,HookSchema:()=>_O,IndexSchema:()=>oO,JSONValidationSchema:()=>VD,JoinNodeSchema:()=>OD,JoinStrategy:()=>DD,JoinType:()=>ED,LOGICAL_OPERATORS:()=>SD,LocationCoordinatesSchema:()=>yse,MappingSchema:()=>bO,MentionSchema:()=>Jk,MetricSchema:()=>Hk,NoSQLDataTypeMappingSchema:()=>dk,NoSQLDatabaseTypeSchema:()=>ik,NoSQLDriverConfigSchema:()=>fk,NoSQLIndexSchema:()=>gk,NoSQLIndexTypeSchema:()=>sk,NoSQLOperationTypeSchema:()=>ak,NoSQLQueryOptionsSchema:()=>pk,NoSQLTransactionOptionsSchema:()=>_k,NormalizedFilterSchema:()=>_D,NotificationChannel:()=>nA,ObjectCapabilities:()=>aO,ObjectDependencyGraphSchema:()=>Sk,ObjectDependencyNodeSchema:()=>xk,ObjectExtensionSchema:()=>hO,ObjectOwnershipEnum:()=>Vse,ObjectSchema:()=>mO,PartitioningConfigSchema:()=>dO,PoolConfigSchema:()=>XO,QueryFilterSchema:()=>jse,QuerySchema:()=>PD,RangeOperatorSchema:()=>Ose,ReactionSchema:()=>Xk,RecordSubscriptionSchema:()=>rA,ReferenceResolutionErrorSchema:()=>Ck,ReferenceResolutionSchema:()=>bk,ReplicationConfigSchema:()=>lk,SQLDialectSchema:()=>QO,SQLDriverConfigSchema:()=>tk,SQLiteAlterTableLimitations:()=>rk,SQLiteDataTypeMappingDefaults:()=>nk,SSLConfigSchema:()=>ek,ScriptValidationSchema:()=>ID,SearchConfigSchema:()=>sO,SeedLoaderConfigSchema:()=>wk,SeedLoaderRequestSchema:()=>Dk,SeedLoaderResultSchema:()=>Ek,SelectOptionSchema:()=>YE,SetOperatorSchema:()=>Dse,ShardingConfigSchema:()=>ck,SoftDeleteConfigSchema:()=>lO,SortNodeSchema:()=>CD,SpecialOperatorSchema:()=>Ase,StateMachineValidationSchema:()=>RD,StringOperatorSchema:()=>kse,SubscriptionEventType:()=>tA,TenancyConfigSchema:()=>cO,TenantDatabaseLifecycleSchema:()=>oA,TenantResolverStrategySchema:()=>iA,TimeUpdateInterval:()=>Vk,TransformType:()=>vO,TursoGroupSchema:()=>aA,TursoMultiTenantConfigSchema:()=>sA,UniquenessValidationSchema:()=>LD,VALID_AST_OPERATORS:()=>vD,ValidationRuleSchema:()=>WD,VectorConfigSchema:()=>ZE,VersioningConfigSchema:()=>uO,WindowFunction:()=>kD,WindowFunctionNodeSchema:()=>jD,WindowSpecSchema:()=>AD,isFilterAST:()=>yD,parseFilterAST:()=>bD});var mD=l({$field:o().describe(`Field Reference/Column Name`)}),Tse=l({$eq:T().optional(),$ne:T().optional()}),Ese=l({$gt:c([A(),_(),mD]).optional(),$gte:c([A(),_(),mD]).optional(),$lt:c([A(),_(),mD]).optional(),$lte:c([A(),_(),mD]).optional()}),Dse=l({$in:S(T()).optional(),$nin:S(T()).optional()}),Ose=l({$between:a([c([A(),_(),mD]),c([A(),_(),mD])]).optional()}),kse=l({$contains:o().optional(),$notContains:o().optional(),$startsWith:o().optional(),$endsWith:o().optional()}),Ase=l({$null:v().optional(),$exists:v().optional()}),hD=l({$eq:T().optional(),$ne:T().optional(),$gt:c([A(),_(),mD]).optional(),$gte:c([A(),_(),mD]).optional(),$lt:c([A(),_(),mD]).optional(),$lte:c([A(),_(),mD]).optional(),$in:S(T()).optional(),$nin:S(T()).optional(),$between:a([c([A(),_(),mD]),c([A(),_(),mD])]).optional(),$contains:o().optional(),$notContains:o().optional(),$startsWith:o().optional(),$endsWith:o().optional(),$null:v().optional(),$exists:v().optional()}),gD=j(()=>u(o(),b()).and(l({$and:S(gD).optional(),$or:S(gD).optional(),$not:gD.optional()}))),jse=l({where:gD.optional()}),_D=j(()=>l({$and:S(c([u(o(),hD),_D])).optional(),$or:S(c([u(o(),hD),_D])).optional(),$not:c([u(o(),hD),_D]).optional()})),vD=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function yD(e){if(!Array.isArray(e)||e.length===0)return!1;let t=e[0];if(typeof t==`string`){let n=t.toLowerCase();if(n===`and`||n===`or`)return e.length>=2&&e.slice(1).every(e=>yD(e));if(e.length>=2&&typeof e[1]==`string`)return vD.has(e[1].toLowerCase())}return e.every(e=>yD(e))?e.length>0:!1}var Mse={"=":`$eq`,"==":`$eq`,"!=":`$ne`,"<>":`$ne`,">":`$gt`,">=":`$gte`,"<":`$lt`,"<=":`$lte`,in:`$in`,nin:`$nin`,not_in:`$nin`,contains:`$contains`,notcontains:`$notContains`,not_contains:`$notContains`,like:`$contains`,startswith:`$startsWith`,starts_with:`$startsWith`,endswith:`$endsWith`,ends_with:`$endsWith`,between:`$between`,is_null:`$null`,is_not_null:`$null`};function Nse(e){let[t,n,r]=e,i=n.toLowerCase();if(i===`=`||i===`==`)return{[t]:r};if(i===`is_null`)return{[t]:{$null:!0}};if(i===`is_not_null`)return{[t]:{$null:!1}};let a=Mse[i];return a?{[t]:{[a]:r}}:{[t]:{[`$${i}`]:r}}}function bD(e){if(e==null)return;if(!Array.isArray(e))return e;if(e.length===0)return;let t=e[0];if(typeof t==`string`&&(t.toLowerCase()===`and`||t.toLowerCase()===`or`)){let n=`$${t.toLowerCase()}`,r=e.slice(1).map(e=>bD(e)).filter(Boolean);return r.length===0?void 0:r.length===1?r[0]:{[n]:r}}if(e.length>=2&&typeof t==`string`)return Nse(e);if(e.every(e=>Array.isArray(e))){let t=e.map(e=>bD(e)).filter(Boolean);return t.length===0?void 0:t.length===1?t[0]:{$and:t}}}var xD=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],SD=[`$and`,`$or`,`$not`],Pse=[...xD,...SD],CD=l({field:o(),order:x([`asc`,`desc`]).default(`asc`)}),wD=x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),TD=l({function:wD.describe(`Aggregation function`),field:o().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:o().describe(`Result column alias`),distinct:v().optional().describe(`Apply DISTINCT before aggregation`),filter:gD.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)}),ED=x([`inner`,`left`,`right`,`full`]),DD=x([`auto`,`database`,`hash`,`loop`]),OD=j(()=>l({type:ED.describe(`Join type`),strategy:DD.optional().describe(`Execution strategy hint`),object:o().describe(`Object/table to join`),alias:o().optional().describe(`Table alias`),on:gD.describe(`Join condition`),subquery:j(()=>PD).optional().describe(`Subquery instead of object`)})),kD=x([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),AD=l({partitionBy:S(o()).optional().describe(`PARTITION BY fields`),orderBy:S(CD).optional().describe(`ORDER BY specification`),frame:l({type:x([`rows`,`range`]).optional(),start:o().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:o().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)}),jD=l({function:kD.describe(`Window function name`),field:o().optional().describe(`Field to operate on (for aggregate window functions)`),alias:o().describe(`Result column alias`),over:AD.describe(`Window specification (OVER clause)`)}),MD=j(()=>c([o(),l({field:o(),fields:S(MD).optional(),alias:o().optional()})])),ND=l({query:o().describe(`Search query text`),fields:S(o()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:v().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:x([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:u(o(),A()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:A().optional().describe(`Minimum relevance score threshold`),language:o().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:v().optional().default(!1).describe(`Enable search result highlighting`)}),PD=l({object:o().describe(`Object name (e.g. account)`),fields:S(MD).optional().describe(`Fields to retrieve`),where:gD.optional().describe(`Filtering criteria (WHERE)`),search:ND.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:S(CD).optional().describe(`Sorting instructions (ORDER BY)`),limit:A().optional().describe(`Max records to return (LIMIT)`),offset:A().optional().describe(`Records to skip (OFFSET)`),top:A().optional().describe(`Alias for limit (OData compatibility)`),cursor:u(o(),b()).optional().describe(`Cursor for keyset pagination`),joins:S(OD).optional().describe(`Explicit Table Joins`),aggregations:S(TD).optional().describe(`Aggregation functions`),groupBy:S(o()).optional().describe(`GROUP BY fields`),having:gD.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:S(jD).optional().describe(`Window functions with OVER clause`),distinct:v().optional().describe(`SELECT DISTINCT flag`)}).extend({expand:j(()=>u(o(),PD)).optional().describe(`Recursive relation loading map. Keys are lookup/master_detail field names; values are nested QueryAST objects that control select, filter, sort, and further expansion on the related object. The engine resolves expand via batch $in queries (driver-agnostic) with a default max depth of 3.`)}),FD=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:o().optional().describe(`Human-readable label for the rule listing`),description:o().optional().describe(`Administrative notes explaining the business reason`),active:v().default(!0),events:S(x([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:A().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:S(o()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:x([`error`,`warning`,`info`]).default(`error`),message:o().describe(`Error message to display to the user`)}),ID=FD.extend({type:p(`script`),condition:o().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),LD=FD.extend({type:p(`unique`),fields:S(o()).describe(`Fields that must be combined unique`),scope:o().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:v().default(!0)}),RD=FD.extend({type:p(`state_machine`),field:o().describe(`State field (e.g. status)`),transitions:u(o(),S(o())).describe(`Map of { OldState: [AllowedNewStates] }`)}),zD=FD.extend({type:p(`format`),field:o(),regex:o().optional(),format:x([`email`,`url`,`phone`,`json`]).optional()}),BD=FD.extend({type:p(`cross_field`),condition:o().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:S(o()).describe(`Fields involved in the validation`)}),VD=FD.extend({type:p(`json_schema`),field:o().describe(`JSON field to validate`),schema:u(o(),b()).describe(`JSON Schema object definition`)}),HD=FD.extend({type:p(`async`),field:o().describe(`Field to validate`),validatorUrl:o().optional().describe(`External API endpoint for validation`),method:x([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:u(o(),o()).optional().describe(`Custom headers for the request`),validatorFunction:o().optional().describe(`Reference to custom validator function`),timeout:A().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:A().optional().describe(`Debounce delay in milliseconds`),params:u(o(),b()).optional().describe(`Additional parameters to pass to validator`)}),UD=FD.extend({type:p(`custom`),handler:o().describe(`Name of the custom validation function registered in the system`),params:u(o(),b()).optional().describe(`Parameters passed to the custom handler`)}),WD=j(()=>d(`type`,[ID,LD,RD,zD,BD,VD,HD,UD,GD])),GD=FD.extend({type:p(`conditional`),when:o().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:WD.describe(`Validation rule to apply when condition is true`),otherwise:WD.optional().describe(`Validation rule to apply when condition is false`)}),KD=c([o().describe(`Action Name`),l({type:o(),params:u(o(),b()).optional()})]),qD=c([o().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),l({type:o(),params:u(o(),b()).optional()})]),JD=l({target:o().optional().describe(`Target State ID`),cond:qD.optional().describe(`Condition (Guard) required to take this path`),actions:S(KD).optional().describe(`Actions to execute during transition`),description:o().optional().describe(`Human readable description of this rule`)}),Fse=l({type:o().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:u(o(),b()).optional().describe(`Expected event payload structure`)}),YD=j(()=>l({type:x([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:S(KD).optional().describe(`Actions to run when entering this state`),exit:S(KD).optional().describe(`Actions to run when leaving this state`),on:u(o(),c([o(),JD,S(JD)])).optional().describe(`Map of Event Type -> Transition Definition`),always:S(JD).optional(),initial:o().optional().describe(`Initial child state (if compound)`),states:u(o(),YD).optional(),meta:l({label:o().optional(),description:o().optional(),color:o().optional(),aiInstructions:o().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),XD=l({id:OE.describe(`Unique Machine ID`),description:o().optional(),contextSchema:u(o(),b()).optional().describe(`Zod Schema for the machine context/memory`),initial:o().describe(`Initial State ID`),states:u(o(),YD).describe(`State Nodes`),on:u(o(),c([o(),JD,S(JD)])).optional()}),ZD=l({key:o().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:o().optional().describe(`Fallback value when translation key is not found`),params:u(o(),c([o(),A(),v()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}),G=c([o(),ZD]).describe(`Display label: plain string or i18n translation object`),QD=l({ariaLabel:G.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:o().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:o().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`),Ise=l({key:o().describe(`Translation key`),zero:o().optional().describe(`Zero form (e.g., "No items")`),one:o().optional().describe(`Singular form (e.g., "{count} item")`),two:o().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:o().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:o().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:o().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`),$D=l({style:x([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:o().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:o().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:A().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:A().optional().describe(`Maximum number of fraction digits`),useGrouping:v().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),eO=l({dateStyle:x([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:x([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:o().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:v().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`),Lse=l({code:o().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:S(o()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:x([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:$D.optional().describe(`Default number formatting rules`),dateFormat:eO.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`),tO=l({name:o(),label:G,type:JE,required:v().default(!1),options:S(l({label:G,value:o()})).optional()}),nO=x([`script`,`url`,`modal`,`flow`,`api`]),Rse=new Set(nO.options.filter(e=>e!==`script`)),rO=l({name:OE.describe(`Machine name (lowercase snake_case)`),label:G.describe(`Display label`),objectName:o().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:o().optional().describe(`Icon name`),locations:S(x([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:x([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:nO.default(`script`).describe(`Action functionality type`),target:o().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:o().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:S(tO).optional().describe(`Input parameters required from user`),variant:x([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:G.optional().describe(`Confirmation message before execution`),successMessage:G.optional().describe(`Success message to show after execution`),refreshAfter:v().default(!1).describe(`Refresh view after execution`),visible:o().optional().describe(`Formula returning boolean`),disabled:c([v(),o()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:o().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:v().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:A().optional().describe(`Maximum execution time in milliseconds for the action`),aria:QD.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(Rse.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),zse={create:e=>rO.parse(e)},iO=x([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),aO=l({trackHistory:v().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:v().default(!0).describe(`Index records for global search`),apiEnabled:v().default(!0).describe(`Expose object via automatic APIs`),apiMethods:S(iO).optional().describe(`Whitelist of allowed API operations`),files:v().default(!1).describe(`Enable file attachments and document management`),feeds:v().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:v().default(!1).describe(`Enable standard tasks and events tracking`),trash:v().default(!0).describe(`Enable soft-delete with restore capability`),mru:v().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:v().default(!0).describe(`Allow record deep cloning`)}),oO=l({name:o().optional().describe(`Index name (auto-generated if not provided)`),fields:S(o()).describe(`Fields included in the index`),type:x([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:v().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:o().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),sO=l({fields:S(o()).describe(`Fields to index for full-text search weighting`),displayFields:S(o()).optional().describe(`Fields to display in search result cards`),filters:S(o()).optional().describe(`Default filters for search results`)}),cO=l({enabled:v().describe(`Enable multi-tenancy for this object`),strategy:x([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:o().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:v().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),lO=l({enabled:v().describe(`Enable soft delete (trash/recycle bin)`),field:o().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:v().default(!1).describe(`Cascade soft delete to related records`)}),uO=l({enabled:v().describe(`Enable record versioning`),strategy:x([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:A().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:o().default(`version`).describe(`Field name for version number/timestamp`)}),dO=l({enabled:v().describe(`Enable table partitioning`),strategy:x([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:o().describe(`Field name to partition by`),interval:o().optional().describe(`Partition interval for range strategy (e.g., "1 month", "1 year")`)}).refine(e=>!(e.strategy===`range`&&!e.interval),{message:`interval is required when strategy is "range"`}),fO=l({enabled:v().describe(`Enable Change Data Capture`),events:S(x([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:o().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),pO=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:o().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:o().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:o().optional().describe(`Developer documentation / description`),icon:o().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:o().regex(/^[a-z][a-z0-9]*$/).optional().describe(`Logical domain namespace — single lowercase word (e.g. "sys", "crm"). Used for routing, permissions, and auto-deriving tableName as {namespace}_{name}.`),tags:S(o()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:v().optional().default(!0).describe(`Is the object active and usable`),isSystem:v().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:v().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:o().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:o().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:u(o().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),tD).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:S(oO).optional().describe(`Database performance indexes`),tenancy:cO.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:lO.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:uO.optional().describe(`Record versioning and history tracking configuration`),partitioning:dO.optional().describe(`Table partitioning configuration for performance`),cdc:fO.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:S(WD).optional().describe(`Object-level validation rules`),stateMachines:u(o(),XD).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:o().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:l({type:x([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:o().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:A().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:o().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:S(o()).optional().describe(`Primary fields for hover/cards/lookups`),search:sO.optional().describe(`Search engine configuration`),enable:aO.optional().describe(`Enabled system features modules`),recordTypes:S(o()).optional().describe(`Record type names for this object`),sharingModel:x([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:o().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:S(rO).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Bse(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var mO=Object.assign(pO,{create:e=>{let t={...e,label:e.label??Bse(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return pO.parse(t)}}),Vse=x([`own`,`extend`]),hO=l({extend:o().describe(`Target object name (FQN) to extend`),fields:u(o(),tD).optional().describe(`Fields to add/override`),label:o().optional().describe(`Override label for the extended object`),pluralLabel:o().optional().describe(`Override plural label for the extended object`),description:o().optional().describe(`Override description for the extended object`),validations:S(WD).optional().describe(`Additional validation rules to merge into the target object`),indexes:S(oO).optional().describe(`Additional indexes to merge into the target object`),priority:A().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}),gO=x([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]),_O=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:o().optional().describe(`Description of what this hook does`),object:c([o(),S(o())]).describe(`Target object(s)`),events:S(gO).describe(`Lifecycle events`),handler:c([o(),O()]).optional().describe(`Handler function name (string) or inline function reference`),priority:A().default(100).describe(`Execution priority`),async:v().default(!1).describe(`Run specifically as fire-and-forget`),condition:o().optional().describe(`Formula expression; hook runs only when TRUE (e.g., "status = 'closed' AND amount > 1000")`),description:o().optional().describe(`Human-readable description of what this hook does`),retryPolicy:l({maxRetries:A().default(3).describe(`Maximum retry attempts on failure`),backoffMs:A().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:A().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:x([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)}),Hse=l({id:o().optional().describe(`Unique execution ID for tracing`),object:o(),event:gO,input:u(o(),b()).describe(`Mutable input parameters`),result:b().optional().describe(`Operation result (After hooks only)`),previous:u(o(),b()).optional().describe(`Record state before operation`),session:l({userId:o().optional(),tenantId:o().optional(),roles:S(o()).optional(),accessToken:o().optional()}).optional().describe(`Current session context`),transaction:b().optional().describe(`Database transaction handle`),ql:b().describe(`ObjectQL Engine Reference`),api:b().optional().describe(`Cross-object data access (ScopedContext)`),user:l({id:o().optional(),name:o().optional(),email:o().optional()}).optional().describe(`Current user info shortcut`)}),vO=x([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),yO=l({source:c([o(),S(o())]).describe(`Source column header(s)`),target:c([o(),S(o())]).describe(`Target object field(s)`),transform:vO.default(`none`),params:l({value:b().optional(),object:o().optional(),fromField:o().optional(),toField:o().optional(),autoCreate:v().optional(),valueMap:u(o(),b()).optional(),separator:o().optional()}).optional()}),bO=l({name:OE.describe(`Mapping unique name (lowercase snake_case)`),label:o().optional(),sourceFormat:x([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:o().describe(`Target Object Name`),fieldMapping:S(yO),mode:x([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:S(o()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:PD.optional().describe(`Query to run for export only`),errorPolicy:x([`skip`,`abort`,`retry`]).default(`skip`),batchSize:A().default(1e3)}),xO=l({userId:o().optional(),tenantId:o().optional(),roles:S(o()).default([]),permissions:S(o()).default([]),isSystem:v().default(!1),accessToken:o().optional(),transaction:b().optional(),traceId:o().optional()}),SO=c([u(o(),b()),gD]).describe(`Data Engine query filter conditions`),CO=c([u(o(),x([`asc`,`desc`])),u(o(),c([p(1),p(-1)])),S(CD)]).describe(`Sort order definition`),wO=l({context:xO.optional()}),TO=wO.extend({where:c([u(o(),b()),gD]).optional(),fields:S(MD).optional(),orderBy:S(CD).optional(),limit:A().optional(),offset:A().optional(),top:A().optional(),cursor:u(o(),b()).optional(),search:ND.optional(),expand:j(()=>u(o(),PD)).optional(),distinct:v().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`),Use=wO.extend({filter:SO.optional(),select:S(o()).optional(),sort:CO.optional(),limit:A().int().min(1).optional(),skip:A().int().min(0).optional(),top:A().int().min(1).optional(),populate:S(o()).optional()}).describe(`Query options for IDataEngine.find() operations`),EO=wO.extend({returning:v().default(!0).optional()}).describe(`Options for DataEngine.insert operations`),DO=wO.extend({where:c([u(o(),b()),gD]).optional(),upsert:v().default(!1).optional(),multi:v().default(!1).optional(),returning:v().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`),Wse=wO.extend({filter:SO.optional(),upsert:v().default(!1).optional(),multi:v().default(!1).optional(),returning:v().default(!1).optional()}).describe(`Options for DataEngine.update operations`),OO=wO.extend({where:c([u(o(),b()),gD]).optional(),multi:v().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`),Gse=wO.extend({filter:SO.optional(),multi:v().default(!1).optional()}).describe(`Options for DataEngine.delete operations`),kO=wO.extend({where:c([u(o(),b()),gD]).optional(),groupBy:S(o()).optional(),aggregations:S(TD).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`),AO=wO.extend({filter:SO.optional(),groupBy:S(o()).optional(),aggregations:S(l({field:o(),method:x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:o().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`),jO=wO.extend({where:c([u(o(),b()),gD]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`),MO=wO.extend({filter:SO.optional()}).describe(`Options for DataEngine.count operations`),NO=l({find:O().input(a([o(),TO.optional()])).output(k(S(b()))),findOne:O().input(a([o(),TO.optional()])).output(k(b())),insert:O().input(a([o(),c([u(o(),b()),S(u(o(),b()))]),EO.optional()])).output(k(b())),update:O().input(a([o(),u(o(),b()),DO.optional()])).output(k(b())),delete:O().input(a([o(),OO.optional()])).output(k(b())),count:O().input(a([o(),jO.optional()])).output(k(A())),aggregate:O().input(a([o(),kO])).output(k(S(b())))}).describe(`Standard Data Engine Contract`),PO={filter:SO.optional()},FO=TO.extend({...PO,select:S(o()).optional(),sort:CO.optional(),skip:A().int().min(0).optional(),populate:S(o()).optional()}),IO=l({method:p(`find`),object:o(),query:FO.optional()}),LO=l({method:p(`findOne`),object:o(),query:FO.optional()}),RO=l({method:p(`insert`),object:o(),data:c([u(o(),b()),S(u(o(),b()))]),options:EO.optional()}),zO=l({method:p(`update`),object:o(),data:u(o(),b()),id:c([o(),A()]).optional().describe(`ID for single update, or use where in options`),options:DO.extend(PO).optional()}),BO=l({method:p(`delete`),object:o(),id:c([o(),A()]).optional().describe(`ID for single delete, or use where in options`),options:OO.extend(PO).optional()}),VO=l({method:p(`count`),object:o(),query:jO.extend(PO).optional()}),HO=l({method:p(`aggregate`),object:o(),query:kO.extend(PO)}),UO=l({method:p(`execute`),command:b(),options:u(o(),b()).optional()}),WO=l({method:p(`vectorFind`),object:o(),vector:S(A()),where:c([u(o(),b()),gD]).optional(),fields:S(o()).optional(),limit:A().int().default(5).optional(),threshold:A().optional()}),GO=l({method:p(`batch`),requests:S(d(`method`,[IO,LO,RO,zO,BO,VO,HO,UO,WO])),transaction:v().default(!0).optional()}),KO=d(`method`,[IO,LO,RO,zO,BO,VO,HO,GO,UO,WO]).describe(`Virtual ObjectQL Request Protocol`),qO=l({transaction:b().optional().describe(`Transaction handle`),timeout:A().optional().describe(`Timeout in ms`),skipCache:v().optional().describe(`Bypass cache`),traceContext:u(o(),o()).optional().describe(`OpenTelemetry context or request ID`),tenantId:o().optional().describe(`Tenant Isolation identifier`)}),JO=l({create:v().default(!0).describe(`Supports CREATE operations`),read:v().default(!0).describe(`Supports READ operations`),update:v().default(!0).describe(`Supports UPDATE operations`),delete:v().default(!0).describe(`Supports DELETE operations`),bulkCreate:v().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:v().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:v().default(!1).describe(`Supports bulk DELETE operations`),transactions:v().default(!1).describe(`Supports ACID transactions`),savepoints:v().default(!1).describe(`Supports transaction savepoints`),isolationLevels:S(BE).optional().describe(`Supported isolation levels`),queryFilters:v().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:v().default(!1).describe(`Supports GROUP BY and aggregation functions`),querySorting:v().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:v().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:v().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:v().default(!1).describe(`Supports subqueries`),queryCTE:v().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:v().default(!1).describe(`Supports SQL joins`),fullTextSearch:v().default(!1).describe(`Supports full-text search`),jsonQuery:v().default(!1).describe(`Supports JSON field querying`),geospatialQuery:v().default(!1).describe(`Supports geospatial queries`),streaming:v().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:v().default(!1).describe(`Supports JSON field types`),arrayFields:v().default(!1).describe(`Supports array field types`),vectorSearch:v().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:v().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:v().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:v().default(!1).describe(`Supports database migrations`),indexes:v().default(!1).describe(`Supports index creation and management`),connectionPooling:v().default(!1).describe(`Supports connection pooling`),preparedStatements:v().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:v().default(!1).describe(`Supports query result caching`)}),YO=l({name:o().describe(`Driver unique name`),version:o().describe(`Driver version`),supports:JO,connect:O().input(a([])).output(k(g())).describe(`Establish connection`),disconnect:O().input(a([])).output(k(g())).describe(`Close connection`),checkHealth:O().input(a([])).output(k(v())).describe(`Health check`),getPoolStats:O().input(a([])).output(l({total:A(),idle:A(),active:A(),waiting:A()}).optional()).optional().describe(`Get connection pool statistics`),execute:O().input(a([b(),S(b()).optional(),qO.optional()])).output(k(b())).describe(`Execute raw command`),find:O().input(a([o(),PD,qO.optional()])).output(k(S(u(o(),b())))).describe(`Find records`),findStream:O().input(a([o(),PD,qO.optional()])).output(b()).describe(`Stream records (AsyncIterable)`),findOne:O().input(a([o(),PD,qO.optional()])).output(k(u(o(),b()).nullable())).describe(`Find one record`),create:O().input(a([o(),u(o(),b()),qO.optional()])).output(k(u(o(),b()))).describe(`Create record`),update:O().input(a([o(),o().or(A()),u(o(),b()),qO.optional()])).output(k(u(o(),b()))).describe(`Update record`),upsert:O().input(a([o(),u(o(),b()),S(o()).optional(),qO.optional()])).output(k(u(o(),b()))).describe(`Upsert record`),delete:O().input(a([o(),o().or(A()),qO.optional()])).output(k(v())).describe(`Delete record`),count:O().input(a([o(),PD.optional(),qO.optional()])).output(k(A())).describe(`Count records`),bulkCreate:O().input(a([o(),S(u(o(),b())),qO.optional()])).output(k(S(u(o(),b())))),bulkUpdate:O().input(a([o(),S(l({id:o().or(A()),data:u(o(),b())})),qO.optional()])).output(k(S(u(o(),b())))),bulkDelete:O().input(a([o(),S(o().or(A())),qO.optional()])).output(k(g())),updateMany:O().input(a([o(),PD,u(o(),b()),qO.optional()])).output(k(A())).optional(),deleteMany:O().input(a([o(),PD,qO.optional()])).output(k(A())).optional(),beginTransaction:O().input(a([l({isolationLevel:BE.optional()}).optional()])).output(k(b())).describe(`Start transaction`),commit:O().input(a([b()])).output(k(g())).describe(`Commit transaction`),rollback:O().input(a([b()])).output(k(g())).describe(`Rollback transaction`),syncSchema:O().input(a([o(),b(),qO.optional()])).output(k(g())).describe(`Sync object schema to DB`),syncSchemasBatch:O().input(a([S(l({object:o(),schema:b()})),qO.optional()])).output(k(g())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:O().input(a([o(),qO.optional()])).output(k(g())),explain:O().input(a([o(),PD,qO.optional()])).output(k(b())).optional()}),XO=l({min:A().min(0).default(2).describe(`Minimum number of connections in pool`),max:A().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:A().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:A().min(0).default(5e3).describe(`Time in ms to wait for available connection`)}),ZO=l({name:o().describe(`Driver instance name`),type:x([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:JO.describe(`Driver capability flags`),connectionString:o().optional().describe(`Database connection string (driver-specific format)`),poolConfig:XO.optional().describe(`Connection pool configuration`)}),QO=x([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`]),$O=l({text:o().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:o().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:o().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:o().describe(`SQL type for date fields (e.g., DATE)`),datetime:o().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:o().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:o().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:o().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)}),ek=l({rejectUnauthorized:v().default(!0).describe(`Reject connections with invalid certificates`),ca:o().optional().describe(`CA certificate file path or content`),cert:o().optional().describe(`Client certificate file path or content`),key:o().optional().describe(`Client private key file path or content`)}).refine(e=>e.cert!==void 0==(e.key!==void 0),{message:`Client certificate (cert) and private key (key) must be provided together`}),tk=ZO.extend({type:p(`sql`).describe(`Driver type must be "sql"`),dialect:QO.describe(`SQL database dialect`),dataTypeMapping:$O.describe(`SQL data type mapping configuration`),ssl:v().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:ek.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}),nk={text:`TEXT`,number:`REAL`,boolean:`INTEGER`,date:`TEXT`,datetime:`TEXT`,json:`TEXT`,uuid:`TEXT`,binary:`BLOB`},rk={supportsAddColumn:!0,supportsRenameColumn:!0,supportsDropColumn:!0,supportsModifyColumn:!1,supportsAddConstraint:!1,rebuildStrategy:`create_copy_drop_rename`},ik=x([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]),ak=x([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]),ok=x([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`]),sk=x([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`]),ck=l({enabled:v().default(!1).describe(`Enable sharding`),shardKey:o().optional().describe(`Field to use as shard key`),shardingStrategy:x([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:A().int().positive().optional().describe(`Number of shards`)}),lk=l({enabled:v().default(!1).describe(`Enable replication`),replicaSetName:o().optional().describe(`Replica set name`),replicas:A().int().positive().optional().describe(`Number of replicas`),readPreference:x([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:x([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)}),uk=l({enabled:v().default(!1).describe(`Enable schema validation`),validationLevel:x([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:x([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:u(o(),b()).optional().describe(`JSON Schema for validation`)}),dk=l({text:o().describe(`NoSQL type for text fields`),number:o().describe(`NoSQL type for number fields`),boolean:o().describe(`NoSQL type for boolean fields`),date:o().describe(`NoSQL type for date fields`),datetime:o().describe(`NoSQL type for datetime fields`),json:o().optional().describe(`NoSQL type for JSON/object fields`),uuid:o().optional().describe(`NoSQL type for UUID fields`),binary:o().optional().describe(`NoSQL type for binary fields`),array:o().optional().describe(`NoSQL type for array fields`),objectId:o().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:o().optional().describe(`NoSQL type for geospatial point fields`)}),fk=ZO.extend({type:p(`nosql`).describe(`Driver type must be "nosql"`),databaseType:ik.describe(`Specific NoSQL database type`),dataTypeMapping:dk.describe(`NoSQL data type mapping configuration`),consistency:ok.optional().describe(`Consistency level for operations`),replication:lk.optional().describe(`Replication configuration`),sharding:ck.optional().describe(`Sharding configuration`),schemaValidation:uk.optional().describe(`Document schema validation`),region:o().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:o().optional().describe(`AWS access key ID`),secretAccessKey:o().optional().describe(`AWS secret access key`),ttlField:o().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:A().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:o().optional().describe(`Prefix for collection/table names`)}),pk=l({consistency:ok.optional().describe(`Consistency level override`),readFromSecondary:v().optional().describe(`Allow reading from secondary replicas`),projection:u(o(),c([p(0),p(1)])).optional().describe(`Field projection`),timeout:A().int().positive().optional().describe(`Query timeout (ms)`),useCursor:v().optional().describe(`Use cursor instead of loading all results`),batchSize:A().int().positive().optional().describe(`Cursor batch size`),profile:v().optional().describe(`Enable query profiling`),hint:o().optional().describe(`Index hint for query optimization`)}),mk=l({operator:o().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:u(o(),b()).describe(`Stage-specific options`)}),hk=l({collection:o().describe(`Collection/table name`),stages:S(mk).describe(`Aggregation pipeline stages`),options:pk.optional().describe(`Query options`)}),gk=l({name:o().describe(`Index name`),type:sk.describe(`Index type`),fields:S(l({field:o().describe(`Field name`),order:x([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:v().default(!1).describe(`Enforce uniqueness`),sparse:v().default(!1).describe(`Sparse index`),expireAfterSeconds:A().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:u(o(),b()).optional().describe(`Partial index filter`),background:v().default(!1).describe(`Create index in background`)}),_k=l({readConcern:x([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:x([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:x([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:A().int().positive().optional().describe(`Transaction commit timeout (ms)`)}),vk=x([`insert`,`update`,`upsert`,`replace`,`ignore`]),yk=l({object:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:o().default(`name`).describe(`Field match for uniqueness check`),mode:vk.default(`upsert`).describe(`Conflict resolution strategy`),env:S(x([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:S(u(o(),b())).describe(`Data records`)}),bk=l({field:o().describe(`Source field name containing the reference value`),targetObject:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:o().default(`name`).describe(`Field on target object used for matching`),fieldType:x([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`),xk=l({object:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:S(o()).describe(`Objects this object depends on`),references:S(bk).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`),Sk=l({nodes:S(xk).describe(`All objects in the dependency graph`),insertOrder:S(o()).describe(`Topologically sorted insert order`),circularDependencies:S(S(o())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`),Ck=l({sourceObject:o().describe(`Object with the broken reference`),field:o().describe(`Field name with unresolved reference`),targetObject:o().describe(`Target object searched for the reference`),targetField:o().describe(`ExternalId field used for matching`),attemptedValue:b().describe(`Value that failed to resolve`),recordIndex:A().int().min(0).describe(`Index of the record in the dataset`),message:o().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`),wk=l({dryRun:v().default(!1).describe(`Validate references without writing data`),haltOnError:v().default(!1).describe(`Stop on first reference resolution error`),multiPass:v().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:vk.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:A().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:v().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:x([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`)}).describe(`Seed data loader configuration`),Tk=l({object:o().describe(`Object that was loaded`),mode:vk.describe(`Import mode used`),inserted:A().int().min(0).describe(`Records inserted`),updated:A().int().min(0).describe(`Records updated`),skipped:A().int().min(0).describe(`Records skipped`),errored:A().int().min(0).describe(`Records with errors`),total:A().int().min(0).describe(`Total records in dataset`),referencesResolved:A().int().min(0).describe(`References resolved via externalId`),referencesDeferred:A().int().min(0).describe(`References deferred to second pass`),errors:S(Ck).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`),Ek=l({success:v().describe(`Overall success status`),dryRun:v().describe(`Whether this was a dry-run`),dependencyGraph:Sk.describe(`Object dependency graph`),results:S(Tk).describe(`Per-object load results`),errors:S(Ck).describe(`All reference resolution errors`),summary:l({objectsProcessed:A().int().min(0).describe(`Total objects processed`),totalRecords:A().int().min(0).describe(`Total records across all objects`),totalInserted:A().int().min(0).describe(`Total records inserted`),totalUpdated:A().int().min(0).describe(`Total records updated`),totalSkipped:A().int().min(0).describe(`Total records skipped`),totalErrored:A().int().min(0).describe(`Total records with errors`),totalReferencesResolved:A().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:A().int().min(0).describe(`Total references deferred`),circularDependencyCount:A().int().min(0).describe(`Circular dependency chains detected`),durationMs:A().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`),Dk=l({datasets:S(yk).min(1).describe(`Datasets to load`),config:i(e=>e??{},wk).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`),Ok=l({versionNumber:A().describe(`Version number`),createdAt:A().describe(`Creation timestamp`),createdBy:o().describe(`Creator user ID`),size:A().describe(`File size in bytes`),checksum:o().describe(`File checksum`),downloadUrl:o().url().describe(`Download URL`),isLatest:v().optional().default(!1).describe(`Is latest version`)}),kk=l({id:o().describe(`Template ID`),name:o().describe(`Template name`),description:o().optional().describe(`Template description`),fileUrl:o().url().describe(`Template file URL`),fileType:o().describe(`File MIME type`),placeholders:S(l({key:o().describe(`Placeholder key`),label:o().describe(`Placeholder label`),type:x([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:v().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)}),Ak=l({provider:x([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:v().optional().default(!1).describe(`E-signature enabled`),signers:S(l({email:o().email().describe(`Signer email`),name:o().describe(`Signer name`),role:o().describe(`Signer role`),order:A().describe(`Signing order`)})).describe(`Document signers`),expirationDays:A().optional().default(30).describe(`Expiration days`),reminderDays:A().optional().default(7).describe(`Reminder interval days`)}),jk=l({id:o().describe(`Document ID`),name:o().describe(`Document name`),description:o().optional().describe(`Document description`),fileType:o().describe(`File MIME type`),fileSize:A().describe(`File size in bytes`),category:o().optional().describe(`Document category`),tags:S(o()).optional().describe(`Document tags`),versioning:l({enabled:v().describe(`Versioning enabled`),versions:S(Ok).describe(`Version history`),majorVersion:A().describe(`Major version`),minorVersion:A().describe(`Minor version`)}).optional().describe(`Version control`),template:kk.optional().describe(`Document template`),eSignature:Ak.optional().describe(`E-signature config`),access:l({isPublic:v().optional().default(!1).describe(`Public access`),sharedWith:S(o()).optional().describe(`Shared with`),expiresAt:A().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:u(o(),b()).optional().describe(`Custom metadata`)}),Mk=l({id:o().describe(`Data source ID`),name:o().describe(`Data source name`),type:x([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:o().url().describe(`API endpoint URL`),authentication:l({type:x([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:u(o(),b()).describe(`Auth configuration`)}).describe(`Authentication`)}),Nk=jE.extend({type:o().optional().describe(`Field type`),readonly:v().optional().default(!0).describe(`Read-only field`)}),Pk=l({fieldName:o().describe(`Field name`),dataSource:Mk.describe(`External data source`),query:l({endpoint:o().describe(`Query endpoint path`),method:x([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:u(o(),b()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:S(Nk).describe(`Field mappings`),caching:l({enabled:v().optional().default(!0).describe(`Cache enabled`),ttl:A().optional().default(300).describe(`Cache TTL (seconds)`),strategy:x([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:l({enabled:v().optional().default(!0).describe(`Fallback enabled`),defaultValue:b().optional().describe(`Default fallback value`),showError:v().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:l({requestsPerSecond:A().describe(`Requests per second limit`),burstSize:A().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:l({maxRetries:A().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:A().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:A().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:A().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:S(A()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:l({request:l({headers:u(o(),o()).optional().describe(`Additional request headers`),queryParams:u(o(),o()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:l({dataPath:o().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:o().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:l({type:x([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:A().default(100).describe(`Items per page`),maxPages:A().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}),Fk=o().describe(`Underlying driver identifier`),Ik=l({id:o().describe(`Unique driver identifier (e.g. "postgres")`),label:o().describe(`Display label (e.g. "PostgreSQL")`),description:o().optional(),icon:o().optional(),configSchema:u(o(),b()).describe(`JSON Schema for connection configuration`),capabilities:j(()=>Lk).optional()}),Lk=l({transactions:v().default(!1),queryFilters:v().default(!1),queryAggregations:v().default(!1),querySorting:v().default(!1),queryPagination:v().default(!1),queryWindowFunctions:v().default(!1),querySubqueries:v().default(!1),joins:v().default(!1),fullTextSearch:v().default(!1),readOnly:v().default(!1),dynamicSchema:v().default(!1)}),Rk=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:o().optional().describe(`Display label`),driver:Fk.describe(`Underlying driver type`),config:u(o(),b()).describe(`Driver specific configuration`),pool:l({min:A().default(0).describe(`Minimum connections`),max:A().default(10).describe(`Maximum connections`),idleTimeoutMillis:A().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:A().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:S(u(o(),b())).optional().describe(`Read-only replica configurations`),capabilities:Lk.optional().describe(`Capability overrides`),healthCheck:l({enabled:v().default(!0).describe(`Enable health check endpoint`),intervalMs:A().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:A().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:l({enabled:v().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:v().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:o().optional().describe(`CA certificate (PEM format or path to file)`),cert:o().optional().describe(`Client certificate (PEM format or path to file)`),key:o().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:l({maxRetries:A().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:A().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:A().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:A().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:o().optional().describe(`Internal description`),active:v().default(!0).describe(`Is datasource enabled`)}),zk=x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),Bk=x([`string`,`number`,`boolean`,`time`,`geo`]),Vk=x([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),Hk=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:o().describe(`Human readable label`),description:o().optional(),type:zk,sql:o().describe(`SQL expression or field reference`),filters:S(l({sql:o()})).optional(),format:o().optional()}),Uk=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:o().describe(`Human readable label`),description:o().optional(),type:Bk,sql:o().describe(`SQL expression or column reference`),granularities:S(Vk).optional()}),Wk=l({name:o().describe(`Target cube name`),relationship:x([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:o().describe(`Join condition (ON clause)`)}),Gk=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:o().optional(),description:o().optional(),sql:o().describe(`Base SQL statement or Table Name`),measures:u(o(),Hk).describe(`Quantitative metrics`),dimensions:u(o(),Uk).describe(`Qualitative attributes`),joins:u(o(),Wk).optional(),refreshKey:l({every:o().optional(),sql:o().optional()}).optional(),public:v().default(!1)}),Kk=l({cube:o().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:S(o()).describe(`List of metrics to calculate`),dimensions:S(o()).optional().describe(`List of dimensions to group by`),filters:S(l({member:o().describe(`Dimension or Measure`),operator:x([`equals`,`notEquals`,`contains`,`notContains`,`gt`,`gte`,`lt`,`lte`,`set`,`notSet`,`inDateRange`]),values:S(o()).optional()})).optional(),timeDimensions:S(l({dimension:o(),granularity:Vk.optional(),dateRange:c([o(),S(o())]).optional()})).optional(),order:u(o(),x([`asc`,`desc`])).optional(),limit:A().optional(),offset:A().optional(),timezone:o().optional().default(`UTC`)}),qk=x([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Jk=l({type:x([`user`,`team`,`record`]).describe(`Mention target type`),id:o().describe(`Target ID`),name:o().describe(`Display name for rendering`),offset:A().int().min(0).describe(`Character offset in body text`),length:A().int().min(1).describe(`Length of mention token in body text`)}),Yk=l({field:o().describe(`Field machine name`),fieldLabel:o().optional().describe(`Field display label`),oldValue:b().optional().describe(`Previous value`),newValue:b().optional().describe(`New value`),oldDisplayValue:o().optional().describe(`Human-readable old value`),newDisplayValue:o().optional().describe(`Human-readable new value`)}),Xk=l({emoji:o().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:S(o()).describe(`Users who reacted`),count:A().int().min(1).describe(`Total reaction count`)}),Zk=l({type:x([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:o().describe(`Actor ID`),name:o().optional().describe(`Actor display name`),avatarUrl:o().url().optional().describe(`Actor avatar URL`),source:o().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),Qk=x([`public`,`internal`,`private`]),$k=l({id:o().describe(`Feed item ID`),type:qk.describe(`Activity type`),object:o().describe(`Object name (e.g., "account")`),recordId:o().describe(`Record ID this feed item belongs to`),actor:Zk.describe(`Who performed this action`),body:o().optional().describe(`Rich text body (Markdown supported)`),mentions:S(Jk).optional().describe(`Mentioned users/teams/records`),changes:S(Yk).optional().describe(`Field-level changes`),reactions:S(Xk).optional().describe(`Emoji reactions on this item`),parentId:o().optional().describe(`Parent feed item ID for threaded replies`),replyCount:A().int().min(0).default(0).describe(`Number of replies`),pinned:v().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:o().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:o().optional().describe(`User ID who pinned the item`),starred:v().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:o().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Qk.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:o().datetime().describe(`Creation timestamp`),updatedAt:o().datetime().optional().describe(`Last update timestamp`),editedAt:o().datetime().optional().describe(`When comment was last edited`),isEdited:v().default(!1).describe(`Whether comment has been edited`)}),eA=x([`all`,`comments_only`,`changes_only`,`tasks_only`]),tA=x([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),nA=x([`in_app`,`email`,`push`,`slack`]),rA=l({object:o().describe(`Object name`),recordId:o().describe(`Record ID`),userId:o().describe(`Subscribing user ID`),events:S(tA).default([`all`]).describe(`Event types to receive notifications for`),channels:S(nA).default([`in_app`]).describe(`Notification delivery channels`),active:v().default(!0).describe(`Whether the subscription is active`),createdAt:o().datetime().describe(`Subscription creation timestamp`)}),iA=x([`header`,`subdomain`,`path`,`token`,`lookup`]).describe(`Strategy for resolving tenant identity from request context`),aA=l({name:o().min(1).describe(`Turso database group name`),primaryLocation:o().min(2).describe(`Primary Turso region code (e.g., iad, lhr, nrt)`),replicaLocations:S(o().min(2)).default([]).describe(`Additional replica region codes`),schemaDatabase:o().optional().describe(`Schema database name for multi-db schemas`)}).describe(`Turso database group configuration`),oA=l({onTenantCreate:l({autoCreate:v().default(!0).describe(`Auto-create database on tenant registration`),group:o().optional().describe(`Turso group for the new database`),applyGroupSchema:v().default(!0).describe(`Apply shared schema from group`),seedData:v().default(!1).describe(`Populate seed data on creation`)}).describe(`Tenant creation hook`),onTenantDelete:l({immediate:v().default(!1).describe(`Destroy database immediately`),gracePeriodHours:A().int().min(0).default(72).describe(`Grace period before permanent deletion`),createBackup:v().default(!0).describe(`Create backup before deletion`)}).describe(`Tenant deletion hook`),onTenantSuspend:l({revokeTokens:v().default(!0).describe(`Revoke auth tokens on suspension`),readOnly:v().default(!0).describe(`Set database to read-only on suspension`)}).describe(`Tenant suspension hook`)}).describe(`Tenant database lifecycle hooks`),sA=l({organizationSlug:o().min(1).describe(`Turso organization slug`),urlTemplate:o().min(1).describe(`URL template with {tenant_id} placeholder`),groupAuthToken:o().min(1).describe(`Group-level auth token for platform operations`),tenantResolverStrategy:iA.default(`token`),group:aA.optional().describe(`Database group configuration`),lifecycle:oA.optional().describe(`Lifecycle hooks`),maxCachedConnections:A().int().min(1).default(100).describe(`Max cached tenant connections (LRU)`),connectionCacheTTL:A().int().min(0).default(300).describe(`Connection cache TTL in seconds`)}).describe(`Turso multi-tenant router configuration`);EE({},{AuditPolicySchema:()=>jA,CriteriaSharingRuleSchema:()=>wA,FieldPermissionSchema:()=>_A,NetworkPolicySchema:()=>kA,OWDModel:()=>yA,ObjectPermissionSchema:()=>gA,OwnerSharingRuleSchema:()=>TA,PasswordPolicySchema:()=>OA,PermissionSetSchema:()=>vA,PolicySchema:()=>MA,RLS:()=>hA,RLSAuditConfigSchema:()=>dA,RLSAuditEventSchema:()=>uA,RLSConfigSchema:()=>fA,RLSEvaluationResultSchema:()=>mA,RLSOperation:()=>cA,RLSUserContextSchema:()=>pA,RowLevelSecurityPolicySchema:()=>lA,SessionPolicySchema:()=>AA,ShareRecipientType:()=>SA,SharingLevel:()=>xA,SharingRuleSchema:()=>EA,SharingRuleType:()=>bA,TerritoryModelSchema:()=>Kse,TerritorySchema:()=>qse,TerritoryType:()=>DA});var cA=x([`select`,`insert`,`update`,`delete`,`all`]),lA=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy unique identifier (snake_case)`),label:o().optional().describe(`Human-readable policy label`),description:o().optional().describe(`Policy description and business justification`),object:o().describe(`Target object name`),operation:cA.describe(`Database operation this policy applies to`),using:o().optional().describe(`Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.`),check:o().optional().describe(`Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)`),roles:S(o()).optional().describe(`Roles this policy applies to (omit for all roles)`),enabled:v().default(!0).describe(`Whether this policy is active`),priority:A().int().default(0).describe(`Policy evaluation priority (higher = evaluated first)`),tags:S(o()).optional().describe(`Policy categorization tags`)}).superRefine((e,t)=>{!e.using&&!e.check&&t.addIssue({code:le.custom,message:`At least one of "using" or "check" must be specified. For SELECT/UPDATE/DELETE operations, provide "using". For INSERT operations, provide "check".`})}),uA=l({timestamp:o().describe(`ISO 8601 timestamp of the evaluation`),userId:o().describe(`User ID whose access was evaluated`),operation:x([`select`,`insert`,`update`,`delete`]).describe(`Database operation being performed`),object:o().describe(`Target object name`),policyName:o().describe(`Name of the RLS policy evaluated`),granted:v().describe(`Whether access was granted`),evaluationDurationMs:A().describe(`Policy evaluation duration in milliseconds`),matchedCondition:o().optional().describe(`Which USING/CHECK clause matched`),rowCount:A().optional().describe(`Number of rows affected`),metadata:u(o(),b()).optional().describe(`Additional audit event metadata`)}),dA=l({enabled:v().describe(`Enable RLS audit logging`),logLevel:x([`all`,`denied_only`,`granted_only`,`none`]).describe(`Which evaluations to log`),destination:x([`system_log`,`audit_trail`,`external`]).describe(`Audit log destination`),sampleRate:A().min(0).max(1).describe(`Sampling rate (0-1) for high-traffic environments`),retentionDays:A().int().default(90).describe(`Audit log retention period in days`),includeRowData:v().default(!1).describe(`Include row data in audit logs (security-sensitive)`),alertOnDenied:v().default(!0).describe(`Send alerts when access is denied`)}),fA=l({enabled:v().default(!0).describe(`Enable RLS enforcement globally`),defaultPolicy:x([`deny`,`allow`]).default(`deny`).describe(`Default action when no policies match`),allowSuperuserBypass:v().default(!0).describe(`Allow superusers to bypass RLS`),bypassRoles:S(o()).optional().describe(`Roles that bypass RLS (see all data)`),logEvaluations:v().default(!1).describe(`Log RLS policy evaluations for debugging`),cacheResults:v().default(!0).describe(`Cache RLS evaluation results`),cacheTtlSeconds:A().int().positive().default(300).describe(`Cache TTL in seconds`),prefetchUserContext:v().default(!0).describe(`Pre-fetch user context for performance`),audit:dA.optional().describe(`RLS audit logging configuration`)}),pA=l({id:o().describe(`User ID`),email:o().email().optional().describe(`User email`),tenantId:o().optional().describe(`Tenant/Organization ID`),role:c([o(),S(o())]).optional().describe(`User role(s)`),department:o().optional().describe(`User department`),attributes:u(o(),b()).optional().describe(`Additional custom user attributes`)}),mA=l({policyName:o().describe(`Policy name`),granted:v().describe(`Whether access was granted`),durationMs:A().optional().describe(`Evaluation duration in milliseconds`),error:o().optional().describe(`Error message if evaluation failed`),usingResult:v().optional().describe(`USING clause evaluation result`),checkResult:v().optional().describe(`CHECK clause evaluation result`)}),hA={ownerPolicy:(e,t=`owner_id`)=>({name:`${e}_owner_access`,label:`Owner Access for ${e}`,object:e,operation:`all`,using:`${t} = current_user.id`,enabled:!0,priority:0}),tenantPolicy:(e,t=`tenant_id`)=>({name:`${e}_tenant_isolation`,label:`Tenant Isolation for ${e}`,object:e,operation:`all`,using:`${t} = current_user.tenant_id`,check:`${t} = current_user.tenant_id`,enabled:!0,priority:0}),rolePolicy:(e,t,n)=>({name:`${e}_${t.join(`_`)}_access`,label:`${t.join(`, `)} Access for ${e}`,object:e,operation:`select`,using:n,roles:t,enabled:!0,priority:0}),allowAllPolicy:(e,t)=>({name:`${e}_${t.join(`_`)}_full_access`,label:`Full Access for ${t.join(`, `)}`,object:e,operation:`all`,using:`1 = 1`,roles:t,enabled:!0,priority:0})},gA=l({allowCreate:v().default(!1).describe(`Create permission`),allowRead:v().default(!1).describe(`Read permission`),allowEdit:v().default(!1).describe(`Edit permission`),allowDelete:v().default(!1).describe(`Delete permission`),allowTransfer:v().default(!1).describe(`Change record ownership`),allowRestore:v().default(!1).describe(`Restore from trash (Undelete)`),allowPurge:v().default(!1).describe(`Permanently delete (Hard Delete/GDPR)`),viewAllRecords:v().default(!1).describe(`View All Data (Bypass Sharing)`),modifyAllRecords:v().default(!1).describe(`Modify All Data (Bypass Sharing)`)}),_A=l({readable:v().default(!0).describe(`Field read access`),editable:v().default(!1).describe(`Field edit access`)}),vA=l({name:OE.describe(`Permission set unique name (lowercase snake_case)`),label:o().optional().describe(`Display label`),isProfile:v().default(!1).describe(`Whether this is a user profile`),objects:u(o(),gA).describe(`Entity permissions`),fields:u(o(),_A).optional().describe(`Field level security`),systemPermissions:S(o()).optional().describe(`System level capabilities`),tabPermissions:u(o(),x([`visible`,`hidden`,`default_on`,`default_off`])).optional().describe(`App/tab visibility: visible, hidden, default_on (shown by default), default_off (available but hidden initially)`),rowLevelSecurity:S(lA).optional().describe(`Row-level security policies (see rls.zod.ts for full spec)`),contextVariables:u(o(),b()).optional().describe(`Context variables for RLS evaluation`)}),yA=x([`private`,`public_read`,`public_read_write`,`controlled_by_parent`]),bA=x([`owner`,`criteria`]),xA=x([`read`,`edit`,`full`]),SA=x([`user`,`group`,`role`,`role_and_subordinates`,`guest`]),CA=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:o().optional().describe(`Human-readable label`),description:o().optional().describe(`Administrative notes`),object:o().describe(`Target Object Name`),active:v().default(!0),accessLevel:xA.default(`read`),sharedWith:l({type:SA,value:o().describe(`ID or Code of the User/Group/Role`)}).describe(`The recipient of the shared access`)}),wA=CA.extend({type:p(`criteria`),condition:o().describe(`Formula condition (e.g. "department = 'Sales'")`)}),TA=CA.extend({type:p(`owner`),ownedBy:l({type:SA,value:o()}).describe(`Source group/role whose records are being shared`)}),EA=d(`type`,[wA,TA]),DA=x([`geography`,`industry`,`named_account`,`product_line`]),Kse=l({name:o().describe(`Model Name (e.g. FY24 Planning)`),state:x([`planning`,`active`,`archived`]).default(`planning`),startDate:o().optional(),endDate:o().optional()}),qse=l({name:OE.describe(`Territory unique name (lowercase snake_case)`),label:o().describe(`Territory Label (e.g. "West Coast")`),modelId:o().describe(`Belongs to which Territory Model`),parent:o().optional().describe(`Parent Territory`),type:DA.default(`geography`),assignmentRule:o().optional().describe(`Criteria based assignment rule`),assignedUsers:S(o()).optional(),accountAccess:x([`read`,`edit`]).default(`read`),opportunityAccess:x([`read`,`edit`]).default(`read`),caseAccess:x([`read`,`edit`]).default(`read`)}),OA=l({minLength:A().default(8),requireUppercase:v().default(!0),requireLowercase:v().default(!0),requireNumbers:v().default(!0),requireSymbols:v().default(!1),expirationDays:A().optional().describe(`Force password change every X days`),historyCount:A().default(3).describe(`Prevent reusing last X passwords`)}),kA=l({trustedRanges:S(o()).describe(`CIDR ranges allowed to access (e.g. 10.0.0.0/8)`),blockUnknown:v().default(!1).describe(`Block all IPs not in trusted ranges`),vpnRequired:v().default(!1)}),AA=l({idleTimeout:A().default(30).describe(`Minutes before idle session logout`),absoluteTimeout:A().default(480).describe(`Max session duration (minutes)`),forceMfa:v().default(!1).describe(`Require 2FA for all users`)}),jA=l({logRetentionDays:A().default(180),sensitiveFields:S(o()).describe(`Fields to redact in logs (e.g. password, ssn)`),captureRead:v().default(!1).describe(`Log read access (High volume!)`)}),MA=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy Name`),password:OA.optional(),network:kA.optional(),session:AA.optional(),audit:jA.optional(),isDefault:v().default(!1).describe(`Apply to all users by default`),assignedProfiles:S(o()).optional().describe(`Apply to specific profiles`)});EE({},{AIChatWindowProps:()=>vM,Action:()=>zse,ActionNavItemSchema:()=>QA,ActionParamSchema:()=>tO,ActionSchema:()=>rO,ActionType:()=>nO,AddRecordConfigSchema:()=>xj,AnimationSchema:()=>HM,AnimationTriggerSchema:()=>rN,App:()=>Jse,AppBrandingSchema:()=>tj,AppSchema:()=>rj,AppearanceConfigSchema:()=>yj,AriaPropsSchema:()=>QD,BlankPageLayoutItemSchema:()=>Zj,BlankPageLayoutSchema:()=>Qj,BorderRadiusSchema:()=>zM,BreakpointColumnMapSchema:()=>BA,BreakpointName:()=>zA,BreakpointOrderMapSchema:()=>VA,BreakpointsSchema:()=>VM,CalendarConfigSchema:()=>Cj,ChartAnnotationSchema:()=>IA,ChartAxisSchema:()=>PA,ChartConfigSchema:()=>RA,ChartInteractionSchema:()=>LA,ChartSeriesSchema:()=>FA,ChartTypeSchema:()=>NA,ColorPaletteSchema:()=>IM,ColumnSummarySchema:()=>oj,ComponentAnimationSchema:()=>iN,ComponentPropsMap:()=>tce,ConflictResolutionSchema:()=>YM,Dashboard:()=>Zse,DashboardHeaderActionSchema:()=>Pj,DashboardHeaderSchema:()=>Fj,DashboardNavItemSchema:()=>JA,DashboardSchema:()=>Bj,DashboardWidgetSchema:()=>Lj,DateFormatSchema:()=>eO,DensityMode:()=>ace,DensityModeSchema:()=>GM,DndConfigSchema:()=>dce,DragConstraintSchema:()=>fN,DragHandleSchema:()=>uN,DragItemSchema:()=>mN,DropEffectSchema:()=>dN,DropZoneSchema:()=>pN,EasingFunctionSchema:()=>tN,ElementButtonPropsSchema:()=>SM,ElementDataSourceSchema:()=>Jj,ElementFilterPropsSchema:()=>CM,ElementFormPropsSchema:()=>wM,ElementImagePropsSchema:()=>xM,ElementNumberPropsSchema:()=>bM,ElementRecordPickerPropsSchema:()=>TM,ElementTextPropsSchema:()=>yM,EmbedConfigSchema:()=>GA,EvictionPolicySchema:()=>QM,FieldWidgetPropsSchema:()=>ece,FocusManagementSchema:()=>FM,FocusTrapConfigSchema:()=>NM,FormFieldSchema:()=>Oj,FormSectionSchema:()=>kj,FormViewSchema:()=>Aj,GalleryConfigSchema:()=>pj,GanttConfigSchema:()=>wj,GestureConfigSchema:()=>MM,GestureTypeSchema:()=>DM,GlobalFilterOptionsFromSchema:()=>Rj,GlobalFilterSchema:()=>zj,GroupNavItemSchema:()=>$A,GroupingConfigSchema:()=>fj,GroupingFieldSchema:()=>dj,HttpMethodSchema:()=>NE,HttpRequestSchema:()=>PE,I18nLabelSchema:()=>G,I18nObjectSchema:()=>ZD,InterfacePageConfigSchema:()=>tM,KanbanConfigSchema:()=>Sj,KeyboardNavigationConfigSchema:()=>rce,KeyboardShortcutSchema:()=>PM,ListColumnSchema:()=>sj,ListViewSchema:()=>Dj,LocaleConfigSchema:()=>Lse,LongPressGestureConfigSchema:()=>jM,MotionConfigSchema:()=>cce,NavigationAreaSchema:()=>nj,NavigationConfigSchema:()=>Ej,NavigationItemSchema:()=>ej,NavigationModeSchema:()=>Tj,NotificationActionSchema:()=>lN,NotificationConfigSchema:()=>uce,NotificationPositionSchema:()=>cN,NotificationSchema:()=>lce,NotificationSeveritySchema:()=>sN,NotificationTypeSchema:()=>oN,NumberFormatSchema:()=>$D,ObjectNavItemSchema:()=>qA,OfflineCacheConfigSchema:()=>$M,OfflineConfigSchema:()=>sce,OfflineStrategySchema:()=>JM,PageAccordionProps:()=>_M,PageCardProps:()=>uM,PageComponentSchema:()=>Yj,PageComponentType:()=>qj,PageHeaderProps:()=>cM,PageNavItemSchema:()=>YA,PageRegionSchema:()=>Kj,PageSchema:()=>nM,PageTabsProps:()=>lM,PageTransitionSchema:()=>aN,PageTypeSchema:()=>$j,PageVariableSchema:()=>Xj,PaginationConfigSchema:()=>lj,PerformanceConfigSchema:()=>UA,PersistStorageSchema:()=>ZM,PinchGestureConfigSchema:()=>AM,PluralRuleSchema:()=>Ise,RecordActivityProps:()=>mM,RecordChatterProps:()=>hM,RecordDetailsProps:()=>dM,RecordHighlightsProps:()=>pM,RecordPathProps:()=>gM,RecordRelatedListProps:()=>fM,RecordReviewConfigSchema:()=>eM,Report:()=>Qse,ReportChartSchema:()=>Wj,ReportColumnSchema:()=>Hj,ReportGroupingSchema:()=>Uj,ReportNavItemSchema:()=>ZA,ReportSchema:()=>Gj,ReportType:()=>Vj,ResponsiveConfigSchema:()=>HA,RowColorConfigSchema:()=>gj,RowHeightSchema:()=>uj,SelectionConfigSchema:()=>cj,ShadowSchema:()=>BM,SharingConfigSchema:()=>WA,SpacingSchema:()=>RM,SwipeDirectionSchema:()=>OM,SwipeGestureConfigSchema:()=>kM,SyncConfigSchema:()=>XM,ThemeMode:()=>ice,ThemeModeSchema:()=>WM,ThemeSchema:()=>qM,TimelineConfigSchema:()=>mj,TouchInteractionSchema:()=>nce,TouchTargetConfigSchema:()=>EM,TransitionConfigSchema:()=>nN,TransitionPresetSchema:()=>eN,TypographySchema:()=>LM,UrlNavItemSchema:()=>XA,UserActionsConfigSchema:()=>vj,ViewDataSchema:()=>ij,ViewFilterRuleSchema:()=>aj,ViewSchema:()=>jj,ViewSharingSchema:()=>hj,ViewTabSchema:()=>bj,VisualizationTypeSchema:()=>_j,WcagContrastLevel:()=>oce,WcagContrastLevelSchema:()=>KM,WidgetActionTypeSchema:()=>Nj,WidgetColorVariantSchema:()=>Mj,WidgetEventSchema:()=>iM,WidgetLifecycleSchema:()=>rM,WidgetManifestSchema:()=>$se,WidgetMeasureSchema:()=>Ij,WidgetPropertySchema:()=>aM,WidgetSourceSchema:()=>oM,ZIndexSchema:()=>UM,defineApp:()=>Yse,defineView:()=>Xse});var NA=x(`bar.horizontal-bar.column.grouped-bar.stacked-bar.bi-polar-bar.line.area.stacked-area.step-line.spline.pie.donut.funnel.pyramid.scatter.bubble.treemap.sunburst.sankey.word-cloud.gauge.solid-gauge.metric.kpi.bullet.choropleth.bubble-map.gl-map.heatmap.radar.waterfall.box-plot.violin.candlestick.stock.table.pivot`.split(`.`)),PA=l({field:o().describe(`Data field key`),title:G.optional().describe(`Axis display title`),format:o().optional().describe(`Value format string (e.g., "$0,0.00")`),min:A().optional().describe(`Minimum value`),max:A().optional().describe(`Maximum value`),stepSize:A().optional().describe(`Step size for ticks`),showGridLines:v().default(!0),position:x([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:v().default(!1)}),FA=l({name:o().describe(`Field name or series identifier`),label:G.optional().describe(`Series display label`),type:NA.optional().describe(`Override chart type for this series`),color:o().optional().describe(`Series color (hex/rgb/token)`),stack:o().optional().describe(`Stack identifier to group series`),yAxis:x([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`)}),IA=l({type:x([`line`,`region`]).default(`line`),axis:x([`x`,`y`]).default(`y`),value:c([A(),o()]).describe(`Start value`),endValue:c([A(),o()]).optional().describe(`End value for regions`),color:o().optional(),label:G.optional(),style:x([`solid`,`dashed`,`dotted`]).default(`dashed`)}),LA=l({tooltips:v().default(!0),zoom:v().default(!1),brush:v().default(!1),clickAction:o().optional().describe(`Action ID to trigger on click`)}),RA=l({type:NA,title:G.optional().describe(`Chart title`),subtitle:G.optional().describe(`Chart subtitle`),description:G.optional().describe(`Accessibility description`),xAxis:PA.optional().describe(`X-Axis configuration`),yAxis:S(PA).optional().describe(`Y-Axis configuration (support dual axis)`),series:S(FA).optional().describe(`Defined series configuration`),colors:S(o()).optional().describe(`Color palette`),height:A().optional().describe(`Fixed height in pixels`),showLegend:v().default(!0).describe(`Display legend`),showDataLabels:v().default(!1).describe(`Display data labels`),annotations:S(IA).optional(),interaction:LA.optional(),aria:QD.optional().describe(`ARIA accessibility attributes`)}),zA=x([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),BA=l({xs:A().min(1).max(12).optional(),sm:A().min(1).max(12).optional(),md:A().min(1).max(12).optional(),lg:A().min(1).max(12).optional(),xl:A().min(1).max(12).optional(),"2xl":A().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),VA=l({xs:A().optional(),sm:A().optional(),md:A().optional(),lg:A().optional(),xl:A().optional(),"2xl":A().optional()}).describe(`Display order per breakpoint`),HA=l({breakpoint:zA.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:S(zA).optional().describe(`Hide on these breakpoints`),columns:BA.optional().describe(`Grid columns per breakpoint`),order:VA.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),UA=l({lazyLoad:v().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:l({enabled:v().default(!1).describe(`Enable virtual scrolling`),itemHeight:A().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:A().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:x([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:v().optional().describe(`Prefetch data before component is visible`),pageSize:A().optional().describe(`Number of items per page for pagination`),debounceMs:A().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),WA=l({enabled:v().default(!1).describe(`Enable public sharing`),publicLink:o().optional().describe(`Generated public share URL`),password:o().optional().describe(`Password required to access shared link`),allowedDomains:S(o()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:o().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:v().optional().default(!1).describe(`Allow access without authentication`)}),GA=l({enabled:v().default(!1).describe(`Enable iframe embedding`),allowedOrigins:S(o()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:o().optional().default(`100%`).describe(`Embed width (CSS value)`),height:o().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:v().optional().default(!0).describe(`Show interface header in embed`),showNavigation:v().optional().default(!1).describe(`Show navigation in embed`),responsive:v().optional().default(!0).describe(`Enable responsive resizing`)}),KA=l({id:OE.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:G.describe(`Display proper label`),icon:o().optional().describe(`Icon name`),order:A().optional().describe(`Sort order within the same level (lower = first)`),badge:c([o(),A()]).optional().describe(`Badge text or count displayed on the item`),visible:o().optional().describe(`Visibility formula condition`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this item`)}),qA=KA.extend({type:p(`object`),objectName:o().describe(`Target object name`),viewName:o().optional().describe(`Default list view to open. Defaults to "all"`)}),JA=KA.extend({type:p(`dashboard`),dashboardName:o().describe(`Target dashboard name`)}),YA=KA.extend({type:p(`page`),pageName:o().describe(`Target custom page component name`),params:u(o(),b()).optional().describe(`Parameters passed to the page context`)}),XA=KA.extend({type:p(`url`),url:o().describe(`Target external URL`),target:x([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),ZA=KA.extend({type:p(`report`),reportName:o().describe(`Target report name`)}),QA=KA.extend({type:p(`action`),actionDef:l({actionName:o().describe(`Action machine name to execute`),params:u(o(),b()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),$A=KA.extend({type:p(`group`),expanded:v().default(!1).describe(`Default expansion state in sidebar`)}),ej=j(()=>c([qA.extend({children:S(ej).optional().describe(`Child navigation items (e.g. specific views)`)}),JA,YA,XA,ZA,QA,$A.extend({children:S(ej).describe(`Child navigation items`)})])),tj=l({primaryColor:o().optional().describe(`Primary theme color hex code`),logo:o().optional().describe(`Custom logo URL for this app`),favicon:o().optional().describe(`Custom favicon URL for this app`)}),nj=l({id:OE.describe(`Unique area identifier (lowercase snake_case)`),label:G.describe(`Area display label`),icon:o().optional().describe(`Area icon name`),order:A().optional().describe(`Sort order among areas (lower = first)`),description:G.optional().describe(`Area description`),visible:o().optional().describe(`Visibility formula condition for this area`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this area`),navigation:S(ej).describe(`Navigation items within this area`)}),rj=l({name:OE.describe(`App unique machine name (lowercase snake_case)`),label:G.describe(`App display label`),version:o().optional().describe(`App version`),description:G.optional().describe(`App description`),icon:o().optional().describe(`App icon used in the App Launcher`),branding:tj.optional().describe(`App-specific branding`),active:v().optional().default(!0).describe(`Whether the app is enabled`),isDefault:v().optional().default(!1).describe(`Is default app`),navigation:S(ej).optional().describe(`Full navigation tree for the app sidebar`),areas:S(nj).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:o().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this app`),objects:S(b()).optional().describe(`Objects belonging to this app`),apis:S(b()).optional().describe(`Custom APIs belonging to this app`),sharing:WA.optional().describe(`Public sharing configuration`),embed:GA.optional().describe(`Iframe embedding configuration`),mobileNavigation:l({mode:x([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:S(o()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:QD.optional().describe(`ARIA accessibility attributes for the application`)}),Jse={create:e=>rj.parse(e)};function Yse(e){return rj.parse(e)}var ij=d(`provider`,[l({provider:p(`object`),object:o().describe(`Target object name`)}),l({provider:p(`api`),read:PE.optional().describe(`Configuration for fetching data`),write:PE.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),l({provider:p(`value`),items:S(b()).describe(`Static data array`)})]),aj=l({field:o().describe(`Field name to filter on`),operator:o().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:c([o(),A(),v(),h(),S(c([o(),A()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),oj=x([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),sj=l({field:o().describe(`Field name (snake_case)`),label:G.optional().describe(`Display label override`),width:A().positive().optional().describe(`Column width in pixels`),align:x([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:v().optional().describe(`Hide column by default`),sortable:v().optional().describe(`Allow sorting by this column`),resizable:v().optional().describe(`Allow resizing this column`),wrap:v().optional().describe(`Allow text wrapping`),type:o().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:x([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:oj.optional().describe(`Footer aggregation function for this column`),link:v().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:o().optional().describe(`Registered Action ID to execute when clicked`)}),cj=l({type:x([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),lj=l({pageSize:A().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:S(A().int().positive()).optional().describe(`Available page size options`)}),uj=x([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),dj=l({field:o().describe(`Field name to group by`),order:x([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:v().default(!1).describe(`Collapse groups by default`)}),fj=l({fields:S(dj).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),pj=l({coverField:o().optional().describe(`Attachment/image field to display as card cover`),coverFit:x([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:x([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:o().optional().describe(`Field to display as card title`),visibleFields:S(o()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),mj=l({startDateField:o().describe(`Field for timeline item start date`),endDateField:o().optional().describe(`Field for timeline item end date`),titleField:o().describe(`Field to display as timeline item title`),groupByField:o().optional().describe(`Field to group timeline rows`),colorField:o().optional().describe(`Field to determine item color`),scale:x([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),hj=l({type:x([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:o().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),gj=l({field:o().describe(`Field to derive color from (typically a select/status field)`),colors:u(o(),o()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),_j=x([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),vj=l({sort:v().default(!0).describe(`Allow users to sort records`),search:v().default(!0).describe(`Allow users to search records`),filter:v().default(!0).describe(`Allow users to filter records`),rowHeight:v().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:v().default(!1).describe(`Add records through a form instead of inline`),buttons:S(o()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),yj=l({showDescription:v().default(!0).describe(`Show the view description text`),allowedVisualizations:S(_j).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),bj=l({name:OE.describe(`Tab identifier (snake_case)`),label:G.optional().describe(`Display label`),icon:o().optional().describe(`Tab icon name`),view:o().optional().describe(`Referenced list view name from listViews`),filter:S(aj).optional().describe(`Tab-specific filter criteria`),order:A().int().min(0).optional().describe(`Tab display order`),pinned:v().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:v().default(!1).describe(`Set as the default active tab`),visible:v().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),xj=l({enabled:v().default(!0).describe(`Show the add record entry point`),position:x([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:x([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:o().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),Sj=l({groupByField:o().describe(`Field to group columns by (usually status/select)`),summarizeField:o().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:S(o()).describe(`Fields to show on cards`)}),Cj=l({startDateField:o(),endDateField:o().optional(),titleField:o(),colorField:o().optional()}),wj=l({startDateField:o(),endDateField:o(),titleField:o(),progressField:o().optional(),dependenciesField:o().optional()}),Tj=x([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]),Ej=l({mode:Tj.default(`page`),view:o().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:v().default(!1).describe(`Disable standard navigation entirely`),openNewTab:v().default(!1).describe(`Force open in new tab (applies to page mode)`),width:c([o(),A()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),Dj=l({name:OE.optional().describe(`Internal view name (lowercase snake_case)`),label:G.optional(),type:x([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:ij.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:c([S(o()),S(sj)]).describe(`Fields to display as columns`),filter:S(aj).optional().describe(`Filter criteria (JSON Rules)`),sort:c([o(),S(l({field:o(),order:x([`asc`,`desc`])}))]).optional(),searchableFields:S(o()).optional().describe(`Fields enabled for search`),filterableFields:S(o()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:S(l({field:o().describe(`Field name to filter by`),label:o().optional().describe(`Display label for the chip`),operator:x([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:c([o(),A(),v(),h(),S(c([o(),A()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:v().optional().describe(`Enable column resizing`),striped:v().optional().describe(`Striped row styling`),bordered:v().optional().describe(`Show borders`),selection:cj.optional().describe(`Row selection configuration`),navigation:Ej.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:lj.optional().describe(`Pagination configuration`),kanban:Sj.optional(),calendar:Cj.optional(),gantt:wj.optional(),gallery:pj.optional(),timeline:mj.optional(),description:G.optional().describe(`View description for documentation/tooltips`),sharing:hj.optional().describe(`View sharing and access configuration`),rowHeight:uj.optional().describe(`Row height / density setting`),grouping:fj.optional().describe(`Group records by one or more fields`),rowColor:gj.optional().describe(`Color rows based on field value`),hiddenFields:S(o()).optional().describe(`Fields to hide in this specific view`),fieldOrder:S(o()).optional().describe(`Explicit field display order for this view`),rowActions:S(o()).optional().describe(`Actions available for individual row items`),bulkActions:S(o()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:v().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:S(l({condition:o().describe(`Condition expression to evaluate`),style:u(o(),o()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:v().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:S(x([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:vj.optional().describe(`User action toggles for the view toolbar`),appearance:yj.optional().describe(`Appearance and visualization configuration`),tabs:S(bj).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:xj.optional().describe(`Add record entry point configuration`),showRecordCount:v().optional().describe(`Show record count at the bottom of the list`),allowPrinting:v().optional().describe(`Allow users to print the view`),emptyState:l({title:G.optional(),message:G.optional(),icon:o().optional()}).optional().describe(`Empty state configuration when no records found`),aria:QD.optional().describe(`ARIA accessibility attributes for the list view`),responsive:HA.optional().describe(`Responsive layout configuration`),performance:UA.optional().describe(`Performance optimization settings`)}),Oj=l({field:o().describe(`Field name (snake_case)`),label:G.optional().describe(`Display label override`),placeholder:G.optional().describe(`Placeholder text`),helpText:G.optional().describe(`Help/hint text`),readonly:v().optional().describe(`Read-only override`),required:v().optional().describe(`Required override`),hidden:v().optional().describe(`Hidden override`),colSpan:A().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:o().optional().describe(`Custom widget/component name`),dependsOn:o().optional().describe(`Parent field name for cascading`),visibleOn:o().optional().describe(`Visibility condition expression`)}),kj=l({label:G.optional(),collapsible:v().default(!1),collapsed:v().default(!1),columns:x([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:S(c([o(),Oj]))}),Aj=l({type:x([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:ij.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:S(kj).optional(),groups:S(kj).optional(),defaultSort:S(l({field:o().describe(`Field name to sort by`),order:x([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:WA.optional().describe(`Public sharing configuration for this form`),aria:QD.optional().describe(`ARIA accessibility attributes for the form view`)}),jj=l({list:Dj.optional(),form:Aj.optional(),listViews:u(o(),Dj).optional().describe(`Additional named list views`),formViews:u(o(),Aj).optional().describe(`Additional named form views`)});function Xse(e){return jj.parse(e)}var Mj=x([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`),Nj=x([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`),Pj=l({label:G.describe(`Action button label`),actionUrl:o().describe(`URL or target for the action`),actionType:Nj.optional().describe(`Type of action`),icon:o().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`),Fj=l({showTitle:v().default(!0).describe(`Show dashboard title in header`),showDescription:v().default(!0).describe(`Show dashboard description in header`),actions:S(Pj).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`),Ij=l({valueField:o().describe(`Field to aggregate`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:G.optional().describe(`Measure display label`),format:o().optional().describe(`Number format string`)}).describe(`Widget measure definition`),Lj=l({id:OE.describe(`Unique widget identifier (snake_case)`),title:G.optional().describe(`Widget title`),description:G.optional().describe(`Widget description text below the header`),type:NA.default(`metric`).describe(`Visualization type`),chartConfig:RA.optional().describe(`Chart visualization configuration`),colorVariant:Mj.optional().describe(`Widget color variant for theming`),actionUrl:o().optional().describe(`URL or target for the widget action button`),actionType:Nj.optional().describe(`Type of action for the widget action button`),actionIcon:o().optional().describe(`Icon identifier for the widget action button`),object:o().optional().describe(`Data source object name`),filter:gD.optional().describe(`Data filter criteria`),categoryField:o().optional().describe(`Field for grouping (X-Axis)`),valueField:o().optional().describe(`Field for values (Y-Axis)`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:S(Ij).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:l({x:A(),y:A(),w:A(),h:A()}).describe(`Grid layout position`),options:b().optional().describe(`Widget specific configuration`),responsive:HA.optional().describe(`Responsive layout configuration`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),Rj=l({object:o().describe(`Source object name`),valueField:o().describe(`Field to use as option value`),labelField:o().describe(`Field to use as option label`),filter:gD.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`),zj=l({field:o().describe(`Field name to filter on`),label:G.optional().describe(`Display label for the filter`),type:x([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:S(l({value:c([o(),A(),v()]).describe(`Option value`),label:G})).optional().describe(`Static filter options`),optionsFrom:Rj.optional().describe(`Dynamic filter options from object`),defaultValue:c([o(),A(),v()]).optional().describe(`Default filter value`),scope:x([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:S(o()).optional().describe(`Widget IDs to apply this filter to`)}),Bj=l({name:OE.describe(`Dashboard unique name`),label:G.describe(`Dashboard label`),description:G.optional().describe(`Dashboard description`),header:Fj.optional().describe(`Dashboard header configuration`),widgets:S(Lj).describe(`Widgets to display`),refreshInterval:A().optional().describe(`Auto-refresh interval in seconds`),dateRange:l({field:o().optional().describe(`Default date field name for time-based filtering`),defaultRange:x([`today`,`yesterday`,`this_week`,`last_week`,`this_month`,`last_month`,`this_quarter`,`last_quarter`,`this_year`,`last_year`,`last_7_days`,`last_30_days`,`last_90_days`,`custom`]).default(`this_month`).describe(`Default date range preset`),allowCustomRange:v().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:S(zj).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:QD.optional().describe(`ARIA accessibility attributes`),performance:UA.optional().describe(`Performance optimization settings`)}),Zse={create:e=>Bj.parse(e)},Vj=x([`tabular`,`summary`,`matrix`,`joined`]),Hj=l({field:o().describe(`Field name`),label:G.optional().describe(`Override label`),aggregate:x([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:HA.optional().describe(`Responsive visibility for this column`)}),Uj=l({field:o().describe(`Field to group by`),sortOrder:x([`asc`,`desc`]).default(`asc`),dateGranularity:x([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)}),Wj=RA.extend({xAxis:o().describe(`Grouping field for X-Axis`),yAxis:o().describe(`Summary field for Y-Axis`),groupBy:o().optional().describe(`Additional grouping field`)}),Gj=l({name:OE.describe(`Report unique name`),label:G.describe(`Report label`),description:G.optional(),objectName:o().describe(`Primary object`),type:Vj.default(`tabular`).describe(`Report format type`),columns:S(Hj).describe(`Columns to display`),groupingsDown:S(Uj).optional().describe(`Row groupings`),groupingsAcross:S(Uj).optional().describe(`Column groupings (Matrix only)`),filter:gD.optional().describe(`Filter criteria`),chart:Wj.optional().describe(`Embedded chart configuration`),aria:QD.optional().describe(`ARIA accessibility attributes`),performance:UA.optional().describe(`Performance optimization settings`)}),Qse={create:e=>Gj.parse(e)},Kj=l({name:o().describe(`Region name (e.g. "sidebar", "main", "header")`),width:x([`small`,`medium`,`large`,`full`]).optional(),components:S(j(()=>Yj)).describe(`Components in this region`)}),qj=x(`page:header.page:footer.page:sidebar.page:tabs.page:accordion.page:card.page:section.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.ai:chat_window.ai:suggestion.element:text.element:number.element:image.element:divider.element:button.element:filter.element:form.element:record_picker`.split(`.`)),Jj=l({object:o().describe(`Object to query`),view:o().optional().describe(`Named view to apply`),filter:gD.optional().describe(`Additional filter criteria`),sort:S(zE).optional().describe(`Sort order`),limit:A().int().positive().optional().describe(`Max records to display`)}),Yj=l({type:c([qj,o()]).describe(`Component Type (Standard enum or custom string)`),id:o().optional().describe(`Unique instance ID`),label:G.optional(),properties:u(o(),b()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:u(o(),o()).optional().describe(`Event handlers map`),style:u(o(),o()).optional().describe(`Inline styles or utility classes`),className:o().optional().describe(`CSS class names`),visibility:o().optional().describe(`Visibility filter/formula`),dataSource:Jj.optional().describe(`Per-element data binding for multi-object pages`),responsive:HA.optional().describe(`Responsive layout configuration`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),Xj=l({name:o().describe(`Variable name`),type:x([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:b().optional(),source:o().optional().describe(`Component ID that writes to this variable`)}),Zj=l({componentId:o().describe(`Reference to a PageComponent.id in the page`),x:A().int().min(0).describe(`Grid column position (0-based)`),y:A().int().min(0).describe(`Grid row position (0-based)`),width:A().int().min(1).describe(`Width in grid columns`),height:A().int().min(1).describe(`Height in grid rows`)}),Qj=l({columns:A().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:A().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:A().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:S(Zj).describe(`Positioned components on the canvas`)}),$j=x([`record`,`home`,`app`,`utility`,`dashboard`,`grid`,`list`,`gallery`,`kanban`,`calendar`,`timeline`,`form`,`record_detail`,`record_review`,`overview`,`blank`]).describe(`Page type — platform or interface page types`),eM=l({object:o().describe(`Target object for review`),filter:gD.optional().describe(`Filter criteria for review queue`),sort:S(zE).optional().describe(`Sort order for review queue`),displayFields:S(o()).optional().describe(`Fields to display on the review page`),actions:S(l({label:o().describe(`Action button label`),type:x([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:o().optional().describe(`Field to update on action`),value:c([o(),A(),v()]).optional().describe(`Value to set on action`),nextRecord:v().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:x([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:v().optional().default(!0).describe(`Show review progress indicator`)}),tM=l({source:o().optional().describe(`Source object name for the page`),levels:A().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:S(aj).optional().describe(`Page-level filter criteria`),appearance:yj.optional().describe(`Appearance and visualization configuration`),userFilters:l({elements:S(x([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:S(bj).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:vj.optional().describe(`User action toggles`),addRecord:xj.optional().describe(`Add record entry point configuration`),showRecordCount:v().optional().describe(`Show record count at page bottom`),allowPrinting:v().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`),nM=l({name:OE.describe(`Page unique name (lowercase snake_case)`),label:G,description:G.optional(),icon:o().optional().describe(`Page icon name`),type:$j.default(`record`).describe(`Page type`),variables:S(Xj).optional().describe(`Local page state variables`),object:o().optional().describe(`Bound object (for Record pages)`),recordReview:eM.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:Qj.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:o().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:S(Kj).describe(`Defined regions with components`),isDefault:v().default(!1),assignedProfiles:S(o()).optional(),interfaceConfig:tM.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:QD.optional().describe(`ARIA accessibility attributes`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:le.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:le.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`})}),rM=l({onMount:o().optional().describe(`Initialization code when widget mounts`),onUpdate:o().optional().describe(`Code to run when props change`),onUnmount:o().optional().describe(`Cleanup code when widget unmounts`),onValidate:o().optional().describe(`Custom validation logic`),onFocus:o().optional().describe(`Code to run on focus`),onBlur:o().optional().describe(`Code to run on blur`),onError:o().optional().describe(`Error handling code`)}),iM=l({name:o().describe(`Event name`),label:G.optional().describe(`Human-readable event label`),description:G.optional().describe(`Event description and usage`),bubbles:v().default(!1).describe(`Whether event bubbles`),cancelable:v().default(!1).describe(`Whether event is cancelable`),payload:u(o(),b()).optional().describe(`Event payload schema`)}),aM=l({name:o().describe(`Property name (camelCase)`),label:G.optional().describe(`Human-readable label`),type:x([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:v().default(!1).describe(`Whether property is required`),default:b().optional().describe(`Default value`),description:G.optional().describe(`Property description`),validation:u(o(),b()).optional().describe(`Validation rules`),category:o().optional().describe(`Property category`)}),oM=d(`type`,[l({type:p(`npm`),packageName:o().describe(`NPM package name`),version:o().default(`latest`),exportName:o().optional().describe(`Named export (default: default)`)}),l({type:p(`remote`),url:o().url().describe(`Remote entry URL (.js)`),moduleName:o().describe(`Exposed module name`),scope:o().describe(`Remote scope name`)}),l({type:p(`inline`),code:o().describe(`JavaScript code body`)})]),$se=l({name:OE.describe(`Widget identifier (snake_case)`),label:G.describe(`Widget display name`),description:G.optional().describe(`Widget description`),version:o().optional().describe(`Widget version (semver)`),author:o().optional().describe(`Widget author`),icon:o().optional().describe(`Widget icon`),fieldTypes:S(o()).optional().describe(`Supported field types`),category:x([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:rM.optional().describe(`Lifecycle hooks`),events:S(iM).optional().describe(`Custom events`),properties:S(aM).optional().describe(`Configuration properties`),implementation:oM.optional().describe(`Widget implementation source`),dependencies:S(l({name:o(),version:o().optional(),url:o().url().optional()})).optional().describe(`Widget dependencies`),screenshots:S(o().url()).optional().describe(`Screenshot URLs`),documentation:o().url().optional().describe(`Documentation URL`),license:o().optional().describe(`License (SPDX identifier)`),tags:S(o()).optional().describe(`Tags for categorization`),aria:QD.optional().describe(`ARIA accessibility attributes`),performance:UA.optional().describe(`Performance optimization settings`)}),ece=l({value:b().describe(`Current field value`),onChange:O().input(a([b()])).output(g()).describe(`Callback to update field value`),readonly:v().default(!1).describe(`Read-only mode flag`),required:v().default(!1).describe(`Required field flag`),error:o().optional().describe(`Validation error message`),field:tD.describe(`Field schema definition`),record:u(o(),b()).optional().describe(`Complete record data`),options:u(o(),b()).optional().describe(`Custom widget options`)}),sM=l({}),cM=l({title:G.describe(`Page title`),subtitle:G.optional().describe(`Page subtitle`),icon:o().optional().describe(`Icon name`),breadcrumb:v().default(!0).describe(`Show breadcrumb`),actions:S(o()).optional().describe(`Action IDs to show in header`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),lM=l({type:x([`line`,`card`,`pill`]).default(`line`),position:x([`top`,`left`]).default(`top`),items:S(l({label:G,icon:o().optional(),children:S(b()).describe(`Child components`)})),aria:QD.optional().describe(`ARIA accessibility attributes`)}),uM=l({title:G.optional(),bordered:v().default(!0),actions:S(o()).optional(),body:S(b()).optional().describe(`Card content components (slot)`),footer:S(b()).optional().describe(`Card footer components (slot)`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),dM=l({columns:x([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:x([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:S(o()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:S(o()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),fM=l({objectName:o().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:o().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:S(o()).describe(`Fields to display in the related list`),sort:c([o(),S(l({field:o(),order:x([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:A().int().positive().default(5).describe(`Number of records to display initially`),filter:S(aj).optional().describe(`Additional filter criteria for related records`),title:G.optional().describe(`Custom title for the related list`),showViewAll:v().default(!0).describe(`Show "View All" link to see all related records`),actions:S(o()).optional().describe(`Action IDs available for related records`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),pM=l({fields:S(o()).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards)`),layout:x([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),mM=l({types:S(qk).optional().describe(`Feed item types to show (default: all)`),filterMode:eA.default(`all`).describe(`Default activity filter`),showFilterToggle:v().default(!0).describe(`Show filter dropdown in panel header`),limit:A().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:v().default(!1).describe(`Include completed activities`),unifiedTimeline:v().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:v().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:v().default(!0).describe(`Enable @mentions in comments`),enableReactions:v().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:v().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:v().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),hM=l({position:x([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:c([o(),A()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:v().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:v().default(!1).describe(`Whether the panel starts collapsed`),feed:mM.optional().describe(`Embedded activity feed configuration`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),gM=l({statusField:o().describe(`Field name representing the current status/stage`),stages:S(l({value:o(),label:G})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),_M=l({items:S(l({label:G,icon:o().optional(),collapsed:v().default(!1),children:S(b()).describe(`Child components`)})),allowMultiple:v().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),vM=l({mode:x([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:o().optional().describe(`Specific AI agent to use`),context:u(o(),b()).optional().describe(`Contextual data to pass to the AI`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),yM=l({content:o().describe(`Text or Markdown content`),variant:x([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:x([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),bM=l({object:o().describe(`Source object`),field:o().optional().describe(`Field to aggregate`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:gD.optional().describe(`Filter criteria`),format:x([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:o().optional().describe(`Prefix text (e.g. "$")`),suffix:o().optional().describe(`Suffix text (e.g. "%")`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),xM=l({src:o().describe(`Image URL or attachment field`),alt:o().optional().describe(`Alt text for accessibility`),fit:x([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:A().optional().describe(`Fixed height in pixels`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),SM=l({label:G.describe(`Button display label`),variant:x([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:x([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:o().optional().describe(`Icon name (Lucide icon)`),iconPosition:x([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:v().optional().default(!1).describe(`Disable the button`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),CM=l({object:o().describe(`Object to filter`),fields:S(o()).describe(`Filterable field names`),targetVariable:o().optional().describe(`Page variable to store filter state`),layout:x([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:v().optional().default(!0).describe(`Show search input`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),wM=l({object:o().describe(`Object for the form`),fields:S(o()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:x([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:G.optional().describe(`Submit button label`),onSubmit:o().optional().describe(`Action expression on form submit`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),TM=l({object:o().describe(`Object to pick records from`),displayField:o().describe(`Field to display as the record label`),searchFields:S(o()).optional().describe(`Fields to search against`),filter:gD.optional().describe(`Filter criteria for available records`),multiple:v().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:o().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:G.optional().describe(`Placeholder text`),aria:QD.optional().describe(`ARIA accessibility attributes`)}),tce={"page:header":cM,"page:tabs":lM,"page:card":uM,"page:footer":sM,"page:sidebar":sM,"page:accordion":_M,"page:section":sM,"record:details":dM,"record:related_list":fM,"record:highlights":pM,"record:activity":mM,"record:chatter":hM,"record:path":gM,"app:launcher":sM,"nav:menu":sM,"nav:breadcrumb":sM,"global:search":sM,"global:notifications":sM,"user:profile":sM,"ai:chat_window":vM,"ai:suggestion":l({context:o().optional()}),"element:text":yM,"element:number":bM,"element:image":xM,"element:divider":sM,"element:button":SM,"element:filter":CM,"element:form":wM,"element:record_picker":TM},EM=l({minWidth:A().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:A().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:A().optional().describe(`Additional padding around touch target in pixels`),hitSlop:l({top:A().optional().describe(`Extra hit area above the element`),right:A().optional().describe(`Extra hit area to the right of the element`),bottom:A().optional().describe(`Extra hit area below the element`),left:A().optional().describe(`Extra hit area to the left of the element`)}).optional().describe(`Invisible hit area extension beyond the visible bounds`)}).describe(`Touch target sizing configuration (WCAG accessible)`),DM=x([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`),OM=x([`up`,`down`,`left`,`right`]),kM=l({direction:S(OM).describe(`Allowed swipe directions`),threshold:A().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:A().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`),AM=l({minScale:A().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:A().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`),jM=l({duration:A().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:A().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`),MM=l({type:DM.describe(`Gesture type to configure`),label:G.optional().describe(`Descriptive label for the gesture action`),enabled:v().default(!0).describe(`Whether this gesture is active`),swipe:kM.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:AM.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:jM.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`),nce=l({gestures:S(MM).optional().describe(`Configured gesture recognizers`),touchTarget:EM.optional().describe(`Touch target sizing and hit area`),hapticFeedback:v().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(QD.partial()).describe(`Touch and gesture interaction configuration`),NM=l({enabled:v().default(!1).describe(`Enable focus trapping within this container`),initialFocus:o().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:v().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:v().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`),PM=l({key:o().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:o().describe(`Action identifier to invoke when shortcut is triggered`),description:G.optional().describe(`Human-readable description of what the shortcut does`),scope:x([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`),FM=l({tabOrder:x([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:v().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:v().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:NM.optional().describe(`Focus trap settings`),arrowNavigation:v().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`),rce=l({shortcuts:S(PM).optional().describe(`Registered keyboard shortcuts`),focusManagement:FM.optional().describe(`Focus and tab order management`),rovingTabindex:v().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(QD.partial()).describe(`Keyboard navigation and shortcut configuration`),IM=l({primary:o().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:o().optional().describe(`Secondary brand color`),accent:o().optional().describe(`Accent color for highlights`),success:o().optional().describe(`Success state color (default: green)`),warning:o().optional().describe(`Warning state color (default: yellow)`),error:o().optional().describe(`Error state color (default: red)`),info:o().optional().describe(`Info state color (default: blue)`),background:o().optional().describe(`Background color`),surface:o().optional().describe(`Surface/card background color`),text:o().optional().describe(`Primary text color`),textSecondary:o().optional().describe(`Secondary text color`),border:o().optional().describe(`Border color`),disabled:o().optional().describe(`Disabled state color`),primaryLight:o().optional().describe(`Lighter shade of primary`),primaryDark:o().optional().describe(`Darker shade of primary`),secondaryLight:o().optional().describe(`Lighter shade of secondary`),secondaryDark:o().optional().describe(`Darker shade of secondary`)}),LM=l({fontFamily:l({base:o().optional().describe(`Base font family (default: system fonts)`),heading:o().optional().describe(`Heading font family`),mono:o().optional().describe(`Monospace font family for code`)}).optional(),fontSize:l({xs:o().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:o().optional().describe(`Small font size (e.g., 0.875rem)`),base:o().optional().describe(`Base font size (e.g., 1rem)`),lg:o().optional().describe(`Large font size (e.g., 1.125rem)`),xl:o().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":o().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":o().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":o().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:l({light:A().optional().describe(`Light weight (default: 300)`),normal:A().optional().describe(`Normal weight (default: 400)`),medium:A().optional().describe(`Medium weight (default: 500)`),semibold:A().optional().describe(`Semibold weight (default: 600)`),bold:A().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:l({tight:o().optional().describe(`Tight line height (e.g., 1.25)`),normal:o().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:o().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:o().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:l({tighter:o().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:o().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:o().optional().describe(`Normal letter spacing (e.g., 0)`),wide:o().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:o().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()}),RM=l({0:o().optional().describe(`0 spacing (0)`),1:o().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:o().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:o().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:o().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:o().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:o().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:o().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:o().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:o().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:o().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:o().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:o().optional().describe(`Spacing unit 24 (e.g., 6rem)`)}),zM=l({none:o().optional().describe(`No border radius (0)`),sm:o().optional().describe(`Small border radius (e.g., 0.125rem)`),base:o().optional().describe(`Base border radius (e.g., 0.25rem)`),md:o().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:o().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:o().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":o().optional().describe(`2X large border radius (e.g., 1rem)`),full:o().optional().describe(`Full border radius (50%)`)}),BM=l({none:o().optional().describe(`No shadow`),sm:o().optional().describe(`Small shadow`),base:o().optional().describe(`Base shadow`),md:o().optional().describe(`Medium shadow`),lg:o().optional().describe(`Large shadow`),xl:o().optional().describe(`Extra large shadow`),"2xl":o().optional().describe(`2X large shadow`),inner:o().optional().describe(`Inner shadow (inset)`)}),VM=l({xs:o().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:o().optional().describe(`Small breakpoint (e.g., 640px)`),md:o().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:o().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:o().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":o().optional().describe(`2X large breakpoint (e.g., 1536px)`)}),HM=l({duration:l({fast:o().optional().describe(`Fast animation (e.g., 150ms)`),base:o().optional().describe(`Base animation (e.g., 300ms)`),slow:o().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:l({linear:o().optional().describe(`Linear timing function`),ease:o().optional().describe(`Ease timing function`),ease_in:o().optional().describe(`Ease-in timing function`),ease_out:o().optional().describe(`Ease-out timing function`),ease_in_out:o().optional().describe(`Ease-in-out timing function`)}).optional()}),UM=l({base:A().optional().describe(`Base z-index (e.g., 0)`),dropdown:A().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:A().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:A().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:A().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:A().optional().describe(`Modal z-index (e.g., 1050)`),popover:A().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:A().optional().describe(`Tooltip z-index (e.g., 1070)`)}),WM=x([`light`,`dark`,`auto`]),ice=WM,GM=x([`compact`,`regular`,`spacious`]),ace=GM,KM=x([`AA`,`AAA`]),oce=KM,qM=l({name:OE.describe(`Unique theme identifier (snake_case)`),label:o().describe(`Human-readable theme name`),description:o().optional().describe(`Theme description`),mode:WM.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:IM.describe(`Color palette configuration`),typography:LM.optional().describe(`Typography settings`),spacing:RM.optional().describe(`Spacing scale`),borderRadius:zM.optional().describe(`Border radius scale`),shadows:BM.optional().describe(`Box shadow effects`),breakpoints:VM.optional().describe(`Responsive breakpoints`),animation:HM.optional().describe(`Animation settings`),zIndex:UM.optional().describe(`Z-index scale for layering`),customVars:u(o(),o()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:l({light:o().optional().describe(`Logo URL for light mode`),dark:o().optional().describe(`Logo URL for dark mode`),favicon:o().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:o().optional().describe(`Base theme to extend from`),density:GM.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:KM.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:v().optional().describe(`Enable right-to-left layout direction`),touchTarget:EM.optional().describe(`Touch target sizing defaults`),keyboardNavigation:FM.optional().describe(`Keyboard focus management settings`)}),JM=x([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`),YM=x([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`),XM=l({strategy:JM.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:YM.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:A().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:A().optional().describe(`Maximum number of sync retry attempts`),batchSize:A().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`),ZM=x([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`),QM=x([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`),$M=l({maxSize:A().optional().describe(`Maximum cache size in bytes`),ttl:A().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:ZM.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:QM.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`),sce=l({enabled:v().default(!1).describe(`Enable offline support`),strategy:JM.default(`network_first`).describe(`Default offline fetch strategy`),cache:$M.optional().describe(`Cache settings for offline data`),sync:XM.optional().describe(`Sync settings for offline mutations`),offlineIndicator:v().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:G.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:A().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`),eN=x([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`),tN=x([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`),nN=l({preset:eN.optional().describe(`Transition preset to apply`),duration:A().optional().describe(`Transition duration in milliseconds`),easing:tN.optional().describe(`Easing function for the transition`),delay:A().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:o().optional().describe(`CSS @keyframes name for custom animations`),themeToken:o().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`),rN=x([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`),iN=l({label:G.optional().describe(`Descriptive label for this animation configuration`),enter:nN.optional().describe(`Enter/mount animation`),exit:nN.optional().describe(`Exit/unmount animation`),hover:nN.optional().describe(`Hover state animation`),trigger:rN.optional().describe(`When to trigger the animation`),reducedMotion:x([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(QD.partial()).describe(`Component-level animation configuration`),aN=l({type:eN.default(`fade`).describe(`Page transition type`),duration:A().default(300).describe(`Transition duration in milliseconds`),easing:tN.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:v().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`),cce=l({label:G.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:nN.optional().describe(`Default transition applied to all animations`),pageTransitions:aN.optional().describe(`Page navigation transition settings`),componentAnimations:u(o(),iN).optional().describe(`Component name to animation configuration mapping`),reducedMotion:v().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:v().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`),oN=x([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`),sN=x([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`),cN=x([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`),lN=l({label:G.describe(`Action button label`),action:o().describe(`Action identifier to execute`),variant:x([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`),lce=l({type:oN.default(`toast`).describe(`Notification presentation style`),severity:sN.default(`info`).describe(`Notification severity level`),title:G.optional().describe(`Notification title`),message:G.describe(`Notification message body`),icon:o().optional().describe(`Icon name override`),duration:A().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:v().default(!0).describe(`Allow user to dismiss the notification`),actions:S(lN).optional().describe(`Action buttons`),position:cN.optional().describe(`Override default position`)}).merge(QD.partial()).describe(`Notification instance definition`),uce=l({defaultPosition:cN.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:A().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:A().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:x([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:v().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`),uN=x([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`),dN=x([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`),fN=l({axis:x([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:x([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:a([A(),A()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`),pN=l({label:G.optional().describe(`Accessible label for the drop zone`),accept:S(o()).describe(`Accepted drag item types`),maxItems:A().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:v().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:dN.default(`move`).describe(`Visual effect on drop`)}).merge(QD.partial()).describe(`Drop zone configuration`),mN=l({type:o().describe(`Drag item type identifier for matching with drop zones`),label:G.optional().describe(`Accessible label describing the draggable item`),handle:uN.default(`element`).describe(`How to initiate drag`),constraint:fN.optional().describe(`Drag movement constraints`),preview:x([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:v().default(!1).describe(`Disable dragging`)}).merge(QD.partial()).describe(`Draggable item configuration`),dce=l({enabled:v().default(!1).describe(`Enable drag and drop`),dragItem:mN.optional().describe(`Configuration for draggable item`),dropZone:pN.optional().describe(`Configuration for drop target`),sortable:v().default(!1).describe(`Enable sortable list behavior`),autoScroll:v().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:A().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`);EE({},{AccessControlConfigSchema:()=>BN,AddFieldOperation:()=>sF,AdvancedAuthConfigSchema:()=>CF,AnalyzerConfigSchema:()=>qN,AppCompatibilityCheckSchema:()=>$ce,AppInstallRequestSchema:()=>ele,AppInstallResultSchema:()=>tle,AppManifestSchema:()=>Qce,AppTranslationBundleSchema:()=>LI,AuditConfigSchema:()=>Ace,AuditEventActorSchema:()=>nP,AuditEventChangeSchema:()=>iP,AuditEventFilterSchema:()=>kce,AuditEventSchema:()=>Oce,AuditEventSeverity:()=>tP,AuditEventTargetSchema:()=>rP,AuditEventType:()=>eP,AuditFindingSchema:()=>jF,AuditFindingSeveritySchema:()=>kF,AuditFindingStatusSchema:()=>AF,AuditLogConfigSchema:()=>OF,AuditRetentionPolicySchema:()=>aP,AuditScheduleSchema:()=>MF,AuditStorageConfigSchema:()=>sP,AuthConfigSchema:()=>wF,AuthPluginConfigSchema:()=>vF,AuthProviderConfigSchema:()=>_F,AwarenessEventSchema:()=>mL,AwarenessSessionSchema:()=>fL,AwarenessUpdateSchema:()=>pL,AwarenessUserStateSchema:()=>dL,BackupConfigSchema:()=>wN,BackupRetentionSchema:()=>CN,BackupStrategySchema:()=>SN,BatchProgressSchema:()=>mI,BatchTask:()=>bI,BatchTaskSchema:()=>pI,BucketConfigSchema:()=>UN,CRDTMergeResultSchema:()=>iL,CRDTStateSchema:()=>rL,CRDTType:()=>qI,CacheAvalanchePreventionSchema:()=>bN,CacheConfigSchema:()=>vN,CacheConsistencySchema:()=>yN,CacheInvalidationSchema:()=>_N,CacheStrategySchema:()=>hN,CacheTierSchema:()=>gN,CacheWarmupSchema:()=>xN,ChangeImpactSchema:()=>iF,ChangePrioritySchema:()=>nF,ChangeRequestSchema:()=>oF,ChangeSetSchema:()=>gF,ChangeStatusSchema:()=>rF,ChangeTypeSchema:()=>tF,CollaborationMode:()=>hL,CollaborationSessionConfigSchema:()=>gL,CollaborationSessionSchema:()=>_L,CollaborativeCursorSchema:()=>cL,ComplianceAuditRequirementSchema:()=>YP,ComplianceConfigSchema:()=>NF,ComplianceEncryptionRequirementSchema:()=>XP,ComplianceFrameworkSchema:()=>JP,ConsoleDestinationConfigSchema:()=>pP,ConsumerConfigSchema:()=>jN,CoreServiceName:()=>IL,CounterOperationSchema:()=>XI,CoverageBreakdownEntrySchema:()=>BI,CreateObjectOperation:()=>uF,CronScheduleSchema:()=>QF,CursorColorPreset:()=>aL,CursorSelectionSchema:()=>sL,CursorStyleSchema:()=>oL,CursorUpdateSchema:()=>lL,DEFAULT_SUSPICIOUS_ACTIVITY_RULES:()=>jce,DataClassificationPolicySchema:()=>$P,DataClassificationSchema:()=>qP,DatabaseLevelIsolationStrategySchema:()=>ZL,DatabaseProviderSchema:()=>UL,DeadLetterQueueSchema:()=>MN,DeleteObjectOperation:()=>fF,DeployBundleSchema:()=>Zce,DeployDiffSchema:()=>Jce,DeployManifestSchema:()=>cR,DeployStatusEnum:()=>qce,DeployValidationIssueSchema:()=>sR,DeployValidationResultSchema:()=>Xce,DisasterRecoveryPlanSchema:()=>pce,DistributedCacheConfigSchema:()=>fce,EmailAndPasswordConfigSchema:()=>xF,EmailTemplateSchema:()=>xI,EmailVerificationConfigSchema:()=>SF,EncryptionAlgorithmSchema:()=>HE,EncryptionConfigSchema:()=>GE,ExecuteSqlOperation:()=>pF,ExtendedLogLevel:()=>dP,ExternalServiceDestinationConfigSchema:()=>gP,FacetConfigSchema:()=>YN,FailoverConfigSchema:()=>EN,FailoverModeSchema:()=>TN,FeatureSchema:()=>Vce,FieldEncryptionSchema:()=>_se,FieldTranslationSchema:()=>OI,FileDestinationConfigSchema:()=>mP,FileMetadataSchema:()=>PN,GCounterSchema:()=>ZI,GDPRConfigSchema:()=>TF,HIPAAConfigSchema:()=>EF,HistogramBucketConfigSchema:()=>SP,HttpDestinationConfigSchema:()=>hP,HttpServerConfig:()=>Ece,HttpServerConfigSchema:()=>XN,InAppNotificationSchema:()=>wI,IncidentCategorySchema:()=>FF,IncidentNotificationMatrixSchema:()=>zF,IncidentNotificationRuleSchema:()=>RF,IncidentResponsePhaseSchema:()=>LF,IncidentResponsePolicySchema:()=>VF,IncidentSchema:()=>BF,IncidentSeveritySchema:()=>PF,IncidentStatusSchema:()=>IF,IntervalScheduleSchema:()=>$F,JobExecutionSchema:()=>aI,JobExecutionStatus:()=>iI,JobSchema:()=>rI,KernelServiceMapSchema:()=>BL,KeyManagementProviderSchema:()=>UE,KeyRotationPolicySchema:()=>WE,LWWRegisterSchema:()=>YI,LicenseMetricType:()=>QL,LicenseSchema:()=>Uce,LifecycleActionSchema:()=>RN,LifecyclePolicyConfigSchema:()=>HN,LifecyclePolicyRuleSchema:()=>VN,LocaleSchema:()=>DI,LogDestinationSchema:()=>_P,LogDestinationType:()=>fP,LogEnrichmentConfigSchema:()=>vP,LogEntrySchema:()=>Mce,LogFormat:()=>lP,LogLevel:()=>cP,LoggerConfigSchema:()=>uP,LoggingConfigSchema:()=>Pce,MaskingConfigSchema:()=>vse,MaskingRuleSchema:()=>qE,MaskingStrategySchema:()=>KE,MaskingVisibilityRuleSchema:()=>ZP,MessageFormatSchema:()=>NI,MessageQueueConfigSchema:()=>mce,MessageQueueProviderSchema:()=>kN,MetadataCollectionInfoSchema:()=>AL,MetadataExportOptionsSchema:()=>jL,MetadataFallbackStrategySchema:()=>NL,MetadataFormatSchema:()=>SL,MetadataImportOptionsSchema:()=>ML,MetadataLoadOptionsSchema:()=>TL,MetadataLoadResultSchema:()=>EL,MetadataLoaderContractSchema:()=>wL,MetadataManagerConfigSchema:()=>FL,MetadataRecordSchema:()=>bL,MetadataSaveOptionsSchema:()=>DL,MetadataSaveResultSchema:()=>OL,MetadataScopeSchema:()=>vL,MetadataSourceSchema:()=>PL,MetadataStateSchema:()=>yL,MetadataStatsSchema:()=>CL,MetadataWatchEventSchema:()=>kL,MetricAggregationConfigSchema:()=>EP,MetricAggregationType:()=>xP,MetricDataPointSchema:()=>Fce,MetricDefinitionSchema:()=>wP,MetricExportConfigSchema:()=>kP,MetricLabelsSchema:()=>CP,MetricType:()=>yP,MetricUnit:()=>bP,MetricsConfigSchema:()=>Lce,MiddlewareConfig:()=>Dce,MiddlewareConfigSchema:()=>QN,MiddlewareType:()=>ZN,MigrationDependencySchema:()=>hF,MigrationOperationSchema:()=>mF,MigrationPlanSchema:()=>Yce,MigrationStatementSchema:()=>oR,ModifyFieldOperation:()=>cF,MultipartUploadConfigSchema:()=>zN,MutualTLSConfigSchema:()=>yF,NotificationChannelSchema:()=>TI,NotificationConfigSchema:()=>EI,ORSetElementSchema:()=>$I,ORSetSchema:()=>eL,OTComponentSchema:()=>WI,OTOperationSchema:()=>GI,OTOperationType:()=>UI,OTTransformResultSchema:()=>KI,ObjectMetadataSchema:()=>hce,ObjectStorageConfigSchema:()=>GN,ObjectTranslationDataSchema:()=>kI,ObjectTranslationNodeSchema:()=>II,OnceScheduleSchema:()=>eI,OpenTelemetryCompatibilitySchema:()=>GP,OtelExporterType:()=>WP,PCIDSSConfigSchema:()=>DF,PKG_CONVENTIONS:()=>nle,PNCounterSchema:()=>QI,PackagePublishResultSchema:()=>xL,PlanSchema:()=>Hce,PresignedUrlConfigSchema:()=>gce,ProvisioningStepSchema:()=>iR,PushNotificationSchema:()=>CI,QueueConfig:()=>vI,QueueConfigSchema:()=>fI,QuotaEnforcementResultSchema:()=>qL,RPOSchema:()=>DN,RTOSchema:()=>ON,RegistryConfigSchema:()=>Wce,RegistrySyncPolicySchema:()=>$L,RegistryUpstreamSchema:()=>eR,RemoveFieldOperation:()=>lF,RenameObjectOperation:()=>dF,RetryPolicySchema:()=>nI,RollbackPlanSchema:()=>aF,RouteHandlerMetadataSchema:()=>Sce,RowLevelIsolationStrategySchema:()=>YL,SMSTemplateSchema:()=>SI,SamplingDecision:()=>zP,SamplingStrategyType:()=>BP,ScheduleSchema:()=>tI,SchemaChangeSchema:()=>aR,SchemaLevelIsolationStrategySchema:()=>XL,SearchConfigSchema:()=>xce,SearchIndexConfigSchema:()=>JN,SearchProviderSchema:()=>KN,SecurityContextConfigSchema:()=>eF,SecurityEventCorrelationSchema:()=>QP,ServerCapabilitiesSchema:()=>wce,ServerEventSchema:()=>Cce,ServerEventType:()=>$N,ServerStatusSchema:()=>Tce,ServiceConfigSchema:()=>VL,ServiceCriticalitySchema:()=>LL,ServiceLevelIndicatorSchema:()=>DP,ServiceLevelObjectiveSchema:()=>OP,ServiceRequirementDef:()=>RL,ServiceStatusSchema:()=>zL,SocialProviderConfigSchema:()=>bF,SpanAttributeValueSchema:()=>FP,SpanAttributesSchema:()=>IP,SpanEventSchema:()=>LP,SpanKind:()=>NP,SpanLinkSchema:()=>RP,SpanSchema:()=>Rce,SpanStatus:()=>PP,StorageAclSchema:()=>IN,StorageClassSchema:()=>LN,StorageConnectionSchema:()=>WN,StorageNameMapping:()=>ale,StorageProviderSchema:()=>FN,StorageScopeSchema:()=>NN,StructuredLogEntrySchema:()=>Nce,SupplierAssessmentStatusSchema:()=>UF,SupplierRiskLevelSchema:()=>HF,SupplierSecurityAssessmentSchema:()=>GF,SupplierSecurityPolicySchema:()=>KF,SupplierSecurityRequirementSchema:()=>WF,SuspiciousActivityRuleSchema:()=>oP,SystemFieldName:()=>ile,SystemObjectName:()=>rle,TASK_PRIORITY_VALUES:()=>sI,TRANSLATE_PLACEHOLDER:()=>HI,Task:()=>_I,TaskExecutionResultSchema:()=>dI,TaskPriority:()=>oI,TaskRetryPolicySchema:()=>lI,TaskSchema:()=>uI,TaskStatus:()=>cI,TenantConnectionConfigSchema:()=>WL,TenantIsolationConfigSchema:()=>zce,TenantIsolationLevel:()=>HL,TenantPlanSchema:()=>nR,TenantProvisioningRequestSchema:()=>Gce,TenantProvisioningResultSchema:()=>Kce,TenantProvisioningStatusEnum:()=>tR,TenantQuotaSchema:()=>GL,TenantRegionSchema:()=>rR,TenantSchema:()=>JL,TenantSecurityPolicySchema:()=>Bce,TenantUsageSchema:()=>KL,TextCRDTOperationSchema:()=>tL,TextCRDTStateSchema:()=>nL,TimeSeriesDataPointSchema:()=>TP,TimeSeriesSchema:()=>Ice,TopicConfigSchema:()=>AN,TraceContextPropagationSchema:()=>UP,TraceContextSchema:()=>MP,TraceFlagsSchema:()=>jP,TracePropagationFormat:()=>HP,TraceSamplingConfigSchema:()=>VP,TraceStateSchema:()=>AP,TracingConfigSchema:()=>KP,TrainingCategorySchema:()=>qF,TrainingCompletionStatusSchema:()=>JF,TrainingCourseSchema:()=>YF,TrainingPlanSchema:()=>ZF,TrainingRecordSchema:()=>XF,TranslationBundleSchema:()=>jI,TranslationConfigSchema:()=>PI,TranslationCoverageResultSchema:()=>VI,TranslationDataSchema:()=>AI,TranslationDiffItemSchema:()=>zI,TranslationDiffStatusSchema:()=>RI,TranslationFileOrganizationSchema:()=>MI,UserActivityStatus:()=>uL,VectorClockSchema:()=>JI,WorkerConfig:()=>yI,WorkerConfigSchema:()=>hI,WorkerStatsSchema:()=>gI,azureBlobStorageExample:()=>yce,gcsStorageExample:()=>bce,minioStorageExample:()=>vce,s3StorageExample:()=>_ce});var hN=x([`lru`,`lfu`,`fifo`,`ttl`,`adaptive`]).describe(`Cache eviction strategy`),gN=l({name:o().describe(`Unique cache tier name`),type:x([`memory`,`redis`,`memcached`,`cdn`]).describe(`Cache backend type`),maxSize:A().optional().describe(`Max size in MB`),ttl:A().default(300).describe(`Default TTL in seconds`),strategy:hN.default(`lru`).describe(`Eviction strategy`),warmup:v().default(!1).describe(`Pre-populate cache on startup`)}).describe(`Configuration for a single cache tier in the hierarchy`),_N=l({trigger:x([`create`,`update`,`delete`,`manual`]).describe(`Event that triggers invalidation`),scope:x([`key`,`pattern`,`tag`,`all`]).describe(`Invalidation scope`),pattern:o().optional().describe(`Key pattern for pattern-based invalidation`),tags:S(o()).optional().describe(`Cache tags to invalidate`)}).describe(`Rule defining when and how cached entries are invalidated`),vN=l({enabled:v().default(!1).describe(`Enable application-level caching`),tiers:S(gN).describe(`Ordered cache tier hierarchy`),invalidation:S(_N).describe(`Cache invalidation rules`),prefetch:v().default(!1).describe(`Enable cache prefetching`),compression:v().default(!1).describe(`Enable data compression in cache`),encryption:v().default(!1).describe(`Enable encryption for cached data`)}).describe(`Top-level application cache configuration`),yN=x([`write_through`,`write_behind`,`write_around`,`refresh_ahead`]).describe(`Distributed cache write consistency strategy`),bN=l({jitterTtl:l({enabled:v().default(!1).describe(`Add random jitter to TTL values`),maxJitterSeconds:A().default(60).describe(`Maximum jitter added to TTL in seconds`)}).optional().describe(`TTL jitter to prevent simultaneous expiration`),circuitBreaker:l({enabled:v().default(!1).describe(`Enable circuit breaker for backend protection`),failureThreshold:A().default(5).describe(`Failures before circuit opens`),resetTimeout:A().default(30).describe(`Seconds before half-open state`)}).optional().describe(`Circuit breaker for backend protection`),lockout:l({enabled:v().default(!1).describe(`Enable cache locking for key regeneration`),lockTimeoutMs:A().default(5e3).describe(`Maximum lock wait time in milliseconds`)}).optional().describe(`Lock-based stampede prevention`)}).describe(`Cache avalanche/stampede prevention configuration`),xN=l({enabled:v().default(!1).describe(`Enable cache warmup`),strategy:x([`eager`,`lazy`,`scheduled`]).default(`lazy`).describe(`Warmup strategy: eager (at startup), lazy (on first access), scheduled (cron)`),schedule:o().optional().describe(`Cron expression for scheduled warmup`),patterns:S(o()).optional().describe(`Key patterns to warm up (e.g., "user:*", "config:*")`),concurrency:A().default(10).describe(`Maximum concurrent warmup operations`)}).describe(`Cache warmup strategy`),fce=vN.extend({consistency:yN.optional().describe(`Distributed cache consistency strategy`),avalanchePrevention:bN.optional().describe(`Cache avalanche and stampede prevention`),warmup:xN.optional().describe(`Cache warmup strategy`)}).describe(`Distributed cache configuration with consistency and avalanche prevention`),SN=x([`full`,`incremental`,`differential`]).describe(`Backup strategy type`),CN=l({days:A().min(1).describe(`Retention period in days`),minCopies:A().min(1).default(3).describe(`Minimum backup copies to retain`),maxCopies:A().optional().describe(`Maximum backup copies to store`)}).describe(`Backup retention policy`),wN=l({strategy:SN.default(`incremental`).describe(`Backup strategy`),schedule:o().optional().describe(`Cron expression for backup schedule (e.g., "0 2 * * *")`),retention:CN.describe(`Backup retention policy`),destination:l({type:x([`s3`,`gcs`,`azure_blob`,`local`]).describe(`Storage backend type`),bucket:o().optional().describe(`Cloud storage bucket/container name`),path:o().optional().describe(`Storage path prefix`),region:o().optional().describe(`Cloud storage region`)}).describe(`Backup storage destination`),encryption:l({enabled:v().default(!0).describe(`Enable backup encryption`),algorithm:x([`AES-256-GCM`,`AES-256-CBC`,`ChaCha20-Poly1305`]).default(`AES-256-GCM`).describe(`Encryption algorithm`),keyId:o().optional().describe(`KMS key ID for encryption`)}).optional().describe(`Backup encryption settings`),compression:l({enabled:v().default(!0).describe(`Enable backup compression`),algorithm:x([`gzip`,`zstd`,`lz4`,`snappy`]).default(`zstd`).describe(`Compression algorithm`)}).optional().describe(`Backup compression settings`),verifyAfterBackup:v().default(!0).describe(`Verify backup integrity after creation`)}).describe(`Backup configuration`),TN=x([`active_passive`,`active_active`,`pilot_light`,`warm_standby`]).describe(`Failover mode`),EN=l({mode:TN.default(`active_passive`).describe(`Failover mode`),autoFailover:v().default(!0).describe(`Enable automatic failover`),healthCheckInterval:A().default(30).describe(`Health check interval in seconds`),failureThreshold:A().default(3).describe(`Consecutive failures before failover`),regions:S(l({name:o().describe(`Region identifier (e.g., "us-east-1", "eu-west-1")`),role:x([`primary`,`secondary`,`witness`]).describe(`Region role`),endpoint:o().optional().describe(`Region endpoint URL`),priority:A().optional().describe(`Failover priority (lower = higher priority)`)})).min(2).describe(`Multi-region configuration (minimum 2 regions)`),dns:l({ttl:A().default(60).describe(`DNS TTL in seconds for failover`),provider:x([`route53`,`cloudflare`,`azure_dns`,`custom`]).optional().describe(`DNS provider for automatic failover`)}).optional().describe(`DNS failover settings`)}).describe(`Failover configuration`),DN=l({value:A().min(0).describe(`RPO value`),unit:x([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RPO time unit`)}).describe(`Recovery Point Objective (maximum acceptable data loss)`),ON=l({value:A().min(0).describe(`RTO value`),unit:x([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RTO time unit`)}).describe(`Recovery Time Objective (maximum acceptable downtime)`),pce=l({enabled:v().default(!1).describe(`Enable disaster recovery plan`),rpo:DN.describe(`Recovery Point Objective`),rto:ON.describe(`Recovery Time Objective`),backup:wN.describe(`Backup configuration`),failover:EN.optional().describe(`Multi-region failover configuration`),replication:l({mode:x([`synchronous`,`asynchronous`,`semi_synchronous`]).default(`asynchronous`).describe(`Data replication mode`),maxLagSeconds:A().optional().describe(`Maximum acceptable replication lag in seconds`),includeObjects:S(o()).optional().describe(`Objects to replicate (empty = all)`),excludeObjects:S(o()).optional().describe(`Objects to exclude from replication`)}).optional().describe(`Data replication settings`),testing:l({enabled:v().default(!1).describe(`Enable automated DR testing`),schedule:o().optional().describe(`Cron expression for DR test schedule`),notificationChannel:o().optional().describe(`Notification channel for DR test results`)}).optional().describe(`Automated disaster recovery testing`),runbookUrl:o().optional().describe(`URL to disaster recovery runbook/playbook`),contacts:S(l({name:o().describe(`Contact name`),role:o().describe(`Contact role (e.g., "DBA", "SRE Lead")`),email:o().optional().describe(`Contact email`),phone:o().optional().describe(`Contact phone`)})).optional().describe(`Emergency contact list for DR incidents`)}).describe(`Complete disaster recovery plan configuration`),kN=x([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Supported message queue backend provider`),AN=l({name:o().describe(`Topic name identifier`),partitions:A().default(1).describe(`Number of partitions for parallel consumption`),replicationFactor:A().default(1).describe(`Number of replicas for fault tolerance`),retentionMs:A().optional().describe(`Message retention period in milliseconds`),compressionType:x([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression algorithm`)}).describe(`Configuration for a message queue topic`),jN=l({groupId:o().describe(`Consumer group identifier`),autoOffsetReset:x([`earliest`,`latest`]).default(`latest`).describe(`Where to start reading when no offset exists`),enableAutoCommit:v().default(!0).describe(`Automatically commit consumed offsets`),maxPollRecords:A().default(500).describe(`Maximum records returned per poll`)}).describe(`Consumer group configuration for topic consumption`),MN=l({enabled:v().default(!1).describe(`Enable dead letter queue for failed messages`),maxRetries:A().default(3).describe(`Maximum delivery attempts before sending to DLQ`),queueName:o().describe(`Name of the dead letter queue`)}).describe(`Dead letter queue configuration for unprocessable messages`),mce=l({provider:kN.describe(`Message queue backend provider`),topics:S(AN).describe(`List of topic configurations`),consumers:S(jN).optional().describe(`Consumer group configurations`),deadLetterQueue:MN.optional().describe(`Dead letter queue for failed messages`),ssl:v().default(!1).describe(`Enable SSL/TLS for broker connections`),sasl:l({mechanism:x([`plain`,`scram-sha-256`,`scram-sha-512`]).describe(`SASL authentication mechanism`),username:o().describe(`SASL username`),password:o().describe(`SASL password`)}).optional().describe(`SASL authentication configuration`)}).describe(`Top-level message queue configuration`),NN=x([`global`,`tenant`,`user`,`session`,`temp`,`cache`,`data`,`logs`,`config`,`public`]).describe(`Storage scope classification`),PN=l({path:o().describe(`File path`),name:o().describe(`File name`),size:A().int().describe(`File size in bytes`),mimeType:o().describe(`MIME type`),lastModified:o().datetime().describe(`Last modified timestamp`),created:o().datetime().describe(`Creation timestamp`),etag:o().optional().describe(`Entity tag`)}),FN=x([`s3`,`azure_blob`,`gcs`,`minio`,`r2`,`spaces`,`wasabi`,`backblaze`,`local`]).describe(`Storage provider type`),IN=x([`private`,`public_read`,`public_read_write`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full_control`]).describe(`Storage access control level`),LN=x([`standard`,`intelligent`,`infrequent_access`,`glacier`,`deep_archive`]).describe(`Storage class/tier for cost optimization`),RN=x([`transition`,`delete`,`abort`]).describe(`Lifecycle policy action type`),hce=l({contentType:o().describe(`MIME type (e.g., image/jpeg, application/pdf)`),contentLength:A().min(0).describe(`File size in bytes`),contentEncoding:o().optional().describe(`Content encoding (e.g., gzip)`),contentDisposition:o().optional().describe(`Content disposition header`),contentLanguage:o().optional().describe(`Content language`),cacheControl:o().optional().describe(`Cache control directives`),etag:o().optional().describe(`Entity tag for versioning/caching`),lastModified:o().datetime().optional().describe(`Last modification timestamp`),versionId:o().optional().describe(`Object version identifier`),storageClass:LN.optional().describe(`Storage class/tier`),encryption:l({algorithm:o().describe(`Encryption algorithm (e.g., AES256, aws:kms)`),keyId:o().optional().describe(`KMS key ID if using managed encryption`)}).optional().describe(`Server-side encryption configuration`),custom:u(o(),o()).optional().describe(`Custom user-defined metadata`)}),gce=l({operation:x([`get`,`put`,`delete`,`head`]).describe(`Allowed operation`),expiresIn:A().min(1).max(604800).describe(`Expiration time in seconds (max 7 days)`),contentType:o().optional().describe(`Required content type for PUT operations`),maxSize:A().min(0).optional().describe(`Maximum file size in bytes for PUT operations`),responseContentType:o().optional().describe(`Override content-type for GET operations`),responseContentDisposition:o().optional().describe(`Override content-disposition for GET operations`)}),zN=l({enabled:v().default(!0).describe(`Enable multipart uploads`),partSize:A().min(5*1024*1024).max(5*1024*1024*1024).default(10*1024*1024).describe(`Part size in bytes (min 5MB, max 5GB)`),maxParts:A().min(1).max(1e4).default(1e4).describe(`Maximum number of parts (max 10,000)`),threshold:A().min(0).default(100*1024*1024).describe(`File size threshold to trigger multipart upload (bytes)`),maxConcurrent:A().min(1).max(100).default(4).describe(`Maximum concurrent part uploads`),abortIncompleteAfterDays:A().min(1).optional().describe(`Auto-abort incomplete uploads after N days`)}),BN=l({acl:IN.default(`private`).describe(`Default access control level`),allowedOrigins:S(o()).optional().describe(`CORS allowed origins`),allowedMethods:S(x([`GET`,`PUT`,`POST`,`DELETE`,`HEAD`])).optional().describe(`CORS allowed HTTP methods`),allowedHeaders:S(o()).optional().describe(`CORS allowed headers`),exposeHeaders:S(o()).optional().describe(`CORS exposed headers`),maxAge:A().min(0).optional().describe(`CORS preflight cache duration in seconds`),corsEnabled:v().default(!1).describe(`Enable CORS configuration`),publicAccess:l({allowPublicRead:v().default(!1).describe(`Allow public read access`),allowPublicWrite:v().default(!1).describe(`Allow public write access`),allowPublicList:v().default(!1).describe(`Allow public bucket listing`)}).optional().describe(`Public access control`),allowedIps:S(o()).optional().describe(`Allowed IP addresses/CIDR blocks`),blockedIps:S(o()).optional().describe(`Blocked IP addresses/CIDR blocks`)}),VN=l({id:DE.describe(`Rule identifier`),enabled:v().default(!0).describe(`Enable this rule`),action:RN.describe(`Action to perform`),prefix:o().optional().describe(`Object key prefix filter (e.g., "uploads/")`),tags:u(o(),o()).optional().describe(`Object tag filters`),daysAfterCreation:A().min(0).optional().describe(`Days after object creation`),daysAfterModification:A().min(0).optional().describe(`Days after last modification`),targetStorageClass:LN.optional().describe(`Target storage class for transition action`)}).refine(e=>!(e.action===`transition`&&!e.targetStorageClass),{message:`targetStorageClass is required when action is "transition"`}),HN=l({enabled:v().default(!1).describe(`Enable lifecycle policies`),rules:S(VN).default([]).describe(`Lifecycle rules`)}),UN=l({name:DE.describe(`Bucket identifier in ObjectStack (snake_case)`),label:o().describe(`Display label`),bucketName:o().describe(`Actual bucket/container name in storage provider`),region:o().optional().describe(`Storage region (e.g., us-east-1, westus)`),provider:FN.describe(`Storage provider`),endpoint:o().optional().describe(`Custom endpoint URL (for S3-compatible providers)`),pathStyle:v().default(!1).describe(`Use path-style URLs (for S3-compatible providers)`),versioning:v().default(!1).describe(`Enable object versioning`),encryption:l({enabled:v().default(!1).describe(`Enable server-side encryption`),algorithm:x([`AES256`,`aws:kms`,`azure:kms`,`gcp:kms`]).default(`AES256`).describe(`Encryption algorithm`),kmsKeyId:o().optional().describe(`KMS key ID for managed encryption`)}).optional().describe(`Server-side encryption configuration`),accessControl:BN.optional().describe(`Access control configuration`),lifecyclePolicy:HN.optional().describe(`Lifecycle policy configuration`),multipartConfig:zN.optional().describe(`Multipart upload configuration`),tags:u(o(),o()).optional().describe(`Bucket tags for organization`),description:o().optional().describe(`Bucket description`),enabled:v().default(!0).describe(`Enable this bucket`)}),WN=l({accessKeyId:o().optional().describe(`AWS access key ID or MinIO access key`),secretAccessKey:o().optional().describe(`AWS secret access key or MinIO secret key`),sessionToken:o().optional().describe(`AWS session token for temporary credentials`),accountName:o().optional().describe(`Azure storage account name`),accountKey:o().optional().describe(`Azure storage account key`),sasToken:o().optional().describe(`Azure SAS token`),projectId:o().optional().describe(`GCP project ID`),credentials:o().optional().describe(`GCP service account credentials JSON`),endpoint:o().optional().describe(`Custom endpoint URL`),region:o().optional().describe(`Default region`),useSSL:v().default(!0).describe(`Use SSL/TLS for connections`),timeout:A().min(0).optional().describe(`Connection timeout in milliseconds`)}),GN=l({name:DE.describe(`Storage configuration identifier`),label:o().describe(`Display label`),provider:FN.describe(`Primary storage provider`),scope:NN.optional().default(`global`).describe(`Storage scope`),connection:WN.describe(`Connection credentials`),buckets:S(UN).default([]).describe(`Configured buckets`),defaultBucket:o().optional().describe(`Default bucket name for operations`),location:o().optional().describe(`Root path (local) or base location`),quota:A().int().positive().optional().describe(`Max size in bytes`),options:u(o(),b()).optional().describe(`Provider-specific configuration options`),enabled:v().default(!0).describe(`Enable this storage configuration`),description:o().optional().describe(`Configuration description`)}),_ce=GN.parse({name:`aws_s3_storage`,label:`AWS S3 Production Storage`,provider:`s3`,connection:{accessKeyId:"${AWS_ACCESS_KEY_ID}",secretAccessKey:"${AWS_SECRET_ACCESS_KEY}",region:`us-east-1`},buckets:[{name:`user_uploads`,label:`User Uploads`,bucketName:`my-app-user-uploads`,region:`us-east-1`,provider:`s3`,versioning:!0,encryption:{enabled:!0,algorithm:`aws:kms`,kmsKeyId:"${AWS_KMS_KEY_ID}"},accessControl:{acl:`private`,corsEnabled:!0,allowedOrigins:[`https://app.example.com`],allowedMethods:[`GET`,`PUT`,`POST`]},lifecyclePolicy:{enabled:!0,rules:[{id:`archive_old_uploads`,enabled:!0,action:`transition`,daysAfterCreation:90,targetStorageClass:`glacier`}]},multipartConfig:{enabled:!0,partSize:10*1024*1024,threshold:100*1024*1024,maxConcurrent:4}}],defaultBucket:`user_uploads`,enabled:!0}),vce=GN.parse({name:`minio_local`,label:`MinIO Local Storage`,provider:`minio`,connection:{accessKeyId:`minioadmin`,secretAccessKey:`minioadmin`,endpoint:`http://localhost:9000`,useSSL:!1},buckets:[{name:`development_files`,label:`Development Files`,bucketName:`dev-files`,provider:`minio`,endpoint:`http://localhost:9000`,pathStyle:!0,accessControl:{acl:`private`}}],defaultBucket:`development_files`,enabled:!0}),yce=GN.parse({name:`azure_blob_storage`,label:`Azure Blob Storage`,provider:`azure_blob`,connection:{accountName:`mystorageaccount`,accountKey:"${AZURE_STORAGE_KEY}",endpoint:`https://mystorageaccount.blob.core.windows.net`},buckets:[{name:`media_files`,label:`Media Files`,bucketName:`media`,provider:`azure_blob`,region:`eastus`,accessControl:{acl:`public_read`,publicAccess:{allowPublicRead:!0,allowPublicWrite:!1,allowPublicList:!1}}}],defaultBucket:`media_files`,enabled:!0}),bce=GN.parse({name:`gcs_storage`,label:`Google Cloud Storage`,provider:`gcs`,connection:{projectId:`my-gcp-project`,credentials:"${GCP_SERVICE_ACCOUNT_JSON}"},buckets:[{name:`backup_storage`,label:`Backup Storage`,bucketName:`my-app-backups`,region:`us-central1`,provider:`gcs`,lifecyclePolicy:{enabled:!0,rules:[{id:`delete_old_backups`,enabled:!0,action:`delete`,daysAfterCreation:30}]}}],defaultBucket:`backup_storage`,enabled:!0}),KN=x([`elasticsearch`,`algolia`,`meilisearch`,`typesense`,`opensearch`]).describe(`Supported full-text search engine provider`),qN=l({type:x([`standard`,`simple`,`whitespace`,`keyword`,`pattern`,`language`]).describe(`Text analyzer type`),language:o().optional().describe(`Language for language-specific analysis`),stopwords:S(o()).optional().describe(`Custom stopwords to filter during analysis`),customFilters:S(o()).optional().describe(`Additional token filter names to apply`)}).describe(`Text analyzer configuration for index tokenization and normalization`),JN=l({indexName:o().describe(`Name of the search index`),objectName:o().describe(`Source ObjectQL object`),fields:S(l({name:o().describe(`Field name to index`),type:x([`text`,`keyword`,`number`,`date`,`boolean`,`geo`]).describe(`Index field data type`),analyzer:o().optional().describe(`Named analyzer to use for this field`),searchable:v().default(!0).describe(`Include field in full-text search`),filterable:v().default(!1).describe(`Allow filtering on this field`),sortable:v().default(!1).describe(`Allow sorting by this field`),boost:A().default(1).describe(`Relevance boost factor for this field`)})).describe(`Fields to include in the search index`),replicas:A().default(1).describe(`Number of index replicas for availability`),shards:A().default(1).describe(`Number of index shards for distribution`)}).describe(`Search index definition mapping an ObjectQL object to a search engine index`),YN=l({field:o().describe(`Field name to generate facets from`),maxValues:A().default(10).describe(`Maximum number of facet values to return`),sort:x([`count`,`alpha`]).default(`count`).describe(`Facet value sort order`)}).describe(`Faceted search configuration for a single field`),xce=l({provider:KN.describe(`Search engine backend provider`),indexes:S(JN).describe(`Search index definitions`),analyzers:u(o(),qN).optional().describe(`Named text analyzer configurations`),facets:S(YN).optional().describe(`Faceted search configurations`),typoTolerance:v().default(!0).describe(`Enable typo-tolerant search`),synonyms:u(o(),S(o())).optional().describe(`Synonym mappings for search expansion`),ranking:S(x([`typo`,`geo`,`words`,`filters`,`proximity`,`attribute`,`exact`,`custom`])).optional().describe(`Custom ranking rule order`)}).describe(`Top-level full-text search engine configuration`),XN=l({port:A().int().min(1).max(65535).default(3e3).describe(`Port number to listen on`),host:o().default(`0.0.0.0`).describe(`Host address to bind to`),cors:FE.optional().describe(`CORS configuration`),requestTimeout:A().int().default(3e4).describe(`Request timeout in milliseconds`),bodyLimit:o().default(`10mb`).describe(`Maximum request body size`),compression:v().default(!0).describe(`Enable response compression`),security:l({helmet:v().default(!0).describe(`Enable security headers via helmet`),rateLimit:IE.optional().describe(`Global rate limiting configuration`)}).optional().describe(`Security configuration`),static:S(LE).optional().describe(`Static file serving configuration`),trustProxy:v().default(!1).describe(`Trust X-Forwarded-* headers`)}),Sce=l({method:ME.describe(`HTTP method`),path:o().describe(`URL path pattern`),handler:o().describe(`Handler identifier or name`),metadata:l({summary:o().optional().describe(`Route summary for documentation`),description:o().optional().describe(`Route description`),tags:S(o()).optional().describe(`Tags for grouping`),operationId:o().optional().describe(`Unique operation identifier`)}).optional(),security:l({authRequired:v().default(!0).describe(`Require authentication`),permissions:S(o()).optional().describe(`Required permissions`),rateLimit:o().optional().describe(`Rate limit policy override`)}).optional()}),ZN=x([`authentication`,`authorization`,`logging`,`validation`,`transformation`,`error`,`custom`]),QN=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Middleware name (snake_case)`),type:ZN.describe(`Middleware type`),enabled:v().default(!0).describe(`Whether middleware is enabled`),order:A().int().default(100).describe(`Execution order priority`),config:u(o(),b()).optional().describe(`Middleware configuration object`),paths:l({include:S(o()).optional().describe(`Include path patterns (glob)`),exclude:S(o()).optional().describe(`Exclude path patterns (glob)`)}).optional().describe(`Path filtering`)}),$N=x([`starting`,`started`,`stopping`,`stopped`,`request`,`response`,`error`]),Cce=l({type:$N.describe(`Event type`),timestamp:o().datetime().describe(`Event timestamp (ISO 8601)`),data:u(o(),b()).optional().describe(`Event-specific data`)}),wce=l({httpVersions:S(x([`1.0`,`1.1`,`2.0`,`3.0`])).default([`1.1`]).describe(`Supported HTTP versions`),websocket:v().default(!1).describe(`WebSocket support`),sse:v().default(!1).describe(`Server-Sent Events support`),serverPush:v().default(!1).describe(`HTTP/2 Server Push support`),streaming:v().default(!0).describe(`Response streaming support`),middleware:v().default(!0).describe(`Middleware chain support`),routeParams:v().default(!0).describe(`URL parameter support (/users/:id)`),compression:v().default(!0).describe(`Built-in compression support`)}),Tce=l({state:x([`stopped`,`starting`,`running`,`stopping`,`error`]).describe(`Current server state`),uptime:A().int().optional().describe(`Server uptime in milliseconds`),server:l({port:A().int().describe(`Listening port`),host:o().describe(`Bound host`),url:o().optional().describe(`Full server URL`)}).optional(),connections:l({active:A().int().describe(`Active connections`),total:A().int().describe(`Total connections handled`)}).optional(),requests:l({total:A().int().describe(`Total requests processed`),success:A().int().describe(`Successful requests`),errors:A().int().describe(`Failed requests`)}).optional()}),Ece=Object.assign(XN,{create:e=>e}),Dce=Object.assign(QN,{create:e=>e}),eP=x(`data.create,data.read,data.update,data.delete,data.export,data.import,data.bulk_update,data.bulk_delete,auth.login,auth.login_failed,auth.logout,auth.session_created,auth.session_expired,auth.password_reset,auth.password_changed,auth.email_verified,auth.mfa_enabled,auth.mfa_disabled,auth.account_locked,auth.account_unlocked,authz.permission_granted,authz.permission_revoked,authz.role_assigned,authz.role_removed,authz.role_created,authz.role_updated,authz.role_deleted,authz.policy_created,authz.policy_updated,authz.policy_deleted,system.config_changed,system.plugin_installed,system.plugin_uninstalled,system.backup_created,system.backup_restored,system.integration_added,system.integration_removed,security.access_denied,security.suspicious_activity,security.data_breach,security.api_key_created,security.api_key_revoked`.split(`,`)),tP=x([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),nP=l({type:x([`user`,`system`,`service`,`api_client`,`integration`]).describe(`Actor type`),id:o().describe(`Actor identifier`),name:o().optional().describe(`Actor display name`),email:o().email().optional().describe(`Actor email address`),ipAddress:o().optional().describe(`Actor IP address`),userAgent:o().optional().describe(`User agent string`)}),rP=l({type:o().describe(`Target type`),id:o().describe(`Target identifier`),name:o().optional().describe(`Target display name`),metadata:u(o(),b()).optional().describe(`Target metadata`)}),iP=l({field:o().describe(`Changed field name`),oldValue:b().optional().describe(`Previous value`),newValue:b().optional().describe(`New value`)}),Oce=l({id:o().describe(`Audit event ID`),eventType:eP.describe(`Event type`),severity:tP.default(`info`).describe(`Event severity`),timestamp:o().datetime().describe(`Event timestamp`),actor:nP.describe(`Event actor`),target:rP.optional().describe(`Event target`),description:o().describe(`Event description`),changes:S(iP).optional().describe(`List of changes`),result:x([`success`,`failure`,`partial`]).default(`success`).describe(`Action result`),errorMessage:o().optional().describe(`Error message`),tenantId:o().optional().describe(`Tenant identifier`),requestId:o().optional().describe(`Request ID for tracing`),metadata:u(o(),b()).optional().describe(`Additional metadata`),location:l({country:o().optional(),region:o().optional(),city:o().optional()}).optional().describe(`Geographic location`)}),aP=l({retentionDays:A().int().min(1).default(180).describe(`Retention period in days`),archiveAfterRetention:v().default(!0).describe(`Archive logs after retention period`),archiveStorage:l({type:x([`s3`,`gcs`,`azure_blob`,`filesystem`]).describe(`Archive storage type`),endpoint:o().optional().describe(`Storage endpoint URL`),bucket:o().optional().describe(`Storage bucket/container name`),path:o().optional().describe(`Storage path prefix`),credentials:u(o(),b()).optional().describe(`Storage credentials`)}).optional().describe(`Archive storage configuration`),customRetention:u(o(),A().int().positive()).optional().describe(`Custom retention by event type`),minimumRetentionDays:A().int().positive().optional().describe(`Minimum retention for compliance`)}),oP=l({id:o().describe(`Rule identifier`),name:o().describe(`Rule name`),description:o().optional().describe(`Rule description`),enabled:v().default(!0).describe(`Rule enabled status`),eventTypes:S(eP).describe(`Event types to monitor`),condition:l({threshold:A().int().positive().describe(`Event threshold`),windowSeconds:A().int().positive().describe(`Time window in seconds`),groupBy:S(o()).optional().describe(`Grouping criteria`),filters:u(o(),b()).optional().describe(`Additional filters`)}).describe(`Detection condition`),actions:S(x([`alert`,`lock_account`,`block_ip`,`require_mfa`,`log_critical`,`webhook`])).describe(`Actions to take`),alertSeverity:tP.default(`warning`).describe(`Alert severity`),notifications:l({email:S(o().email()).optional().describe(`Email recipients`),slack:o().url().optional().describe(`Slack webhook URL`),webhook:o().url().optional().describe(`Custom webhook URL`)}).optional().describe(`Notification configuration`)}),sP=l({type:x([`database`,`elasticsearch`,`mongodb`,`clickhouse`,`s3`,`gcs`,`azure_blob`,`custom`]).describe(`Storage backend type`),connectionString:o().optional().describe(`Connection string`),config:u(o(),b()).optional().describe(`Storage-specific configuration`),bufferEnabled:v().default(!0).describe(`Enable buffering`),bufferSize:A().int().positive().default(100).describe(`Buffer size`),flushIntervalSeconds:A().int().positive().default(5).describe(`Flush interval in seconds`),compression:v().default(!0).describe(`Enable compression`)}),kce=l({eventTypes:S(eP).optional().describe(`Event types to include`),severities:S(tP).optional().describe(`Severity levels to include`),actorId:o().optional().describe(`Actor identifier`),tenantId:o().optional().describe(`Tenant identifier`),timeRange:l({from:o().datetime().describe(`Start time`),to:o().datetime().describe(`End time`)}).optional().describe(`Time range filter`),result:x([`success`,`failure`,`partial`]).optional().describe(`Result status`),searchQuery:o().optional().describe(`Search query`),customFilters:u(o(),b()).optional().describe(`Custom filters`)}),Ace=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:o().describe(`Display label`),enabled:v().default(!0).describe(`Enable audit logging`),eventTypes:S(eP).optional().describe(`Event types to audit`),excludeEventTypes:S(eP).optional().describe(`Event types to exclude`),minimumSeverity:tP.default(`info`).describe(`Minimum severity level`),storage:sP.describe(`Storage configuration`),retentionPolicy:aP.optional().describe(`Retention policy`),suspiciousActivityRules:S(oP).default([]).describe(`Suspicious activity rules`),includeSensitiveData:v().default(!1).describe(`Include sensitive data`),redactFields:S(o()).default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`]).describe(`Fields to redact`),logReads:v().default(!1).describe(`Log read operations`),readSamplingRate:A().min(0).max(1).default(.1).describe(`Read sampling rate`),logSystemEvents:v().default(!0).describe(`Log system events`),customHandlers:S(l({eventType:eP.describe(`Event type to handle`),handlerId:o().describe(`Unique identifier for the handler`)})).optional().describe(`Custom event handler references`),compliance:l({standards:S(x([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),immutableLogs:v().default(!0).describe(`Enforce immutable logs`),requireSigning:v().default(!1).describe(`Require log signing`),signingKey:o().optional().describe(`Signing key`)}).optional().describe(`Compliance configuration`)}),jce=[{id:`multiple_failed_logins`,name:`Multiple Failed Login Attempts`,description:`Detects multiple failed login attempts from the same user or IP`,enabled:!0,eventTypes:[`auth.login_failed`],condition:{threshold:5,windowSeconds:600,groupBy:[`actor.id`,`actor.ipAddress`]},actions:[`alert`,`lock_account`],alertSeverity:`warning`},{id:`bulk_data_export`,name:`Bulk Data Export`,description:`Detects large data export operations`,enabled:!0,eventTypes:[`data.export`],condition:{threshold:3,windowSeconds:3600,groupBy:[`actor.id`]},actions:[`alert`,`log_critical`],alertSeverity:`warning`},{id:`suspicious_permission_changes`,name:`Rapid Permission Changes`,description:`Detects rapid permission or role changes`,enabled:!0,eventTypes:[`authz.permission_granted`,`authz.role_assigned`],condition:{threshold:10,windowSeconds:300,groupBy:[`actor.id`]},actions:[`alert`,`log_critical`],alertSeverity:`critical`},{id:`after_hours_access`,name:`After Hours Access`,description:`Detects access during non-business hours`,enabled:!1,eventTypes:[`auth.login`],condition:{threshold:1,windowSeconds:86400},actions:[`alert`],alertSeverity:`notice`}],cP=x([`debug`,`info`,`warn`,`error`,`fatal`,`silent`]).describe(`Log severity level`),lP=x([`json`,`text`,`pretty`]).describe(`Log output format`),uP=l({name:o().optional().describe(`Logger name identifier`),level:cP.optional().default(`info`),format:lP.optional().default(`json`),redact:S(o()).optional().default([`password`,`token`,`secret`,`key`]).describe(`Keys to redact from log context`),sourceLocation:v().optional().default(!1).describe(`Include file and line number`),file:o().optional().describe(`Path to log file`),rotation:l({maxSize:o().optional().default(`10m`),maxFiles:A().optional().default(5)}).optional()}),Mce=l({timestamp:o().datetime().describe(`ISO 8601 timestamp`),level:cP,message:o().describe(`Log message`),context:u(o(),b()).optional().describe(`Structured context data`),error:u(o(),b()).optional().describe(`Error object if present`),traceId:o().optional().describe(`Distributed trace ID`),spanId:o().optional().describe(`Span ID`),service:o().optional().describe(`Service name`),component:o().optional().describe(`Component name (e.g. plugin id)`)}),dP=x([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]).describe(`Extended log severity level`),fP=x([`console`,`file`,`syslog`,`elasticsearch`,`cloudwatch`,`stackdriver`,`azure_monitor`,`datadog`,`splunk`,`loki`,`http`,`kafka`,`redis`,`custom`]).describe(`Log destination type`),pP=l({stream:x([`stdout`,`stderr`]).optional().default(`stdout`),colors:v().optional().default(!0),prettyPrint:v().optional().default(!1)}).describe(`Console destination configuration`),mP=l({path:o().describe(`Log file path`),rotation:l({maxSize:o().optional().default(`10m`),maxFiles:A().int().positive().optional().default(5),compress:v().optional().default(!0),interval:x([`hourly`,`daily`,`weekly`,`monthly`]).optional()}).optional(),encoding:o().optional().default(`utf8`),append:v().optional().default(!0)}).describe(`File destination configuration`),hP=l({url:o().url().describe(`HTTP endpoint URL`),method:x([`POST`,`PUT`]).optional().default(`POST`),headers:u(o(),o()).optional(),auth:l({type:x([`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:o().optional(),password:o().optional(),token:o().optional(),apiKey:o().optional(),apiKeyHeader:o().optional().default(`X-API-Key`)}).optional(),batch:l({maxSize:A().int().positive().optional().default(100),flushInterval:A().int().positive().optional().default(5e3)}).optional(),retry:l({maxAttempts:A().int().positive().optional().default(3),initialDelay:A().int().positive().optional().default(1e3),backoffMultiplier:A().positive().optional().default(2)}).optional(),timeout:A().int().positive().optional().default(3e4)}).describe(`HTTP destination configuration`),gP=l({endpoint:o().url().optional(),region:o().optional(),credentials:l({accessKeyId:o().optional(),secretAccessKey:o().optional(),apiKey:o().optional(),projectId:o().optional()}).optional(),logGroup:o().optional(),logStream:o().optional(),index:o().optional(),config:u(o(),b()).optional()}).describe(`External service destination configuration`),_P=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Destination name (snake_case)`),type:fP.describe(`Destination type`),level:dP.optional().default(`info`),enabled:v().optional().default(!0),console:pP.optional(),file:mP.optional(),http:hP.optional(),externalService:gP.optional(),format:x([`json`,`text`,`pretty`]).optional().default(`json`),filterId:o().optional().describe(`Filter function identifier`)}).describe(`Log destination configuration`),vP=l({staticFields:u(o(),b()).optional().describe(`Static fields added to every log`),dynamicEnrichers:S(o()).optional().describe(`Dynamic enricher function IDs`),addHostname:v().optional().default(!0),addProcessId:v().optional().default(!0),addEnvironment:v().optional().default(!0),addTimestampFormats:l({unix:v().optional().default(!1),iso:v().optional().default(!0)}).optional(),addCaller:v().optional().default(!1),addCorrelationIds:v().optional().default(!0)}).describe(`Log enrichment configuration`),Nce=l({timestamp:o().datetime().describe(`ISO 8601 timestamp`),level:dP.describe(`Log severity level`),message:o().describe(`Log message`),context:u(o(),b()).optional().describe(`Structured context`),error:l({name:o().optional(),message:o().optional(),stack:o().optional(),code:o().optional(),details:u(o(),b()).optional()}).optional().describe(`Error details`),trace:l({traceId:o().describe(`Trace ID`),spanId:o().describe(`Span ID`),parentSpanId:o().optional().describe(`Parent span ID`),traceFlags:A().int().optional().describe(`Trace flags`)}).optional().describe(`Distributed tracing context`),source:l({service:o().optional().describe(`Service name`),component:o().optional().describe(`Component name`),file:o().optional().describe(`Source file`),line:A().int().optional().describe(`Line number`),function:o().optional().describe(`Function name`)}).optional().describe(`Source information`),host:l({hostname:o().optional(),pid:A().int().optional(),ip:o().optional()}).optional().describe(`Host information`),environment:o().optional().describe(`Environment (e.g., production, staging)`),user:l({id:o().optional(),username:o().optional(),email:o().optional()}).optional().describe(`User context`),request:l({id:o().optional(),method:o().optional(),path:o().optional(),userAgent:o().optional(),ip:o().optional()}).optional().describe(`Request context`),labels:u(o(),o()).optional().describe(`Custom labels`),metadata:u(o(),b()).optional().describe(`Additional metadata`)}).describe(`Structured log entry`),Pce=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:o().describe(`Display label`),enabled:v().optional().default(!0),level:dP.optional().default(`info`),default:uP.optional().describe(`Default logger configuration`),loggers:u(o(),uP).optional().describe(`Named logger configurations`),destinations:S(_P).describe(`Log destinations`),enrichment:vP.optional(),redact:S(o()).optional().default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`,`authorization`]).describe(`Fields to redact`),sampling:l({enabled:v().optional().default(!1),rate:A().min(0).max(1).optional().default(1),rateByLevel:u(o(),A().min(0).max(1)).optional()}).optional(),buffer:l({enabled:v().optional().default(!0),size:A().int().positive().optional().default(1e3),flushInterval:A().int().positive().optional().default(1e3),flushOnShutdown:v().optional().default(!0)}).optional(),performance:l({async:v().optional().default(!0),workers:A().int().positive().optional().default(1)}).optional()}).describe(`Logging configuration`),yP=x([`counter`,`gauge`,`histogram`,`summary`]).describe(`Metric type`),bP=x([`nanoseconds`,`microseconds`,`milliseconds`,`seconds`,`minutes`,`hours`,`days`,`bytes`,`kilobytes`,`megabytes`,`gigabytes`,`terabytes`,`requests_per_second`,`events_per_second`,`bytes_per_second`,`percent`,`ratio`,`count`,`operations`,`custom`]).describe(`Metric unit`),xP=x([`sum`,`avg`,`min`,`max`,`count`,`p50`,`p75`,`p90`,`p95`,`p99`,`p999`,`rate`,`stddev`]).describe(`Metric aggregation type`),SP=l({type:x([`linear`,`exponential`,`explicit`]).describe(`Bucket type`),linear:l({start:A().describe(`Start value`),width:A().positive().describe(`Bucket width`),count:A().int().positive().describe(`Number of buckets`)}).optional(),exponential:l({start:A().positive().describe(`Start value`),factor:A().positive().describe(`Growth factor`),count:A().int().positive().describe(`Number of buckets`)}).optional(),explicit:l({boundaries:S(A()).describe(`Bucket boundaries`)}).optional()}).describe(`Histogram bucket configuration`),CP=u(o(),o()).describe(`Metric labels`),wP=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Metric name (snake_case)`),label:o().optional().describe(`Display label`),type:yP.describe(`Metric type`),unit:bP.optional().describe(`Metric unit`),description:o().optional().describe(`Metric description`),labelNames:S(o()).optional().default([]).describe(`Label names`),histogram:SP.optional(),summary:l({quantiles:S(A().min(0).max(1)).optional().default([.5,.9,.99]),maxAge:A().int().positive().optional().default(600),ageBuckets:A().int().positive().optional().default(5)}).optional(),enabled:v().optional().default(!0)}).describe(`Metric definition`),Fce=l({name:o().describe(`Metric name`),type:yP.describe(`Metric type`),timestamp:o().datetime().describe(`Observation timestamp`),value:A().optional().describe(`Metric value`),labels:CP.optional().describe(`Metric labels`),histogram:l({count:A().int().nonnegative().describe(`Total count`),sum:A().describe(`Sum of all values`),buckets:S(l({upperBound:A().describe(`Upper bound of bucket`),count:A().int().nonnegative().describe(`Count in bucket`)})).describe(`Histogram buckets`)}).optional(),summary:l({count:A().int().nonnegative().describe(`Total count`),sum:A().describe(`Sum of all values`),quantiles:S(l({quantile:A().min(0).max(1).describe(`Quantile (0-1)`),value:A().describe(`Quantile value`)})).describe(`Summary quantiles`)}).optional()}).describe(`Metric data point`),TP=l({timestamp:o().datetime().describe(`Timestamp`),value:A().describe(`Value`),labels:u(o(),o()).optional().describe(`Labels`)}).describe(`Time series data point`),Ice=l({name:o().describe(`Series name`),labels:u(o(),o()).optional().describe(`Series labels`),dataPoints:S(TP).describe(`Data points`),startTime:o().datetime().optional().describe(`Start time`),endTime:o().datetime().optional().describe(`End time`)}).describe(`Time series`),EP=l({type:xP.describe(`Aggregation type`),window:l({size:A().int().positive().describe(`Window size in seconds`),sliding:v().optional().default(!1),slideInterval:A().int().positive().optional()}).optional(),groupBy:S(o()).optional().describe(`Group by label names`),filters:u(o(),b()).optional().describe(`Filter criteria`)}).describe(`Metric aggregation configuration`),DP=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLI name (snake_case)`),label:o().describe(`Display label`),description:o().optional().describe(`SLI description`),metric:o().describe(`Base metric name`),type:x([`availability`,`latency`,`throughput`,`error_rate`,`saturation`,`custom`]).describe(`SLI type`),successCriteria:l({threshold:A().describe(`Threshold value`),operator:x([`lt`,`lte`,`gt`,`gte`,`eq`]).describe(`Comparison operator`),percentile:A().min(0).max(1).optional().describe(`Percentile (0-1)`)}).describe(`Success criteria`),window:l({size:A().int().positive().describe(`Window size in seconds`),rolling:v().optional().default(!0)}).describe(`Measurement window`),enabled:v().optional().default(!0)}).describe(`Service Level Indicator`),OP=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLO name (snake_case)`),label:o().describe(`Display label`),description:o().optional().describe(`SLO description`),sli:o().describe(`SLI name`),target:A().min(0).max(100).describe(`Target percentage`),period:l({type:x([`rolling`,`calendar`]).describe(`Period type`),duration:A().int().positive().optional().describe(`Duration in seconds`),calendar:x([`daily`,`weekly`,`monthly`,`quarterly`,`yearly`]).optional()}).describe(`Time period`),errorBudget:l({enabled:v().optional().default(!0),alertThreshold:A().min(0).max(100).optional().default(80),burnRateWindows:S(l({window:A().int().positive().describe(`Window size`),threshold:A().positive().describe(`Burn rate threshold`)})).optional()}).optional(),alerts:S(l({name:o().describe(`Alert name`),severity:x([`info`,`warning`,`critical`]).describe(`Alert severity`),condition:l({type:x([`slo_breach`,`error_budget`,`burn_rate`]).describe(`Condition type`),threshold:A().optional().describe(`Threshold value`)}).describe(`Alert condition`)})).optional().default([]),enabled:v().optional().default(!0)}).describe(`Service Level Objective`),kP=l({type:x([`prometheus`,`openmetrics`,`graphite`,`statsd`,`influxdb`,`datadog`,`cloudwatch`,`stackdriver`,`azure_monitor`,`http`,`custom`]).describe(`Export type`),endpoint:o().optional().describe(`Export endpoint`),interval:A().int().positive().optional().default(60),batch:l({enabled:v().optional().default(!0),size:A().int().positive().optional().default(1e3)}).optional(),auth:l({type:x([`none`,`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:o().optional(),password:o().optional(),token:o().optional(),apiKey:o().optional()}).optional(),config:u(o(),b()).optional().describe(`Additional configuration`)}).describe(`Metric export configuration`),Lce=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:o().describe(`Display label`),enabled:v().optional().default(!0),metrics:S(wP).optional().default([]),defaultLabels:CP.optional().default({}),aggregations:S(EP).optional().default([]),slis:S(DP).optional().default([]),slos:S(OP).optional().default([]),exports:S(kP).optional().default([]),collectionInterval:A().int().positive().optional().default(15),retention:l({period:A().int().positive().optional().default(604800),downsampling:S(l({afterSeconds:A().int().positive().describe(`Downsample after seconds`),resolution:A().int().positive().describe(`Downsampled resolution`)})).optional()}).optional(),cardinalityLimits:l({maxLabelCombinations:A().int().positive().optional().default(1e4),onLimitExceeded:x([`drop`,`sample`,`alert`]).optional().default(`alert`)}).optional()}).describe(`Metrics configuration`),AP=l({entries:u(o(),o()).describe(`Trace state entries`)}).describe(`Trace state`),jP=A().int().min(0).max(255).describe(`Trace flags bitmap`),MP=l({traceId:o().regex(/^[0-9a-f]{32}$/).describe(`Trace ID (32 hex chars)`),spanId:o().regex(/^[0-9a-f]{16}$/).describe(`Span ID (16 hex chars)`),traceFlags:jP.optional().default(1),traceState:AP.optional(),parentSpanId:o().regex(/^[0-9a-f]{16}$/).optional().describe(`Parent span ID (16 hex chars)`),sampled:v().optional().default(!0),remote:v().optional().default(!1)}).describe(`Trace context (W3C Trace Context)`),NP=x([`internal`,`server`,`client`,`producer`,`consumer`]).describe(`Span kind`),PP=x([`unset`,`ok`,`error`]).describe(`Span status`),FP=c([o(),A(),v(),S(o()),S(A()),S(v())]).describe(`Span attribute value`),IP=u(o(),FP).describe(`Span attributes`),LP=l({name:o().describe(`Event name`),timestamp:o().datetime().describe(`Event timestamp`),attributes:IP.optional().describe(`Event attributes`)}).describe(`Span event`),RP=l({context:MP.describe(`Linked trace context`),attributes:IP.optional().describe(`Link attributes`)}).describe(`Span link`),Rce=l({context:MP.describe(`Trace context`),name:o().describe(`Span name`),kind:NP.optional().default(`internal`),startTime:o().datetime().describe(`Span start time`),endTime:o().datetime().optional().describe(`Span end time`),duration:A().nonnegative().optional().describe(`Duration in milliseconds`),status:l({code:PP.describe(`Status code`),message:o().optional().describe(`Status message`)}).optional(),attributes:IP.optional().default({}),events:S(LP).optional().default([]),links:S(RP).optional().default([]),resource:IP.optional().describe(`Resource attributes`),instrumentationLibrary:l({name:o().describe(`Library name`),version:o().optional().describe(`Library version`)}).optional()}).describe(`OpenTelemetry span`),zP=x([`drop`,`record_only`,`record_and_sample`]).describe(`Sampling decision`),BP=x([`always_on`,`always_off`,`trace_id_ratio`,`rate_limiting`,`parent_based`,`probability`,`composite`,`custom`]).describe(`Sampling strategy type`),VP=l({type:BP.describe(`Sampling strategy`),ratio:A().min(0).max(1).optional().describe(`Sample ratio (0-1)`),rateLimit:A().positive().optional().describe(`Traces per second`),parentBased:l({whenParentSampled:BP.optional().default(`always_on`),whenParentNotSampled:BP.optional().default(`always_off`),root:BP.optional().default(`trace_id_ratio`),rootRatio:A().min(0).max(1).optional().default(.1)}).optional(),composite:S(l({strategy:BP.describe(`Strategy type`),ratio:A().min(0).max(1).optional(),condition:u(o(),b()).optional().describe(`Condition for this strategy`)})).optional(),rules:S(l({name:o().describe(`Rule name`),match:l({service:o().optional(),spanName:o().optional(),attributes:u(o(),b()).optional()}).optional(),decision:zP.describe(`Sampling decision`),rate:A().min(0).max(1).optional()})).optional().default([]),customSamplerId:o().optional().describe(`Custom sampler identifier`)}).describe(`Trace sampling configuration`),HP=x([`w3c`,`b3`,`b3_multi`,`jaeger`,`xray`,`ottrace`,`custom`]).describe(`Trace propagation format`),UP=l({formats:S(HP).optional().default([`w3c`]),extract:v().optional().default(!0),inject:v().optional().default(!0),headers:l({traceId:o().optional(),spanId:o().optional(),traceFlags:o().optional(),traceState:o().optional()}).optional(),baggage:l({enabled:v().optional().default(!0),maxSize:A().int().positive().optional().default(8192),allowedKeys:S(o()).optional()}).optional()}).describe(`Trace context propagation`),WP=x([`otlp_http`,`otlp_grpc`,`jaeger`,`zipkin`,`console`,`datadog`,`honeycomb`,`lightstep`,`newrelic`,`custom`]).describe(`OpenTelemetry exporter type`),GP=l({sdkVersion:o().optional().describe(`OTel SDK version`),exporter:l({type:WP.describe(`Exporter type`),endpoint:o().url().optional().describe(`Exporter endpoint`),protocol:o().optional().describe(`Protocol version`),headers:u(o(),o()).optional().describe(`HTTP headers`),timeout:A().int().positive().optional().default(1e4),compression:x([`none`,`gzip`]).optional().default(`none`),batch:l({maxBatchSize:A().int().positive().optional().default(512),maxQueueSize:A().int().positive().optional().default(2048),exportTimeout:A().int().positive().optional().default(3e4),scheduledDelay:A().int().positive().optional().default(5e3)}).optional()}).describe(`Exporter configuration`),resource:l({serviceName:o().describe(`Service name`),serviceVersion:o().optional().describe(`Service version`),serviceInstanceId:o().optional().describe(`Service instance ID`),serviceNamespace:o().optional().describe(`Service namespace`),deploymentEnvironment:o().optional().describe(`Deployment environment`),attributes:IP.optional().describe(`Additional resource attributes`)}).describe(`Resource attributes`),instrumentation:l({autoInstrumentation:v().optional().default(!0),libraries:S(o()).optional().describe(`Enabled libraries`),disabledLibraries:S(o()).optional().describe(`Disabled libraries`)}).optional(),semanticConventionsVersion:o().optional().describe(`Semantic conventions version`)}).describe(`OpenTelemetry compatibility configuration`),KP=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:o().describe(`Display label`),enabled:v().optional().default(!0),sampling:VP.optional().default({type:`always_on`,rules:[]}),propagation:UP.optional().default({formats:[`w3c`],extract:!0,inject:!0}),openTelemetry:GP.optional(),spanLimits:l({maxAttributes:A().int().positive().optional().default(128),maxEvents:A().int().positive().optional().default(128),maxLinks:A().int().positive().optional().default(128),maxAttributeValueLength:A().int().positive().optional().default(4096)}).optional(),traceIdGenerator:x([`random`,`uuid`,`custom`]).optional().default(`random`),customTraceIdGeneratorId:o().optional().describe(`Custom generator identifier`),performance:l({asyncExport:v().optional().default(!0),exportInterval:A().int().positive().optional().default(5e3)}).optional()}).describe(`Tracing configuration`),qP=x([`pii`,`phi`,`pci`,`financial`,`confidential`,`internal`,`public`]).describe(`Data classification level`),JP=x([`gdpr`,`hipaa`,`sox`,`pci_dss`,`ccpa`,`iso27001`]).describe(`Compliance framework identifier`),YP=l({framework:JP.describe(`Compliance framework identifier`),requiredEvents:S(o()).describe(`Audit event types required by this framework (e.g., "data.delete", "auth.login")`),retentionDays:A().min(1).describe(`Minimum audit log retention period required by this framework (in days)`),alertOnMissing:v().default(!0).describe(`Raise alert if a required audit event is not being captured`)}).describe(`Compliance framework audit event requirements`),XP=l({framework:JP.describe(`Compliance framework identifier`),dataClassifications:S(qP).describe(`Data classifications that must be encrypted under this framework`),minimumAlgorithm:x([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).default(`aes-256-gcm`).describe(`Minimum encryption algorithm strength required`),keyRotationMaxDays:A().min(1).default(90).describe(`Maximum key rotation interval required (in days)`)}).describe(`Compliance framework encryption requirements`),ZP=l({dataClassification:qP.describe(`Data classification this rule applies to`),defaultMasked:v().default(!0).describe(`Whether data is masked by default`),unmaskRoles:S(o()).optional().describe(`Roles allowed to view unmasked data`),auditUnmask:v().default(!0).describe(`Log an audit event when data is unmasked`),requireApproval:v().default(!1).describe(`Require explicit approval before unmasking`),approvalRoles:S(o()).optional().describe(`Roles that can approve unmasking requests`)}).describe(`Masking visibility and audit rule per data classification`),QP=l({enabled:v().default(!0).describe(`Enable cross-subsystem security event correlation`),correlationId:v().default(!0).describe(`Inject a shared correlation ID into audit, encryption, and masking events`),linkAuthToAudit:v().default(!0).describe(`Link authentication events to subsequent data operation audit trails`),linkEncryptionToAudit:v().default(!0).describe(`Log encryption/decryption operations in the audit trail`),linkMaskingToAudit:v().default(!0).describe(`Log masking/unmasking operations in the audit trail`)}).describe(`Cross-subsystem security event correlation configuration`),$P=l({classification:qP.describe(`Data classification level`),requireEncryption:v().default(!1).describe(`Encryption required for this classification`),requireMasking:v().default(!1).describe(`Masking required for this classification`),requireAudit:v().default(!1).describe(`Audit trail required for access to this classification`),retentionDays:A().optional().describe(`Data retention limit in days (for compliance)`)}).describe(`Security policy for a specific data classification level`),eF=l({enabled:v().default(!0).describe(`Enable unified security context governance`),complianceAuditRequirements:S(YP).optional().describe(`Compliance-driven audit event requirements`),complianceEncryptionRequirements:S(XP).optional().describe(`Compliance-driven encryption requirements by data classification`),maskingVisibility:S(ZP).optional().describe(`Masking visibility rules per data classification`),dataClassifications:S($P).optional().describe(`Data classification policies for unified security enforcement`),eventCorrelation:QP.optional().describe(`Cross-subsystem security event correlation settings`),enforceOnWrite:v().default(!0).describe(`Enforce encryption and masking requirements on data write operations`),enforceOnRead:v().default(!0).describe(`Enforce masking and audit requirements on data read operations`),failOpen:v().default(!1).describe(`When false (default), deny access if security context cannot be evaluated`)}).describe(`Unified security context governance configuration`),tF=x([`standard`,`normal`,`emergency`,`major`]),nF=x([`critical`,`high`,`medium`,`low`]),rF=x([`draft`,`submitted`,`in-review`,`approved`,`scheduled`,`in-progress`,`completed`,`failed`,`rolled-back`,`cancelled`]),iF=l({level:x([`low`,`medium`,`high`,`critical`]).describe(`Impact level`),affectedSystems:S(o()).describe(`Affected systems`),affectedUsers:A().optional().describe(`Affected user count`),downtime:l({required:v().describe(`Downtime required`),durationMinutes:A().optional().describe(`Downtime duration`)}).optional().describe(`Downtime information`)}),aF=l({description:o().describe(`Rollback description`),steps:S(l({order:A().describe(`Step order`),description:o().describe(`Step description`),estimatedMinutes:A().describe(`Estimated duration`)})).describe(`Rollback steps`),testProcedure:o().optional().describe(`Test procedure`)}),oF=l({id:o().describe(`Change request ID`),title:o().describe(`Change title`),description:o().describe(`Change description`),type:tF.describe(`Change type`),priority:nF.describe(`Change priority`),status:rF.describe(`Change status`),requestedBy:o().describe(`Requester user ID`),requestedAt:A().describe(`Request timestamp`),impact:iF.describe(`Impact assessment`),implementation:l({description:o().describe(`Implementation description`),steps:S(l({order:A().describe(`Step order`),description:o().describe(`Step description`),estimatedMinutes:A().describe(`Estimated duration`)})).describe(`Implementation steps`),testing:o().optional().describe(`Testing procedure`)}).describe(`Implementation plan`),rollbackPlan:aF.describe(`Rollback plan`),schedule:l({plannedStart:A().describe(`Planned start time`),plannedEnd:A().describe(`Planned end time`),actualStart:A().optional().describe(`Actual start time`),actualEnd:A().optional().describe(`Actual end time`)}).optional().describe(`Schedule`),securityImpact:l({assessed:v().describe(`Whether security impact has been assessed`),riskLevel:x([`none`,`low`,`medium`,`high`,`critical`]).optional().describe(`Security risk level`),affectedDataClassifications:S(qP).optional().describe(`Affected data classifications`),requiresSecurityApproval:v().default(!1).describe(`Whether security team approval is required`),reviewedBy:o().optional().describe(`Security reviewer user ID`),reviewedAt:A().optional().describe(`Security review timestamp`),reviewNotes:o().optional().describe(`Security review notes or conditions`)}).optional().describe(`Security impact assessment per ISO 27001:2022 A.8.32`),approval:l({required:v().describe(`Approval required`),approvers:S(l({userId:o().describe(`Approver user ID`),approvedAt:A().optional().describe(`Approval timestamp`),comments:o().optional().describe(`Approver comments`)})).describe(`Approvers`)}).optional().describe(`Approval workflow`),attachments:S(l({name:o().describe(`Attachment name`),url:o().url().describe(`Attachment URL`)})).optional().describe(`Attachments`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}),sF=l({type:p(`add_field`),objectName:o().describe(`Target object name`),fieldName:o().describe(`Name of the field to add`),field:tD.describe(`Full field definition to add`)}).describe(`Add a new field to an existing object`),cF=l({type:p(`modify_field`),objectName:o().describe(`Target object name`),fieldName:o().describe(`Name of the field to modify`),changes:u(o(),b()).describe(`Partial field definition updates`)}).describe(`Modify properties of an existing field`),lF=l({type:p(`remove_field`),objectName:o().describe(`Target object name`),fieldName:o().describe(`Name of the field to remove`)}).describe(`Remove a field from an existing object`),uF=l({type:p(`create_object`),object:mO.describe(`Full object definition to create`)}).describe(`Create a new object`),dF=l({type:p(`rename_object`),oldName:o().describe(`Current object name`),newName:o().describe(`New object name`)}).describe(`Rename an existing object`),fF=l({type:p(`delete_object`),objectName:o().describe(`Name of the object to delete`)}).describe(`Delete an existing object`),pF=l({type:p(`execute_sql`),sql:o().describe(`Raw SQL statement to execute`),description:o().optional().describe(`Human-readable description of the SQL`)}).describe(`Execute a raw SQL statement`),mF=d(`type`,[sF,cF,lF,uF,dF,fF,pF]),hF=l({migrationId:o().describe(`ID of the migration this depends on`),package:o().optional().describe(`Package that owns the dependency migration`)}).describe(`Dependency reference to another migration that must run first`),gF=l({id:o().uuid().describe(`Unique identifier for this change set`),name:o().describe(`Human readable name for the migration`),description:o().optional().describe(`Detailed description of what this migration does`),author:o().optional().describe(`Author who created this migration`),createdAt:o().datetime().optional().describe(`ISO 8601 timestamp when the migration was created`),dependencies:S(hF).optional().describe(`Migrations that must run before this one`),operations:S(mF).describe(`Ordered list of atomic migration operations`),rollback:S(mF).optional().describe(`Operations to reverse this migration`)}).describe(`A versioned set of atomic schema migration operations`),_F=l({id:o().describe(`Provider ID (github, google)`),clientId:o().describe(`OAuth Client ID`),clientSecret:o().describe(`OAuth Client Secret`),scope:S(o()).optional().describe(`Requested permissions`)}),vF=l({organization:v().default(!1).describe(`Enable Organization/Teams support`),twoFactor:v().default(!1).describe(`Enable 2FA`),passkeys:v().default(!1).describe(`Enable Passkey support`),magicLink:v().default(!1).describe(`Enable Magic Link login`)}),yF=l({enabled:v().default(!1).describe(`Enable mutual TLS authentication`),clientCertRequired:v().default(!1).describe(`Require client certificates for all connections`),trustedCAs:S(o()).describe(`PEM-encoded CA certificates or file paths`),crlUrl:o().optional().describe(`Certificate Revocation List (CRL) URL`),ocspUrl:o().optional().describe(`Online Certificate Status Protocol (OCSP) URL`),certificateValidation:x([`strict`,`relaxed`,`none`]).describe(`Certificate validation strictness level`),allowedCNs:S(o()).optional().describe(`Allowed Common Names (CN) on client certificates`),allowedOUs:S(o()).optional().describe(`Allowed Organizational Units (OU) on client certificates`),pinning:l({enabled:v().describe(`Enable certificate pinning`),pins:S(o()).describe(`Pinned certificate hashes`)}).optional().describe(`Certificate pinning configuration`)}),bF=u(o(),l({clientId:o().describe(`OAuth Client ID`),clientSecret:o().describe(`OAuth Client Secret`),enabled:v().optional().default(!0).describe(`Enable this provider`),scope:S(o()).optional().describe(`Additional OAuth scopes`)}).catchall(b())).optional().describe(`Social/OAuth provider map forwarded to better-auth socialProviders. Keys are provider ids (google, github, apple, …).`),xF=l({enabled:v().default(!0).describe(`Enable email/password auth`),disableSignUp:v().optional().describe(`Disable new user registration via email/password`),requireEmailVerification:v().optional().describe(`Require email verification before creating a session`),minPasswordLength:A().optional().describe(`Minimum password length (default 8)`),maxPasswordLength:A().optional().describe(`Maximum password length (default 128)`),resetPasswordTokenExpiresIn:A().optional().describe(`Reset-password token TTL in seconds (default 3600)`),autoSignIn:v().optional().describe(`Auto sign-in after sign-up (default true)`),revokeSessionsOnPasswordReset:v().optional().describe(`Revoke all other sessions on password reset`)}).optional().describe(`Email and password authentication options forwarded to better-auth`),SF=l({sendOnSignUp:v().optional().describe(`Automatically send verification email after sign-up`),sendOnSignIn:v().optional().describe(`Send verification email on sign-in when not yet verified`),autoSignInAfterVerification:v().optional().describe(`Auto sign-in the user after email verification`),expiresIn:A().optional().describe(`Verification token TTL in seconds (default 3600)`)}).optional().describe(`Email verification options forwarded to better-auth`),CF=l({crossSubDomainCookies:l({enabled:v().describe(`Enable cross-subdomain cookies`),additionalCookies:S(o()).optional().describe(`Extra cookies shared across subdomains`),domain:o().optional().describe(`Cookie domain override — defaults to root domain derived from baseUrl`)}).optional().describe(`Share auth cookies across subdomains (critical for *.example.com multi-tenant)`),useSecureCookies:v().optional().describe(`Force Secure flag on cookies`),disableCSRFCheck:v().optional().describe(`⚠ Disable CSRF check — security risk, use with caution`),cookiePrefix:o().optional().describe(`Prefix for auth cookie names`)}).optional().describe(`Advanced / low-level Better-Auth options`),wF=l({secret:o().optional().describe(`Encryption secret`),baseUrl:o().optional().describe(`Base URL for auth routes`),databaseUrl:o().optional().describe(`Database connection string`),providers:S(_F).optional(),plugins:vF.optional(),session:l({expiresIn:A().default(3600*24*7).describe(`Session duration in seconds`),updateAge:A().default(3600*24).describe(`Session update frequency`)}).optional(),trustedOrigins:S(o()).optional().describe(`Trusted origins for CSRF protection. Supports wildcards (e.g. "https://*.example.com"). The baseUrl origin is always trusted implicitly.`),socialProviders:bF,emailAndPassword:xF,emailVerification:SF,advanced:CF,mutualTls:yF.optional().describe(`Mutual TLS (mTLS) configuration`)}).catchall(b()),TF=l({enabled:v().describe(`Enable GDPR compliance controls`),dataSubjectRights:l({rightToAccess:v().default(!0).describe(`Allow data subjects to access their data`),rightToRectification:v().default(!0).describe(`Allow data subjects to correct their data`),rightToErasure:v().default(!0).describe(`Allow data subjects to request deletion`),rightToRestriction:v().default(!0).describe(`Allow data subjects to restrict processing`),rightToPortability:v().default(!0).describe(`Allow data subjects to export their data`),rightToObjection:v().default(!0).describe(`Allow data subjects to object to processing`)}).describe(`Data subject rights configuration per GDPR Articles 15-21`),legalBasis:x([`consent`,`contract`,`legal-obligation`,`vital-interests`,`public-task`,`legitimate-interests`]).describe(`Legal basis for data processing under GDPR Article 6`),consentTracking:v().default(!0).describe(`Track and record user consent`),dataRetentionDays:A().optional().describe(`Maximum data retention period in days`),dataProcessingAgreement:o().optional().describe(`URL or reference to the data processing agreement`)}).describe(`GDPR (General Data Protection Regulation) compliance configuration`),EF=l({enabled:v().describe(`Enable HIPAA compliance controls`),phi:l({encryption:v().default(!0).describe(`Encrypt Protected Health Information at rest`),accessControl:v().default(!0).describe(`Enforce role-based access to PHI`),auditTrail:v().default(!0).describe(`Log all PHI access events`),backupAndRecovery:v().default(!0).describe(`Enable PHI backup and disaster recovery`)}).describe(`Protected Health Information safeguards`),businessAssociateAgreement:v().default(!1).describe(`BAA is in place with third-party processors`)}).describe(`HIPAA (Health Insurance Portability and Accountability Act) compliance configuration`),DF=l({enabled:v().describe(`Enable PCI-DSS compliance controls`),level:x([`1`,`2`,`3`,`4`]).describe(`PCI-DSS compliance level (1 = highest)`),cardDataFields:S(o()).describe(`Field names containing cardholder data`),tokenization:v().default(!0).describe(`Replace card data with secure tokens`),encryptionInTransit:v().default(!0).describe(`Encrypt cardholder data during transmission`),encryptionAtRest:v().default(!0).describe(`Encrypt stored cardholder data`)}).describe(`PCI-DSS (Payment Card Industry Data Security Standard) compliance configuration`),OF=l({enabled:v().default(!0).describe(`Enable audit logging`),retentionDays:A().default(365).describe(`Number of days to retain audit logs`),immutable:v().default(!0).describe(`Prevent modification or deletion of audit logs`),signLogs:v().default(!1).describe(`Cryptographically sign log entries for tamper detection`),events:S(x([`create`,`read`,`update`,`delete`,`export`,`permission-change`,`login`,`logout`,`failed-login`])).describe(`Event types to capture in the audit log`)}).describe(`Audit log configuration for compliance and security monitoring`),kF=x([`critical`,`major`,`minor`,`observation`]),AF=x([`open`,`in_remediation`,`remediated`,`verified`,`accepted_risk`,`closed`]),jF=l({id:o().describe(`Unique finding identifier`),title:o().describe(`Finding title`),description:o().describe(`Finding description`),severity:kF.describe(`Finding severity`),status:AF.describe(`Finding status`),controlReference:o().optional().describe(`ISO 27001 control reference`),framework:JP.optional().describe(`Related compliance framework`),identifiedAt:A().describe(`Identification timestamp`),identifiedBy:o().describe(`Identifier (auditor name or system)`),remediationPlan:o().optional().describe(`Remediation plan`),remediationDeadline:A().optional().describe(`Remediation deadline timestamp`),verifiedAt:A().optional().describe(`Verification timestamp`),verifiedBy:o().optional().describe(`Verifier name or role`),notes:o().optional().describe(`Additional notes`)}).describe(`Audit finding with remediation tracking per ISO 27001:2022 A.5.35`),MF=l({id:o().describe(`Unique audit schedule identifier`),title:o().describe(`Audit title`),scope:S(o()).describe(`Audit scope areas`),framework:JP.describe(`Target compliance framework`),scheduledAt:A().describe(`Scheduled audit timestamp`),completedAt:A().optional().describe(`Completion timestamp`),assessor:o().describe(`Assessor or audit team`),isExternal:v().default(!1).describe(`Whether this is an external audit`),recurrenceMonths:A().default(0).describe(`Recurrence interval in months (0 = one-time)`),findings:S(jF).optional().describe(`Audit findings`)}).describe(`Audit schedule for independent security reviews per ISO 27001:2022 A.5.35`),NF=l({gdpr:TF.optional().describe(`GDPR compliance settings`),hipaa:EF.optional().describe(`HIPAA compliance settings`),pciDss:DF.optional().describe(`PCI-DSS compliance settings`),auditLog:OF.describe(`Audit log configuration`),auditSchedules:S(MF).optional().describe(`Scheduled compliance audits (A.5.35)`)}).describe(`Unified compliance configuration spanning GDPR, HIPAA, PCI-DSS, and audit governance`),PF=x([`critical`,`high`,`medium`,`low`]),FF=x([`data_breach`,`malware`,`unauthorized_access`,`denial_of_service`,`social_engineering`,`insider_threat`,`physical_security`,`configuration_error`,`vulnerability_exploit`,`policy_violation`,`other`]),IF=x([`reported`,`triaged`,`investigating`,`containing`,`eradicating`,`recovering`,`resolved`,`closed`]),LF=l({phase:x([`identification`,`containment`,`eradication`,`recovery`,`lessons_learned`]).describe(`Response phase name`),description:o().describe(`Phase description and objectives`),assignedTo:o().describe(`Responsible team or role`),targetHours:A().min(0).describe(`Target completion time in hours`),completedAt:A().optional().describe(`Actual completion timestamp`),notes:o().optional().describe(`Phase notes and findings`)}).describe(`Incident response phase with timing and assignment`),RF=l({severity:PF.describe(`Minimum severity to trigger notification`),channels:S(x([`email`,`sms`,`slack`,`pagerduty`,`webhook`])).describe(`Notification channels`),recipients:S(o()).describe(`Roles or teams to notify`),withinMinutes:A().min(1).describe(`Notification deadline in minutes from detection`),notifyRegulators:v().default(!1).describe(`Whether to notify regulatory authorities`),regulatorDeadlineHours:A().optional().describe(`Regulatory notification deadline in hours`)}).describe(`Incident notification rule per severity level`),zF=l({rules:S(RF).describe(`Notification rules by severity level`),escalationTimeoutMinutes:A().default(30).describe(`Auto-escalation timeout in minutes`),escalationChain:S(o()).default([]).describe(`Ordered escalation chain of roles`)}).describe(`Incident notification matrix with escalation policies`),BF=l({id:o().describe(`Unique incident identifier`),title:o().describe(`Incident title`),description:o().describe(`Detailed incident description`),severity:PF.describe(`Incident severity level`),category:FF.describe(`Incident category`),status:IF.describe(`Current incident status`),reportedBy:o().describe(`Reporter user ID or system name`),reportedAt:A().describe(`Report timestamp`),detectedAt:A().optional().describe(`Detection timestamp`),resolvedAt:A().optional().describe(`Resolution timestamp`),affectedSystems:S(o()).describe(`Affected systems`),affectedDataClassifications:S(qP).optional().describe(`Affected data classifications`),responsePhases:S(LF).optional().describe(`Incident response phases`),rootCause:o().optional().describe(`Root cause analysis`),correctiveActions:S(o()).optional().describe(`Corrective actions taken or planned`),lessonsLearned:o().optional().describe(`Lessons learned from the incident`),relatedChangeRequestIds:S(o()).optional().describe(`Related change request IDs`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Security incident record per ISO 27001:2022 A.5.24–A.5.28`),VF=l({enabled:v().default(!0).describe(`Enable incident response management`),notificationMatrix:zF.describe(`Notification and escalation matrix`),defaultResponseTeam:o().describe(`Default incident response team or role`),triageDeadlineHours:A().default(1).describe(`Maximum hours to begin triage after detection`),requirePostIncidentReview:v().default(!0).describe(`Require post-incident review for all incidents`),regulatoryNotificationThreshold:PF.default(`high`).describe(`Minimum severity requiring regulatory notification`),retentionDays:A().default(2555).describe(`Incident record retention period in days (default ~7 years)`)}).describe(`Organization-level incident response policy per ISO 27001:2022`),HF=x([`critical`,`high`,`medium`,`low`]),UF=x([`pending`,`in_progress`,`completed`,`expired`,`failed`]),WF=l({id:o().describe(`Requirement identifier`),description:o().describe(`Requirement description`),controlReference:o().optional().describe(`ISO 27001 control reference`),mandatory:v().default(!0).describe(`Whether this requirement is mandatory`),compliant:v().optional().describe(`Whether the supplier meets this requirement`),evidence:o().optional().describe(`Compliance evidence or assessment notes`)}).describe(`Individual supplier security requirement`),GF=l({supplierId:o().describe(`Unique supplier identifier`),supplierName:o().describe(`Supplier display name`),riskLevel:HF.describe(`Supplier risk classification`),status:UF.describe(`Assessment status`),assessedBy:o().describe(`Assessor user ID or team`),assessedAt:A().describe(`Assessment timestamp`),validUntil:A().describe(`Assessment validity expiry timestamp`),requirements:S(WF).describe(`Security requirements and their compliance status`),overallCompliant:v().describe(`Whether supplier meets all mandatory requirements`),dataClassificationsShared:S(qP).optional().describe(`Data classifications shared with supplier`),servicesProvided:S(o()).optional().describe(`Services provided by this supplier`),certifications:S(o()).optional().describe(`Supplier certifications (e.g., ISO 27001, SOC 2)`),remediationItems:S(l({requirementId:o().describe(`Non-compliant requirement ID`),action:o().describe(`Required remediation action`),deadline:A().describe(`Remediation deadline timestamp`),status:x([`pending`,`in_progress`,`completed`]).default(`pending`).describe(`Remediation status`)})).optional().describe(`Remediation items for non-compliant requirements`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Supplier security assessment record per ISO 27001:2022 A.5.19–A.5.21`),KF=l({enabled:v().default(!0).describe(`Enable supplier security management`),reassessmentIntervalDays:A().default(365).describe(`Supplier reassessment interval in days`),requirePreOnboardingAssessment:v().default(!0).describe(`Require security assessment before supplier onboarding`),formalAssessmentThreshold:HF.default(`medium`).describe(`Minimum risk level requiring formal assessment`),monitorChanges:v().default(!0).describe(`Monitor supplier security posture changes`),requiredCertifications:S(o()).default([]).describe(`Required certifications for critical-risk suppliers`)}).describe(`Organization-level supplier security management policy per ISO 27001:2022`),qF=x([`security_awareness`,`data_protection`,`incident_response`,`access_control`,`phishing_awareness`,`compliance`,`secure_development`,`physical_security`,`business_continuity`,`other`]),JF=x([`not_started`,`in_progress`,`completed`,`failed`,`expired`]),YF=l({id:o().describe(`Unique course identifier`),title:o().describe(`Course title`),description:o().describe(`Course description and learning objectives`),category:qF.describe(`Training category`),durationMinutes:A().min(1).describe(`Estimated course duration in minutes`),mandatory:v().default(!1).describe(`Whether training is mandatory`),targetRoles:S(o()).describe(`Target roles or groups`),validityDays:A().optional().describe(`Certification validity period in days`),passingScore:A().min(0).max(100).optional().describe(`Minimum passing score percentage`),version:o().optional().describe(`Course content version`)}).describe(`Security training course definition`),XF=l({courseId:o().describe(`Training course identifier`),userId:o().describe(`User identifier`),status:JF.describe(`Training completion status`),assignedAt:A().describe(`Assignment timestamp`),completedAt:A().optional().describe(`Completion timestamp`),score:A().min(0).max(100).optional().describe(`Assessment score percentage`),expiresAt:A().optional().describe(`Certification expiry timestamp`),notes:o().optional().describe(`Training notes or comments`)}).describe(`Individual training completion record`),ZF=l({enabled:v().default(!0).describe(`Enable training management`),courses:S(YF).describe(`Training courses`),recertificationIntervalDays:A().default(365).describe(`Default recertification interval in days`),trackCompletion:v().default(!0).describe(`Track training completion for compliance`),gracePeriodDays:A().default(30).describe(`Grace period in days after certification expiry`),sendReminders:v().default(!0).describe(`Send reminders for upcoming training deadlines`),reminderDaysBefore:A().default(14).describe(`Days before deadline to send first reminder`)}).describe(`Organizational training plan per ISO 27001:2022 A.6.3`),QF=l({type:p(`cron`),expression:o().describe(`Cron expression (e.g., "0 0 * * *" for daily at midnight)`),timezone:o().optional().default(`UTC`).describe(`Timezone for cron execution (e.g., "America/New_York")`)}),$F=l({type:p(`interval`),intervalMs:A().int().positive().describe(`Interval in milliseconds`)}),eI=l({type:p(`once`),at:o().datetime().describe(`ISO 8601 datetime when to execute`)}),tI=d(`type`,[QF,$F,eI]),nI=l({maxRetries:A().int().min(0).default(3).describe(`Maximum number of retry attempts`),backoffMs:A().int().positive().default(1e3).describe(`Initial backoff delay in milliseconds`),backoffMultiplier:A().positive().default(2).describe(`Multiplier for exponential backoff`)}),rI=l({id:o().describe(`Unique job identifier`),name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Job name (snake_case)`),schedule:tI.describe(`Job schedule configuration`),handler:o().describe(`Handler path (e.g. "path/to/file:functionName") or script ID`),retryPolicy:nI.optional().describe(`Retry policy configuration`),timeout:A().int().positive().optional().describe(`Timeout in milliseconds`),enabled:v().default(!0).describe(`Whether the job is enabled`)}),iI=x([`running`,`success`,`failed`,`timeout`]),aI=l({jobId:o().describe(`Job identifier`),startedAt:o().datetime().describe(`ISO 8601 datetime when execution started`),completedAt:o().datetime().optional().describe(`ISO 8601 datetime when execution completed`),status:iI.describe(`Execution status`),error:o().optional().describe(`Error message if failed`),duration:A().int().optional().describe(`Execution duration in milliseconds`)}),oI=x([`critical`,`high`,`normal`,`low`,`background`]),sI={critical:0,high:1,normal:2,low:3,background:4},cI=x([`pending`,`queued`,`processing`,`completed`,`failed`,`cancelled`,`timeout`,`dead`]),lI=l({maxRetries:A().int().min(0).default(3).describe(`Maximum retry attempts`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy between retries`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:A().int().positive().default(6e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:A().positive().default(2).describe(`Multiplier for exponential backoff`)}),uI=l({id:o().describe(`Unique task identifier`),type:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),payload:b().describe(`Task payload data`),queue:o().default(`default`).describe(`Queue name`),priority:oI.default(`normal`).describe(`Task priority level`),retryPolicy:lI.optional().describe(`Retry policy configuration`),timeoutMs:A().int().positive().optional().describe(`Task timeout in milliseconds`),scheduledAt:o().datetime().optional().describe(`ISO 8601 datetime to execute task`),attempts:A().int().min(0).default(0).describe(`Number of execution attempts`),status:cI.default(`pending`).describe(`Current task status`),metadata:l({createdAt:o().datetime().optional().describe(`When task was created`),updatedAt:o().datetime().optional().describe(`Last update time`),createdBy:o().optional().describe(`User who created task`),tags:S(o()).optional().describe(`Task tags for filtering`)}).optional().describe(`Task metadata`)}),dI=l({taskId:o().describe(`Task identifier`),status:cI.describe(`Execution status`),result:b().optional().describe(`Execution result data`),error:l({message:o().describe(`Error message`),stack:o().optional().describe(`Error stack trace`),code:o().optional().describe(`Error code`)}).optional().describe(`Error details if failed`),durationMs:A().int().optional().describe(`Execution duration in milliseconds`),startedAt:o().datetime().describe(`When execution started`),completedAt:o().datetime().optional().describe(`When execution completed`),attempt:A().int().min(1).describe(`Attempt number (1-indexed)`),willRetry:v().describe(`Whether task will be retried`)}),fI=l({name:o().describe(`Queue name (snake_case)`),concurrency:A().int().min(1).default(5).describe(`Max concurrent task executions`),rateLimit:l({max:A().int().positive().describe(`Maximum tasks per duration`),duration:A().int().positive().describe(`Duration in milliseconds`)}).optional().describe(`Rate limit configuration`),defaultRetryPolicy:lI.optional().describe(`Default retry policy for tasks`),deadLetterQueue:o().optional().describe(`Dead letter queue name`),priority:A().int().min(0).default(0).describe(`Queue priority (lower = higher priority)`),autoScale:l({enabled:v().default(!1).describe(`Enable auto-scaling`),minWorkers:A().int().min(1).default(1).describe(`Minimum workers`),maxWorkers:A().int().min(1).default(10).describe(`Maximum workers`),scaleUpThreshold:A().int().positive().default(100).describe(`Queue size to scale up`),scaleDownThreshold:A().int().min(0).default(10).describe(`Queue size to scale down`)}).optional().describe(`Auto-scaling configuration`)}),pI=l({id:o().describe(`Unique batch job identifier`),type:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),items:S(b()).describe(`Array of items to process`),batchSize:A().int().min(1).default(100).describe(`Number of items per batch`),queue:o().default(`batch`).describe(`Queue for batch tasks`),priority:oI.default(`normal`).describe(`Batch task priority`),parallel:v().default(!0).describe(`Process batches in parallel`),stopOnError:v().default(!1).describe(`Stop batch if any item fails`),onProgress:O().input(a([l({processed:A(),total:A(),failed:A()})])).output(g()).optional().describe(`Progress callback function (called after each batch)`)}),mI=l({batchId:o().describe(`Batch job identifier`),total:A().int().min(0).describe(`Total number of items`),processed:A().int().min(0).default(0).describe(`Items processed`),succeeded:A().int().min(0).default(0).describe(`Items succeeded`),failed:A().int().min(0).default(0).describe(`Items failed`),percentage:A().min(0).max(100).describe(`Progress percentage`),status:x([`pending`,`running`,`completed`,`failed`,`cancelled`]).describe(`Batch status`),startedAt:o().datetime().optional().describe(`When batch started`),completedAt:o().datetime().optional().describe(`When batch completed`)}),hI=l({name:o().describe(`Worker name`),queues:S(o()).min(1).describe(`Queue names to process`),queueConfigs:S(fI).optional().describe(`Queue configurations`),pollIntervalMs:A().int().positive().default(1e3).describe(`Queue polling interval in milliseconds`),visibilityTimeoutMs:A().int().positive().default(3e4).describe(`How long a task is invisible after being claimed`),defaultTimeoutMs:A().int().positive().default(3e5).describe(`Default task timeout in milliseconds`),shutdownTimeoutMs:A().int().positive().default(3e4).describe(`Graceful shutdown timeout in milliseconds`),handlers:u(o(),O()).optional().describe(`Task type handlers`)}),gI=l({workerName:o().describe(`Worker name`),totalProcessed:A().int().min(0).describe(`Total tasks processed`),succeeded:A().int().min(0).describe(`Successful tasks`),failed:A().int().min(0).describe(`Failed tasks`),active:A().int().min(0).describe(`Currently active tasks`),avgExecutionMs:A().min(0).optional().describe(`Average execution time in milliseconds`),uptimeMs:A().int().min(0).describe(`Worker uptime in milliseconds`),queues:u(o(),l({pending:A().int().min(0).describe(`Pending tasks`),active:A().int().min(0).describe(`Active tasks`),completed:A().int().min(0).describe(`Completed tasks`),failed:A().int().min(0).describe(`Failed tasks`)})).optional().describe(`Per-queue statistics`)}),_I=Object.assign(uI,{create:e=>e}),vI=Object.assign(fI,{create:e=>e}),yI=Object.assign(hI,{create:e=>e}),bI=Object.assign(pI,{create:e=>e}),xI=l({id:o().describe(`Template identifier`),subject:o().describe(`Email subject`),body:o().describe(`Email body content`),bodyType:x([`text`,`html`,`markdown`]).optional().default(`html`).describe(`Body content type`),variables:S(o()).optional().describe(`Template variables`),attachments:S(l({name:o().describe(`Attachment filename`),url:o().url().describe(`Attachment URL`)})).optional().describe(`Email attachments`)}),SI=l({id:o().describe(`Template identifier`),message:o().describe(`SMS message content`),maxLength:A().optional().default(160).describe(`Maximum message length`),variables:S(o()).optional().describe(`Template variables`)}),CI=l({title:o().describe(`Notification title`),body:o().describe(`Notification body`),icon:o().url().optional().describe(`Notification icon URL`),badge:A().optional().describe(`Badge count`),data:u(o(),b()).optional().describe(`Custom data`),actions:S(l({action:o().describe(`Action identifier`),title:o().describe(`Action button title`)})).optional().describe(`Notification actions`)}),wI=l({title:o().describe(`Notification title`),message:o().describe(`Notification message`),type:x([`info`,`success`,`warning`,`error`]).describe(`Notification type`),actionUrl:o().optional().describe(`Action URL`),dismissible:v().optional().default(!0).describe(`User dismissible`),expiresAt:A().optional().describe(`Expiration timestamp`)}),TI=x([`email`,`sms`,`push`,`in-app`,`slack`,`teams`,`webhook`]),EI=l({id:o().describe(`Notification ID`),name:o().describe(`Notification name`),channel:TI.describe(`Notification channel`),template:c([xI,SI,CI,wI]).describe(`Notification template`),recipients:l({to:S(o()).describe(`Primary recipients`),cc:S(o()).optional().describe(`CC recipients`),bcc:S(o()).optional().describe(`BCC recipients`)}).describe(`Recipients`),schedule:l({type:x([`immediate`,`delayed`,`scheduled`]).describe(`Schedule type`),delay:A().optional().describe(`Delay in milliseconds`),scheduledAt:A().optional().describe(`Scheduled timestamp`)}).optional().describe(`Scheduling`),retryPolicy:l({enabled:v().optional().default(!0).describe(`Enable retries`),maxRetries:A().optional().default(3).describe(`Max retry attempts`),backoffStrategy:x([`exponential`,`linear`,`fixed`]).describe(`Backoff strategy`)}).optional().describe(`Retry policy`),tracking:l({trackOpens:v().optional().default(!1).describe(`Track opens`),trackClicks:v().optional().default(!1).describe(`Track clicks`),trackDelivery:v().optional().default(!0).describe(`Track delivery`)}).optional().describe(`Tracking configuration`)}),DI=o().describe(`BCP-47 Language Tag (e.g. en-US, zh-CN)`),OI=l({label:o().optional().describe(`Translated field label`),help:o().optional().describe(`Translated help text`),placeholder:o().optional().describe(`Translated placeholder text for form inputs`),options:u(o(),o()).optional().describe(`Option value to translated label map`)}).describe(`Translation data for a single field`),kI=l({label:o().describe(`Translated singular label`),pluralLabel:o().optional().describe(`Translated plural label`),fields:u(o(),OI).optional().describe(`Field-level translations`)}).describe(`Translation data for a single object`),AI=l({objects:u(o(),kI).optional().describe(`Object translations keyed by object name`),apps:u(o(),l({label:o().describe(`Translated app label`),description:o().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),messages:u(o(),o()).optional().describe(`UI message translations keyed by message ID`),validationMessages:u(o(),o()).optional().describe(`Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})`)}).describe(`Translation data for objects, apps, and UI messages`),jI=u(DI,AI).describe(`Map of locale codes to translation data`),MI=x([`bundled`,`per_locale`,`per_namespace`]).describe(`Translation file organization strategy`),NI=x([`icu`,`simple`]).describe(`Message interpolation format: ICU MessageFormat or simple {variable} replacement`),PI=l({defaultLocale:DI.describe(`Default locale (e.g., "en")`),supportedLocales:S(DI).describe(`Supported BCP-47 locale codes`),fallbackLocale:DI.optional().describe(`Fallback locale code`),fileOrganization:MI.default(`per_locale`).describe(`File organization strategy`),messageFormat:NI.default(`simple`).describe(`Message interpolation format (ICU MessageFormat or simple)`),lazyLoad:v().default(!1).describe(`Load translations on demand`),cache:v().default(!0).describe(`Cache loaded translations`)}).describe(`Internationalization configuration`),FI=u(o(),o()).describe(`Option value to translated label map`),II=l({label:o().describe(`Translated singular label`),pluralLabel:o().optional().describe(`Translated plural label`),description:o().optional().describe(`Translated object description`),helpText:o().optional().describe(`Translated help text for the object`),fields:u(o(),OI).optional().describe(`Field translations keyed by field name`),_options:u(o(),FI).optional().describe(`Object-scoped picklist option translations keyed by field name`),_views:u(o(),l({label:o().optional().describe(`Translated view label`),description:o().optional().describe(`Translated view description`)})).optional().describe(`View translations keyed by view name`),_sections:u(o(),l({label:o().optional().describe(`Translated section label`)})).optional().describe(`Section translations keyed by section name`),_actions:u(o(),l({label:o().optional().describe(`Translated action label`),confirmMessage:o().optional().describe(`Translated confirmation message`)})).optional().describe(`Action translations keyed by action name`),_notifications:u(o(),l({title:o().optional().describe(`Translated notification title`),body:o().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Notification translations keyed by notification name`),_errors:u(o(),o()).optional().describe(`Error message translations keyed by error code`)}).describe(`Object-first aggregated translation node`),LI=l({_meta:l({locale:o().optional().describe(`BCP-47 locale code for this bundle`),direction:x([`ltr`,`rtl`]).optional().describe(`Text direction: left-to-right or right-to-left`)}).optional().describe(`Bundle-level metadata (locale, bidi direction)`),namespace:o().optional().describe(`Namespace for plugin isolation to avoid translation key collisions`),o:u(o(),II).optional().describe(`Object-first translations keyed by object name`),_globalOptions:u(o(),FI).optional().describe(`Global picklist option translations keyed by option set name`),app:u(o(),l({label:o().describe(`Translated app label`),description:o().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),nav:u(o(),o()).optional().describe(`Navigation item translations keyed by nav item name`),dashboard:u(o(),l({label:o().optional().describe(`Translated dashboard label`),description:o().optional().describe(`Translated dashboard description`)})).optional().describe(`Dashboard translations keyed by dashboard name`),reports:u(o(),l({label:o().optional().describe(`Translated report label`),description:o().optional().describe(`Translated report description`)})).optional().describe(`Report translations keyed by report name`),pages:u(o(),l({title:o().optional().describe(`Translated page title`),description:o().optional().describe(`Translated page description`)})).optional().describe(`Page translations keyed by page name`),messages:u(o(),o()).optional().describe(`UI message translations keyed by message ID (supports ICU MessageFormat)`),validationMessages:u(o(),o()).optional().describe(`Validation error message translations keyed by rule name (supports ICU MessageFormat)`),notifications:u(o(),l({title:o().optional().describe(`Translated notification title`),body:o().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Global notification translations keyed by notification name`),errors:u(o(),o()).optional().describe(`Global error message translations keyed by error code`)}).describe(`Object-first application translation bundle for a single locale`),RI=x([`missing`,`redundant`,`stale`]).describe(`Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)`),zI=l({key:o().describe(`Dot-path translation key`),status:RI.describe(`Diff status of this translation key`),objectName:o().optional().describe(`Associated object name (snake_case)`),locale:o().describe(`BCP-47 locale code`),sourceHash:o().optional().describe(`Hash of source metadata for precise stale detection`),aiSuggested:o().optional().describe(`AI-suggested translation for this key`),aiConfidence:A().min(0).max(1).optional().describe(`AI suggestion confidence score (0–1)`)}).describe(`A single translation diff item`),BI=l({group:o().describe(`Translation group category`),totalKeys:A().int().nonnegative().describe(`Total keys in this group`),translatedKeys:A().int().nonnegative().describe(`Translated keys in this group`),coveragePercent:A().min(0).max(100).describe(`Coverage percentage for this group`)}).describe(`Coverage breakdown for a single translation group`),VI=l({locale:o().describe(`BCP-47 locale code`),objectName:o().optional().describe(`Object name scope (omit for full bundle)`),totalKeys:A().int().nonnegative().describe(`Total translatable keys from metadata`),translatedKeys:A().int().nonnegative().describe(`Number of translated keys`),missingKeys:A().int().nonnegative().describe(`Number of missing translations`),redundantKeys:A().int().nonnegative().describe(`Number of redundant translations`),staleKeys:A().int().nonnegative().describe(`Number of stale translations`),coveragePercent:A().min(0).max(100).describe(`Translation coverage percentage`),items:S(zI).describe(`Detailed diff items`),breakdown:S(BI).optional().describe(`Per-group coverage breakdown`)}).describe(`Aggregated translation coverage result`),HI=`__TRANSLATE__`,UI=x([`insert`,`delete`,`retain`]),WI=d(`type`,[l({type:p(`insert`),text:o().describe(`Text to insert`),attributes:u(o(),b()).optional().describe(`Text formatting attributes (e.g., bold, italic)`)}),l({type:p(`delete`),count:A().int().positive().describe(`Number of characters to delete`)}),l({type:p(`retain`),count:A().int().positive().describe(`Number of characters to retain`),attributes:u(o(),b()).optional().describe(`Attribute changes to apply`)})]),GI=l({operationId:o().uuid().describe(`Unique operation identifier`),documentId:o().describe(`Document identifier`),userId:o().describe(`User who created the operation`),sessionId:o().uuid().describe(`Session identifier`),components:S(WI).describe(`Operation components`),baseVersion:A().int().nonnegative().describe(`Document version this operation is based on`),timestamp:o().datetime().describe(`ISO 8601 datetime when operation was created`),metadata:u(o(),b()).optional().describe(`Additional operation metadata`)}),KI=l({operation:GI.describe(`Transformed operation`),transformed:v().describe(`Whether transformation was applied`),conflicts:S(o()).optional().describe(`Conflict descriptions if any`)}),qI=x([`lww-register`,`g-counter`,`pn-counter`,`g-set`,`or-set`,`lww-map`,`text`,`tree`,`json`]),JI=l({clock:u(o(),A().int().nonnegative()).describe(`Map of replica ID to logical timestamp`)}),YI=l({type:p(`lww-register`),value:b().describe(`Current register value`),timestamp:o().datetime().describe(`ISO 8601 datetime of last write`),replicaId:o().describe(`ID of replica that performed last write`),vectorClock:JI.optional().describe(`Optional vector clock for causality tracking`)}),XI=l({replicaId:o().describe(`Replica identifier`),delta:A().int().describe(`Change amount (positive for increment, negative for decrement)`),timestamp:o().datetime().describe(`ISO 8601 datetime of operation`)}),ZI=l({type:p(`g-counter`),counts:u(o(),A().int().nonnegative()).describe(`Map of replica ID to count`)}),QI=l({type:p(`pn-counter`),positive:u(o(),A().int().nonnegative()).describe(`Positive increments per replica`),negative:u(o(),A().int().nonnegative()).describe(`Negative increments per replica`)}),$I=l({value:b().describe(`Element value`),timestamp:o().datetime().describe(`Addition timestamp`),replicaId:o().describe(`Replica that added the element`),uid:o().uuid().describe(`Unique identifier for this addition`),removed:v().optional().default(!1).describe(`Whether element has been removed`)}),eL=l({type:p(`or-set`),elements:S($I).describe(`Set elements with metadata`)}),tL=l({operationId:o().uuid().describe(`Unique operation identifier`),replicaId:o().describe(`Replica identifier`),position:A().int().nonnegative().describe(`Position in document`),insert:o().optional().describe(`Text to insert`),delete:A().int().positive().optional().describe(`Number of characters to delete`),timestamp:o().datetime().describe(`ISO 8601 datetime of operation`),lamportTimestamp:A().int().nonnegative().describe(`Lamport timestamp for ordering`)}),nL=l({type:p(`text`),documentId:o().describe(`Document identifier`),content:o().describe(`Current text content`),operations:S(tL).describe(`History of operations`),lamportClock:A().int().nonnegative().describe(`Current Lamport clock value`),vectorClock:JI.describe(`Vector clock for causality`)}),rL=d(`type`,[YI,ZI,QI,eL,nL]),iL=l({state:rL.describe(`Merged CRDT state`),conflicts:S(l({type:o().describe(`Conflict type`),description:o().describe(`Conflict description`),resolved:v().describe(`Whether conflict was automatically resolved`)})).optional().describe(`Conflicts encountered during merge`)}),aL=x([`blue`,`green`,`red`,`yellow`,`purple`,`orange`,`pink`,`teal`,`indigo`,`cyan`]),oL=l({color:c([aL,o()]).describe(`Cursor color (preset or custom hex)`),opacity:A().min(0).max(1).optional().default(1).describe(`Cursor opacity (0-1)`),label:o().optional().describe(`Label to display with cursor (usually username)`),showLabel:v().optional().default(!0).describe(`Whether to show label`),pulseOnUpdate:v().optional().default(!0).describe(`Whether to pulse when cursor moves`)}),sL=l({anchor:l({line:A().int().nonnegative().describe(`Anchor line number`),column:A().int().nonnegative().describe(`Anchor column number`)}).describe(`Selection anchor (start point)`),focus:l({line:A().int().nonnegative().describe(`Focus line number`),column:A().int().nonnegative().describe(`Focus column number`)}).describe(`Selection focus (end point)`),direction:x([`forward`,`backward`]).optional().describe(`Selection direction`)}),cL=l({userId:o().describe(`User identifier`),sessionId:o().uuid().describe(`Session identifier`),documentId:o().describe(`Document identifier`),userName:o().describe(`Display name of user`),position:l({line:A().int().nonnegative().describe(`Cursor line number (0-indexed)`),column:A().int().nonnegative().describe(`Cursor column number (0-indexed)`)}).describe(`Current cursor position`),selection:sL.optional().describe(`Current text selection`),style:oL.describe(`Visual style for this cursor`),isTyping:v().optional().default(!1).describe(`Whether user is currently typing`),lastUpdate:o().datetime().describe(`ISO 8601 datetime of last cursor update`),metadata:u(o(),b()).optional().describe(`Additional cursor metadata`)}),lL=l({position:l({line:A().int().nonnegative(),column:A().int().nonnegative()}).optional().describe(`Updated cursor position`),selection:sL.optional().describe(`Updated selection`),isTyping:v().optional().describe(`Updated typing state`),metadata:u(o(),b()).optional().describe(`Updated metadata`)}),uL=x([`active`,`idle`,`viewing`,`disconnected`]),dL=l({userId:o().describe(`User identifier`),sessionId:o().uuid().describe(`Session identifier`),userName:o().describe(`Display name`),userAvatar:o().optional().describe(`User avatar URL`),status:uL.describe(`Current activity status`),currentDocument:o().optional().describe(`Document ID user is currently editing`),currentView:o().optional().describe(`Current view/page user is on`),lastActivity:o().datetime().describe(`ISO 8601 datetime of last activity`),joinedAt:o().datetime().describe(`ISO 8601 datetime when user joined session`),permissions:S(o()).optional().describe(`User permissions in this session`),metadata:u(o(),b()).optional().describe(`Additional user state metadata`)}),fL=l({sessionId:o().uuid().describe(`Session identifier`),documentId:o().optional().describe(`Document ID this session is for`),users:S(dL).describe(`Active users in session`),startedAt:o().datetime().describe(`ISO 8601 datetime when session started`),lastUpdate:o().datetime().describe(`ISO 8601 datetime of last update`),metadata:u(o(),b()).optional().describe(`Session metadata`)}),pL=l({status:uL.optional().describe(`Updated status`),currentDocument:o().optional().describe(`Updated current document`),currentView:o().optional().describe(`Updated current view`),metadata:u(o(),b()).optional().describe(`Updated metadata`)}),mL=l({eventId:o().uuid().describe(`Event identifier`),sessionId:o().uuid().describe(`Session identifier`),eventType:x([`user.joined`,`user.left`,`user.updated`,`session.created`,`session.ended`]).describe(`Type of awareness event`),userId:o().optional().describe(`User involved in event`),timestamp:o().datetime().describe(`ISO 8601 datetime of event`),payload:b().describe(`Event payload`)}),hL=x([`ot`,`crdt`,`lock`,`hybrid`]),gL=l({mode:hL.describe(`Collaboration mode to use`),enableCursorSharing:v().optional().default(!0).describe(`Enable cursor sharing`),enablePresence:v().optional().default(!0).describe(`Enable presence tracking`),enableAwareness:v().optional().default(!0).describe(`Enable awareness state`),maxUsers:A().int().positive().optional().describe(`Maximum concurrent users`),idleTimeout:A().int().positive().optional().default(3e5).describe(`Idle timeout in milliseconds`),conflictResolution:x([`ot`,`crdt`,`manual`]).optional().default(`ot`).describe(`Conflict resolution strategy`),persistence:v().optional().default(!0).describe(`Enable operation persistence`),snapshot:l({enabled:v().describe(`Enable periodic snapshots`),interval:A().int().positive().describe(`Snapshot interval in milliseconds`)}).optional().describe(`Snapshot configuration`)}),_L=l({sessionId:o().uuid().describe(`Session identifier`),documentId:o().describe(`Document identifier`),config:gL.describe(`Session configuration`),users:S(dL).describe(`Active users`),cursors:S(cL).describe(`Active cursors`),version:A().int().nonnegative().describe(`Current document version`),operations:S(c([GI,tL])).optional().describe(`Recent operations`),createdAt:o().datetime().describe(`ISO 8601 datetime when session was created`),lastActivity:o().datetime().describe(`ISO 8601 datetime of last activity`),status:x([`active`,`idle`,`ended`]).describe(`Session status`)}),vL=x([`system`,`platform`,`user`]),yL=x([`draft`,`active`,`archived`,`deprecated`]),bL=l({id:o(),name:o(),type:o(),namespace:o().default(`default`),packageId:o().optional().describe(`Package ID that owns/delivered this metadata`),managedBy:x([`package`,`platform`,`user`]).optional().describe(`Who manages this metadata record lifecycle`),scope:vL.default(`platform`),metadata:u(o(),b()),extends:o().optional().describe(`Name of the parent metadata to extend/override`),strategy:x([`merge`,`replace`]).default(`merge`),owner:o().optional(),state:yL.default(`active`),tenantId:o().optional().describe(`Tenant identifier for multi-tenant isolation`),version:A().default(1).describe(`Record version for optimistic concurrency control`),checksum:o().optional().describe(`Content checksum for change detection`),source:x([`filesystem`,`database`,`api`,`migration`]).optional().describe(`Origin of this metadata record`),tags:S(o()).optional().describe(`Classification tags for filtering and grouping`),publishedDefinition:b().optional().describe(`Snapshot of the last published definition`),publishedAt:o().datetime().optional().describe(`When this metadata was last published`),publishedBy:o().optional().describe(`Who published this version`),createdBy:o().optional(),createdAt:o().datetime().optional().describe(`Creation timestamp`),updatedBy:o().optional(),updatedAt:o().datetime().optional().describe(`Last update timestamp`)}),xL=l({success:v().describe(`Whether the publish succeeded`),packageId:o().describe(`The package ID that was published`),version:A().int().describe(`New version number after publish`),publishedAt:o().datetime().describe(`Publish timestamp`),itemsPublished:A().int().describe(`Total metadata items published`),validationErrors:S(l({type:o().describe(`Metadata type that failed validation`),name:o().describe(`Item name that failed validation`),message:o().describe(`Validation error message`)})).optional().describe(`Validation errors if publish failed`)}),SL=x([`json`,`yaml`,`yml`,`ts`,`js`,`typescript`,`javascript`]),CL=l({path:o().optional(),size:A().optional(),mtime:o().datetime().optional(),hash:o().optional(),etag:o().optional(),modifiedAt:o().datetime().optional(),format:SL.optional()}),wL=l({name:o(),protocol:x([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Loader protocol identifier`),description:o().optional(),supportedFormats:S(o()).optional(),supportsWatch:v().optional(),supportsWrite:v().optional(),supportsCache:v().optional(),capabilities:l({read:v().default(!0),write:v().default(!1),watch:v().default(!1),list:v().default(!0)})}),TL=l({scope:vL.optional(),namespace:o().optional(),raw:v().optional().describe(`Return raw file content instead of parsed JSON`),cache:v().optional(),useCache:v().optional(),validate:v().optional(),ifNoneMatch:o().optional(),recursive:v().optional(),limit:A().optional(),patterns:S(o()).optional(),loader:o().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),EL=l({data:b(),stats:CL.optional(),format:SL.optional(),source:o().optional(),fromCache:v().optional(),etag:o().optional(),notModified:v().optional(),loadTime:A().optional()}),DL=l({format:SL.optional(),create:v().default(!0),overwrite:v().default(!0),path:o().optional(),prettify:v().optional(),indent:A().optional(),sortKeys:v().optional(),backup:v().optional(),atomic:v().optional(),loader:o().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),OL=l({success:v(),path:o().optional(),stats:CL.optional(),etag:o().optional(),size:A().optional(),saveTime:A().optional(),backupPath:o().optional()}),kL=l({type:x([`add`,`change`,`unlink`,`added`,`changed`,`deleted`]),path:o(),name:o().optional(),stats:CL.optional(),metadataType:o().optional(),data:b().optional(),timestamp:o().datetime().optional()}),AL=l({type:o(),count:A(),namespaces:S(o())}),jL=l({types:S(o()).optional(),namespaces:S(o()).optional(),output:o().describe(`Output directory or file`),format:SL.default(`json`)}),ML=l({source:o().describe(`Input directory or file`),strategy:x([`merge`,`replace`,`skip`]).default(`merge`),validate:v().default(!0)}),NL=x([`filesystem`,`memory`,`none`]),PL=x([`filesystem`,`database`,`api`,`migration`]),FL=l({datasource:o().optional().describe(`Datasource name reference for database persistence`),tableName:o().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:NL.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:o().optional().describe(`Root directory for filesystem-based metadata`),formats:S(SL).optional().describe(`Enabled metadata formats`),watch:v().optional().describe(`Enable file watching for filesystem loaders`),cache:v().optional().describe(`Enable metadata caching`),watchOptions:l({ignored:S(o()).optional().describe(`Patterns to ignore`),persistent:v().default(!0).describe(`Keep process running`)}).optional().describe(`File watcher options`)}),IL=x([`metadata`,`data`,`auth`,`file-storage`,`search`,`cache`,`queue`,`automation`,`graphql`,`analytics`,`realtime`,`job`,`notification`,`ai`,`i18n`,`ui`,`workflow`]),LL=x([`required`,`core`,`optional`]),RL={metadata:`required`,data:`required`,auth:`core`,cache:`core`,queue:`core`,job:`core`,i18n:`core`,"file-storage":`optional`,search:`optional`,automation:`optional`,graphql:`optional`,analytics:`optional`,realtime:`optional`,notification:`optional`,ai:`optional`,ui:`optional`,workflow:`optional`},zL=l({name:IL,enabled:v(),status:x([`running`,`stopped`,`degraded`,`initializing`]),version:o().optional(),provider:o().optional().describe(`Implementation provider (e.g. "s3" for storage)`),features:S(o()).optional().describe(`List of supported sub-features`)}),BL=u(IL,b().describe(`Service Instance implementing the protocol interface`)),VL=l({id:o(),name:IL,options:u(o(),b()).optional()}),HL=x([`shared_schema`,`isolated_schema`,`isolated_db`]),UL=x([`turso`,`postgres`,`memory`]).describe(`Database provider for tenant data`),WL=l({url:o().min(1).describe(`Database connection URL`),authToken:o().optional().describe(`Database auth token (encrypted at rest)`),group:o().optional().describe(`Turso database group name`)}).describe(`Tenant database connection configuration`),GL=l({maxUsers:A().int().positive().optional().describe(`Maximum number of users`),maxStorage:A().int().positive().optional().describe(`Maximum storage in bytes`),apiRateLimit:A().int().positive().optional().describe(`API requests per minute`),maxObjects:A().int().positive().optional().describe(`Maximum number of custom objects`),maxRecordsPerObject:A().int().positive().optional().describe(`Maximum records per object`),maxDeploymentsPerDay:A().int().positive().optional().describe(`Maximum deployments per day`),maxStorageBytes:A().int().positive().optional().describe(`Maximum storage in bytes`)}),KL=l({currentObjectCount:A().int().min(0).default(0).describe(`Current number of custom objects`),currentRecordCount:A().int().min(0).default(0).describe(`Total records across all objects`),currentStorageBytes:A().int().min(0).default(0).describe(`Current storage usage in bytes`),deploymentsToday:A().int().min(0).default(0).describe(`Deployments executed today`),currentUsers:A().int().min(0).default(0).describe(`Current number of active users`),apiRequestsThisMinute:A().int().min(0).default(0).describe(`API requests in the current minute`),lastUpdatedAt:o().datetime().optional().describe(`Last usage update time`)}).describe(`Current tenant resource usage`),qL=l({allowed:v().describe(`Whether the operation is within quota`),exceededQuota:o().optional().describe(`Name of the exceeded quota`),currentUsage:A().optional().describe(`Current usage value`),limit:A().optional().describe(`Quota limit`),message:o().optional().describe(`Human-readable quota message`)}).describe(`Quota enforcement check result`),JL=l({id:o().describe(`Unique tenant identifier`),name:o().describe(`Tenant display name`),isolationLevel:HL,databaseProvider:UL.optional().describe(`Database provider`),connectionConfig:WL.optional().describe(`Database connection config`),provisioningStatus:x([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).optional().describe(`Current provisioning lifecycle status`),plan:x([`free`,`pro`,`enterprise`]).optional().describe(`Subscription plan`),customizations:u(o(),b()).optional().describe(`Custom configuration values`),quotas:GL.optional()}),YL=l({strategy:p(`shared_schema`).describe(`Row-level isolation strategy`),database:l({enableRLS:v().default(!0).describe(`Enable PostgreSQL Row-Level Security`),contextMethod:x([`session_variable`,`search_path`,`application_name`]).default(`session_variable`).describe(`How to set tenant context`),contextVariable:o().default(`app.current_tenant`).describe(`Session variable name`),applicationValidation:v().default(!0).describe(`Application-level tenant validation`)}).optional().describe(`Database configuration`),performance:l({usePartialIndexes:v().default(!0).describe(`Use partial indexes per tenant`),usePartitioning:v().default(!1).describe(`Use table partitioning by tenant_id`),poolSizePerTenant:A().int().positive().optional().describe(`Connection pool size per tenant`)}).optional().describe(`Performance settings`)}),XL=l({strategy:p(`isolated_schema`).describe(`Schema-level isolation strategy`),schema:l({namingPattern:o().default(`tenant_{tenant_id}`).describe(`Schema naming pattern`),includePublicSchema:v().default(!0).describe(`Include public schema`),sharedSchema:o().default(`public`).describe(`Schema for shared resources`),autoCreateSchema:v().default(!0).describe(`Auto-create schema`)}).optional().describe(`Schema configuration`),migrations:l({strategy:x([`parallel`,`sequential`,`on_demand`]).default(`parallel`).describe(`Migration strategy`),maxConcurrent:A().int().positive().default(10).describe(`Max concurrent migrations`),rollbackOnError:v().default(!0).describe(`Rollback on error`)}).optional().describe(`Migration configuration`),performance:l({poolPerSchema:v().default(!1).describe(`Separate pool per schema`),schemaCacheTTL:A().int().positive().default(3600).describe(`Schema cache TTL`)}).optional().describe(`Performance settings`)}),ZL=l({strategy:p(`isolated_db`).describe(`Database-level isolation strategy`),database:l({namingPattern:o().default(`tenant_{tenant_id}`).describe(`Database naming pattern`),serverStrategy:x([`shared`,`sharded`,`dedicated`]).default(`shared`).describe(`Server assignment strategy`),separateCredentials:v().default(!0).describe(`Separate credentials per tenant`),autoCreateDatabase:v().default(!0).describe(`Auto-create database`)}).optional().describe(`Database configuration`),connectionPool:l({poolSize:A().int().positive().default(10).describe(`Connection pool size`),maxActivePools:A().int().positive().default(100).describe(`Max active pools`),idleTimeout:A().int().positive().default(300).describe(`Idle pool timeout`),usePooler:v().default(!0).describe(`Use connection pooler`)}).optional().describe(`Connection pool configuration`),backup:l({strategy:x([`individual`,`consolidated`,`on_demand`]).default(`individual`).describe(`Backup strategy`),frequencyHours:A().int().positive().default(24).describe(`Backup frequency`),retentionDays:A().int().positive().default(30).describe(`Backup retention days`)}).optional().describe(`Backup configuration`),encryption:l({perTenantKeys:v().default(!1).describe(`Per-tenant encryption keys`),algorithm:o().default(`AES-256-GCM`).describe(`Encryption algorithm`),keyManagement:x([`aws_kms`,`azure_key_vault`,`gcp_kms`,`hashicorp_vault`,`custom`]).optional().describe(`Key management service`)}).optional().describe(`Encryption configuration`)}),zce=d(`strategy`,[YL,XL,ZL]),Bce=l({encryption:l({atRest:v().default(!0).describe(`Require encryption at rest`),inTransit:v().default(!0).describe(`Require encryption in transit`),fieldLevel:v().default(!1).describe(`Require field-level encryption`)}).optional().describe(`Encryption requirements`),accessControl:l({requireMFA:v().default(!1).describe(`Require MFA`),requireSSO:v().default(!1).describe(`Require SSO`),ipWhitelist:S(o()).optional().describe(`Allowed IP addresses`),sessionTimeout:A().int().positive().default(3600).describe(`Session timeout`)}).optional().describe(`Access control requirements`),compliance:l({standards:S(x([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),requireAuditLog:v().default(!0).describe(`Require audit logging`),auditRetentionDays:A().int().positive().default(365).describe(`Audit retention days`),dataResidency:l({region:o().optional().describe(`Required region (e.g., US, EU, APAC)`),excludeRegions:S(o()).optional().describe(`Prohibited regions`)}).optional().describe(`Data residency requirements`)}).optional().describe(`Compliance requirements`)}),QL=x([`boolean`,`counter`,`gauge`]).describe(`License metric type`),Vce=l({code:o().regex(/^[a-z_][a-z0-9_.]*$/).describe(`Feature code (e.g. core.api_access)`),label:o(),description:o().optional(),type:QL.default(`boolean`),unit:x([`count`,`bytes`,`seconds`,`percent`]).optional(),requires:S(o()).optional()}),Hce=l({code:o().describe(`Plan code (e.g. pro_v1)`),label:o(),active:v().default(!0),features:S(o()).describe(`List of enabled boolean features`),limits:u(o(),A()).describe(`Map of metric codes to limit values (e.g. { storage_gb: 10 })`),currency:o().default(`USD`).optional(),priceMonthly:A().optional(),priceYearly:A().optional()}),Uce=l({spaceId:o().describe(`Target Space ID`),planCode:o(),issuedAt:o().datetime(),expiresAt:o().datetime().optional(),status:x([`active`,`expired`,`suspended`,`trial`]),customFeatures:S(o()).optional(),customLimits:u(o(),A()).optional(),plugins:S(o()).optional().describe(`List of enabled plugin package IDs`),signature:o().optional().describe(`Cryptographic signature of the license`)}),$L=x([`manual`,`auto`,`proxy`]).describe(`Registry synchronization strategy`),eR=l({url:o().url().describe(`Upstream registry endpoint`),syncPolicy:$L.default(`auto`),syncInterval:A().int().min(60).optional().describe(`Auto-sync interval in seconds`),auth:l({type:x([`none`,`basic`,`bearer`,`api-key`,`oauth2`]).default(`none`),username:o().optional(),password:o().optional(),token:o().optional(),apiKey:o().optional()}).optional(),tls:l({enabled:v().default(!0),verifyCertificate:v().default(!0),certificate:o().optional(),privateKey:o().optional()}).optional(),timeout:A().int().min(1e3).default(3e4).describe(`Request timeout in milliseconds`),retry:l({maxAttempts:A().int().min(0).default(3),backoff:x([`fixed`,`linear`,`exponential`]).default(`exponential`)}).optional()}),Wce=l({type:x([`public`,`private`,`hybrid`]).describe(`Registry deployment type`),upstream:S(eR).optional().describe(`Upstream registries to sync from or proxy to`),scope:S(o()).optional().describe(`npm-style scopes managed by this registry (e.g., @my-corp, @enterprise)`),defaultScope:o().optional().describe(`Default scope prefix for new plugins`),storage:l({backend:x([`local`,`s3`,`gcs`,`azure-blob`,`oss`]).default(`local`),path:o().optional(),credentials:u(o(),b()).optional()}).optional(),visibility:x([`public`,`private`,`internal`]).default(`private`).describe(`Who can access this registry`),accessControl:l({requireAuthForRead:v().default(!1),requireAuthForWrite:v().default(!0),allowedPrincipals:S(o()).optional()}).optional(),cache:l({enabled:v().default(!0),ttl:A().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:A().int().optional().describe(`Maximum cache size in bytes`)}).optional(),mirrors:S(l({url:o().url(),priority:A().int().min(1).default(1)})).optional().describe(`Mirror registries for redundancy`)}),tR=x([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).describe(`Tenant provisioning lifecycle status`),nR=x([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),rR=x([`us-east`,`us-west`,`eu-west`,`eu-central`,`ap-southeast`,`ap-northeast`]).describe(`Available deployment region`),iR=l({name:o().min(1).describe(`Step name (e.g., create_database, sync_schema)`),status:x([`pending`,`running`,`completed`,`failed`,`skipped`]).describe(`Step status`),startedAt:o().datetime().optional().describe(`Step start time`),completedAt:o().datetime().optional().describe(`Step completion time`),durationMs:A().int().min(0).optional().describe(`Step duration in ms`),error:o().optional().describe(`Error message on failure`)}).describe(`Individual provisioning step status`),Gce=l({orgId:o().min(1).describe(`Organization ID`),plan:nR.default(`free`),region:rR.default(`us-east`),displayName:o().optional().describe(`Tenant display name`),adminEmail:o().email().optional().describe(`Initial admin user email`),metadata:u(o(),b()).optional().describe(`Additional metadata`)}).describe(`Tenant provisioning request`),Kce=l({tenantId:o().min(1).describe(`Provisioned tenant ID`),connectionUrl:o().min(1).describe(`Database connection URL`),status:tR,region:rR,plan:nR,steps:S(iR).default([]).describe(`Pipeline step statuses`),totalDurationMs:A().int().min(0).optional().describe(`Total provisioning duration`),provisionedAt:o().datetime().optional().describe(`Provisioning completion time`),error:o().optional().describe(`Error message on failure`)}).describe(`Tenant provisioning result`),qce=x([`validating`,`diffing`,`migrating`,`registering`,`ready`,`failed`,`rolling_back`]).describe(`Deployment lifecycle status`),aR=l({entityType:x([`object`,`field`,`index`,`view`,`flow`,`permission`]).describe(`Entity type`),entityName:o().min(1).describe(`Entity name`),parentEntity:o().optional().describe(`Parent entity name`),changeType:x([`added`,`modified`,`removed`]).describe(`Change type`),oldValue:b().optional().describe(`Previous value`),newValue:b().optional().describe(`New value`)}).describe(`Individual schema change`),Jce=l({changes:S(aR).default([]).describe(`List of schema changes`),summary:l({added:A().int().min(0).default(0).describe(`Number of added entities`),modified:A().int().min(0).default(0).describe(`Number of modified entities`),removed:A().int().min(0).default(0).describe(`Number of removed entities`)}).describe(`Change summary counts`),hasBreakingChanges:v().default(!1).describe(`Whether diff contains breaking changes`)}).describe(`Schema diff between current and desired state`),oR=l({sql:o().min(1).describe(`SQL DDL statement`),reversible:v().default(!0).describe(`Whether the statement can be reversed`),rollbackSql:o().optional().describe(`Reverse SQL for rollback`),order:A().int().min(0).describe(`Execution order`)}).describe(`Single DDL migration statement`),Yce=l({statements:S(oR).default([]).describe(`Ordered DDL statements`),dialect:o().min(1).describe(`Target SQL dialect`),reversible:v().default(!0).describe(`Whether the plan can be fully rolled back`),estimatedDurationMs:A().int().min(0).optional().describe(`Estimated execution time`)}).describe(`Ordered migration plan`),sR=l({severity:x([`error`,`warning`,`info`]).describe(`Issue severity`),path:o().describe(`Entity path (e.g., objects.project_task.fields.name)`),message:o().describe(`Issue description`),code:o().optional().describe(`Validation error code`)}).describe(`Validation issue`),Xce=l({valid:v().describe(`Whether the bundle is valid`),issues:S(sR).default([]).describe(`Validation issues`),errorCount:A().int().min(0).default(0).describe(`Number of errors`),warningCount:A().int().min(0).default(0).describe(`Number of warnings`)}).describe(`Bundle validation result`),cR=l({version:o().min(1).describe(`Deployment version`),checksum:o().optional().describe(`SHA256 checksum`),objects:S(o()).default([]).describe(`Object names included`),views:S(o()).default([]).describe(`View names included`),flows:S(o()).default([]).describe(`Flow names included`),permissions:S(o()).default([]).describe(`Permission names included`),createdAt:o().datetime().optional().describe(`Bundle creation time`)}).describe(`Deployment manifest`),Zce=l({manifest:cR,objects:S(u(o(),b())).default([]).describe(`Object definitions`),views:S(u(o(),b())).default([]).describe(`View definitions`),flows:S(u(o(),b())).default([]).describe(`Flow definitions`),permissions:S(u(o(),b())).default([]).describe(`Permission definitions`),seedData:S(u(o(),b())).default([]).describe(`Seed data records`)}).describe(`Deploy bundle containing all metadata for deployment`),Qce=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`App identifier (snake_case)`),label:o().min(1).describe(`App display label`),version:o().min(1).describe(`App version (semver)`),description:o().optional().describe(`App description`),minKernelVersion:o().optional().describe(`Minimum required kernel version`),objects:S(o()).default([]).describe(`Object names provided`),views:S(o()).default([]).describe(`View names provided`),flows:S(o()).default([]).describe(`Flow names provided`),hasSeedData:v().default(!1).describe(`Whether app includes seed data`),seedData:S(u(o(),b())).default([]).describe(`Seed data records`),dependencies:S(o()).default([]).describe(`Required app dependencies`)}).describe(`App manifest for marketplace installation`),$ce=l({compatible:v().describe(`Whether the app is compatible`),issues:S(l({severity:x([`error`,`warning`]).describe(`Issue severity`),message:o().describe(`Issue description`),category:x([`kernel_version`,`object_conflict`,`dependency_missing`,`quota_exceeded`]).describe(`Issue category`)})).default([]).describe(`Compatibility issues`)}).describe(`App compatibility check result`),ele=l({tenantId:o().min(1).describe(`Target tenant ID`),appId:o().min(1).describe(`App identifier`),configOverrides:u(o(),b()).optional().describe(`Configuration overrides`),skipSeedData:v().default(!1).describe(`Skip seed data population`)}).describe(`App install request`),tle=l({success:v().describe(`Whether installation succeeded`),appId:o().describe(`Installed app identifier`),version:o().describe(`Installed app version`),installedObjects:S(o()).default([]).describe(`Objects created/updated`),createdTables:S(o()).default([]).describe(`Database tables created`),seededRecords:A().int().min(0).default(0).describe(`Seed records inserted`),durationMs:A().int().min(0).optional().describe(`Installation duration`),error:o().optional().describe(`Error message on failure`)}).describe(`App install result`),nle={DIRS:{SCHEMA:`src/schemas`,SERVER:`src/server`,TRIGGERS:`src/triggers`,CLIENT:`src/client`,PAGES:`src/client/pages`,ASSETS:`assets`},FILES:{MANIFEST:`objectstack.config.ts`,ENTRY:`src/index.ts`}},rle={USER:`sys_user`,SESSION:`sys_session`,ACCOUNT:`sys_account`,VERIFICATION:`sys_verification`,ORGANIZATION:`sys_organization`,MEMBER:`sys_member`,INVITATION:`sys_invitation`,TEAM:`sys_team`,TEAM_MEMBER:`sys_team_member`,API_KEY:`sys_api_key`,TWO_FACTOR:`sys_two_factor`,ROLE:`sys_role`,PERMISSION_SET:`sys_permission_set`,AUDIT_LOG:`sys_audit_log`,METADATA:`sys_metadata`,PRESENCE:`sys_presence`},ile={ID:`id`,CREATED_AT:`created_at`,UPDATED_AT:`updated_at`,OWNER_ID:`owner_id`,TENANT_ID:`tenant_id`,USER_ID:`user_id`,DELETED_AT:`deleted_at`},ale={resolveTableName(e){return e.tableName??(e.namespace?`${e.namespace}_${e.name}`:e.name)},resolveColumnName(e,t){return t.columnName??e},buildColumnMap(e){let t={};for(let n of Object.keys(e))t[n]=e[n].columnName??n;return t},buildReverseColumnMap(e){let t={};for(let n of Object.keys(e)){let r=e[n].columnName??n;t[r]=n}return t}};EE({},{ActivationEventSchema:()=>nB,AdvancedPluginLifecycleConfigSchema:()=>Qle,ArtifactChecksumSchema:()=>dR,ArtifactFileEntrySchema:()=>uR,ArtifactSignatureSchema:()=>fR,BreakingChangeSchema:()=>SB,CLICommandContributionSchema:()=>ole,CORE_PLUGIN_TYPES:()=>sz,CapabilityConformanceLevelSchema:()=>BR,CompatibilityLevelSchema:()=>xB,CompatibilityMatrixEntrySchema:()=>wB,CustomizationOriginSchema:()=>Ole,CustomizationPolicySchema:()=>pz,DEFAULT_METADATA_TYPE_REGISTRY:()=>Vle,DeadLetterQueueEntrySchema:()=>yle,DependencyConflictSchema:()=>TB,DependencyGraphNodeSchema:()=>LB,DependencyGraphSchema:()=>RB,DependencyResolutionResultSchema:()=>SR,DependencyStatusEnum:()=>yR,DeprecationNoticeSchema:()=>CB,DevFixtureConfigSchema:()=>wR,DevPluginConfigSchema:()=>hle,DevPluginPreset:()=>ER,DevServiceOverrideSchema:()=>CR,DevToolsConfigSchema:()=>TR,DisablePackageRequestSchema:()=>Rz,DisablePackageResponseSchema:()=>zz,DistributedStateConfigSchema:()=>qz,DynamicLoadRequestSchema:()=>lue,DynamicLoadingConfigSchema:()=>fue,DynamicPluginOperationSchema:()=>eB,DynamicPluginResultSchema:()=>due,DynamicUnloadRequestSchema:()=>uue,EVENT_PRIORITY_VALUES:()=>gle,EnablePackageRequestSchema:()=>Iz,EnablePackageResponseSchema:()=>Lz,EventBusConfigSchema:()=>xle,EventHandlerSchema:()=>jR,EventLogEntrySchema:()=>ble,EventMessageQueueConfigSchema:()=>IR,EventMetadataSchema:()=>OR,EventPersistenceSchema:()=>MR,EventPhaseSchema:()=>Zz,EventPriority:()=>DR,EventQueueConfigSchema:()=>NR,EventReplayConfigSchema:()=>vle,EventRouteSchema:()=>_le,EventSchema:()=>AR,EventSourcingConfigSchema:()=>PR,EventTypeDefinitionSchema:()=>kR,EventWebhookConfigSchema:()=>FR,ExecutionContextSchema:()=>xO,ExtensionPointSchema:()=>qR,FeatureFlag:()=>Sle,FeatureFlagSchema:()=>zR,FeatureStrategy:()=>RR,FieldChangeSchema:()=>lz,GetPackageRequestSchema:()=>Az,GetPackageResponseSchema:()=>jz,GracefulDegradationSchema:()=>Yz,HealthStatusSchema:()=>DB,HookRegisteredEventSchema:()=>iue,HookTriggeredEventSchema:()=>aue,HotReloadConfigSchema:()=>Jz,InstallPackageRequestSchema:()=>Mz,InstallPackageResponseSchema:()=>Nz,InstalledPackageSchema:()=>Dz,KernelContextSchema:()=>vR,KernelEventBaseSchema:()=>$z,KernelReadyEventSchema:()=>oue,KernelSecurityPolicySchema:()=>mB,KernelSecurityScanResultSchema:()=>pB,KernelSecurityVulnerabilitySchema:()=>fB,KernelShutdownEventSchema:()=>sue,ListPackagesRequestSchema:()=>Oz,ListPackagesResponseSchema:()=>kz,ManifestSchema:()=>cz,MergeConflictSchema:()=>dz,MergeResultSchema:()=>kle,MergeStrategyConfigSchema:()=>fz,MetadataBulkRegisterRequestSchema:()=>Hle,MetadataBulkResultSchema:()=>wz,MetadataCategoryEnum:()=>lR,MetadataChangeTypeSchema:()=>Bz,MetadataCollectionInfoSchema:()=>Lle,MetadataDependencySchema:()=>Tz,MetadataDiffItemSchema:()=>Vz,MetadataEventSchema:()=>zle,MetadataExportOptionsSchema:()=>Mle,MetadataFallbackStrategySchema:()=>gz,MetadataFormatSchema:()=>mz,MetadataImportOptionsSchema:()=>Nle,MetadataLoadOptionsSchema:()=>Ale,MetadataLoadResultSchema:()=>Ple,MetadataLoaderContractSchema:()=>Rle,MetadataManagerConfigSchema:()=>_z,MetadataOverlaySchema:()=>uz,MetadataPluginConfigSchema:()=>Cz,MetadataPluginManifestSchema:()=>Ble,MetadataQueryResultSchema:()=>xz,MetadataQuerySchema:()=>bz,MetadataSaveOptionsSchema:()=>jle,MetadataSaveResultSchema:()=>Fle,MetadataStatsSchema:()=>hz,MetadataTypeRegistryEntrySchema:()=>yz,MetadataTypeSchema:()=>vz,MetadataValidationResultSchema:()=>Sz,MetadataWatchEventSchema:()=>Ile,MultiVersionSupportSchema:()=>xue,NamespaceConflictErrorSchema:()=>Wle,NamespaceRegistryEntrySchema:()=>Ule,OclifPluginConfigSchema:()=>sle,OpsDomainModuleSchema:()=>mue,OpsFilePathSchema:()=>_B,OpsPluginStructureSchema:()=>hue,PackageArtifactSchema:()=>pR,PackageDependencyConflictSchema:()=>zB,PackageDependencyResolutionResultSchema:()=>BB,PackageDependencySchema:()=>IB,PackageStatusEnum:()=>Ez,PermissionActionSchema:()=>oB,PermissionSchema:()=>cB,PermissionScopeSchema:()=>aB,PermissionSetSchema:()=>lB,PluginBuildOptionsSchema:()=>cle,PluginBuildResultSchema:()=>lle,PluginCachingSchema:()=>nz,PluginCapabilityManifestSchema:()=>JR,PluginCapabilitySchema:()=>WR,PluginCodeSplittingSchema:()=>ZR,PluginCompatibilityMatrixSchema:()=>yue,PluginContextSchema:()=>Tle,PluginDependencyResolutionResultSchema:()=>bue,PluginDependencyResolutionSchema:()=>ez,PluginDependencySchema:()=>KR,PluginDiscoveryConfigSchema:()=>iB,PluginDiscoverySourceSchema:()=>rB,PluginDynamicImportSchema:()=>QR,PluginErrorEventSchema:()=>tue,PluginEventBaseSchema:()=>Qz,PluginHealthCheckSchema:()=>Kz,PluginHealthReportSchema:()=>Xle,PluginHealthStatusSchema:()=>Gz,PluginHotReloadSchema:()=>tz,PluginInitializationSchema:()=>$R,PluginInstallConfigSchema:()=>Mue,PluginInterfaceSchema:()=>GR,PluginLifecycleEventType:()=>cue,PluginLifecyclePhaseEventSchema:()=>eue,PluginLifecycleSchema:()=>oz,PluginLoadingConfigSchema:()=>az,PluginLoadingEventSchema:()=>Cle,PluginLoadingStateSchema:()=>wle,PluginLoadingStrategySchema:()=>YR,PluginMetadataSchema:()=>_ue,PluginPerformanceMonitoringSchema:()=>iz,PluginPreloadConfigSchema:()=>XR,PluginProvenanceSchema:()=>UB,PluginPublishOptionsSchema:()=>fle,PluginPublishResultSchema:()=>ple,PluginQualityMetricsSchema:()=>AB,PluginRegisteredEventSchema:()=>$le,PluginRegistryEntrySchema:()=>Aue,PluginSandboxingSchema:()=>rz,PluginSchema:()=>Dle,PluginSearchFiltersSchema:()=>jue,PluginSecurityManifestSchema:()=>pue,PluginSecurityProtocol:()=>Nue,PluginSourceSchema:()=>tB,PluginStartupResultSchema:()=>OB,PluginStateSnapshotSchema:()=>Zle,PluginStatisticsSchema:()=>jB,PluginTrustLevelSchema:()=>hB,PluginTrustScoreSchema:()=>WB,PluginUpdateStrategySchema:()=>Xz,PluginValidateOptionsSchema:()=>ule,PluginValidateResultSchema:()=>dle,PluginVendorSchema:()=>kB,PluginVersionMetadataSchema:()=>Sue,PreviewModeConfigSchema:()=>_R,ProtocolFeatureSchema:()=>UR,ProtocolReferenceSchema:()=>HR,ProtocolVersionSchema:()=>VR,RealTimeNotificationConfigSchema:()=>LR,RequiredActionSchema:()=>xR,ResolvedDependencySchema:()=>bR,ResourceTypeSchema:()=>sB,RollbackPackageRequestSchema:()=>Jle,RollbackPackageResponseSchema:()=>Yle,RuntimeConfigSchema:()=>uB,RuntimeMode:()=>gR,SBOMEntrySchema:()=>VB,SBOMSchema:()=>HB,SandboxConfigSchema:()=>dB,ScopeConfigSchema:()=>Eue,ScopeInfoSchema:()=>Due,SecurityPolicySchema:()=>FB,SecurityScanResultSchema:()=>PB,SecurityVulnerabilitySchema:()=>NB,SemanticVersionSchema:()=>bB,ServiceFactoryRegistrationSchema:()=>Tue,ServiceMetadataSchema:()=>Cue,ServiceRegisteredEventSchema:()=>nue,ServiceRegistryConfigSchema:()=>wue,ServiceScopeType:()=>EB,ServiceUnregisteredEventSchema:()=>rue,StartupOptionsSchema:()=>Oue,StartupOrchestrationResultSchema:()=>kue,TenantRuntimeContextSchema:()=>mle,UninstallPackageRequestSchema:()=>Pz,UninstallPackageResponseSchema:()=>Fz,UpgradeContextSchema:()=>Ele,UpgradeImpactLevelSchema:()=>Hz,UpgradePackageRequestSchema:()=>Kle,UpgradePackageResponseSchema:()=>qle,UpgradePhaseSchema:()=>Wz,UpgradePlanSchema:()=>Uz,UpgradeSnapshotSchema:()=>Gle,ValidationErrorSchema:()=>vB,ValidationFindingSchema:()=>hR,ValidationResultSchema:()=>gue,ValidationSeverityEnum:()=>mR,ValidationWarningSchema:()=>yB,VersionConstraintSchema:()=>vue,VulnerabilitySeverity:()=>MB});var ole=l({name:o().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:o().optional().describe(`Command description for help text`),module:o().optional().describe(`Module path exporting oclif Command classes`)}),sle=l({commands:l({strategy:x([`pattern`,`explicit`,`single`]).optional().describe(`Command discovery strategy`),target:o().optional().describe(`Target directory for command files`),glob:o().optional().describe(`Glob pattern for command file matching`)}).optional().describe(`Command discovery configuration`),topicSeparator:o().optional().describe(`Character separating topic and command names`)}).describe(`oclif plugin configuration section`),lR=x([`objects`,`views`,`pages`,`flows`,`dashboards`,`permissions`,`agents`,`reports`,`actions`,`translations`,`themes`,`datasets`,`apis`,`triggers`,`workflows`]).describe(`Metadata category within the artifact`),uR=l({path:o().describe(`Relative file path within the artifact`),size:A().int().nonnegative().describe(`File size in bytes`),category:lR.optional().describe(`Metadata category this file belongs to`)}).describe(`A single file entry within the artifact`),dR=l({algorithm:x([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm used for checksums`),files:u(o(),o().regex(/^[a-f0-9]+$/)).describe(`File path to hash value mapping`)}).describe(`Checksum manifest for artifact integrity verification`),fR=l({algorithm:x([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).default(`RSA-SHA256`).describe(`Signing algorithm used`),publicKeyRef:o().describe(`Public key reference (URL or fingerprint) for signature verification`),signature:o().describe(`Base64-encoded digital signature`),signedAt:o().datetime().optional().describe(`ISO 8601 timestamp of when the artifact was signed`),signedBy:o().optional().describe(`Identity of the signer (publisher ID or email)`)}).describe(`Digital signature for artifact authenticity verification`),pR=l({formatVersion:o().regex(/^\d+\.\d+$/).default(`1.0`).describe(`Artifact format version (e.g. "1.0")`),packageId:o().describe(`Package identifier from manifest`),version:o().describe(`Package version from manifest`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Archive format of the artifact`),size:A().int().positive().optional().describe(`Total artifact file size in bytes`),builtAt:o().datetime().describe(`ISO 8601 timestamp of when the artifact was built`),builtWith:o().optional().describe(`Build tool identifier (e.g. "os-cli@3.2.0")`),files:S(uR).optional().describe(`List of files contained in the artifact`),metadataCategories:S(lR).optional().describe(`Metadata categories included in this artifact`),checksums:dR.optional().describe(`SHA256 checksums for artifact integrity verification`),signature:fR.optional().describe(`Digital signature for artifact authenticity verification`)}).describe(`Package artifact structure and metadata`),cle=l({directory:o().optional().describe(`Project root directory (defaults to current working directory)`),outDir:o().optional().describe(`Output directory for the built artifact (defaults to ./dist)`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Archive format for the artifact`),sign:v().default(!1).describe(`Whether to digitally sign the artifact`),privateKeyPath:o().optional().describe(`Path to RSA/ECDSA private key file for signing`),signAlgorithm:x([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).optional().describe(`Signing algorithm to use`),checksumAlgorithm:x([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm for file checksums`),includeData:v().default(!0).describe(`Whether to include seed data in the artifact`),includeLocales:v().default(!0).describe(`Whether to include locale/translation files`)}).describe(`Options for the os plugin build command`),lle=l({success:v().describe(`Whether the build succeeded`),artifactPath:o().optional().describe(`Absolute path to the generated artifact file`),artifact:pR.optional().describe(`Artifact metadata`),fileCount:A().int().min(0).optional().describe(`Total number of files in the artifact`),size:A().int().min(0).optional().describe(`Total artifact size in bytes`),durationMs:A().optional().describe(`Build duration in milliseconds`),errorMessage:o().optional().describe(`Error message if build failed`),warnings:S(o()).optional().describe(`Warnings emitted during build`)}).describe(`Result of the os plugin build command`),mR=x([`error`,`warning`,`info`]).describe(`Validation issue severity`),hR=l({severity:mR.describe(`Issue severity level`),rule:o().describe(`Validation rule identifier`),message:o().describe(`Human-readable finding description`),path:o().optional().describe(`Relative file path within the artifact`)}).describe(`A single validation finding`),ule=l({artifactPath:o().describe(`Path to the artifact file to validate`),verifySignature:v().default(!0).describe(`Whether to verify the digital signature`),publicKeyPath:o().optional().describe(`Path to the public key for signature verification`),verifyChecksums:v().default(!0).describe(`Whether to verify checksums of all files`),validateMetadata:v().default(!0).describe(`Whether to validate metadata against schemas`),platformVersion:o().optional().describe(`Platform version for compatibility verification`)}).describe(`Options for the os plugin validate command`),dle=l({valid:v().describe(`Whether the artifact passed validation`),artifact:pR.optional().describe(`Extracted artifact metadata`),checksumVerification:l({passed:v().describe(`Whether all checksums match`),checksums:dR.optional().describe(`Verified checksums`),mismatches:S(o()).optional().describe(`Files with checksum mismatches`)}).optional().describe(`Checksum verification result`),signatureVerification:l({passed:v().describe(`Whether the signature is valid`),signature:fR.optional().describe(`Signature details`),failureReason:o().optional().describe(`Signature verification failure reason`)}).optional().describe(`Signature verification result`),platformCompatibility:l({compatible:v().describe(`Whether artifact is compatible`),requiredRange:o().optional().describe(`Required platform version range`),targetVersion:o().optional().describe(`Target platform version`)}).optional().describe(`Platform compatibility check result`),findings:S(hR).describe(`All validation findings`),summary:l({errors:A().int().min(0).describe(`Error count`),warnings:A().int().min(0).describe(`Warning count`),infos:A().int().min(0).describe(`Info count`)}).optional().describe(`Finding counts by severity`)}).describe(`Result of the os plugin validate command`),fle=l({artifactPath:o().describe(`Path to the artifact file to publish`),registryUrl:o().url().optional().describe(`Marketplace API base URL`),token:o().optional().describe(`Authentication token for marketplace API`),releaseNotes:o().optional().describe(`Release notes for this version`),preRelease:v().default(!1).describe(`Whether this is a pre-release version`),skipValidation:v().default(!1).describe(`Whether to skip local validation before publish`),access:x([`public`,`restricted`]).default(`public`).describe(`Package access level on the marketplace`),tags:S(o()).optional().describe(`Tags for marketplace categorization`)}).describe(`Options for the os plugin publish command`),ple=l({success:v().describe(`Whether the publish succeeded`),packageId:o().optional().describe(`Published package identifier`),version:o().optional().describe(`Published version string`),artifactUrl:o().url().optional().describe(`URL of the published artifact in the marketplace`),sha256:o().optional().describe(`SHA256 checksum of the uploaded artifact`),submissionId:o().optional().describe(`Marketplace submission ID for review tracking`),errorMessage:o().optional().describe(`Error message if publish failed`),message:o().optional().describe(`Human-readable status message`)}).describe(`Result of the os plugin publish command`),gR=x([`development`,`production`,`test`,`provisioning`,`preview`]).describe(`Kernel operating mode`),_R=l({autoLogin:v().default(!0).describe(`Auto-login as simulated user, skipping login/registration pages`),simulatedRole:x([`admin`,`user`,`viewer`]).default(`admin`).describe(`Permission role for the simulated preview user`),simulatedUserName:o().default(`Preview User`).describe(`Display name for the simulated preview user`),readOnly:v().default(!1).describe(`Restrict the preview session to read-only operations`),expiresInSeconds:A().int().min(0).default(0).describe(`Preview session duration in seconds (0 = no expiration)`),bannerMessage:o().optional().describe(`Banner message displayed in the UI during preview mode`)}),vR=l({instanceId:o().uuid().describe(`Unique UUID for this running kernel process`),mode:gR.default(`production`),version:o().describe(`Kernel version`),appName:o().optional().describe(`Host application name`),cwd:o().describe(`Current working directory`),workspaceRoot:o().optional().describe(`Workspace root if different from cwd`),startTime:A().int().describe(`Boot timestamp (ms)`),features:u(o(),v()).default({}).describe(`Global feature toggles`),previewMode:_R.optional().describe(`Preview/demo mode configuration (used when mode is "preview")`)}),mle=vR.extend({tenantId:o().min(1).describe(`Resolved tenant identifier`),tenantPlan:x([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),tenantRegion:o().optional().describe(`Tenant deployment region`),tenantDbUrl:o().min(1).describe(`Tenant database connection URL`),tenantQuotas:GL.optional().describe(`Tenant resource quotas`)}).describe(`Tenant-aware kernel runtime context`),yR=x([`satisfied`,`needs_install`,`needs_upgrade`,`conflict`]).describe(`Resolution status for a dependency`),bR=l({packageId:o().describe(`Dependency package identifier`),requiredRange:o().describe(`SemVer range required (e.g. "^2.0.0")`),resolvedVersion:o().optional().describe(`Actual version resolved from registry`),installedVersion:o().optional().describe(`Currently installed version`),status:yR.describe(`Resolution status`),conflictReason:o().optional().describe(`Explanation of the conflict`)}).describe(`Resolution result for a single dependency`),xR=l({type:x([`install`,`upgrade`,`confirm_conflict`]).describe(`Type of action required`),packageId:o().describe(`Target package identifier`),description:o().describe(`Human-readable action description`)}).describe(`Action required before installation can proceed`),SR=l({dependencies:S(bR).describe(`Resolution result for each dependency`),canProceed:v().describe(`Whether installation can proceed`),requiredActions:S(xR).describe(`Actions required before proceeding`),installOrder:S(o()).describe(`Topologically sorted package IDs for installation`),circularDependencies:S(S(o())).optional().describe(`Circular dependency chains detected (e.g. [["A", "B", "A"]])`)}).describe(`Complete dependency resolution result`),CR=l({service:o().min(1).describe(`Target service identifier`),enabled:v().default(!0).describe(`Enable or disable this service`),strategy:x([`mock`,`memory`,`stub`,`passthrough`]).default(`memory`).describe(`Implementation strategy for development`),config:u(o(),b()).optional().describe(`Strategy-specific configuration for this service override`)}),wR=l({enabled:v().default(!0).describe(`Load fixture data on startup`),paths:S(o()).optional().describe(`Glob patterns for fixture files`),resetBeforeLoad:v().default(!0).describe(`Clear existing data before loading fixtures`),envFilter:S(o()).optional().describe(`Only load fixtures matching these environment tags`)}),TR=l({hotReload:v().default(!0).describe(`Enable HMR / live-reload`),requestInspector:v().default(!1).describe(`Enable request inspector`),dbExplorer:v().default(!1).describe(`Enable database explorer UI`),verboseLogging:v().default(!0).describe(`Enable verbose logging`),apiDocs:v().default(!0).describe(`Serve OpenAPI docs at /_dev/docs`),mailCatcher:v().default(!1).describe(`Capture outbound emails in dev`)}),ER=x([`minimal`,`standard`,`full`]).describe(`Predefined dev configuration profile`),hle=l({preset:ER.default(`standard`).describe(`Base configuration preset`),services:u(o().min(1),CR.omit({service:!0})).optional().describe(`Per-service dev overrides keyed by service name`),fixtures:wR.optional().describe(`Fixture data loading configuration`),tools:TR.optional().describe(`Developer tooling settings`),port:A().int().min(1).max(65535).default(4400).describe(`Port for the dev-tools dashboard`),open:v().default(!1).describe(`Auto-open dev dashboard in browser`),seedAdminUser:v().default(!0).describe(`Create a default admin user for development`),simulatedLatency:A().int().min(0).default(0).describe(`Artificial latency (ms) added to service calls`)}),DR=x([`critical`,`high`,`normal`,`low`,`background`]),gle={critical:0,high:1,normal:2,low:3,background:4},OR=l({source:o().describe(`Event source (e.g., plugin name, system component)`),timestamp:o().datetime().describe(`ISO 8601 datetime when event was created`),userId:o().optional().describe(`User who triggered the event`),tenantId:o().optional().describe(`Tenant identifier for multi-tenant systems`),correlationId:o().optional().describe(`Correlation ID for event tracing`),causationId:o().optional().describe(`ID of the event that caused this event`),priority:DR.optional().default(`normal`).describe(`Event priority`)}),kR=l({name:kE.describe(`Event type name (lowercase with dots)`),version:o().default(`1.0.0`).describe(`Event schema version`),schema:b().optional().describe(`JSON Schema for event payload validation`),description:o().optional().describe(`Event type description`),deprecated:v().optional().default(!1).describe(`Whether this event type is deprecated`),tags:S(o()).optional().describe(`Event type tags`)}),AR=l({id:o().optional().describe(`Unique event identifier`),name:kE.describe(`Event name (lowercase with dots, e.g., user.created, order.paid)`),payload:b().describe(`Event payload schema`),metadata:OR.describe(`Event metadata`)}),jR=l({id:o().optional().describe(`Unique handler identifier`),eventName:o().describe(`Name of event to handle (supports wildcards like user.*)`),handler:b().describe(`Handler function`),priority:A().int().default(0).describe(`Execution priority (lower numbers execute first)`),async:v().default(!0).describe(`Execute in background (true) or block (false)`),retry:l({maxRetries:A().int().min(0).default(3).describe(`Maximum retry attempts`),backoffMs:A().int().positive().default(1e3).describe(`Initial backoff delay`),backoffMultiplier:A().positive().default(2).describe(`Backoff multiplier`)}).optional().describe(`Retry policy for failed handlers`),timeoutMs:A().int().positive().optional().describe(`Handler timeout in milliseconds`),filter:b().optional().describe(`Optional filter to determine if handler should execute`)}),_le=l({from:o().describe(`Source event pattern (supports wildcards, e.g., user.* or *.created)`),to:S(o()).describe(`Target event names to route to`),transform:b().optional().describe(`Optional function to transform payload`)}),MR=l({enabled:v().default(!1).describe(`Enable event persistence`),retention:A().int().positive().describe(`Days to retain persisted events`),filter:b().optional().describe(`Optional filter function to select which events to persist`),storage:x([`database`,`file`,`s3`,`custom`]).default(`database`).describe(`Storage backend for persisted events`)}),NR=l({name:o().default(`events`).describe(`Event queue name`),concurrency:A().int().min(1).default(10).describe(`Max concurrent event handlers`),retryPolicy:l({maxRetries:A().int().min(0).default(3).describe(`Max retries for failed events`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:A().int().positive().default(6e4).describe(`Maximum retry delay`)}).optional().describe(`Default retry policy for events`),deadLetterQueue:o().optional().describe(`Dead letter queue name for failed events`),priorityEnabled:v().default(!0).describe(`Process events based on priority`)}),vle=l({fromTimestamp:o().datetime().describe(`Start timestamp for replay (ISO 8601)`),toTimestamp:o().datetime().optional().describe(`End timestamp for replay (ISO 8601)`),eventTypes:S(o()).optional().describe(`Event types to replay (empty = all)`),filters:u(o(),b()).optional().describe(`Additional filters for event selection`),speed:A().positive().default(1).describe(`Replay speed multiplier (1 = real-time)`),targetHandlers:S(o()).optional().describe(`Handler IDs to execute (empty = all)`)}),PR=l({enabled:v().default(!1).describe(`Enable event sourcing`),snapshotInterval:A().int().positive().default(100).describe(`Create snapshot every N events`),snapshotRetention:A().int().positive().default(10).describe(`Number of snapshots to retain`),retention:A().int().positive().default(365).describe(`Days to retain events`),aggregateTypes:S(o()).optional().describe(`Aggregate types to enable event sourcing for`),storage:l({type:x([`database`,`file`,`s3`,`eventstore`]).default(`database`).describe(`Storage backend`),options:u(o(),b()).optional().describe(`Storage-specific options`)}).optional().describe(`Event store configuration`)}),yle=l({id:o().describe(`Unique entry identifier`),event:AR.describe(`Original event`),error:l({message:o().describe(`Error message`),stack:o().optional().describe(`Error stack trace`),code:o().optional().describe(`Error code`)}).describe(`Failure details`),retries:A().int().min(0).describe(`Number of retry attempts`),firstFailedAt:o().datetime().describe(`When event first failed`),lastFailedAt:o().datetime().describe(`When event last failed`),failedHandler:o().optional().describe(`Handler ID that failed`)}),ble=l({id:o().describe(`Unique log entry identifier`),event:AR.describe(`The event`),status:x([`pending`,`processing`,`completed`,`failed`]).describe(`Processing status`),handlersExecuted:S(l({handlerId:o().describe(`Handler identifier`),status:x([`success`,`failed`,`timeout`]).describe(`Handler execution status`),durationMs:A().int().optional().describe(`Execution duration`),error:o().optional().describe(`Error message if failed`)})).optional().describe(`Handlers that processed this event`),receivedAt:o().datetime().describe(`When event was received`),processedAt:o().datetime().optional().describe(`When event was processed`),totalDurationMs:A().int().optional().describe(`Total processing time`)}),FR=l({id:o().optional().describe(`Unique webhook identifier`),eventPattern:o().describe(`Event name pattern (supports wildcards)`),url:o().url().describe(`Webhook endpoint URL`),method:x([`GET`,`POST`,`PUT`,`PATCH`]).default(`POST`).describe(`HTTP method`),headers:u(o(),o()).optional().describe(`HTTP headers`),authentication:l({type:x([`none`,`bearer`,`basic`,`api-key`]).describe(`Auth type`),credentials:u(o(),o()).optional().describe(`Auth credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:l({maxRetries:A().int().min(0).default(3).describe(`Max retry attempts`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:A().int().positive().default(6e4).describe(`Max retry delay`)}).optional().describe(`Retry policy`),timeoutMs:A().int().positive().default(3e4).describe(`Request timeout in milliseconds`),transform:b().optional().describe(`Transform event before sending`),enabled:v().default(!0).describe(`Whether webhook is enabled`)}),IR=l({provider:x([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Message queue provider`),topic:o().describe(`Topic or queue name`),eventPattern:o().default(`*`).describe(`Event name pattern to publish (supports wildcards)`),partitionKey:o().optional().describe(`JSON path for partition key (e.g., "metadata.tenantId")`),format:x([`json`,`avro`,`protobuf`]).default(`json`).describe(`Message serialization format`),includeMetadata:v().default(!0).describe(`Include event metadata in message`),compression:x([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression`),batchSize:A().int().min(1).default(1).describe(`Batch size for publishing`),flushIntervalMs:A().int().positive().default(1e3).describe(`Flush interval for batching`)}),LR=l({enabled:v().default(!0).describe(`Enable real-time notifications`),protocol:x([`websocket`,`sse`,`long-polling`]).default(`websocket`).describe(`Real-time protocol`),eventPattern:o().default(`*`).describe(`Event pattern to broadcast`),userFilter:v().default(!0).describe(`Filter events by user`),tenantFilter:v().default(!0).describe(`Filter events by tenant`),channels:S(l({name:o().describe(`Channel name`),eventPattern:o().describe(`Event pattern for channel`),filter:b().optional().describe(`Additional filter function`)})).optional().describe(`Named channels for event broadcasting`),rateLimit:l({maxEventsPerSecond:A().int().positive().describe(`Max events per second per client`),windowMs:A().int().positive().default(1e3).describe(`Rate limit window`)}).optional().describe(`Rate limiting configuration`)}),xle=l({persistence:MR.optional().describe(`Event persistence configuration`),queue:NR.optional().describe(`Event queue configuration`),eventSourcing:PR.optional().describe(`Event sourcing configuration`),replay:l({enabled:v().default(!0).describe(`Enable event replay capability`)}).optional().describe(`Event replay configuration`),webhooks:S(FR).optional().describe(`Webhook configurations`),messageQueue:IR.optional().describe(`Message queue integration`),realtime:LR.optional().describe(`Real-time notification configuration`),eventTypes:S(kR).optional().describe(`Event type definitions`),handlers:S(jR).optional().describe(`Global event handlers`)}),RR=x([`boolean`,`percentage`,`user_list`,`group`,`custom`]),zR=l({name:OE.describe(`Feature key (snake_case)`),label:o().optional().describe(`Display label`),description:o().optional(),enabled:v().default(!1).describe(`Is globally enabled`),strategy:RR.default(`boolean`),conditions:l({percentage:A().min(0).max(100).optional(),users:S(o()).optional(),groups:S(o()).optional(),expression:o().optional().describe(`Custom formula expression`)}).optional(),environment:x([`dev`,`staging`,`prod`,`all`]).default(`all`).describe(`Environment validity`),expiresAt:o().datetime().optional().describe(`Feature flag expiration date`)}),Sle=Object.assign(zR,{create:e=>e}),BR=x([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),VR=l({major:A().int().min(0),minor:A().int().min(0),patch:A().int().min(0)}).describe(`Semantic version of the protocol`),HR=l({id:o().regex(/^([a-z][a-z0-9]*\.)+protocol\.[a-z][a-z0-9._]*\.v\d+$/).describe(`Unique protocol identifier (e.g., com.objectstack.protocol.storage.v1)`),label:o(),version:VR,specification:o().optional().describe(`URL or path to protocol specification`),description:o().optional()}),UR=l({name:o().describe(`Feature identifier within the protocol`),enabled:v().default(!0),description:o().optional(),sinceVersion:o().optional().describe(`Version when this feature was added`),deprecatedSince:o().optional().describe(`Version when deprecated`)}),WR=l({protocol:HR,conformance:BR.default(`full`),implementedFeatures:S(o()).optional().describe(`List of implemented feature names`),features:S(UR).optional(),metadata:u(o(),b()).optional(),certified:v().default(!1).describe(`Has passed official conformance tests`),certificationDate:o().datetime().optional()}),GR=l({id:o().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:o(),description:o().optional(),version:VR,methods:S(l({name:o().describe(`Method name`),description:o().optional(),parameters:S(l({name:o(),type:o().describe(`Type notation (e.g., string, number, User)`),required:v().default(!0),description:o().optional()})).optional(),returnType:o().optional().describe(`Return value type`),async:v().default(!1).describe(`Whether method returns a Promise`)})),events:S(l({name:o().describe(`Event name`),description:o().optional(),payload:o().optional().describe(`Event payload type`)})).optional(),stability:x([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),KR=l({pluginId:o().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:o().describe(`Semantic version constraint`),optional:v().default(!1),reason:o().optional(),requiredCapabilities:S(o()).optional().describe(`Protocol IDs the dependency must support`)}),qR=l({id:o().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:o(),description:o().optional(),type:x([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:l({input:o().optional().describe(`Input type/schema`),output:o().optional().describe(`Output type/schema`),signature:o().optional().describe(`Function signature if applicable`)}).optional(),cardinality:x([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),JR=l({implements:S(WR).optional().describe(`List of protocols this plugin conforms to`),provides:S(GR).optional().describe(`Services/APIs this plugin offers to others`),requires:S(KR).optional().describe(`Required plugins and their capabilities`),extensionPoints:S(qR).optional().describe(`Points where other plugins can extend this plugin`),extensions:S(l({targetPluginId:o().describe(`Plugin ID being extended`),extensionPointId:o().describe(`Extension point identifier`),implementation:o().describe(`Path to implementation module`),priority:A().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),YR=x([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),XR=l({enabled:v().default(!1),priority:A().int().min(0).default(100),resources:S(x([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:l({routes:S(o()).optional(),roles:S(o()).optional(),deviceType:S(x([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:x([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),ZR=l({enabled:v().default(!0),strategy:x([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:x([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:A().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:l({enabled:v().default(!0),minChunks:A().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),QR=l({enabled:v().default(!0),mode:x([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:v().default(!1).describe(`Prefetch module in idle time`),preload:v().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:o().optional().describe(`Custom chunk name for webpack`),timeout:A().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:l({enabled:v().default(!0),maxAttempts:A().int().min(1).max(10).default(3),backoffMs:A().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),$R=l({mode:x([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:A().int().min(100).default(3e4),priority:A().int().min(0).default(100),critical:v().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:l({enabled:v().default(!1),maxAttempts:A().int().min(1).max(5).default(3),backoffMs:A().int().min(0).default(1e3)}).optional(),healthCheckInterval:A().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),ez=l({strategy:x([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:l({resolve:v().default(!0),onMissing:x([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:x([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:l({load:v().default(!0),onFailure:x([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:x([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:x([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),tz=l({enabled:v().default(!1),environment:x([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:x([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:S(o()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:S(o()).optional().describe(`Glob patterns for files to ignore`),debounceMs:A().int().min(0).default(300),preserveState:v().default(!1),stateSerialization:l({enabled:v().default(!1),handler:o().optional()}).optional(),hooks:l({beforeReload:o().optional().describe(`Function to call before reload`),afterReload:o().optional().describe(`Function to call after reload`),onError:o().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:l({healthValidation:v().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:v().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:A().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:v().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:A().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:A().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:A().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),nz=l({enabled:v().default(!0),storage:x([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:x([`version`,`hash`,`timestamp`]).default(`version`),ttl:A().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:A().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:S(x([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:l({enabled:v().default(!1),algorithm:x([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),rz=l({enabled:v().default(!1),scope:x([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:x([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:S(o()).optional().describe(`List of allowed capability IDs`),resourceQuotas:l({maxMemoryMB:A().int().min(1).optional(),maxCpuTimeMs:A().int().min(100).optional(),maxFileDescriptors:A().int().min(1).optional(),maxNetworkKBps:A().int().min(1).optional()}).optional(),permissions:l({allowedAPIs:S(o()).optional(),allowedPaths:S(o()).optional(),allowedEndpoints:S(o()).optional(),allowedEnvVars:S(o()).optional()}).optional(),ipc:l({enabled:v().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:x([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:A().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:A().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:S(o()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),iz=l({enabled:v().default(!1),metrics:S(x([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:A().min(0).max(1).default(1),reportingInterval:A().int().min(1).default(60),budgets:l({maxLoadTimeMs:A().int().min(0).optional(),maxInitTimeMs:A().int().min(0).optional(),maxMemoryMB:A().int().min(0).optional()}).optional(),onBudgetViolation:x([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),az=l({strategy:YR.default(`lazy`),preload:XR.optional(),codeSplitting:ZR.optional(),dynamicImport:QR.optional(),initialization:$R.optional(),dependencyResolution:ez.optional(),hotReload:tz.optional(),caching:nz.optional(),sandboxing:rz.optional(),monitoring:iz.optional()}).describe(`Complete plugin loading configuration`),Cle=l({type:x([`load-started`,`load-completed`,`load-failed`,`init-started`,`init-completed`,`init-failed`,`preload-started`,`preload-completed`,`cache-hit`,`cache-miss`,`hot-reload`,`dynamic-load`,`dynamic-unload`,`dynamic-discover`]),pluginId:o(),timestamp:A().int().min(0),durationMs:A().int().min(0).optional(),metadata:u(o(),b()).optional(),error:l({message:o(),code:o().optional(),stack:o().optional()}).optional()}).describe(`Plugin loading lifecycle event`),wle=l({pluginId:o(),state:x([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:A().min(0).max(100).default(0),startedAt:A().int().min(0).optional(),completedAt:A().int().min(0).optional(),lastError:o().optional(),retryCount:A().int().min(0).default(0)}).describe(`Plugin loading state`),Tle=l({ql:l({object:O().describe(`Get object handle for method chaining`),query:O().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:l({getCurrentUser:O().describe(`Get the current authenticated user`),getConfig:O().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:l({debug:O().describe(`Log debug message`),info:O().describe(`Log info message`),warn:O().describe(`Log warning message`),error:O().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:l({get:O().describe(`Get a value from storage`),set:O().describe(`Set a value in storage`),delete:O().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:l({t:O().describe(`Translate a key`),getLocale:O().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:u(o(),b()),events:u(o(),b()),app:l({router:l({get:O().describe(`Register GET route handler`),post:O().describe(`Register POST route handler`),use:O().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:l({register:O().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),Ele=l({previousVersion:o().describe(`Version before upgrade`),newVersion:o().describe(`Version after upgrade`),isMajorUpgrade:v().describe(`Whether this is a major version bump`),previousMetadata:u(o(),b()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`),oz=l({onInstall:O().optional().describe(`Called when plugin is installed`),onEnable:O().optional().describe(`Called when plugin is enabled`),onDisable:O().optional().describe(`Called when plugin is disabled`),onUninstall:O().optional().describe(`Called when plugin is uninstalled`),onUpgrade:O().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),sz=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`],Dle=oz.extend({id:o().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:x([`standard`,...sz]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:o().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:o().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:v().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:o().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:o().optional(),author:o().optional(),homepage:o().url().optional()}),cz=l({id:o().describe(`Unique package identifier (reverse domain style)`),namespace:o().regex(/^[a-z][a-z0-9_]{1,19}$/,`Namespace must be 2-20 chars, lowercase alphanumeric + underscore`).optional().describe(`Short namespace identifier for metadata scoping (e.g. "crm", "todo")`),version:o().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:x([`plugin`,...sz,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:o().describe(`Human-readable package name`),description:o().optional().describe(`Package description`),permissions:S(o()).optional().describe(`Array of required permission strings`),objects:S(o()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:S(o()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:u(o(),o()).optional().describe(`Package dependencies`),configuration:l({title:o().optional(),properties:u(o(),l({type:x([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:b().optional().describe(`Default value`),description:o().optional().describe(`Tooltip description`),required:v().optional().describe(`Is this setting required?`),secret:v().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:S(o()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:l({kinds:S(l({id:o().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:S(o()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:o().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:S(o()).optional().describe(`Events this plugin listens to`),menus:u(o(),S(l({id:o(),label:o(),command:o().optional()}))).optional().describe(`UI Menu contributions`),themes:S(l({id:o(),label:o(),path:o()})).optional().describe(`Theme contributions`),translations:S(l({locale:o(),path:o()})).optional().describe(`Translation resources`),actions:S(l({name:o().describe(`Unique action name`),label:o().optional(),description:o().optional(),input:b().optional().describe(`Input validation schema`),output:b().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:S(l({id:o().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:o().describe(`Human readable name`),description:o().optional()})).optional().describe(`Driver contributions`),fieldTypes:S(l({name:o().describe(`Unique field type name (e.g. "vector")`),label:o().describe(`Display label`),description:o().optional()})).optional().describe(`Field Type contributions`),functions:S(l({name:o().describe(`Function name (e.g. "distance")`),description:o().optional(),args:S(o()).optional().describe(`Argument types`),returnType:o().optional()})).optional().describe(`Query Function contributions`),routes:S(l({prefix:o().regex(/^\//).describe(`API path prefix`),service:o().describe(`Service name this plugin provides`),methods:S(o()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:S(l({name:o().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:o().optional().describe(`Command description for help text`),module:o().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:S(yk).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:JR.optional().describe(`Plugin capability declarations for interoperability`),extensions:u(o(),b()).optional().describe(`Extension points and contributions`),loading:az.optional().describe(`Plugin loading and runtime behavior configuration`),engine:l({objectstack:o().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)}),Ole=x([`package`,`admin`,`user`,`migration`,`api`]),lz=l({path:o().describe(`JSON path to the changed field`),originalValue:b().optional().describe(`Original value from the package`),currentValue:b().describe(`Current customized value`),changedBy:o().optional().describe(`User or admin who made this change`),changedAt:o().datetime().optional().describe(`Timestamp of the change`)}),uz=l({id:o().describe(`Overlay record ID (UUID)`),baseType:o().describe(`Metadata type being customized`),baseName:o().describe(`Metadata name being customized`),packageId:o().optional().describe(`Package ID that delivered the base metadata`),packageVersion:o().optional().describe(`Package version when overlay was created`),scope:x([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:o().optional().describe(`Tenant identifier`),owner:o().optional().describe(`Owner user ID for user-scope overlays`),patch:u(o(),b()).describe(`JSON Merge Patch payload (changed fields only)`),changes:S(lz).optional().describe(`Field-level change tracking for conflict detection`),active:v().default(!0).describe(`Whether this overlay is active`),createdAt:o().datetime().optional(),createdBy:o().optional(),updatedAt:o().datetime().optional(),updatedBy:o().optional()}),dz=l({path:o().describe(`JSON path to the conflicting field`),baseValue:b().describe(`Value in the old package version`),incomingValue:b().describe(`Value in the new package version`),customValue:b().describe(`Customer customized value`),suggestedResolution:x([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:o().optional().describe(`Explanation for the suggested resolution`)}),fz=l({defaultStrategy:x([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:S(o()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:S(o()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:v().default(!0).describe(`Auto-resolve changes that do not conflict`)}),kle=l({success:v().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:u(o(),b()).optional().describe(`Merged metadata result`),updatedOverlay:u(o(),b()).optional().describe(`Updated overlay after merge`),conflicts:S(dz).optional().describe(`Unresolved merge conflicts`),autoResolved:S(l({path:o(),resolution:o(),description:o().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:l({totalFields:A().int().min(0).describe(`Total fields evaluated`),unchanged:A().int().min(0).describe(`Fields with no changes`),autoResolved:A().int().min(0).describe(`Fields auto-resolved`),conflicts:A().int().min(0).describe(`Fields with conflicts`)}).optional()}),pz=l({metadataType:o().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:v().default(!0),lockedFields:S(o()).optional().describe(`Field paths that cannot be customized`),customizableFields:S(o()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:v().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:v().default(!1).describe(`Whether admins can delete package-delivered fields`)}),mz=x([`json`,`yaml`,`typescript`,`javascript`]),hz=l({size:A().int().min(0).describe(`File size in bytes`),modifiedAt:o().datetime().describe(`Last modified date`),etag:o().describe(`Entity tag for cache validation`),format:mz.describe(`Serialization format`),path:o().optional().describe(`File system path`),metadata:u(o(),b()).optional().describe(`Provider-specific metadata`)}),Ale=l({patterns:S(o()).optional().describe(`File glob patterns`),ifNoneMatch:o().optional().describe(`ETag for conditional request`),ifModifiedSince:o().datetime().optional().describe(`Only load if modified after this date`),validate:v().default(!0).describe(`Validate against schema`),useCache:v().default(!0).describe(`Enable caching`),filter:o().optional().describe(`Filter predicate as string`),limit:A().int().min(1).optional().describe(`Maximum items to load`),recursive:v().default(!0).describe(`Search subdirectories`)}),jle=l({format:mz.default(`typescript`).describe(`Output format`),prettify:v().default(!0).describe(`Format with indentation`),indent:A().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:v().default(!1).describe(`Sort object keys`),includeDefaults:v().default(!1).describe(`Include default values`),backup:v().default(!1).describe(`Create backup file`),overwrite:v().default(!0).describe(`Overwrite existing file`),atomic:v().default(!0).describe(`Use atomic write operation`),path:o().optional().describe(`Custom output path`)}),Mle=l({output:o().describe(`Output file path`),format:mz.default(`json`).describe(`Export format`),filter:o().optional().describe(`Filter items to export`),includeStats:v().default(!1).describe(`Include metadata statistics`),compress:v().default(!1).describe(`Compress output (gzip)`),prettify:v().default(!0).describe(`Pretty print output`)}),Nle=l({conflictResolution:x([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:v().default(!0).describe(`Validate before import`),dryRun:v().default(!1).describe(`Simulate import without saving`),continueOnError:v().default(!1).describe(`Continue if validation fails`),transform:o().optional().describe(`Transform items before import`)}),Ple=l({data:b().nullable().describe(`Loaded metadata`),fromCache:v().default(!1).describe(`Loaded from cache`),notModified:v().default(!1).describe(`Not modified since last request`),etag:o().optional().describe(`Entity tag`),stats:hz.optional().describe(`Metadata statistics`),loadTime:A().min(0).optional().describe(`Load duration in ms`)}),Fle=l({success:v().describe(`Save successful`),path:o().describe(`Output path`),etag:o().optional().describe(`Generated entity tag`),size:A().int().min(0).optional().describe(`File size`),saveTime:A().min(0).optional().describe(`Save duration in ms`),backupPath:o().optional().describe(`Backup file path`)}),Ile=l({type:x([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:o().describe(`Type of metadata`),name:o().describe(`Item identifier`),path:o().describe(`File path`),data:b().optional().describe(`Item data`),timestamp:o().datetime().describe(`Event timestamp`)}),Lle=l({type:o().describe(`Collection type`),count:A().int().min(0).describe(`Number of items`),formats:S(mz).describe(`Formats in collection`),totalSize:A().int().min(0).optional().describe(`Total size in bytes`),lastModified:o().datetime().optional().describe(`Last modification date`),location:o().optional().describe(`Collection location`)}),Rle=l({name:o().describe(`Loader identifier`),protocol:x([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:l({read:v().default(!0),write:v().default(!1),watch:v().default(!1),list:v().default(!0)}).describe(`Loader capabilities`),supportedFormats:S(mz).describe(`Supported formats`),supportsWatch:v().default(!1).describe(`Supports file watching`),supportsWrite:v().default(!0).describe(`Supports write operations`),supportsCache:v().default(!0).describe(`Supports caching`)}),gz=x([`filesystem`,`memory`,`none`]),_z=l({datasource:o().optional().describe(`Datasource name reference for database persistence`),tableName:o().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:gz.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:o().optional().describe(`Root directory path`),formats:S(mz).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:l({enabled:v().default(!0).describe(`Enable caching`),ttl:A().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:A().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:v().default(!1).describe(`Enable file watching`),watchOptions:l({ignored:S(o()).optional().describe(`Patterns to ignore`),persistent:v().default(!0).describe(`Keep process running`),ignoreInitial:v().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:l({strict:v().default(!0).describe(`Strict validation`),throwOnError:v().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:u(o(),b()).optional().describe(`Loader-specific configuration`)}),vz=x([`object`,`field`,`trigger`,`validation`,`hook`,`view`,`page`,`dashboard`,`app`,`action`,`report`,`flow`,`workflow`,`approval`,`datasource`,`translation`,`router`,`function`,`service`,`permission`,`profile`,`role`,`agent`,`tool`,`skill`]),yz=l({type:vz.describe(`Metadata type identifier`),label:o().describe(`Display label for the metadata type`),description:o().optional().describe(`Description of the metadata type`),filePatterns:S(o()).describe(`Glob patterns to discover files of this type`),supportsOverlay:v().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:v().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:v().default(!1).describe(`Whether version history is tracked`),loadOrder:A().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:x([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)}),bz=l({types:S(vz).optional().describe(`Filter by metadata types`),namespaces:S(o()).optional().describe(`Filter by namespaces`),packageId:o().optional().describe(`Filter by owning package`),search:o().optional().describe(`Full-text search query`),scope:x([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:x([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:S(o()).optional().describe(`Filter by tags`),sortBy:x([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:x([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:A().int().min(1).default(1).describe(`Page number`),pageSize:A().int().min(1).max(500).default(50).describe(`Items per page`)}),xz=l({items:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),namespace:o().optional().describe(`Namespace`),label:o().optional().describe(`Display label`),scope:x([`system`,`platform`,`user`]).optional(),state:x([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:o().optional(),updatedAt:o().datetime().optional()})).describe(`Matched metadata items`),total:A().int().min(0).describe(`Total matching items`),page:A().int().min(1).describe(`Current page`),pageSize:A().int().min(1).describe(`Page size`)}),zle=l({event:x([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:vz.describe(`Metadata type`),name:o().describe(`Metadata item name`),namespace:o().optional().describe(`Namespace`),packageId:o().optional().describe(`Owning package ID`),timestamp:o().datetime().describe(`Event timestamp`),actor:o().optional().describe(`User or system that triggered the event`),payload:u(o(),b()).optional().describe(`Event-specific payload`)}),Sz=l({valid:v().describe(`Whether the metadata is valid`),errors:S(l({path:o().describe(`JSON path to the invalid field`),message:o().describe(`Error description`),code:o().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:S(l({path:o().describe(`JSON path to the field`),message:o().describe(`Warning description`)})).optional().describe(`Validation warnings`)}),Cz=l({storage:_z.describe(`Storage backend configuration`),customizationPolicies:S(pz).optional().describe(`Default customization policies per type`),mergeStrategy:fz.optional().describe(`Merge strategy for package upgrades`),additionalTypes:S(yz.omit({type:!0}).extend({type:o().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:v().default(!0).describe(`Emit metadata change events`),validateOnWrite:v().default(!0).describe(`Validate metadata on write`),enableVersioning:v().default(!1).describe(`Track metadata version history`),cacheMaxItems:A().int().min(0).default(1e4).describe(`Max items in memory cache`)}),Ble=l({id:p(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:p(`ObjectStack Metadata Service`).describe(`Plugin name`),version:o().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:p(`standard`).describe(`Plugin type`),description:o().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:l({crud:v().default(!0).describe(`Supports metadata CRUD`),query:v().default(!0).describe(`Supports metadata query`),overlay:v().default(!0).describe(`Supports customization overlays`),watch:v().default(!1).describe(`Supports file watching`),importExport:v().default(!0).describe(`Supports import/export`),validation:v().default(!0).describe(`Supports schema validation`),versioning:v().default(!1).describe(`Supports version history`),events:v().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:Cz.optional().describe(`Plugin configuration`)}),Vle=[{type:`object`,label:`Object`,filePatterns:[`**/*.object.ts`,`**/*.object.yml`,`**/*.object.json`],supportsOverlay:!0,allowRuntimeCreate:!1,supportsVersioning:!0,loadOrder:10,domain:`data`},{type:`field`,label:`Field`,filePatterns:[`**/*.field.ts`,`**/*.field.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:20,domain:`data`},{type:`trigger`,label:`Trigger`,filePatterns:[`**/*.trigger.ts`,`**/*.trigger.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:30,domain:`data`},{type:`validation`,label:`Validation Rule`,filePatterns:[`**/*.validation.ts`,`**/*.validation.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:30,domain:`data`},{type:`hook`,label:`Hook`,filePatterns:[`**/*.hook.ts`,`**/*.hook.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:30,domain:`data`},{type:`view`,label:`View`,filePatterns:[`**/*.view.ts`,`**/*.view.yml`,`**/*.view.json`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:50,domain:`ui`},{type:`page`,label:`Page`,filePatterns:[`**/*.page.ts`,`**/*.page.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:50,domain:`ui`},{type:`dashboard`,label:`Dashboard`,filePatterns:[`**/*.dashboard.ts`,`**/*.dashboard.yml`,`**/*.dashboard.json`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:60,domain:`ui`},{type:`app`,label:`Application`,filePatterns:[`**/*.app.ts`,`**/*.app.yml`,`**/*.app.json`],supportsOverlay:!0,allowRuntimeCreate:!1,supportsVersioning:!0,loadOrder:70,domain:`ui`},{type:`action`,label:`Action`,filePatterns:[`**/*.action.ts`,`**/*.action.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:50,domain:`ui`},{type:`report`,label:`Report`,filePatterns:[`**/*.report.ts`,`**/*.report.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:60,domain:`ui`},{type:`flow`,label:`Flow`,filePatterns:[`**/*.flow.ts`,`**/*.flow.yml`,`**/*.flow.json`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!0,loadOrder:80,domain:`automation`},{type:`workflow`,label:`Workflow`,filePatterns:[`**/*.workflow.ts`,`**/*.workflow.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!0,loadOrder:80,domain:`automation`},{type:`approval`,label:`Approval Process`,filePatterns:[`**/*.approval.ts`,`**/*.approval.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:80,domain:`automation`},{type:`datasource`,label:`Datasource`,filePatterns:[`**/*.datasource.ts`,`**/*.datasource.yml`],supportsOverlay:!1,allowRuntimeCreate:!1,supportsVersioning:!1,loadOrder:5,domain:`system`},{type:`translation`,label:`Translation`,filePatterns:[`**/*.translation.ts`,`**/*.translation.yml`,`**/*.translation.json`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:90,domain:`system`},{type:`router`,label:`Router`,filePatterns:[`**/*.router.ts`],supportsOverlay:!1,allowRuntimeCreate:!1,supportsVersioning:!1,loadOrder:40,domain:`system`},{type:`function`,label:`Function`,filePatterns:[`**/*.function.ts`],supportsOverlay:!1,allowRuntimeCreate:!1,supportsVersioning:!1,loadOrder:40,domain:`system`},{type:`service`,label:`Service`,filePatterns:[`**/*.service.ts`],supportsOverlay:!1,allowRuntimeCreate:!1,supportsVersioning:!1,loadOrder:40,domain:`system`},{type:`permission`,label:`Permission Set`,filePatterns:[`**/*.permission.ts`,`**/*.permission.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!0,loadOrder:15,domain:`security`},{type:`profile`,label:`Profile`,filePatterns:[`**/*.profile.ts`,`**/*.profile.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:15,domain:`security`},{type:`role`,label:`Role`,filePatterns:[`**/*.role.ts`,`**/*.role.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:15,domain:`security`},{type:`agent`,label:`AI Agent`,filePatterns:[`**/*.agent.ts`,`**/*.agent.yml`],supportsOverlay:!1,allowRuntimeCreate:!0,supportsVersioning:!0,loadOrder:90,domain:`ai`},{type:`tool`,label:`AI Tool`,filePatterns:[`**/*.tool.ts`,`**/*.tool.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:85,domain:`ai`},{type:`skill`,label:`AI Skill`,filePatterns:[`**/*.skill.ts`,`**/*.skill.yml`],supportsOverlay:!0,allowRuntimeCreate:!0,supportsVersioning:!1,loadOrder:88,domain:`ai`}],Hle=l({items:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),data:u(o(),b()).describe(`Metadata payload`),namespace:o().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:v().default(!1).describe(`Continue if individual item fails`),validate:v().default(!0).describe(`Validate before register`)}),wz=l({total:A().int().min(0).describe(`Total items processed`),succeeded:A().int().min(0).describe(`Successfully processed`),failed:A().int().min(0).describe(`Failed items`),errors:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),error:o().describe(`Error message`)})).optional().describe(`Per-item errors`)}),Tz=l({sourceType:o().describe(`Dependent metadata type`),sourceName:o().describe(`Dependent metadata name`),targetType:o().describe(`Referenced metadata type`),targetName:o().describe(`Referenced metadata name`),kind:x([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)}),Ez=x([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),Dz=l({manifest:cz.describe(`Full package manifest`),status:Ez.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:v().default(!0).describe(`Whether the package is currently enabled`),installedAt:o().datetime().optional().describe(`Installation timestamp`),updatedAt:o().datetime().optional().describe(`Last update timestamp`),installedVersion:o().optional().describe(`Currently installed version for quick access`),previousVersion:o().optional().describe(`Version before the last upgrade`),statusChangedAt:o().datetime().optional().describe(`Status change timestamp`),errorMessage:o().optional().describe(`Error message when status is error`),settings:u(o(),b()).optional().describe(`User-provided configuration settings`),upgradeHistory:S(l({fromVersion:o().describe(`Version before upgrade`),toVersion:o().describe(`Version after upgrade`),upgradedAt:o().datetime().describe(`Upgrade timestamp`),status:x([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:S(o()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:S(o()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`),Ule=l({namespace:o().describe(`Namespace prefix`),packageId:o().describe(`Owning package ID`),registeredAt:o().datetime().describe(`Registration timestamp`),status:x([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),Wle=l({type:p(`namespace_conflict`).describe(`Error type`),requestedNamespace:o().describe(`Requested namespace`),conflictingPackageId:o().describe(`Conflicting package ID`),conflictingPackageName:o().describe(`Conflicting package display name`),suggestion:o().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),Oz=l({status:Ez.optional().describe(`Filter by package status`),type:cz.shape.type.optional().describe(`Filter by package type`),enabled:v().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),kz=l({packages:S(Dz).describe(`List of installed packages`),total:A().describe(`Total package count`)}).describe(`List packages response`),Az=l({id:o().describe(`Package identifier`)}).describe(`Get package request`),jz=l({package:Dz.describe(`Package details`)}).describe(`Get package response`),Mz=l({manifest:cz.describe(`Package manifest to install`),settings:u(o(),b()).optional().describe(`User-provided settings at install time`),enableOnInstall:v().default(!0).describe(`Whether to enable immediately after install`),platformVersion:o().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),Nz=l({package:Dz.describe(`Installed package details`),message:o().optional().describe(`Installation status message`),dependencyResolution:SR.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),Pz=l({id:o().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),Fz=l({id:o().describe(`Uninstalled package ID`),success:v().describe(`Whether uninstall succeeded`),message:o().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),Iz=l({id:o().describe(`Package ID to enable`)}).describe(`Enable package request`),Lz=l({package:Dz.describe(`Enabled package details`),message:o().optional().describe(`Enable status message`)}).describe(`Enable package response`),Rz=l({id:o().describe(`Package ID to disable`)}).describe(`Disable package request`),zz=l({package:Dz.describe(`Disabled package details`),message:o().optional().describe(`Disable status message`)}).describe(`Disable package response`),Bz=x([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),Vz=l({type:o().describe(`Metadata type`),name:o().describe(`Metadata name`),changeType:Bz.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:v().default(!1).describe(`Whether this change may conflict with customizations`),summary:o().optional().describe(`Human-readable change summary`),previousName:o().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),Hz=x([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),Uz=l({packageId:o().describe(`Package identifier`),fromVersion:o().describe(`Currently installed version`),toVersion:o().describe(`Target upgrade version`),impactLevel:Hz.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:S(Vz).describe(`All metadata changes`),affectedCustomizations:A().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:v().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:S(o()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:S(l({packageId:o(),fromVersion:o(),toVersion:o()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:A().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:o().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`),Gle=l({id:o().describe(`Snapshot identifier`),packageId:o().describe(`Package identifier`),fromVersion:o().describe(`Version before upgrade`),toVersion:o().describe(`Target upgrade version`),tenantId:o().optional().describe(`Tenant identifier`),previousManifest:cz.describe(`Complete manifest of the previous package version`),metadataSnapshot:S(l({type:o(),name:o(),metadata:u(o(),b())})).describe(`Snapshot of all package metadata`),customizationSnapshot:S(u(o(),b())).optional().describe(`Snapshot of customer customizations`),createdAt:o().datetime().describe(`Snapshot creation timestamp`),expiresAt:o().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),Kle=l({packageId:o().describe(`Package ID to upgrade`),targetVersion:o().optional().describe(`Target version (defaults to latest)`),manifest:cz.optional().describe(`New manifest (if installing from local)`),createSnapshot:v().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:x([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:v().default(!1).describe(`Preview upgrade without making changes`),skipValidation:v().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`),Wz=x([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`),qle=l({success:v().describe(`Whether the upgrade succeeded`),phase:Wz.describe(`Current upgrade phase`),plan:Uz.optional().describe(`Upgrade plan`),snapshotId:o().optional().describe(`Snapshot ID for rollback`),conflicts:S(l({path:o(),baseValue:b(),incomingValue:b(),customValue:b()})).optional().describe(`Unresolved merge conflicts`),errorMessage:o().optional().describe(`Error message if upgrade failed`),message:o().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),Jle=l({packageId:o().describe(`Package ID to rollback`),snapshotId:o().describe(`Snapshot ID to restore from`),rollbackCustomizations:v().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),Yle=l({success:v().describe(`Whether the rollback succeeded`),restoredVersion:o().optional().describe(`Version restored to`),message:o().optional().describe(`Rollback status message`)}).describe(`Rollback package response`),Gz=x([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),Kz=l({interval:A().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:A().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:A().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:A().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:o().optional().describe(`Method name to call for health check`),autoRestart:v().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:A().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)}),Xle=l({status:Gz,timestamp:o().datetime(),message:o().optional(),metrics:l({uptime:A().describe(`Plugin uptime in milliseconds`),memoryUsage:A().optional().describe(`Memory usage in bytes`),cpuUsage:A().optional().describe(`CPU usage percentage`),activeConnections:A().optional().describe(`Number of active connections`),errorRate:A().optional().describe(`Error rate (errors per minute)`),responseTime:A().optional().describe(`Average response time in ms`)}).partial().optional(),checks:S(l({name:o().describe(`Check name`),status:x([`passed`,`failed`,`warning`]),message:o().optional(),data:u(o(),b()).optional()})).optional(),dependencies:S(l({pluginId:o(),status:Gz,message:o().optional()})).optional()}),qz=l({provider:x([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:S(o()).optional().describe(`Backend connection endpoints`),keyPrefix:o().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:A().int().min(0).optional().describe(`State expiration time in seconds`),auth:l({username:o().optional(),password:o().optional(),token:o().optional(),certificate:o().optional()}).optional(),replication:l({enabled:v().default(!0),minReplicas:A().int().min(1).default(1)}).optional(),customConfig:u(o(),b()).optional().describe(`Provider-specific configuration`)}),Jz=l({enabled:v().default(!1),watchPatterns:S(o()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:A().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:v().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:x([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:qz.optional().describe(`Configuration for distributed state management`),shutdownTimeout:A().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:S(o()).optional().describe(`Hook names to call before reload`),afterReload:S(o()).optional().describe(`Hook names to call after reload`)}),Yz=l({enabled:v().default(!0),fallbackMode:x([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:S(o()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:S(o()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:S(l({feature:o().describe(`Feature name`),enabled:v().describe(`Whether feature is available in degraded mode`),reason:o().optional()})).optional(),autoRecovery:l({enabled:v().default(!0),retryInterval:A().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:A().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),Xz=l({mode:x([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:l({major:v().default(!1).describe(`Allow major version updates`),minor:v().default(!0).describe(`Allow minor version updates`),patch:v().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:l({cron:o().optional(),timezone:o().default(`UTC`),maintenanceWindow:A().int().min(1).default(60)}).optional(),rollback:l({enabled:v().default(!0),automatic:v().default(!0),keepVersions:A().int().min(1).default(3),timeout:A().int().min(1e3).default(3e4)}).optional(),validation:l({checkCompatibility:v().default(!0),runTests:v().default(!1),testSuite:o().optional()}).optional()}),Zle=l({pluginId:o(),version:o(),timestamp:o().datetime(),state:u(o(),b()),metadata:l({checksum:o().optional().describe(`State checksum for verification`),compressed:v().default(!1),encryption:o().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),Qle=l({health:Kz.optional(),hotReload:Jz.optional(),degradation:Yz.optional(),updates:Xz.optional(),resources:l({maxMemory:A().int().optional().describe(`Maximum memory in bytes`),maxCpu:A().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:A().int().optional().describe(`Maximum concurrent connections`),timeout:A().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:l({enableMetrics:v().default(!0),enableTracing:v().default(!0),enableProfiling:v().default(!1),metricsInterval:A().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()}),Zz=x([`init`,`start`,`destroy`]).describe(`Plugin lifecycle phase`),Qz=l({pluginName:o().describe(`Name of the plugin`),timestamp:A().int().describe(`Unix timestamp in milliseconds when event occurred`)}),$le=Qz.extend({version:o().optional().describe(`Plugin version`)}),eue=Qz.extend({duration:A().min(0).optional().describe(`Duration of the lifecycle phase in milliseconds`),phase:Zz.optional().describe(`Lifecycle phase`)}),tue=Qz.extend({error:l({name:o().describe(`Error class name`),message:o().describe(`Error message`),stack:o().optional().describe(`Stack trace`),code:o().optional().describe(`Error code`)}).describe(`Serializable error representation`),phase:Zz.describe(`Lifecycle phase where error occurred`),errorMessage:o().optional().describe(`Error message`),errorStack:o().optional().describe(`Error stack trace`)}),nue=l({serviceName:o().describe(`Name of the registered service`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),serviceType:o().optional().describe(`Type or interface name of the service`)}),rue=l({serviceName:o().describe(`Name of the unregistered service`),timestamp:A().int().describe(`Unix timestamp in milliseconds`)}),iue=l({hookName:o().describe(`Name of the hook`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),handlerCount:A().int().min(0).describe(`Number of handlers registered for this hook`)}),aue=l({hookName:o().describe(`Name of the hook`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),args:S(b()).describe(`Arguments passed to the hook handlers`),handlerCount:A().int().min(0).optional().describe(`Number of handlers that will handle this event`)}),$z=l({timestamp:A().int().describe(`Unix timestamp in milliseconds`)}),oue=$z.extend({duration:A().min(0).optional().describe(`Total initialization duration in milliseconds`),pluginCount:A().int().min(0).optional().describe(`Number of plugins initialized`)}),sue=$z.extend({reason:o().optional().describe(`Reason for kernel shutdown`)}),cue=x([`kernel:ready`,`kernel:shutdown`,`kernel:before-init`,`kernel:after-init`,`plugin:registered`,`plugin:before-init`,`plugin:init`,`plugin:after-init`,`plugin:before-start`,`plugin:started`,`plugin:after-start`,`plugin:before-destroy`,`plugin:destroyed`,`plugin:after-destroy`,`plugin:error`,`service:registered`,`service:unregistered`,`hook:registered`,`hook:triggered`]).describe(`Plugin lifecycle event type`),eB=x([`load`,`unload`,`reload`,`enable`,`disable`]).describe(`Runtime plugin operation type`),tB=l({type:x([`npm`,`local`,`url`,`registry`,`git`]).describe(`Plugin source type`),location:o().describe(`Package name, file path, URL, or git repository`),version:o().optional().describe(`Semver version range (e.g., "^1.0.0")`),integrity:o().optional().describe(`Subresource Integrity hash (e.g., "sha384-...")`)}).describe(`Plugin source location for dynamic resolution`),nB=l({type:x([`onCommand`,`onRoute`,`onObject`,`onEvent`,`onService`,`onSchedule`,`onStartup`]).describe(`Trigger type for lazy activation`),pattern:o().describe(`Match pattern for the activation trigger`)}).describe(`Lazy activation trigger for a dynamic plugin`),lue=l({pluginId:o().describe(`Unique plugin identifier`),source:tB,activationEvents:S(nB).optional().describe(`Lazy activation triggers; if omitted plugin starts immediately`),config:u(o(),b()).optional().describe(`Runtime configuration overrides`),priority:A().int().min(0).default(100).describe(`Loading priority (lower is higher)`),sandbox:v().default(!1).describe(`Run in an isolated sandbox`),timeout:A().int().min(1e3).default(6e4).describe(`Maximum time to complete loading in ms`)}).describe(`Request to dynamically load a plugin at runtime`),uue=l({pluginId:o().describe(`Plugin to unload`),strategy:x([`graceful`,`forceful`,`drain`]).default(`graceful`).describe(`How to handle in-flight work during unload`),timeout:A().int().min(1e3).default(3e4).describe(`Maximum time to complete unloading in ms`),cleanupCache:v().default(!1).describe(`Remove cached code and assets after unload`),dependentAction:x([`cascade`,`warn`,`block`]).default(`block`).describe(`How to handle plugins that depend on this one`)}).describe(`Request to dynamically unload a plugin at runtime`),due=l({success:v(),operation:eB,pluginId:o(),durationMs:A().int().min(0).optional(),version:o().optional(),error:l({code:o().describe(`Machine-readable error code`),message:o().describe(`Human-readable error message`),details:u(o(),b()).optional()}).optional(),warnings:S(o()).optional()}).describe(`Result of a dynamic plugin operation`),rB=l({type:x([`registry`,`npm`,`directory`,`url`]).describe(`Discovery source type`),endpoint:o().describe(`Registry URL, directory path, or manifest URL`),pollInterval:A().int().min(0).default(0).describe(`How often to re-scan for new plugins (0 = manual)`),filter:l({tags:S(o()).optional(),vendors:S(o()).optional(),minTrustLevel:x([`verified`,`trusted`,`community`,`untrusted`]).optional()}).optional()}).describe(`Source for runtime plugin discovery`),iB=l({enabled:v().default(!1),sources:S(rB).default([]),autoLoad:v().default(!1).describe(`Automatically load newly discovered plugins`),requireApproval:v().default(!0).describe(`Require admin approval before loading discovered plugins`)}).describe(`Runtime plugin discovery configuration`),fue=l({enabled:v().default(!1).describe(`Enable runtime load/unload of plugins`),maxDynamicPlugins:A().int().min(1).default(50).describe(`Upper limit on runtime-loaded plugins`),discovery:iB.optional(),defaultSandbox:v().default(!0).describe(`Sandbox dynamically loaded plugins by default`),allowedSources:S(x([`npm`,`local`,`url`,`registry`,`git`])).optional().describe(`Restrict which source types are permitted`),requireIntegrity:v().default(!0).describe(`Require integrity hash verification for remote sources`),operationTimeout:A().int().min(1e3).default(6e4).describe(`Default timeout for load/unload operations in ms`)}).describe(`Dynamic plugin loading subsystem configuration`),aB=x([`global`,`tenant`,`user`,`resource`,`plugin`]).describe(`Scope of permission application`),oB=x([`create`,`read`,`update`,`delete`,`execute`,`manage`,`configure`,`share`,`export`,`import`,`admin`]).describe(`Type of action being permitted`),sB=x([`data.object`,`data.record`,`data.field`,`ui.view`,`ui.dashboard`,`ui.report`,`system.config`,`system.plugin`,`system.api`,`system.service`,`storage.file`,`storage.database`,`network.http`,`network.websocket`,`process.spawn`,`process.env`]).describe(`Type of resource being accessed`),cB=l({id:o().describe(`Unique permission identifier`),resource:sB,actions:S(oB),scope:aB.default(`plugin`),filter:l({resourceIds:S(o()).optional(),condition:o().optional().describe(`Filter expression (e.g., owner = currentUser)`),fields:S(o()).optional().describe(`Allowed fields for data resources`)}).optional(),description:o(),required:v().default(!0),justification:o().optional().describe(`Why this permission is needed`)}),lB=l({permissions:S(cB),groups:S(l({name:o().describe(`Group name`),description:o(),permissions:S(o()).describe(`Permission IDs in this group`)})).optional(),defaultGrant:x([`prompt`,`allow`,`deny`,`inherit`]).default(`prompt`)}),uB=l({engine:x([`v8-isolate`,`wasm`,`container`,`process`]).default(`v8-isolate`).describe(`Execution environment engine`),engineConfig:l({wasm:l({maxMemoryPages:A().int().min(1).max(65536).optional().describe(`Maximum WASM memory pages (64KB each)`),instructionLimit:A().int().min(1).optional().describe(`Maximum instructions before timeout`),enableSimd:v().default(!1).describe(`Enable WebAssembly SIMD support`),enableThreads:v().default(!1).describe(`Enable WebAssembly threads`),enableBulkMemory:v().default(!0).describe(`Enable bulk memory operations`)}).optional(),container:l({image:o().optional().describe(`Container image to use`),runtime:x([`docker`,`podman`,`containerd`]).default(`docker`),resources:l({cpuLimit:o().optional().describe(`CPU limit (e.g., "0.5", "2")`),memoryLimit:o().optional().describe(`Memory limit (e.g., "512m", "1g")`)}).optional(),networkMode:x([`none`,`bridge`,`host`]).default(`bridge`)}).optional(),v8Isolate:l({heapSizeMb:A().int().min(1).optional(),enableSnapshot:v().default(!0)}).optional()}).optional(),resourceLimits:l({maxMemory:A().int().optional().describe(`Maximum memory allocation`),maxCpu:A().min(0).max(100).optional().describe(`Maximum CPU usage percentage`),timeout:A().int().min(0).optional().describe(`Maximum execution time`)}).optional()}),dB=l({enabled:v().default(!0),level:x([`none`,`minimal`,`standard`,`strict`,`paranoid`]).default(`standard`),runtime:uB.optional().describe(`Execution environment and isolation settings`),filesystem:l({mode:x([`none`,`readonly`,`restricted`,`full`]).default(`restricted`),allowedPaths:S(o()).optional().describe(`Whitelisted paths`),deniedPaths:S(o()).optional().describe(`Blacklisted paths`),maxFileSize:A().int().optional().describe(`Maximum file size in bytes`)}).optional(),network:l({mode:x([`none`,`local`,`restricted`,`full`]).default(`restricted`),allowedHosts:S(o()).optional().describe(`Whitelisted hosts`),deniedHosts:S(o()).optional().describe(`Blacklisted hosts`),allowedPorts:S(A()).optional().describe(`Allowed port numbers`),maxConnections:A().int().optional()}).optional(),process:l({allowSpawn:v().default(!1).describe(`Allow spawning child processes`),allowedCommands:S(o()).optional().describe(`Whitelisted commands`),timeout:A().int().optional().describe(`Process timeout in ms`)}).optional(),memory:l({maxHeap:A().int().optional().describe(`Maximum heap size in bytes`),maxStack:A().int().optional().describe(`Maximum stack size in bytes`)}).optional(),cpu:l({maxCpuPercent:A().min(0).max(100).optional(),maxThreads:A().int().optional()}).optional(),environment:l({mode:x([`none`,`readonly`,`restricted`,`full`]).default(`readonly`),allowedVars:S(o()).optional(),deniedVars:S(o()).optional()}).optional()}),fB=l({cve:o().optional(),id:o(),severity:x([`critical`,`high`,`medium`,`low`,`info`]),category:o().optional(),title:o(),location:o().optional(),remediation:o().optional(),description:o(),affectedVersions:S(o()),fixedIn:S(o()).optional(),cvssScore:A().min(0).max(10).optional(),exploitAvailable:v().default(!1),patchAvailable:v().default(!1),workaround:o().optional(),references:S(o()).optional(),discoveredDate:o().datetime().optional(),publishedDate:o().datetime().optional()}),pB=l({timestamp:o().datetime(),scanner:l({name:o(),version:o()}),status:x([`passed`,`failed`,`warning`]),vulnerabilities:S(fB).optional(),codeIssues:S(l({severity:x([`error`,`warning`,`info`]),type:o().describe(`Issue type (e.g., sql-injection, xss)`),file:o(),line:A().int().optional(),message:o(),suggestion:o().optional()})).optional(),dependencyVulnerabilities:S(l({package:o(),version:o(),vulnerability:fB})).optional(),licenseCompliance:l({status:x([`compliant`,`non-compliant`,`unknown`]),issues:S(l({package:o(),license:o(),reason:o()})).optional()}).optional(),summary:l({totalVulnerabilities:A().int(),criticalCount:A().int(),highCount:A().int(),mediumCount:A().int(),lowCount:A().int(),infoCount:A().int()})}),mB=l({csp:l({directives:u(o(),S(o())).optional(),reportOnly:v().default(!1)}).optional(),cors:l({allowedOrigins:S(o()),allowedMethods:S(o()),allowedHeaders:S(o()),allowCredentials:v().default(!1),maxAge:A().int().optional()}).optional(),rateLimit:l({enabled:v().default(!0),maxRequests:A().int(),windowMs:A().int().describe(`Time window in milliseconds`),strategy:x([`fixed`,`sliding`,`token-bucket`]).default(`sliding`)}).optional(),authentication:l({required:v().default(!0),methods:S(x([`jwt`,`oauth2`,`api-key`,`session`,`certificate`])),tokenExpiration:A().int().optional().describe(`Token expiration in seconds`)}).optional(),encryption:l({dataAtRest:v().default(!1).describe(`Encrypt data at rest`),dataInTransit:v().default(!0).describe(`Enforce HTTPS/TLS`),algorithm:o().optional().describe(`Encryption algorithm`),minKeyLength:A().int().optional().describe(`Minimum key length in bits`)}).optional(),auditLog:l({enabled:v().default(!0),events:S(o()).optional().describe(`Events to log`),retention:A().int().optional().describe(`Log retention in days`)}).optional()}),hB=x([`verified`,`trusted`,`community`,`untrusted`,`blocked`]).describe(`Trust level of the plugin`),pue=l({pluginId:o(),trustLevel:hB,permissions:lB,sandbox:dB,policy:mB.optional(),scanResults:S(pB).optional(),vulnerabilities:S(fB).optional(),codeSigning:l({signed:v(),signature:o().optional(),certificate:o().optional(),algorithm:o().optional(),timestamp:o().datetime().optional()}).optional(),certifications:S(l({name:o().describe(`Certification name (e.g., SOC 2, ISO 27001)`),issuer:o(),issuedDate:o().datetime(),expiryDate:o().datetime().optional(),certificateUrl:o().url().optional()})).optional(),securityContact:l({email:o().email().optional(),url:o().url().optional(),pgpKey:o().optional()}).optional(),vulnerabilityDisclosure:l({policyUrl:o().url().optional(),responseTime:A().int().optional().describe(`Expected response time in hours`),bugBounty:v().default(!1)}).optional()}),gB=/^[a-z][a-z0-9_]*$/,_B=o().describe(`Validates a file path against OPS naming conventions`).superRefine((e,t)=>{if(!e.startsWith(`src/`))return;let n=e.split(`/`);if(n.length>2){let e=n[1];gB.test(e)||t.addIssue({code:le.custom,message:`Domain directory '${e}' must be lowercase snake_case`})}let r=n[n.length-1];r===`index.ts`||r===`main.ts`||gB.test(r.split(`.`)[0])||t.addIssue({code:le.custom,message:`Filename '${r}' base name must be lowercase snake_case`})}),mue=l({name:o().regex(gB).describe(`Module name (snake_case)`),files:S(o()).describe(`List of files in this module`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}).describe(`Scanned domain module representing a plugin folder`).superRefine((e,t)=>{e.files.includes(`index.ts`)||t.addIssue({code:le.custom,message:`Module '${e.name}' is missing an 'index.ts' entry point.`})}),hue=l({root:o().describe(`Root directory path of the plugin project`),files:S(o()).describe(`List of all file paths relative to root`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}).describe(`Full plugin project layout validated against OPS conventions`).superRefine((e,t)=>{e.files.includes(`objectstack.config.ts`)||t.addIssue({code:le.custom,message:`Missing 'objectstack.config.ts' configuration file.`}),e.files.filter(e=>e.startsWith(`src/`)).forEach(e=>{let n=_B.safeParse(e);n.success||n.error.issues.forEach(n=>{t.addIssue({...n,path:[e]})})})}),vB=l({field:o().describe(`Field name that failed validation`),message:o().describe(`Human-readable error message`),code:o().optional().describe(`Machine-readable error code`)}),yB=l({field:o().describe(`Field name with warning`),message:o().describe(`Human-readable warning message`),code:o().optional().describe(`Machine-readable warning code`)}),gue=l({valid:v().describe(`Whether the plugin passed validation`),errors:S(vB).optional().describe(`Validation errors`),warnings:S(yB).optional().describe(`Validation warnings`)}),_ue=l({name:o().min(1).describe(`Unique plugin identifier`),version:o().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic version (e.g., 1.0.0)`),dependencies:S(o()).optional().describe(`Array of plugin names this plugin depends on`),signature:o().optional().describe(`Cryptographic signature for plugin verification`)}).passthrough().describe(`Plugin metadata for validation`),bB=l({major:A().int().min(0).describe(`Major version (breaking changes)`),minor:A().int().min(0).describe(`Minor version (backward compatible features)`),patch:A().int().min(0).describe(`Patch version (backward compatible fixes)`),preRelease:o().optional().describe(`Pre-release identifier (alpha, beta, rc.1)`),build:o().optional().describe(`Build metadata`)}).describe(`Semantic version number`),vue=c([o().regex(/^[\d.]+$/).describe("Exact version: `1.2.3`"),o().regex(/^\^[\d.]+$/).describe("Compatible with: `^1.2.3` (`>=1.2.3 <2.0.0`)"),o().regex(/^~[\d.]+$/).describe("Approximately: `~1.2.3` (`>=1.2.3 <1.3.0`)"),o().regex(/^>=[\d.]+$/).describe("Greater than or equal: `>=1.2.3`"),o().regex(/^>[\d.]+$/).describe("Greater than: `>1.2.3`"),o().regex(/^<=[\d.]+$/).describe("Less than or equal: `<=1.2.3`"),o().regex(/^<[\d.]+$/).describe("Less than: `<1.2.3`"),o().regex(/^[\d.]+ - [\d.]+$/).describe("Range: `1.2.3 - 2.3.4`"),p(`*`).describe(`Any version`),p(`latest`).describe(`Latest stable version`)]),xB=x([`fully-compatible`,`backward-compatible`,`deprecated-compatible`,`breaking-changes`,`incompatible`]).describe(`Compatibility level between versions`),SB=l({introducedIn:o().describe(`Version that introduced this breaking change`),type:x([`api-removed`,`api-renamed`,`api-signature-changed`,`behavior-changed`,`dependency-changed`,`configuration-changed`,`protocol-changed`]),description:o(),migrationGuide:o().optional().describe(`How to migrate from old to new`),deprecatedIn:o().optional().describe(`Version where old API was deprecated`),removedIn:o().optional().describe(`Version where old API will be removed`),automatedMigration:v().default(!1).describe(`Whether automated migration tool is available`),severity:x([`critical`,`major`,`minor`]).describe(`Impact severity`)}),CB=l({feature:o().describe(`Deprecated feature identifier`),deprecatedIn:o(),removeIn:o().optional(),reason:o(),alternative:o().optional().describe(`What to use instead`),migrationPath:o().optional().describe(`How to migrate to alternative`)}),wB=l({from:o().describe(`Version being upgraded from`),to:o().describe(`Version being upgraded to`),compatibility:xB,breakingChanges:S(SB).optional(),migrationRequired:v().default(!1),migrationComplexity:x([`trivial`,`simple`,`moderate`,`complex`,`major`]).optional(),estimatedMigrationTime:A().optional(),migrationScript:o().optional().describe(`Path to migration script`),testCoverage:A().min(0).max(100).optional().describe(`Percentage of migration covered by tests`)}),yue=l({pluginId:o(),currentVersion:o(),compatibilityMatrix:S(wB),supportedVersions:S(l({version:o(),supported:v(),endOfLife:o().datetime().optional().describe(`End of support date`),securitySupport:v().default(!1).describe(`Still receives security updates`)})),minimumCompatibleVersion:o().optional().describe(`Oldest version that can be directly upgraded`)}),TB=l({type:x([`version-mismatch`,`missing-dependency`,`circular-dependency`,`incompatible-versions`,`conflicting-interfaces`]),plugins:S(l({pluginId:o(),version:o(),requirement:o().optional().describe(`What this plugin requires`)})),description:o(),resolutions:S(l({strategy:x([`upgrade`,`downgrade`,`replace`,`disable`,`manual`]),description:o(),automaticResolution:v().default(!1),riskLevel:x([`low`,`medium`,`high`])})).optional(),severity:x([`critical`,`error`,`warning`,`info`])}),bue=l({success:v(),resolved:S(l({pluginId:o(),version:o(),resolvedVersion:o()})).optional(),conflicts:S(TB).optional(),warnings:S(o()).optional(),installationOrder:S(o()).optional().describe(`Plugin IDs in order they should be installed`),dependencyGraph:u(o(),S(o())).optional().describe(`Map of plugin ID to its dependencies`)}),xue=l({enabled:v().default(!1),maxConcurrentVersions:A().int().min(1).default(2).describe(`How many versions can run at the same time`),selectionStrategy:x([`latest`,`stable`,`compatible`,`pinned`,`canary`,`custom`]).default(`latest`),routing:S(l({condition:o().describe(`Routing condition (e.g., tenant, user, feature flag)`),version:o().describe(`Version to use when condition matches`),priority:A().int().default(100).describe(`Rule priority`)})).optional(),rollout:l({enabled:v().default(!1),strategy:x([`percentage`,`blue-green`,`canary`]),percentage:A().min(0).max(100).optional().describe(`Percentage of traffic to new version`),duration:A().int().optional().describe(`Rollout duration in milliseconds`)}).optional()}),Sue=l({pluginId:o(),version:bB,versionString:o().describe(`Full version string (e.g., 1.2.3-beta.1+build.123)`),releaseDate:o().datetime(),releaseNotes:o().optional(),breakingChanges:S(SB).optional(),deprecations:S(CB).optional(),compatibilityMatrix:S(wB).optional(),securityFixes:S(l({cve:o().optional().describe(`CVE identifier`),severity:x([`critical`,`high`,`medium`,`low`]),description:o(),fixedIn:o().describe(`Version where vulnerability was fixed`)})).optional(),statistics:l({downloads:A().int().min(0).optional(),installations:A().int().min(0).optional(),ratings:A().min(0).max(5).optional()}).optional(),support:l({status:x([`active`,`maintenance`,`deprecated`,`eol`]),endOfLife:o().datetime().optional(),securitySupport:v().default(!0)})}),EB=x([`singleton`,`transient`,`scoped`]).describe(`Service scope type`),Cue=l({name:o().min(1).describe(`Unique service name identifier`),scope:EB.optional().default(`singleton`).describe(`Service scope type`),type:o().optional().describe(`Service type or interface name`),registeredAt:A().int().optional().describe(`Unix timestamp in milliseconds when service was registered`),metadata:u(o(),b()).optional().describe(`Additional service-specific metadata`)}),wue=l({strictMode:v().optional().default(!0).describe(`Throw errors on invalid operations (duplicate registration, service not found, etc.)`),allowOverwrite:v().optional().default(!1).describe(`Allow overwriting existing service registrations`),enableLogging:v().optional().default(!1).describe(`Enable logging for service registration and retrieval`),scopeTypes:S(o()).optional().describe(`Supported scope types`),maxServices:A().int().min(1).optional().describe(`Maximum number of services that can be registered`)}),Tue=l({name:o().min(1).describe(`Unique service name identifier`),scope:EB.optional().default(`singleton`).describe(`Service scope type`),factoryType:x([`sync`,`async`]).optional().default(`sync`).describe(`Whether factory is synchronous or asynchronous`),singleton:v().optional().default(!0).describe(`Whether to cache the factory result (singleton pattern)`)}),Eue=l({scopeType:o().describe(`Type of scope`),scopeId:o().optional().describe(`Unique scope identifier`),metadata:u(o(),b()).optional().describe(`Scope-specific context metadata`)}),Due=l({scopeId:o().describe(`Unique scope identifier`),scopeType:o().describe(`Type of scope`),createdAt:A().int().describe(`Unix timestamp in milliseconds when scope was created`),serviceCount:A().int().min(0).optional().describe(`Number of services registered in this scope`),metadata:u(o(),b()).optional().describe(`Scope-specific context metadata`)}),Oue=l({timeout:A().int().min(0).optional().default(3e4).describe(`Maximum time in milliseconds to wait for each plugin to start`),rollbackOnFailure:v().optional().default(!0).describe(`Whether to rollback already-started plugins if any plugin fails`),healthCheck:v().optional().default(!1).describe(`Whether to run health checks after plugin startup`),parallel:v().optional().default(!1).describe(`Whether to start plugins in parallel when dependencies allow`),context:b().optional().describe(`Custom context object to pass to plugin lifecycle methods`)}),DB=l({healthy:v().describe(`Whether the plugin is healthy`),timestamp:A().int().describe(`Unix timestamp in milliseconds when health check was performed`),details:u(o(),b()).optional().describe(`Optional plugin-specific health details`),message:o().optional().describe(`Error message if plugin is unhealthy`)}),OB=l({plugin:l({name:o(),version:o().optional()}).passthrough().describe(`Plugin metadata`),success:v().describe(`Whether the plugin started successfully`),duration:A().min(0).describe(`Time taken to start the plugin in milliseconds`),error:l({name:o().describe(`Error class name`),message:o().describe(`Error message`),stack:o().optional().describe(`Stack trace`),code:o().optional().describe(`Error code`)}).optional().describe(`Serializable error representation if startup failed`),health:DB.optional().describe(`Health status after startup if health check was enabled`)}),kue=l({results:S(OB).describe(`Startup results for each plugin`),totalDuration:A().min(0).describe(`Total time taken for all plugins in milliseconds`),allSuccessful:v().describe(`Whether all plugins started successfully`),rolledBack:S(o()).optional().describe(`Names of plugins that were rolled back`)}),kB=l({id:o().regex(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/).describe(`Vendor identifier (reverse domain)`),name:o(),website:o().url().optional(),email:o().email().optional(),verified:v().default(!1).describe(`Whether vendor is verified by ObjectStack`),trustLevel:x([`official`,`verified`,`community`,`unverified`]).default(`unverified`)}),AB=l({testCoverage:A().min(0).max(100).optional(),documentationScore:A().min(0).max(100).optional(),codeQuality:A().min(0).max(100).optional(),securityScan:l({lastScanDate:o().datetime().optional(),vulnerabilities:l({critical:A().int().min(0).default(0),high:A().int().min(0).default(0),medium:A().int().min(0).default(0),low:A().int().min(0).default(0)}).optional(),passed:v().default(!1)}).optional(),conformanceTests:S(l({protocolId:o().describe(`Protocol being tested`),passed:v(),totalTests:A().int().min(0),passedTests:A().int().min(0),lastRunDate:o().datetime().optional()})).optional()}),jB=l({downloads:A().int().min(0).default(0),downloadsLastMonth:A().int().min(0).default(0),activeInstallations:A().int().min(0).default(0),ratings:l({average:A().min(0).max(5).default(0),count:A().int().min(0).default(0),distribution:l({5:A().int().min(0).default(0),4:A().int().min(0).default(0),3:A().int().min(0).default(0),2:A().int().min(0).default(0),1:A().int().min(0).default(0)}).optional()}).optional(),stars:A().int().min(0).optional(),dependents:A().int().min(0).default(0)}),Aue=l({id:o().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Plugin identifier (reverse domain notation)`),version:o().regex(/^\d+\.\d+\.\d+$/),name:o(),description:o().optional(),readme:o().optional(),category:x([`data`,`integration`,`ui`,`analytics`,`security`,`automation`,`ai`,`utility`,`driver`,`gateway`,`adapter`]).optional(),tags:S(o()).optional(),vendor:kB,capabilities:JR.optional(),compatibility:l({minObjectStackVersion:o().optional(),maxObjectStackVersion:o().optional(),nodeVersion:o().optional(),platforms:S(x([`linux`,`darwin`,`win32`,`browser`])).optional()}).optional(),links:l({homepage:o().url().optional(),repository:o().url().optional(),documentation:o().url().optional(),bugs:o().url().optional(),changelog:o().url().optional()}).optional(),media:l({icon:o().url().optional(),logo:o().url().optional(),screenshots:S(o().url()).optional(),video:o().url().optional()}).optional(),quality:AB.optional(),statistics:jB.optional(),license:o().optional().describe(`SPDX license identifier`),pricing:l({model:x([`free`,`freemium`,`paid`,`enterprise`]),price:A().min(0).optional(),currency:o().default(`USD`).optional(),billingPeriod:x([`one-time`,`monthly`,`yearly`]).optional()}).optional(),publishedAt:o().datetime().optional(),updatedAt:o().datetime().optional(),deprecated:v().default(!1),deprecationMessage:o().optional(),replacedBy:o().optional().describe(`Plugin ID that replaces this one`),flags:l({experimental:v().default(!1),beta:v().default(!1),featured:v().default(!1),verified:v().default(!1)}).optional()}),jue=l({query:o().optional(),category:S(o()).optional(),tags:S(o()).optional(),trustLevel:S(x([`official`,`verified`,`community`,`unverified`])).optional(),implementsProtocols:S(o()).optional(),pricingModel:S(x([`free`,`freemium`,`paid`,`enterprise`])).optional(),minRating:A().min(0).max(5).optional(),sortBy:x([`relevance`,`downloads`,`rating`,`updated`,`name`]).optional(),sortOrder:x([`asc`,`desc`]).default(`desc`).optional(),page:A().int().min(1).default(1).optional(),limit:A().int().min(1).max(100).default(20).optional()}),Mue=l({pluginId:o(),version:o().optional().describe(`Defaults to latest`),config:u(o(),b()).optional(),autoUpdate:v().default(!1).optional(),options:l({skipDependencies:v().default(!1).optional(),force:v().default(!1).optional(),target:x([`system`,`space`,`user`]).default(`space`).optional()}).optional()}),MB=x([`critical`,`high`,`medium`,`low`,`info`]).describe(`Severity level of a security vulnerability`),NB=l({cve:o().regex(/^CVE-\d{4}-\d+$/).optional().describe(`CVE identifier`),id:o().describe(`Vulnerability ID`),title:o().describe(`Short title summarizing the vulnerability`),description:o().describe(`Detailed description of the vulnerability`),severity:MB.describe(`Severity level of this vulnerability`),cvss:A().min(0).max(10).optional().describe(`CVSS score ranging from 0 to 10`),package:l({name:o().describe(`Name of the affected package`),version:o().describe(`Version of the affected package`),ecosystem:o().optional().describe(`Package ecosystem (e.g., npm, pip, maven)`)}).describe(`Affected package information`),vulnerableVersions:o().describe(`Semver range of vulnerable versions`),patchedVersions:o().optional().describe(`Semver range of patched versions`),references:S(l({type:x([`advisory`,`article`,`report`,`web`]).describe(`Type of reference source`),url:o().url().describe(`URL of the reference`)})).default([]).describe(`External references related to the vulnerability`),cwe:S(o()).default([]).describe(`CWE identifiers associated with this vulnerability`),publishedAt:o().datetime().optional().describe(`ISO 8601 date when the vulnerability was published`),mitigation:o().optional().describe(`Recommended steps to mitigate the vulnerability`)}).describe(`A known security vulnerability in a package dependency`),PB=l({scanId:o().uuid().describe(`Unique identifier for this security scan`),plugin:l({id:o().describe(`Plugin identifier`),version:o().describe(`Plugin version that was scanned`)}).describe(`Plugin that was scanned`),scannedAt:o().datetime().describe(`ISO 8601 timestamp when the scan was performed`),scanner:l({name:o().describe(`Scanner name (e.g., snyk, osv, trivy)`),version:o().describe(`Version of the scanner tool`)}).describe(`Information about the scanner tool used`),status:x([`passed`,`failed`,`warning`]).describe(`Overall result status of the security scan`),vulnerabilities:S(NB).describe(`List of vulnerabilities discovered during the scan`),summary:l({critical:A().int().min(0).default(0).describe(`Count of critical severity vulnerabilities`),high:A().int().min(0).default(0).describe(`Count of high severity vulnerabilities`),medium:A().int().min(0).default(0).describe(`Count of medium severity vulnerabilities`),low:A().int().min(0).default(0).describe(`Count of low severity vulnerabilities`),info:A().int().min(0).default(0).describe(`Count of informational severity vulnerabilities`),total:A().int().min(0).default(0).describe(`Total count of all vulnerabilities`)}).describe(`Summary counts of vulnerabilities by severity`),licenseIssues:S(l({package:o().describe(`Name of the package with a license issue`),license:o().describe(`License identifier of the package`),reason:o().describe(`Reason the license is flagged`),severity:x([`error`,`warning`,`info`]).describe(`Severity of the license compliance issue`)})).default([]).describe(`License compliance issues found during the scan`),codeQuality:l({score:A().min(0).max(100).optional().describe(`Overall code quality score from 0 to 100`),issues:S(l({type:x([`security`,`quality`,`style`]).describe(`Category of the code quality issue`),severity:x([`error`,`warning`,`info`]).describe(`Severity of the code quality issue`),message:o().describe(`Description of the code quality issue`),file:o().optional().describe(`File path where the issue was found`),line:A().int().optional().describe(`Line number where the issue was found`)})).default([]).describe(`List of individual code quality issues`)}).optional().describe(`Code quality analysis results`),nextScanAt:o().datetime().optional().describe(`ISO 8601 timestamp for the next scheduled scan`)}).describe(`Result of a security scan performed on a plugin`),FB=l({id:o().describe(`Unique identifier for the security policy`),name:o().describe(`Human-readable name of the security policy`),autoScan:l({enabled:v().default(!0).describe(`Whether automatic scanning is enabled`),frequency:x([`on-publish`,`daily`,`weekly`,`monthly`]).default(`daily`).describe(`How often automatic scans are performed`)}).describe(`Automatic security scanning configuration`),thresholds:l({maxCritical:A().int().min(0).default(0).describe(`Maximum allowed critical vulnerabilities before blocking`),maxHigh:A().int().min(0).default(0).describe(`Maximum allowed high vulnerabilities before blocking`),maxMedium:A().int().min(0).default(5).describe(`Maximum allowed medium vulnerabilities before warning`)}).describe(`Vulnerability count thresholds for policy enforcement`),allowedLicenses:S(o()).default([`MIT`,`Apache-2.0`,`BSD-3-Clause`,`BSD-2-Clause`,`ISC`]).describe(`List of SPDX license identifiers that are permitted`),prohibitedLicenses:S(o()).default([`GPL-3.0`,`AGPL-3.0`]).describe(`List of SPDX license identifiers that are prohibited`),codeSigning:l({required:v().default(!1).describe(`Whether code signing is required for plugins`),allowedSigners:S(o()).default([]).describe(`List of trusted signer identities`)}).optional().describe(`Code signing requirements for plugin artifacts`),sandbox:l({networkAccess:x([`none`,`localhost`,`allowlist`,`all`]).default(`all`).describe(`Level of network access granted to the plugin`),allowedDestinations:S(o()).default([]).describe(`Permitted network destinations when using allowlist mode`),filesystemAccess:x([`none`,`read-only`,`temp-only`,`full`]).default(`full`).describe(`Level of file system access granted to the plugin`),maxMemoryMB:A().int().positive().optional().describe(`Maximum memory allocation in megabytes`),maxCPUSeconds:A().int().positive().optional().describe(`Maximum CPU time allowed in seconds`)}).optional().describe(`Sandbox restrictions for plugin execution`)}).describe(`Security policy governing plugin scanning and enforcement`),IB=l({name:o().describe(`Package name or identifier`),versionConstraint:o().describe("Semver range (e.g., `^1.0.0`, `>=2.0.0 <3.0.0`)"),type:x([`required`,`optional`,`peer`,`dev`]).default(`required`).describe(`Category of the dependency relationship`),resolvedVersion:o().optional().describe(`Concrete version resolved during dependency resolution`)}).describe(`A package dependency with its version constraint`),LB=l({id:o().describe(`Unique identifier of the package`),version:o().describe(`Resolved version of the package`),dependencies:S(IB).default([]).describe(`Dependencies required by this package`),depth:A().int().min(0).describe(`Depth level in the dependency tree (0 = root)`),isDirect:v().describe(`Whether this is a direct (top-level) dependency`),metadata:l({name:o().describe(`Display name of the package`),description:o().optional().describe(`Short description of the package`),license:o().optional().describe(`SPDX license identifier of the package`),homepage:o().url().optional().describe(`Homepage URL of the package`)}).optional().describe(`Additional metadata about the package`)}).describe(`A node in the dependency graph representing a resolved package`),RB=l({root:l({id:o().describe(`Identifier of the root package`),version:o().describe(`Version of the root package`)}).describe(`Root package of the dependency graph`),nodes:S(LB).describe(`All resolved package nodes in the dependency graph`),edges:S(l({from:o().describe(`Package ID`),to:o().describe(`Package ID`),constraint:o().describe(`Version constraint`)})).describe(`Directed edges representing dependency relationships`),stats:l({totalDependencies:A().int().min(0).describe(`Total number of resolved dependencies`),directDependencies:A().int().min(0).describe(`Number of direct (top-level) dependencies`),maxDepth:A().int().min(0).describe(`Maximum depth of the dependency tree`)}).describe(`Summary statistics for the dependency graph`)}).describe(`Complete dependency graph for a package and its transitive dependencies`),zB=l({package:o().describe(`Name of the package with conflicting version requirements`),conflicts:S(l({version:o().describe(`Conflicting version of the package`),requestedBy:S(o()).describe(`Packages that require this version`),constraint:o().describe(`Semver constraint that produced this version requirement`)})).describe(`List of conflicting version requirements`),resolution:l({strategy:x([`pick-highest`,`pick-lowest`,`manual`]).describe(`Strategy used to resolve the conflict`),version:o().optional().describe(`Resolved version selected by the strategy`),reason:o().optional().describe(`Explanation of why this resolution was chosen`)}).optional().describe(`Suggested resolution for the conflict`),severity:x([`error`,`warning`,`info`]).describe(`Severity level of the dependency conflict`)}).describe(`A detected conflict between dependency version requirements`),BB=l({status:x([`success`,`conflict`,`error`]).describe(`Overall status of the dependency resolution`),graph:RB.optional().describe(`Resolved dependency graph if resolution succeeded`),conflicts:S(zB).default([]).describe(`List of dependency conflicts detected during resolution`),errors:S(l({package:o().describe(`Name of the package that caused the error`),error:o().describe(`Error message describing what went wrong`)})).default([]).describe(`Errors encountered during dependency resolution`),installOrder:S(o()).default([]).describe(`Topologically sorted list of package IDs for installation`),resolvedIn:A().int().min(0).optional().describe(`Time taken to resolve dependencies in milliseconds`)}).describe(`Result of a dependency resolution process`),VB=l({name:o().describe(`Name of the software component`),version:o().describe(`Version of the software component`),purl:o().optional().describe(`Package URL identifier`),license:o().optional().describe(`SPDX license identifier of the component`),hashes:l({sha256:o().optional().describe(`SHA-256 hash of the component artifact`),sha512:o().optional().describe(`SHA-512 hash of the component artifact`)}).optional().describe(`Cryptographic hashes for integrity verification`),supplier:l({name:o().describe(`Name of the component supplier`),url:o().url().optional().describe(`URL of the component supplier`)}).optional().describe(`Supplier information for the component`),externalRefs:S(l({type:x([`website`,`repository`,`documentation`,`issue-tracker`]).describe(`Type of external reference`),url:o().url().describe(`URL of the external reference`)})).default([]).describe(`External references related to the component`)}).describe(`A single entry in a Software Bill of Materials`),HB=l({format:x([`spdx`,`cyclonedx`]).default(`cyclonedx`).describe(`SBOM standard format used`),version:o().describe(`Version of the SBOM specification`),plugin:l({id:o().describe(`Plugin identifier`),version:o().describe(`Plugin version`),name:o().describe(`Human-readable plugin name`)}).describe(`Metadata about the plugin this SBOM describes`),components:S(VB).describe(`List of software components included in the plugin`),generatedAt:o().datetime().describe(`ISO 8601 timestamp when the SBOM was generated`),generator:l({name:o().describe(`Name of the SBOM generator tool`),version:o().describe(`Version of the SBOM generator tool`)}).optional().describe(`Tool used to generate this SBOM`)}).describe(`Software Bill of Materials for a plugin`),UB=l({pluginId:o().describe(`Unique identifier of the plugin`),version:o().describe(`Version of the plugin artifact`),build:l({timestamp:o().datetime().describe(`ISO 8601 timestamp when the build was produced`),environment:l({os:o().describe(`Operating system used for the build`),arch:o().describe(`CPU architecture used for the build`),nodeVersion:o().describe(`Node.js version used for the build`)}).optional().describe(`Environment details where the build was executed`),source:l({repository:o().url().describe(`URL of the source repository`),commit:o().regex(/^[a-f0-9]{40}$/).describe(`Full SHA-1 commit hash of the source`),branch:o().optional().describe(`Branch name the build was produced from`),tag:o().optional().describe(`Git tag associated with the build`)}).optional().describe(`Source repository information for the build`),builder:l({name:o().describe(`Name of the person or system that produced the build`),email:o().email().optional().describe(`Email address of the builder`)}).optional().describe(`Identity of the builder who produced the artifact`)}).describe(`Build provenance information`),artifacts:S(l({filename:o().describe(`Name of the artifact file`),sha256:o().describe(`SHA-256 hash of the artifact`),size:A().int().positive().describe(`Size of the artifact in bytes`)})).describe(`List of build artifacts with integrity hashes`),signatures:S(l({algorithm:x([`rsa`,`ecdsa`,`ed25519`]).describe(`Cryptographic algorithm used for signing`),publicKey:o().describe(`Public key used to verify the signature`),signature:o().describe(`Digital signature value`),signedBy:o().describe(`Identity of the signer`),timestamp:o().datetime().describe(`ISO 8601 timestamp when the signature was created`)})).default([]).describe(`Cryptographic signatures for the plugin artifact`),attestations:S(l({type:x([`code-review`,`security-scan`,`test-results`,`ci-build`]).describe(`Type of attestation`),status:x([`passed`,`failed`]).describe(`Result status of the attestation`),url:o().url().optional().describe(`URL with details about the attestation`),timestamp:o().datetime().describe(`ISO 8601 timestamp when the attestation was issued`)})).default([]).describe(`Verification attestations for the plugin`)}).describe(`Verifiable provenance and chain of custody for a plugin artifact`),WB=l({pluginId:o().describe(`Unique identifier of the plugin`),score:A().min(0).max(100).describe(`Overall trust score from 0 to 100`),components:l({vendorReputation:A().min(0).max(100).describe(`Vendor reputation score from 0 to 100`),securityScore:A().min(0).max(100).describe(`Security scan results score from 0 to 100`),codeQuality:A().min(0).max(100).describe(`Code quality score from 0 to 100`),communityScore:A().min(0).max(100).describe(`Community engagement score from 0 to 100`),maintenanceScore:A().min(0).max(100).describe(`Maintenance and update frequency score from 0 to 100`)}).describe(`Individual score components contributing to the overall trust score`),level:x([`verified`,`trusted`,`neutral`,`untrusted`,`blocked`]).describe(`Computed trust level based on the overall score`),badges:S(x([`official`,`verified-vendor`,`security-scanned`,`code-signed`,`open-source`,`popular`])).default([]).describe(`Verification badges earned by the plugin`),updatedAt:o().datetime().describe(`ISO 8601 timestamp when the trust score was last updated`)}).describe(`Trust score and verification status for a plugin`),Nue={VulnerabilitySeverity:MB,SecurityVulnerability:NB,SecurityScanResult:PB,SecurityPolicy:FB,PackageDependency:IB,DependencyGraphNode:LB,DependencyGraph:RB,DependencyConflict:zB,DependencyResolutionResult:BB,SBOMEntry:VB,SBOM:HB,PluginProvenance:UB,PluginTrustScore:WB};EE({},{AnalyticsTimeRangeSchema:()=>QB,AppDiscoveryRequestSchema:()=>rde,AppDiscoveryResponseSchema:()=>ide,AppSubscriptionSchema:()=>ade,ArtifactDownloadResponseSchema:()=>Fue,ArtifactReferenceSchema:()=>KB,CreateListingRequestSchema:()=>Uue,CuratedCollectionSchema:()=>Xue,FeaturedListingSchema:()=>Yue,InstalledAppSummarySchema:()=>lV,ListInstalledAppsRequestSchema:()=>ode,ListInstalledAppsResponseSchema:()=>sde,ListReviewsRequestSchema:()=>tde,ListReviewsResponseSchema:()=>nde,ListingActionRequestSchema:()=>Gue,ListingStatusSchema:()=>JB,MarketplaceCategorySchema:()=>qB,MarketplaceHealthMetricsSchema:()=>Que,MarketplaceInstallRequestSchema:()=>zue,MarketplaceInstallResponseSchema:()=>Bue,MarketplaceListingSchema:()=>XB,MarketplaceSearchRequestSchema:()=>Lue,MarketplaceSearchResponseSchema:()=>Rue,PackageSubmissionSchema:()=>Iue,PolicyActionSchema:()=>Zue,PolicyViolationTypeSchema:()=>rV,PricingModelSchema:()=>YB,PublisherProfileSchema:()=>Vue,PublisherSchema:()=>Pue,PublisherVerificationSchema:()=>GB,PublishingAnalyticsRequestSchema:()=>Kue,PublishingAnalyticsResponseSchema:()=>que,RecommendationReasonSchema:()=>oV,RecommendedAppSchema:()=>sV,RejectionReasonSchema:()=>nV,ReleaseChannelSchema:()=>ZB,ReviewCriterionSchema:()=>eV,ReviewDecisionSchema:()=>tV,ReviewModerationStatusSchema:()=>iV,SubmissionReviewSchema:()=>Jue,SubmitReviewRequestSchema:()=>ede,SubscriptionStatusSchema:()=>cV,TimeSeriesPointSchema:()=>$B,TrendingListingSchema:()=>$ue,UpdateListingRequestSchema:()=>Wue,UserReviewSchema:()=>aV,VersionReleaseSchema:()=>Hue});var GB=x([`unverified`,`pending`,`verified`,`trusted`,`partner`]).describe(`Publisher verification status`),Pue=l({id:o().describe(`Publisher ID`),name:o().describe(`Publisher display name`),type:x([`individual`,`organization`]).describe(`Publisher type`),verification:GB.default(`unverified`).describe(`Publisher verification status`),email:o().email().optional().describe(`Contact email`),website:o().url().optional().describe(`Publisher website`),logoUrl:o().url().optional().describe(`Publisher logo URL`),description:o().optional().describe(`Publisher description`),registeredAt:o().datetime().optional().describe(`Publisher registration timestamp`)}).describe(`Developer or organization that publishes packages`),KB=l({url:o().url().describe(`Artifact download URL`),sha256:o().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum`),size:A().int().positive().describe(`Artifact size in bytes`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Artifact format`),uploadedAt:o().datetime().describe(`Upload timestamp`)}).describe(`Reference to a downloadable package artifact`),Fue=l({downloadUrl:o().url().describe(`Artifact download URL (may be pre-signed)`),sha256:o().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum for verification`),size:A().int().positive().describe(`Artifact size in bytes`),format:x([`tgz`,`zip`]).describe(`Artifact format`),expiresAt:o().datetime().optional().describe(`URL expiration timestamp for pre-signed URLs`)}).describe(`Artifact download response with integrity metadata`),qB=x([`crm`,`erp`,`hr`,`finance`,`project`,`collaboration`,`analytics`,`integration`,`automation`,`ai`,`security`,`developer-tools`,`ui-theme`,`storage`,`other`]).describe(`Marketplace package category`),JB=x([`draft`,`submitted`,`in-review`,`approved`,`published`,`rejected`,`suspended`,`deprecated`,`unlisted`]).describe(`Marketplace listing status`),YB=x([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).describe(`Package pricing model`),XB=l({id:o().describe(`Listing ID (matches package manifest ID)`),packageId:o().describe(`Package identifier`),publisherId:o().describe(`Publisher ID`),status:JB.default(`draft`).describe(`Publication state: draft, published, under-review, suspended, deprecated, or unlisted`),name:o().describe(`Display name`),tagline:o().max(120).optional().describe(`Short tagline (max 120 chars)`),description:o().optional().describe(`Full description (Markdown)`),category:qB.describe(`Package category`),tags:S(o()).optional().describe(`Search tags`),iconUrl:o().url().optional().describe(`Package icon URL`),screenshots:S(l({url:o().url(),caption:o().optional()})).optional().describe(`Screenshots`),documentationUrl:o().url().optional().describe(`Documentation URL`),supportUrl:o().url().optional().describe(`Support URL`),repositoryUrl:o().url().optional().describe(`Source repository URL`),pricing:YB.default(`free`).describe(`Pricing model`),priceInCents:A().int().min(0).optional().describe(`Price in cents (e.g. 999 = $9.99)`),latestVersion:o().describe(`Latest published version`),minPlatformVersion:o().optional().describe(`Minimum ObjectStack platform version`),versions:S(l({version:o().describe(`Version string`),releaseDate:o().datetime().describe(`Release date`),releaseNotes:o().optional().describe(`Release notes`),minPlatformVersion:o().optional().describe(`Minimum platform version`),deprecated:v().default(!1).describe(`Whether this version is deprecated`),artifact:KB.optional().describe(`Downloadable artifact for this version`)})).optional().describe(`Published versions`),stats:l({totalInstalls:A().int().min(0).default(0).describe(`Total installs`),activeInstalls:A().int().min(0).default(0).describe(`Active installs`),averageRating:A().min(0).max(5).optional().describe(`Average user rating (0-5)`),totalRatings:A().int().min(0).default(0).describe(`Total ratings count`),totalReviews:A().int().min(0).default(0).describe(`Total reviews count`)}).optional().describe(`Aggregate marketplace statistics`),publishedAt:o().datetime().optional().describe(`First published timestamp`),updatedAt:o().datetime().optional().describe(`Last updated timestamp`)}).describe(`Public-facing package listing on the marketplace`),Iue=l({id:o().describe(`Submission ID`),packageId:o().describe(`Package identifier`),version:o().describe(`Version being submitted`),publisherId:o().describe(`Publisher submitting`),status:x([`pending`,`scanning`,`in-review`,`changes-requested`,`approved`,`rejected`]).default(`pending`).describe(`Review status`),artifactUrl:o().describe(`Package artifact URL for review`),releaseNotes:o().optional().describe(`Release notes for this version`),isNewListing:v().default(!1).describe(`Whether this is a new listing submission`),scanResults:l({passed:v(),securityScore:A().min(0).max(100).optional(),compatibilityCheck:v().optional(),issues:S(l({severity:x([`critical`,`high`,`medium`,`low`,`info`]),message:o(),file:o().optional(),line:A().optional()})).optional()}).optional().describe(`Automated scan results`),reviewerNotes:o().optional().describe(`Notes from the platform reviewer`),submittedAt:o().datetime().optional().describe(`Submission timestamp`),reviewedAt:o().datetime().optional().describe(`Review completion timestamp`)}).describe(`Developer submission of a package version for review`),Lue=l({query:o().optional().describe(`Full-text search query`),category:qB.optional().describe(`Filter by category`),tags:S(o()).optional().describe(`Filter by tags`),pricing:YB.optional().describe(`Filter by pricing model`),publisherVerification:GB.optional().describe(`Filter by publisher verification level`),sortBy:x([`relevance`,`popularity`,`rating`,`newest`,`updated`,`name`]).default(`relevance`).describe(`Sort field`),sortDirection:x([`asc`,`desc`]).default(`desc`).describe(`Sort direction`),page:A().int().min(1).default(1).describe(`Page number`),pageSize:A().int().min(1).max(100).default(20).describe(`Items per page`),platformVersion:o().optional().describe(`Filter by platform version compatibility`)}).describe(`Marketplace search request`),Rue=l({items:S(XB).describe(`Search result listings`),total:A().int().min(0).describe(`Total matching results`),page:A().int().min(1).describe(`Current page number`),pageSize:A().int().min(1).describe(`Items per page`),facets:l({categories:S(l({category:qB,count:A().int().min(0)})).optional(),pricing:S(l({model:YB,count:A().int().min(0)})).optional()}).optional().describe(`Aggregation facets for refining search`)}).describe(`Marketplace search response`),zue=l({listingId:o().describe(`Marketplace listing ID`),version:o().optional().describe(`Version to install`),licenseKey:o().optional().describe(`License key for paid packages`),settings:u(o(),b()).optional().describe(`User-provided settings at install time`),enableOnInstall:v().default(!0).describe(`Whether to enable immediately after install`),artifactRef:KB.optional().describe(`Artifact reference for direct installation`),tenantId:o().optional().describe(`Tenant identifier`)}).describe(`Install from marketplace request`),Bue=l({success:v().describe(`Whether installation succeeded`),packageId:o().optional().describe(`Installed package identifier`),version:o().optional().describe(`Installed version`),message:o().optional().describe(`Installation status message`)}).describe(`Install from marketplace response`),Vue=l({organizationId:o().describe(`Identity Organization ID`),publisherId:o().describe(`Marketplace publisher ID`),verification:GB.default(`unverified`),agreementVersion:o().optional().describe(`Accepted developer agreement version`),website:o().url().optional().describe(`Publisher website`),supportEmail:o().email().optional().describe(`Publisher support email`),registeredAt:o().datetime()}),ZB=x([`alpha`,`beta`,`rc`,`stable`]),Hue=l({version:o().describe(`Semver version (e.g., 2.1.0-beta.1)`),channel:ZB.default(`stable`),releaseNotes:o().optional().describe(`Release notes (Markdown)`),changelog:S(l({type:x([`added`,`changed`,`fixed`,`removed`,`deprecated`,`security`]),description:o()})).optional().describe(`Structured changelog entries`),minPlatformVersion:o().optional(),artifactUrl:o().optional().describe(`Built package artifact URL`),artifactChecksum:o().optional().describe(`SHA-256 checksum`),deprecated:v().default(!1),deprecationMessage:o().optional(),releasedAt:o().datetime().optional()}),Uue=l({packageId:o().describe(`Package identifier`),name:o().describe(`App display name`),tagline:o().max(120).optional(),description:o().optional(),category:o().describe(`Marketplace category`),tags:S(o()).optional(),iconUrl:o().url().optional(),screenshots:S(l({url:o().url(),caption:o().optional()})).optional(),documentationUrl:o().url().optional(),supportUrl:o().url().optional(),repositoryUrl:o().url().optional(),pricing:x([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).default(`free`),priceInCents:A().int().min(0).optional()}),Wue=l({listingId:o().describe(`Listing ID to update`),name:o().optional(),tagline:o().max(120).optional(),description:o().optional(),category:o().optional(),tags:S(o()).optional(),iconUrl:o().url().optional(),screenshots:S(l({url:o().url(),caption:o().optional()})).optional(),documentationUrl:o().url().optional(),supportUrl:o().url().optional(),repositoryUrl:o().url().optional(),pricing:x([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).optional(),priceInCents:A().int().min(0).optional()}),Gue=l({listingId:o().describe(`Listing ID`),action:x([`submit`,`unlist`,`deprecate`,`reactivate`]).describe(`Action to perform on listing`),reason:o().optional()}),QB=x([`last_7d`,`last_30d`,`last_90d`,`last_365d`,`all_time`]),Kue=l({listingId:o().describe(`Listing to get analytics for`),timeRange:QB.default(`last_30d`),metrics:S(x([`installs`,`uninstalls`,`active_installs`,`ratings`,`revenue`,`page_views`])).optional().describe(`Metrics to include (default: all)`)}),$B=l({date:o(),value:A()}),que=l({listingId:o(),timeRange:QB,summary:l({totalInstalls:A().int().min(0),activeInstalls:A().int().min(0),totalUninstalls:A().int().min(0),averageRating:A().min(0).max(5).optional(),totalRatings:A().int().min(0),totalRevenue:A().min(0).optional().describe(`Revenue in cents`),pageViews:A().int().min(0)}),timeSeries:u(o(),S($B)).optional().describe(`Time series keyed by metric name`),ratingDistribution:l({1:A().int().min(0).default(0),2:A().int().min(0).default(0),3:A().int().min(0).default(0),4:A().int().min(0).default(0),5:A().int().min(0).default(0)}).optional()}),eV=l({id:o().describe(`Criterion ID`),category:x([`security`,`performance`,`quality`,`ux`,`documentation`,`policy`,`compatibility`]),description:o(),required:v().default(!0),passed:v().optional(),notes:o().optional()}),tV=x([`approved`,`rejected`,`changes-requested`]),nV=x([`security-vulnerability`,`policy-violation`,`quality-below-standard`,`misleading-metadata`,`incompatible`,`duplicate`,`insufficient-documentation`,`other`]),Jue=l({id:o().describe(`Review ID`),submissionId:o().describe(`Submission being reviewed`),reviewerId:o().describe(`Platform reviewer ID`),decision:tV.optional().describe(`Final decision`),criteria:S(eV).optional().describe(`Review checklist results`),rejectionReasons:S(nV).optional(),feedback:o().optional().describe(`Detailed review feedback (Markdown)`),internalNotes:o().optional().describe(`Internal reviewer notes`),startedAt:o().datetime().optional(),completedAt:o().datetime().optional()}),Yue=l({listingId:o().describe(`Featured listing ID`),priority:A().int().min(0).default(0),bannerUrl:o().url().optional(),editorialNote:o().optional(),startDate:o().datetime(),endDate:o().datetime().optional(),active:v().default(!0)}),Xue=l({id:o().describe(`Collection ID`),name:o().describe(`Collection name`),description:o().optional(),coverImageUrl:o().url().optional(),listingIds:S(o()).min(1).describe(`Ordered listing IDs`),published:v().default(!1),sortOrder:A().int().min(0).default(0),createdBy:o().optional(),createdAt:o().datetime().optional(),updatedAt:o().datetime().optional()}),rV=x([`malware`,`data-harvesting`,`spam`,`copyright`,`inappropriate-content`,`terms-of-service`,`security-risk`,`abandoned`]),Zue=l({id:o().describe(`Action ID`),listingId:o().describe(`Target listing ID`),violationType:rV,action:x([`warning`,`suspend`,`takedown`,`restrict`]),reason:o().describe(`Explanation of the violation`),actionBy:o().describe(`Admin user ID`),actionAt:o().datetime(),resolution:o().optional(),resolved:v().default(!1)}),Que=l({totalListings:A().int().min(0),listingsByStatus:u(o(),A().int().min(0)).optional(),listingsByCategory:u(o(),A().int().min(0)).optional(),totalPublishers:A().int().min(0),verifiedPublishers:A().int().min(0),totalInstalls:A().int().min(0),averageReviewTime:A().min(0).optional(),pendingReviews:A().int().min(0),listingsByPricing:u(o(),A().int().min(0)).optional(),snapshotAt:o().datetime()}),$ue=l({listingId:o(),rank:A().int().min(1),trendScore:A().min(0),installVelocity:A().min(0),period:o()}),iV=x([`pending`,`approved`,`flagged`,`rejected`]),aV=l({id:o().describe(`Review ID`),listingId:o().describe(`Listing being reviewed`),userId:o().describe(`Review author user ID`),displayName:o().optional().describe(`Reviewer display name`),rating:A().int().min(1).max(5).describe(`Star rating (1-5)`),title:o().max(200).optional().describe(`Review title`),body:o().max(5e3).optional().describe(`Review text`),appVersion:o().optional().describe(`App version being reviewed`),moderationStatus:iV.default(`pending`),helpfulCount:A().int().min(0).default(0),publisherResponse:l({body:o(),respondedAt:o().datetime()}).optional().describe(`Publisher response to review`),submittedAt:o().datetime(),updatedAt:o().datetime().optional()}),ede=l({listingId:o().describe(`Listing to review`),rating:A().int().min(1).max(5).describe(`Star rating`),title:o().max(200).optional(),body:o().max(5e3).optional()}),tde=l({listingId:o().describe(`Listing to get reviews for`),sortBy:x([`newest`,`oldest`,`highest`,`lowest`,`most-helpful`]).default(`newest`),rating:A().int().min(1).max(5).optional(),page:A().int().min(1).default(1),pageSize:A().int().min(1).max(50).default(10)}),nde=l({items:S(aV),total:A().int().min(0),page:A().int().min(1),pageSize:A().int().min(1),ratingSummary:l({averageRating:A().min(0).max(5),totalRatings:A().int().min(0),distribution:l({1:A().int().min(0).default(0),2:A().int().min(0).default(0),3:A().int().min(0).default(0),4:A().int().min(0).default(0),5:A().int().min(0).default(0)})}).optional()}),oV=x([`popular-in-category`,`similar-users`,`complements-installed`,`trending`,`new-release`,`editor-pick`]),sV=l({listingId:o(),name:o(),tagline:o().optional(),iconUrl:o().url().optional(),category:qB,pricing:YB,averageRating:A().min(0).max(5).optional(),activeInstalls:A().int().min(0).optional(),reason:oV}),rde=l({tenantId:o().optional(),categories:S(qB).optional(),platformVersion:o().optional(),limit:A().int().min(1).max(50).default(10)}),ide=l({featured:S(sV).optional(),recommended:S(sV).optional(),trending:S(sV).optional(),newArrivals:S(sV).optional(),collections:S(l({id:o(),name:o(),description:o().optional(),coverImageUrl:o().url().optional(),apps:S(sV)})).optional()}),cV=x([`active`,`trialing`,`past-due`,`cancelled`,`expired`]),ade=l({id:o().describe(`Subscription ID`),listingId:o().describe(`App listing ID`),tenantId:o().describe(`Customer tenant ID`),status:cV,licenseKey:o().optional(),plan:o().optional().describe(`Subscription plan name`),billingCycle:x([`monthly`,`annual`]).optional(),priceInCents:A().int().min(0).optional(),currentPeriodStart:o().datetime().optional(),currentPeriodEnd:o().datetime().optional(),trialEndDate:o().datetime().optional(),autoRenew:v().default(!0),createdAt:o().datetime()}),lV=l({listingId:o(),packageId:o(),name:o(),iconUrl:o().url().optional(),installedVersion:o(),latestVersion:o().optional(),updateAvailable:v().default(!1),enabled:v().default(!0),subscriptionStatus:cV.optional(),installedAt:o().datetime()}),ode=l({tenantId:o().optional(),enabled:v().optional(),updateAvailable:v().optional(),sortBy:x([`name`,`installed-date`,`updated-date`]).default(`name`),page:A().int().min(1).default(1),pageSize:A().int().min(1).max(100).default(20)}),sde=l({items:S(lV),total:A().int().min(0),page:A().int().min(1),pageSize:A().int().min(1)});EE({},{TestActionSchema:()=>dV,TestActionTypeSchema:()=>uV,TestAssertionSchema:()=>pV,TestAssertionTypeSchema:()=>fV,TestContextSchema:()=>cde,TestScenarioSchema:()=>hV,TestStepSchema:()=>mV,TestSuiteSchema:()=>lde});var cde=u(o(),b()).describe(`Initial context or variables for the test`),uV=x([`create_record`,`update_record`,`delete_record`,`read_record`,`query_records`,`api_call`,`run_script`,`wait`]).describe(`Type of test action to perform`),dV=l({type:uV.describe(`The action type to execute`),target:o().describe(`Target Object, API Endpoint, or Function Name`),payload:u(o(),b()).optional().describe(`Data to send or use`),user:o().optional().describe(`Run as specific user/role for impersonation testing`)}).describe(`A single test action to execute against the system`),fV=x([`equals`,`not_equals`,`contains`,`not_contains`,`is_null`,`not_null`,`gt`,`gte`,`lt`,`lte`,`error`]).describe(`Comparison operator for test assertions`),pV=l({field:o().describe(`Field path in the result to check (e.g. "body.data.0.status")`),operator:fV.describe(`Comparison operator to use`),expectedValue:b().describe(`Expected value to compare against`)}).describe(`A test assertion that validates the result of a test action`),mV=l({name:o().describe(`Step name for identification in test reports`),description:o().optional().describe(`Human-readable description of what this step tests`),action:dV.describe(`The action to execute in this step`),assertions:S(pV).optional().describe(`Assertions to validate after the action completes`),capture:u(o(),o()).optional().describe(`Map result fields to context variables: { "newId": "body.id" }`)}).describe(`A single step in a test scenario, consisting of an action and optional assertions`),hV=l({id:o().describe(`Unique scenario identifier`),name:o().describe(`Scenario name for test reports`),description:o().optional().describe(`Detailed description of the test scenario`),tags:S(o()).optional().describe(`Tags for filtering and categorization (e.g. "critical", "regression", "crm")`),setup:S(mV).optional().describe(`Steps to run before main test (preconditions)`),steps:S(mV).describe(`Main test sequence to execute`),teardown:S(mV).optional().describe(`Steps to cleanup after test execution`),requires:l({params:S(o()).optional().describe(`Required environment variables or parameters`),plugins:S(o()).optional().describe(`Required plugins that must be loaded`)}).optional().describe(`Environment requirements for this scenario`)}).describe(`A complete test scenario with setup, execution steps, and teardown`),lde=l({name:o().describe(`Test suite name`),scenarios:S(hV).describe(`List of test scenarios in this suite`)}).describe(`A collection of test scenarios grouped into a test suite`);EE({},{AUTH_CONSTANTS:()=>hde,AUTH_ERROR_CODES:()=>gde,AccountSchema:()=>dde,ApiKeySchema:()=>mde,InvitationSchema:()=>yde,InvitationStatus:()=>_V,MemberSchema:()=>vde,OrganizationSchema:()=>_de,RoleSchema:()=>gV,SCIM:()=>Cde,SCIMAddressSchema:()=>CV,SCIMBulkOperationSchema:()=>AV,SCIMBulkRequestSchema:()=>wde,SCIMBulkResponseOperationSchema:()=>jV,SCIMBulkResponseSchema:()=>Tde,SCIMEmailSchema:()=>xV,SCIMEnterpriseUserSchema:()=>TV,SCIMErrorSchema:()=>xde,SCIMGroupReferenceSchema:()=>wV,SCIMGroupSchema:()=>OV,SCIMListResponseSchema:()=>bde,SCIMMemberReferenceSchema:()=>DV,SCIMMetaSchema:()=>yV,SCIMNameSchema:()=>bV,SCIMPatchOperationSchema:()=>kV,SCIMPatchRequestSchema:()=>Sde,SCIMPhoneNumberSchema:()=>SV,SCIMUserSchema:()=>EV,SCIM_SCHEMAS:()=>vV,SessionSchema:()=>fde,UserSchema:()=>ude,VerificationTokenSchema:()=>pde});var ude=l({id:o().describe(`Unique user identifier`),email:o().email().describe(`User email address`),emailVerified:v().default(!1).describe(`Whether email is verified`),name:o().optional().describe(`User display name`),image:o().url().optional().describe(`Profile image URL`),createdAt:o().datetime().describe(`Account creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),dde=l({id:o().describe(`Unique account identifier`),userId:o().describe(`Associated user ID`),type:x([`oauth`,`oidc`,`email`,`credentials`,`saml`,`ldap`]).describe(`Account type`),provider:o().describe(`Provider name`),providerAccountId:o().describe(`Provider account ID`),refreshToken:o().optional().describe(`OAuth refresh token`),accessToken:o().optional().describe(`OAuth access token`),expiresAt:A().optional().describe(`Token expiry timestamp (Unix)`),tokenType:o().optional().describe(`OAuth token type`),scope:o().optional().describe(`OAuth scope`),idToken:o().optional().describe(`OAuth ID token`),sessionState:o().optional().describe(`Session state`),createdAt:o().datetime().describe(`Account creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),fde=l({id:o().describe(`Unique session identifier`),sessionToken:o().describe(`Session token`),userId:o().describe(`Associated user ID`),activeOrganizationId:o().optional().describe(`Active organization ID for context switching`),expires:o().datetime().describe(`Session expiry timestamp`),createdAt:o().datetime().describe(`Session creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`),ipAddress:o().optional().describe(`IP address`),userAgent:o().optional().describe(`User agent string`),fingerprint:o().optional().describe(`Device fingerprint`)}),pde=l({identifier:o().describe(`Token identifier (email or phone)`),token:o().describe(`Verification token`),expires:o().datetime().describe(`Token expiry timestamp`),createdAt:o().datetime().describe(`Token creation timestamp`)}),mde=l({id:o().describe(`API key identifier`),name:o().describe(`API key display name`),start:o().optional().describe(`Key prefix for identification`),prefix:o().optional().describe(`Custom key prefix`),userId:o().describe(`Owner user ID`),organizationId:o().optional().describe(`Scoped organization ID`),expiresAt:o().datetime().optional().describe(`Expiration timestamp`),createdAt:o().datetime().describe(`Creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`),lastUsedAt:o().datetime().optional().describe(`Last used timestamp`),lastRefetchAt:o().datetime().optional().describe(`Last refetch timestamp`),enabled:v().default(!0).describe(`Whether the key is active`),rateLimitEnabled:v().optional().describe(`Whether rate limiting is enabled`),rateLimitTimeWindow:A().int().min(0).optional().describe(`Rate limit window (ms)`),rateLimitMax:A().int().min(0).optional().describe(`Max requests per window`),remaining:A().int().min(0).optional().describe(`Remaining requests`),permissions:u(o(),v()).optional().describe(`Granular permission flags`),scopes:S(o()).optional().describe(`High-level access scopes`),metadata:u(o(),b()).optional().describe(`Custom metadata`)}),hde={HEADER_KEY:`Authorization`,TOKEN_PREFIX:`Bearer `,COOKIE_PREFIX:`os_`,CSRF_HEADER:`x-os-csrf-token`,SESSION_COOKIE:`os_session_token`,CSRF_COOKIE:`os_csrf_token`,REFRESH_TOKEN_COOKIE:`os_refresh_token`},gde={INVALID_CREDENTIALS:`invalid_credentials`,INVALID_TOKEN:`invalid_token`,TOKEN_EXPIRED:`token_expired`,INSUFFICIENT_PERMISSIONS:`insufficient_permissions`,ACCOUNT_LOCKED:`account_locked`,ACCOUNT_NOT_VERIFIED:`account_not_verified`,TOO_MANY_REQUESTS:`too_many_requests`,INVALID_CSRF_TOKEN:`invalid_csrf_token`,SESSION_EXPIRED:`session_expired`,OAUTH_ERROR:`oauth_error`,PROVIDER_ERROR:`provider_error`},gV=l({name:OE.describe(`Unique role name (lowercase snake_case)`),label:o().describe(`Display label (e.g. VP of Sales)`),parent:o().optional().describe(`Parent Role ID (Reports To)`),description:o().optional()}),_de=l({id:o().describe(`Unique organization identifier`),name:o().describe(`Organization display name`),slug:o().regex(/^[a-z0-9_-]+$/).describe(`Unique URL-friendly slug (lowercase alphanumeric, hyphens, underscores)`),logo:o().url().optional().describe(`Organization logo URL`),metadata:u(o(),b()).optional().describe(`Custom metadata`),createdAt:o().datetime().describe(`Organization creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),vde=l({id:o().describe(`Unique member identifier`),organizationId:o().describe(`Organization ID`),userId:o().describe(`User ID`),role:o().describe(`Member role (e.g., owner, admin, member, guest)`),createdAt:o().datetime().describe(`Member creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),_V=x([`pending`,`accepted`,`rejected`,`expired`]),yde=l({id:o().describe(`Unique invitation identifier`),organizationId:o().describe(`Organization ID`),email:o().email().describe(`Invitee email address`),role:o().describe(`Role to assign upon acceptance`),status:_V.default(`pending`).describe(`Invitation status`),expiresAt:o().datetime().describe(`Invitation expiry timestamp`),inviterId:o().describe(`User ID of the inviter`),createdAt:o().datetime().describe(`Invitation creation timestamp`),updatedAt:o().datetime().describe(`Last update timestamp`)}),vV={USER:`urn:ietf:params:scim:schemas:core:2.0:User`,GROUP:`urn:ietf:params:scim:schemas:core:2.0:Group`,ENTERPRISE_USER:`urn:ietf:params:scim:schemas:extension:enterprise:2.0:User`,RESOURCE_TYPE:`urn:ietf:params:scim:schemas:core:2.0:ResourceType`,SERVICE_PROVIDER_CONFIG:`urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig`,SCHEMA:`urn:ietf:params:scim:schemas:core:2.0:Schema`,LIST_RESPONSE:`urn:ietf:params:scim:api:messages:2.0:ListResponse`,PATCH_OP:`urn:ietf:params:scim:api:messages:2.0:PatchOp`,BULK_REQUEST:`urn:ietf:params:scim:api:messages:2.0:BulkRequest`,BULK_RESPONSE:`urn:ietf:params:scim:api:messages:2.0:BulkResponse`,ERROR:`urn:ietf:params:scim:api:messages:2.0:Error`},yV=l({resourceType:o().optional().describe(`Resource type`),created:o().datetime().optional().describe(`Creation timestamp`),lastModified:o().datetime().optional().describe(`Last modification timestamp`),location:o().url().optional().describe(`Resource location URI`),version:o().optional().describe(`Entity tag (ETag) for concurrency control`)}),bV=l({formatted:o().optional().describe(`Formatted full name`),familyName:o().optional().describe(`Family name (last name)`),givenName:o().optional().describe(`Given name (first name)`),middleName:o().optional().describe(`Middle name`),honorificPrefix:o().optional().describe(`Honorific prefix (Mr., Ms., Dr.)`),honorificSuffix:o().optional().describe(`Honorific suffix (Jr., Sr.)`)}),xV=l({value:o().email().describe(`Email address`),type:x([`work`,`home`,`other`]).optional().describe(`Email type`),display:o().optional().describe(`Display label`),primary:v().optional().default(!1).describe(`Primary email indicator`)}),SV=l({value:o().describe(`Phone number`),type:x([`work`,`home`,`mobile`,`fax`,`pager`,`other`]).optional().describe(`Phone number type`),display:o().optional().describe(`Display label`),primary:v().optional().default(!1).describe(`Primary phone indicator`)}),CV=l({formatted:o().optional().describe(`Formatted address`),streetAddress:o().optional().describe(`Street address`),locality:o().optional().describe(`City/Locality`),region:o().optional().describe(`State/Region`),postalCode:o().optional().describe(`Postal code`),country:o().optional().describe(`Country`),type:x([`work`,`home`,`other`]).optional().describe(`Address type`),primary:v().optional().default(!1).describe(`Primary address indicator`)}),wV=l({value:o().describe(`Group ID`),$ref:o().url().optional().describe(`URI reference to the group`),display:o().optional().describe(`Group display name`),type:x([`direct`,`indirect`]).optional().describe(`Membership type`)}),TV=l({employeeNumber:o().optional().describe(`Employee number`),costCenter:o().optional().describe(`Cost center`),organization:o().optional().describe(`Organization`),division:o().optional().describe(`Division`),department:o().optional().describe(`Department`),manager:l({value:o().describe(`Manager ID`),$ref:o().url().optional().describe(`Manager URI`),displayName:o().optional().describe(`Manager name`)}).optional().describe(`Manager reference`)}),EV=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.USER),`Must include core User schema URI`).default([vV.USER]).describe(`SCIM schema URIs (must include User schema)`),id:o().optional().describe(`Unique resource identifier`),externalId:o().optional().describe(`External identifier from client system`),userName:o().describe(`Unique username (REQUIRED)`),name:bV.optional().describe(`Structured name components`),displayName:o().optional().describe(`Display name for UI`),nickName:o().optional().describe(`Nickname`),profileUrl:o().url().optional().describe(`Profile page URL`),title:o().optional().describe(`Job title`),userType:o().optional().describe(`User type (employee, contractor)`),preferredLanguage:o().optional().describe(`Preferred language (ISO 639-1)`),locale:o().optional().describe(`Locale (e.g., en-US)`),timezone:o().optional().describe(`Timezone`),active:v().optional().default(!0).describe(`Account active status`),password:o().optional().describe(`Password (write-only)`),emails:S(xV).optional().describe(`Email addresses`),phoneNumbers:S(SV).optional().describe(`Phone numbers`),ims:S(l({value:o(),type:o().optional(),primary:v().optional()})).optional().describe(`IM addresses`),photos:S(l({value:o().url(),type:x([`photo`,`thumbnail`]).optional(),primary:v().optional()})).optional().describe(`Photo URLs`),addresses:S(CV).optional().describe(`Physical addresses`),groups:S(wV).optional().describe(`Group memberships`),entitlements:S(l({value:o(),type:o().optional(),primary:v().optional()})).optional().describe(`Entitlements`),roles:S(l({value:o(),type:o().optional(),primary:v().optional()})).optional().describe(`Roles`),x509Certificates:S(l({value:o(),type:o().optional(),primary:v().optional()})).optional().describe(`X509 certificates`),meta:yV.optional().describe(`Resource metadata`),[vV.ENTERPRISE_USER]:TV.optional().describe(`Enterprise user attributes`)}).superRefine((e,t)=>{e[vV.ENTERPRISE_USER]!=null&&((e.schemas||[]).includes(vV.ENTERPRISE_USER)||t.addIssue({code:le.custom,path:[`schemas`],message:`schemas must include "${vV.ENTERPRISE_USER}" when enterprise user extension attributes are present`}))}),DV=l({value:o().describe(`Member ID`),$ref:o().url().optional().describe(`URI reference to the member`),type:x([`User`,`Group`]).optional().describe(`Member type`),display:o().optional().describe(`Member display name`)}),OV=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.GROUP),`Must include core Group schema URI`).default([vV.GROUP]).describe(`SCIM schema URIs (must include Group schema)`),id:o().optional().describe(`Unique resource identifier`),externalId:o().optional().describe(`External identifier from client system`),displayName:o().describe(`Group display name (REQUIRED)`),members:S(DV).optional().describe(`Group members`),meta:yV.optional().describe(`Resource metadata`)}),bde=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.LIST_RESPONSE),{message:`schemas must include ${vV.LIST_RESPONSE}`}).default([vV.LIST_RESPONSE]).describe(`SCIM schema URIs`),totalResults:A().int().min(0).describe(`Total results count`),Resources:S(c([EV,OV,u(o(),b())])).describe(`Resources array (Users, Groups, or custom resources)`),startIndex:A().int().min(1).optional().describe(`Start index (1-based)`),itemsPerPage:A().int().min(0).optional().describe(`Items per page`)}),xde=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.ERROR),{message:`schemas must include ${vV.ERROR}`}).default([vV.ERROR]).describe(`SCIM schema URIs`),status:A().int().min(400).max(599).describe(`HTTP status code`),scimType:x([`invalidFilter`,`tooMany`,`uniqueness`,`mutability`,`invalidSyntax`,`invalidPath`,`noTarget`,`invalidValue`,`invalidVers`,`sensitive`]).optional().describe(`SCIM error type`),detail:o().optional().describe(`Error detail message`)}),kV=l({op:x([`add`,`remove`,`replace`]).describe(`Operation type`),path:o().optional().describe(`Attribute path (optional for add)`),value:b().optional().describe(`Value to set`)}),Sde=l({schemas:S(o()).min(1).refine(e=>e.includes(vV.PATCH_OP),{message:`SCIM PATCH requests must include the PatchOp schema URI`}).default([vV.PATCH_OP]).describe(`SCIM schema URIs`),Operations:S(kV).min(1).describe(`Patch operations`)}),Cde={user:(e,t,n,r)=>({schemas:[vV.USER],userName:e,emails:[{value:t,type:`work`,primary:!0}],name:{givenName:n,familyName:r},active:!0}),group:(e,t)=>({schemas:[vV.GROUP],displayName:e,members:t||[]}),listResponse:(e,t)=>({schemas:[vV.LIST_RESPONSE],totalResults:t??e.length,Resources:e,startIndex:1,itemsPerPage:e.length}),error:(e,t,n)=>({schemas:[vV.ERROR],status:e,detail:t,scimType:n})},AV=l({method:x([`POST`,`PUT`,`PATCH`,`DELETE`]).describe(`HTTP method for the bulk operation`),path:o().describe(`Resource endpoint path (e.g. /Users, /Groups/{id})`),bulkId:o().optional().describe(`Client-assigned ID for cross-referencing between operations`),data:u(o(),b()).optional().describe(`Request body for POST/PUT/PATCH operations`),version:o().optional().describe(`ETag for optimistic concurrency control`)}),wde=l({schemas:S(p(vV.BULK_REQUEST)).default([vV.BULK_REQUEST]).describe(`SCIM schema URIs (BulkRequest)`),operations:S(AV).min(1).describe(`Bulk operations to execute (minimum 1)`),failOnErrors:A().int().optional().describe(`Stop processing after this many errors`)}),jV=l({method:x([`POST`,`PUT`,`PATCH`,`DELETE`]).describe(`HTTP method that was executed`),bulkId:o().optional().describe(`Client-assigned bulk operation ID`),location:o().optional().describe(`URL of the created or modified resource`),status:o().describe(`HTTP status code as string (e.g. "201", "400")`),response:b().optional().describe(`Response body (typically present for errors)`)}),Tde=l({schemas:S(p(vV.BULK_RESPONSE)).default([vV.BULK_RESPONSE]).describe(`SCIM schema URIs (BulkResponse)`),operations:S(jV).describe(`Results for each bulk operation`)});EE({},{AICodeReviewResultSchema:()=>zde,AIKnowledgeSchema:()=>PV,AIModelConfigSchema:()=>MV,AIOperationCostSchema:()=>rfe,AIOpsAgentConfigSchema:()=>qde,AIOrchestrationExecutionResultSchema:()=>Sfe,AIOrchestrationSchema:()=>bfe,AIOrchestrationTriggerSchema:()=>EU,AITaskSchema:()=>OU,AITaskTypeSchema:()=>DU,AIToolSchema:()=>NV,AgentActionResultSchema:()=>lH,AgentActionSchema:()=>nH,AgentActionSequenceResultSchema:()=>jde,AgentActionSequenceSchema:()=>Ade,AgentCommunicationProtocolSchema:()=>MU,AgentGroupMemberSchema:()=>PU,AgentGroupRoleSchema:()=>NU,AgentSchema:()=>RV,AnomalyDetectionConfigSchema:()=>SH,AutoScalingPolicySchema:()=>TH,BatchAIOrchestrationExecutionSchema:()=>xfe,BillingPeriodSchema:()=>$H,BudgetLimitSchema:()=>ofe,BudgetStatusSchema:()=>tU,BudgetTypeSchema:()=>eU,CICDPipelineConfigSchema:()=>mH,ChunkingStrategySchema:()=>uU,CodeContentSchema:()=>WU,CodeGenerationConfigSchema:()=>dH,CodeGenerationRequestSchema:()=>Ide,CodeGenerationTargetSchema:()=>uH,ComponentActionParamsSchema:()=>tH,ComponentActionTypeSchema:()=>JV,ComponentAgentActionSchema:()=>cH,ConversationAnalyticsSchema:()=>Mfe,ConversationContextSchema:()=>QU,ConversationMessageSchema:()=>JU,ConversationSessionSchema:()=>kfe,ConversationSummarySchema:()=>Afe,CostAlertSchema:()=>rU,CostAlertTypeSchema:()=>nU,CostAnalyticsSchema:()=>oU,CostBreakdownDimensionSchema:()=>iU,CostBreakdownEntrySchema:()=>aU,CostEntrySchema:()=>afe,CostMetricTypeSchema:()=>ife,CostOptimizationRecommendationSchema:()=>sU,CostQueryFiltersSchema:()=>cfe,CostReportSchema:()=>sfe,DataActionParamsSchema:()=>$V,DataActionTypeSchema:()=>KV,DataAgentActionSchema:()=>oH,DeploymentStrategySchema:()=>gH,DevOpsAgentSchema:()=>Nde,DevOpsToolSchema:()=>Pde,DevelopmentConfigSchema:()=>vH,DocumentChunkSchema:()=>lfe,DocumentLoaderConfigSchema:()=>hU,DocumentMetadataSchema:()=>dU,EmbeddingModelSchema:()=>lU,EntitySchema:()=>xU,EvaluationMetricsSchema:()=>zU,FeedbackLoopSchema:()=>Nfe,FieldSynonymConfigSchema:()=>vfe,FileContentSchema:()=>UU,FilterExpressionSchema:()=>gU,FilterGroupSchema:()=>_U,FormActionParamsSchema:()=>QV,FormActionTypeSchema:()=>GV,FormAgentActionSchema:()=>aH,FunctionCallSchema:()=>KU,GeneratedCodeSchema:()=>Lde,GitHubIntegrationSchema:()=>yH,HyperparametersSchema:()=>LU,ImageContentSchema:()=>HU,IntegrationConfigSchema:()=>xH,IntentActionMappingSchema:()=>Mde,IssueSchema:()=>eW,MCPCapabilitySchema:()=>YH,MCPClientConfigSchema:()=>nfe,MCPPromptArgumentSchema:()=>VH,MCPPromptMessageSchema:()=>HH,MCPPromptRequestSchema:()=>efe,MCPPromptResponseSchema:()=>tfe,MCPPromptSchema:()=>UH,MCPResourceRequestSchema:()=>Xde,MCPResourceResponseSchema:()=>Zde,MCPResourceSchema:()=>LH,MCPResourceTemplateSchema:()=>RH,MCPResourceTypeSchema:()=>IH,MCPRootEntrySchema:()=>qH,MCPRootsConfigSchema:()=>JH,MCPSamplingConfigSchema:()=>KH,MCPServerConfigSchema:()=>ZH,MCPServerInfoSchema:()=>XH,MCPStreamingConfigSchema:()=>WH,MCPToolApprovalSchema:()=>GH,MCPToolCallRequestSchema:()=>Qde,MCPToolCallResponseSchema:()=>$de,MCPToolParameterSchema:()=>zH,MCPToolSchema:()=>BH,MCPTransportConfigSchema:()=>FH,MCPTransportTypeSchema:()=>PH,MessageContentSchema:()=>GU,MessageContentTypeSchema:()=>Ofe,MessagePruningEventSchema:()=>jfe,MessageRoleSchema:()=>BU,MetadataFilterSchema:()=>vU,MetadataSourceSchema:()=>$U,ModelCapabilitySchema:()=>DH,ModelConfigSchema:()=>AH,ModelDriftSchema:()=>Dfe,ModelFeatureSchema:()=>IU,ModelLimitsSchema:()=>OH,ModelPricingSchema:()=>kH,ModelProviderSchema:()=>EH,ModelRegistryEntrySchema:()=>NH,ModelRegistrySchema:()=>Jde,ModelSelectionCriteriaSchema:()=>Yde,MonitoringConfigSchema:()=>_H,MultiAgentGroupSchema:()=>Cfe,NLQAnalyticsSchema:()=>_fe,NLQFieldMappingSchema:()=>CU,NLQModelConfigSchema:()=>gfe,NLQParseResultSchema:()=>TU,NLQRequestSchema:()=>pfe,NLQResponseSchema:()=>mfe,NLQTrainingExampleSchema:()=>hfe,NavigationActionParamsSchema:()=>XV,NavigationActionTypeSchema:()=>UV,NavigationAgentActionSchema:()=>rH,PerformanceOptimizationSchema:()=>Kde,PipelineStageSchema:()=>pH,PluginCompositionRequestSchema:()=>Bde,PluginCompositionResultSchema:()=>Vde,PluginRecommendationRequestSchema:()=>Hde,PluginRecommendationSchema:()=>Ude,PluginScaffoldingTemplateSchema:()=>Rde,PostProcessingActionSchema:()=>jU,PredictionRequestSchema:()=>Tfe,PredictionResultSchema:()=>Efe,PredictiveModelSchema:()=>wfe,PredictiveModelTypeSchema:()=>FU,PromptTemplateSchema:()=>MH,PromptVariableSchema:()=>jH,QueryContextSchema:()=>wU,QueryIntentSchema:()=>bU,QueryTemplateSchema:()=>yfe,RAGPipelineConfigSchema:()=>yU,RAGPipelineStatusSchema:()=>ffe,RAGQueryRequestSchema:()=>ufe,RAGQueryResponseSchema:()=>dfe,RerankingConfigSchema:()=>pU,ResolutionSchema:()=>tW,RetrievalStrategySchema:()=>fU,RootCauseAnalysisRequestSchema:()=>Wde,RootCauseAnalysisResultSchema:()=>Gde,SelfHealingActionSchema:()=>CH,SelfHealingConfigSchema:()=>wH,SkillSchema:()=>HV,SkillTriggerConditionSchema:()=>VV,StructuredOutputConfigSchema:()=>LV,StructuredOutputFormatSchema:()=>FV,TestingConfigSchema:()=>fH,TextContentSchema:()=>VU,TimeframeSchema:()=>SU,TokenBudgetConfigSchema:()=>XU,TokenBudgetStrategySchema:()=>YU,TokenUsageSchema:()=>QH,TokenUsageStatsSchema:()=>ZU,ToolCallSchema:()=>qU,ToolCategorySchema:()=>zV,ToolSchema:()=>BV,TrainingConfigSchema:()=>RU,TransformPipelineStepSchema:()=>IV,TypedAgentActionSchema:()=>kde,UIActionTypeSchema:()=>YV,VectorStoreConfigSchema:()=>mU,VectorStoreProviderSchema:()=>cU,VercelIntegrationSchema:()=>bH,VersionManagementSchema:()=>hH,ViewActionParamsSchema:()=>ZV,ViewActionTypeSchema:()=>WV,ViewAgentActionSchema:()=>iH,WorkflowActionParamsSchema:()=>eH,WorkflowActionTypeSchema:()=>qV,WorkflowAgentActionSchema:()=>sH,WorkflowFieldConditionSchema:()=>kU,WorkflowScheduleSchema:()=>AU,defineAgent:()=>Ede,defineSkill:()=>Ode,defineTool:()=>Dde,fullStackDevOpsAgentExample:()=>Fde});var MV=l({provider:x([`openai`,`azure_openai`,`anthropic`,`local`]).default(`openai`),model:o().describe(`Model name (e.g. gpt-4, claude-3-opus)`),temperature:A().min(0).max(2).default(.7),maxTokens:A().optional(),topP:A().optional()}),NV=l({type:x([`action`,`flow`,`query`,`vector_search`]),name:o().describe(`Reference name (Action Name, Flow Name)`),description:o().optional().describe(`Override description for the LLM`)}),PV=l({topics:S(o()).describe(`Topics/Tags to recruit knowledge from`),indexes:S(o()).describe(`Vector Store Indexes`)}),FV=x([`json_object`,`json_schema`,`regex`,`grammar`,`xml`]).describe(`Output format for structured agent responses`),IV=x([`trim`,`parse_json`,`validate`,`coerce_types`]).describe(`Post-processing step for structured output`),LV=l({format:FV.describe(`Expected output format`),schema:u(o(),b()).optional().describe(`JSON Schema definition for output`),strict:v().default(!1).describe(`Enforce exact schema compliance`),retryOnValidationFailure:v().default(!0).describe(`Retry generation when output fails validation`),maxRetries:A().int().min(0).default(3).describe(`Maximum retries on validation failure`),fallbackFormat:FV.optional().describe(`Fallback format if primary format fails`),transformPipeline:S(IV).optional().describe(`Post-processing steps applied to output`)}).describe(`Structured output configuration for agent responses`),RV=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Agent unique identifier`),label:o().describe(`Agent display name`),avatar:o().optional(),role:o().describe(`The persona/role (e.g. "Senior Support Engineer")`),instructions:o().describe(`System Prompt / Prime Directives`),model:MV.optional(),lifecycle:XD.optional().describe(`State machine defining the agent conversation follow and constraints`),skills:S(o().regex(/^[a-z_][a-z0-9_]*$/)).optional().describe(`Skill names to attach (Agent→Skill→Tool architecture)`),tools:S(NV).optional().describe(`Direct tool references (legacy fallback)`),knowledge:PV.optional().describe(`RAG access`),active:v().default(!0),access:S(o()).optional().describe(`Who can chat with this agent`),permissions:S(o()).optional().describe(`Required permissions or roles`),tenantId:o().optional().describe(`Tenant/Organization ID`),visibility:x([`global`,`organization`,`private`]).default(`organization`),planning:l({strategy:x([`react`,`plan_and_execute`,`reflexion`,`tree_of_thought`]).default(`react`).describe(`Autonomous reasoning strategy`),maxIterations:A().int().min(1).max(100).default(10).describe(`Maximum planning loop iterations`),allowReplan:v().default(!0).describe(`Allow dynamic re-planning based on intermediate results`)}).optional().describe(`Autonomous reasoning and planning configuration`),memory:l({shortTerm:l({maxMessages:A().int().min(1).default(50).describe(`Max recent messages in working memory`),maxTokens:A().int().min(100).optional().describe(`Max tokens for short-term context window`)}).optional().describe(`Short-term / working memory`),longTerm:l({enabled:v().default(!1).describe(`Enable long-term memory persistence`),store:x([`vector`,`database`,`redis`]).default(`vector`).describe(`Long-term memory storage backend`),maxEntries:A().int().min(1).optional().describe(`Max entries in long-term memory`)}).optional().describe(`Long-term / persistent memory`),reflectionInterval:A().int().min(1).optional().describe(`Reflect every N interactions to improve behavior`)}).optional().describe(`Agent memory management`),guardrails:l({maxTokensPerInvocation:A().int().min(1).optional().describe(`Token budget per single invocation`),maxExecutionTimeSec:A().int().min(1).optional().describe(`Max execution time in seconds`),blockedTopics:S(o()).optional().describe(`Forbidden topics or action names`)}).optional().describe(`Safety guardrails for the agent`),structuredOutput:LV.optional().describe(`Structured output format and validation configuration`)});function Ede(e){return RV.parse(e)}var zV=x([`data`,`action`,`flow`,`integration`,`vector_search`,`analytics`,`utility`]).describe(`Tool operational category`),BV=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool unique identifier (snake_case)`),label:o().describe(`Tool display name`),description:o().describe(`Tool description for LLM function calling`),category:zV.optional().describe(`Tool category for grouping and filtering`),parameters:u(o(),b()).describe(`JSON Schema for tool parameters`),outputSchema:u(o(),b()).optional().describe(`JSON Schema for tool output`),objectName:o().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object name (snake_case)`),requiresConfirmation:v().default(!1).describe(`Require user confirmation before execution`),permissions:S(o()).optional().describe(`Required permissions or roles`),active:v().default(!0).describe(`Whether the tool is enabled`),builtIn:v().default(!1).describe(`Platform built-in tool flag`)});function Dde(e){return BV.parse(e)}var VV=l({field:o().describe(`Context field to evaluate`),operator:x([`eq`,`neq`,`in`,`not_in`,`contains`]).describe(`Comparison operator`),value:c([o(),S(o())]).describe(`Expected value or values`)}),HV=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Skill unique identifier (snake_case)`),label:o().describe(`Skill display name`),description:o().optional().describe(`Skill description`),instructions:o().optional().describe(`LLM instructions when skill is active`),tools:S(o().regex(/^[a-z_][a-z0-9_]*$/)).describe(`Tool names belonging to this skill`),triggerPhrases:S(o()).optional().describe(`Phrases that activate this skill`),triggerConditions:S(VV).optional().describe(`Programmatic activation conditions`),permissions:S(o()).optional().describe(`Required permissions or roles`),active:v().default(!0).describe(`Whether the skill is enabled`)});function Ode(e){return HV.parse(e)}var UV=x([`navigate_to_object_list`,`navigate_to_object_form`,`navigate_to_record_detail`,`navigate_to_dashboard`,`navigate_to_report`,`navigate_to_app`,`navigate_back`,`navigate_home`,`open_tab`,`close_tab`]),WV=x([`change_view_mode`,`apply_filter`,`clear_filter`,`apply_sort`,`change_grouping`,`show_columns`,`expand_record`,`collapse_record`,`refresh_view`,`export_data`]),GV=x([`create_record`,`update_record`,`delete_record`,`fill_field`,`clear_field`,`submit_form`,`cancel_form`,`validate_form`,`save_draft`]),KV=x([`select_record`,`deselect_record`,`select_all`,`deselect_all`,`bulk_update`,`bulk_delete`,`bulk_export`]),qV=x([`trigger_flow`,`trigger_approval`,`trigger_webhook`,`run_report`,`send_email`,`send_notification`,`schedule_task`]),JV=x([`open_modal`,`close_modal`,`open_sidebar`,`close_sidebar`,`show_notification`,`hide_notification`,`open_dropdown`,`close_dropdown`,`toggle_section`]),YV=c([UV,WV,GV,KV,qV,JV]),XV=l({object:o().optional().describe(`Object name (for object-specific navigation)`),recordId:o().optional().describe(`Record ID (for detail page)`),viewType:x([`list`,`form`,`detail`,`kanban`,`calendar`,`gantt`]).optional(),dashboardId:o().optional().describe(`Dashboard ID`),reportId:o().optional().describe(`Report ID`),appName:o().optional().describe(`App name`),mode:x([`new`,`edit`,`view`]).optional().describe(`Form mode`),openInNewTab:v().optional().describe(`Open in new tab`)}),ZV=l({viewMode:x([`list`,`kanban`,`calendar`,`gantt`,`pivot`]).optional(),filters:u(o(),b()).optional().describe(`Filter conditions`),sort:S(l({field:o(),order:x([`asc`,`desc`])})).optional(),groupBy:o().optional().describe(`Field to group by`),columns:S(o()).optional().describe(`Columns to show/hide`),recordId:o().optional().describe(`Record to expand/collapse`),exportFormat:x([`csv`,`xlsx`,`pdf`,`json`]).optional()}),QV=l({object:o().optional().describe(`Object name`),recordId:o().optional().describe(`Record ID (for edit/delete)`),fieldValues:u(o(),b()).optional().describe(`Field name-value pairs`),fieldName:o().optional().describe(`Specific field to fill/clear`),fieldValue:b().optional().describe(`Value to set`),validateOnly:v().optional().describe(`Validate without saving`)}),$V=l({recordIds:S(o()).optional().describe(`Record IDs to select/operate on`),filters:u(o(),b()).optional().describe(`Filter for bulk operations`),updateData:u(o(),b()).optional().describe(`Data for bulk update`),exportFormat:x([`csv`,`xlsx`,`pdf`,`json`]).optional()}),eH=l({flowName:o().optional().describe(`Flow/workflow name`),approvalProcessName:o().optional().describe(`Approval process name`),webhookUrl:o().optional().describe(`Webhook URL`),reportName:o().optional().describe(`Report name`),emailTemplate:o().optional().describe(`Email template`),recipients:S(o()).optional().describe(`Email recipients`),subject:o().optional().describe(`Email subject`),message:o().optional().describe(`Notification/email message`),taskData:u(o(),b()).optional().describe(`Task creation data`),scheduleTime:o().optional().describe(`Schedule time (ISO 8601)`),contextData:u(o(),b()).optional().describe(`Additional context data`)}),tH=l({componentId:o().optional().describe(`Component ID`),modalConfig:l({title:o().optional(),content:b().optional(),size:x([`small`,`medium`,`large`,`fullscreen`]).optional()}).optional(),notificationConfig:l({type:x([`info`,`success`,`warning`,`error`]).optional(),message:o(),duration:A().optional().describe(`Duration in ms`)}).optional(),sidebarConfig:l({position:x([`left`,`right`]).optional(),width:o().optional(),content:b().optional()}).optional()}),nH=l({id:o().optional().describe(`Unique action ID`),type:YV.describe(`Type of UI action to perform`),params:c([XV,ZV,QV,$V,eH,tH]).describe(`Action-specific parameters`),requireConfirmation:v().default(!1).describe(`Require user confirmation before executing`),confirmationMessage:o().optional().describe(`Message to show in confirmation dialog`),successMessage:o().optional().describe(`Message to show on success`),onError:x([`retry`,`skip`,`abort`]).default(`abort`).describe(`Error handling strategy`),metadata:l({intent:o().optional().describe(`Original user intent/query`),confidence:A().min(0).max(1).optional().describe(`Confidence score (0-1)`),agentName:o().optional().describe(`Agent that generated this action`),timestamp:o().datetime().optional().describe(`Generation timestamp (ISO 8601)`)}).optional()}),rH=nH.extend({type:UV,params:XV}),iH=nH.extend({type:WV,params:ZV}),aH=nH.extend({type:GV,params:QV}),oH=nH.extend({type:KV,params:$V}),sH=nH.extend({type:qV,params:eH}),cH=nH.extend({type:JV,params:tH}),kde=c([rH,iH,aH,oH,sH,cH]),Ade=l({id:o().optional().describe(`Unique sequence ID`),actions:S(nH).describe(`Ordered list of actions`),mode:x([`sequential`,`parallel`]).default(`sequential`).describe(`Execution mode`),stopOnError:v().default(!0).describe(`Stop sequence on first error`),atomic:v().default(!1).describe(`Transaction mode (all-or-nothing)`),startTime:o().datetime().optional().describe(`Execution start time (ISO 8601)`),endTime:o().datetime().optional().describe(`Execution end time (ISO 8601)`),metadata:l({intent:o().optional().describe(`Original user intent`),confidence:A().min(0).max(1).optional().describe(`Overall confidence score`),agentName:o().optional().describe(`Agent that generated this sequence`)}).optional()}),lH=l({actionId:o().describe(`ID of the executed action`),status:x([`success`,`error`,`cancelled`,`pending`]).describe(`Execution status`),data:b().optional().describe(`Action result data`),error:l({code:o(),message:o(),details:b().optional()}).optional().describe(`Error details if status is "error"`),metadata:l({startTime:o().optional().describe(`Execution start time (ISO 8601)`),endTime:o().optional().describe(`Execution end time (ISO 8601)`),duration:A().optional().describe(`Execution duration in ms`)}).optional()}),jde=l({sequenceId:o().describe(`ID of the executed sequence`),status:x([`success`,`partial_success`,`error`,`cancelled`]).describe(`Overall execution status`),results:S(lH).describe(`Results for each action`),summary:l({total:A().describe(`Total number of actions`),successful:A().describe(`Number of successful actions`),failed:A().describe(`Number of failed actions`),cancelled:A().describe(`Number of cancelled actions`)}),metadata:l({startTime:o().optional(),endTime:o().optional(),totalDuration:A().optional().describe(`Total execution time in ms`)}).optional()}),Mde=l({intent:o().describe(`Intent pattern (e.g., "open_new_record_form")`),examples:S(o()).optional().describe(`Example user queries`),actionTemplate:nH.describe(`Action to execute`),paramExtraction:u(o(),l({type:x([`entity`,`slot`,`context`]),required:v().default(!1),default:b().optional()})).optional().describe(`Rules for extracting parameters from user input`),minConfidence:A().min(0).max(1).default(.7).describe(`Minimum confidence to execute`)}),uH=x([`frontend`,`backend`,`api`,`database`,`tests`,`documentation`,`infrastructure`]).describe(`Code generation target`),dH=l({enabled:v().optional().default(!0).describe(`Enable code generation`),targets:S(uH).describe(`Code generation targets`),templateRepo:o().optional().describe(`Template repository for scaffolding`),styleGuide:o().optional().describe(`Code style guide to follow`),includeTests:v().optional().default(!0).describe(`Generate tests with code`),includeDocumentation:v().optional().default(!0).describe(`Generate documentation`),validationMode:x([`strict`,`moderate`,`permissive`]).optional().default(`strict`).describe(`Code validation strictness`)}),fH=l({enabled:v().optional().default(!0).describe(`Enable automated testing`),testTypes:S(x([`unit`,`integration`,`e2e`,`performance`,`security`,`accessibility`])).optional().default([`unit`,`integration`]).describe(`Types of tests to run`),coverageThreshold:A().min(0).max(100).optional().default(80).describe(`Minimum test coverage percentage`),framework:o().optional().describe(`Testing framework (e.g., vitest, jest, playwright)`),preCommitTests:v().optional().default(!0).describe(`Run tests before committing`),autoFix:v().optional().default(!1).describe(`Attempt to auto-fix failing tests`)}),pH=l({name:o().describe(`Pipeline stage name`),type:x([`build`,`test`,`lint`,`security_scan`,`deploy`,`smoke_test`,`rollback`]).describe(`Stage type`),order:A().int().min(0).describe(`Execution order`),parallel:v().optional().default(!1).describe(`Can run in parallel with other stages`),commands:S(o()).describe(`Commands to execute`),env:u(o(),o()).optional().describe(`Stage-specific environment variables`),timeout:A().int().min(60).optional().default(600).describe(`Stage timeout in seconds`),retryOnFailure:v().optional().default(!1).describe(`Retry stage on failure`),maxRetries:A().int().min(0).max(5).optional().default(0).describe(`Maximum retry attempts`)}),mH=l({name:o().describe(`Pipeline name`),trigger:x([`push`,`pull_request`,`release`,`schedule`,`manual`]).describe(`Pipeline trigger`),branches:S(o()).optional().describe(`Branches to run pipeline on`),stages:S(pH).describe(`Pipeline stages`),notifications:l({onSuccess:v().optional().default(!1),onFailure:v().optional().default(!0),channels:S(o()).optional().describe(`Notification channels (e.g., slack, email)`)}).optional().describe(`Pipeline notifications`)}),hH=l({scheme:x([`semver`,`calver`,`custom`]).optional().default(`semver`).describe(`Versioning scheme`),autoIncrement:x([`major`,`minor`,`patch`,`none`]).optional().default(`patch`).describe(`Auto-increment strategy`),prefix:o().optional().default(`v`).describe(`Version tag prefix`),generateChangelog:v().optional().default(!0).describe(`Generate changelog automatically`),changelogFormat:x([`conventional`,`keepachangelog`,`custom`]).optional().default(`conventional`).describe(`Changelog format`),tagReleases:v().optional().default(!0).describe(`Create Git tags for releases`)}),gH=l({type:x([`rolling`,`blue_green`,`canary`,`recreate`]).optional().default(`rolling`).describe(`Deployment strategy`),canaryPercentage:A().min(0).max(100).optional().default(10).describe(`Canary deployment percentage`),healthCheckUrl:o().optional().describe(`Health check endpoint`),healthCheckTimeout:A().int().min(10).optional().default(60).describe(`Health check timeout in seconds`),autoRollback:v().optional().default(!0).describe(`Automatically rollback on failure`),smokeTests:S(o()).optional().describe(`Smoke test commands to run post-deployment`)}),_H=l({enabled:v().optional().default(!0).describe(`Enable monitoring`),metrics:S(x([`performance`,`errors`,`usage`,`availability`,`latency`])).optional().default([`performance`,`errors`,`availability`]).describe(`Metrics to monitor`),alerts:S(l({name:o().describe(`Alert name`),metric:o().describe(`Metric to monitor`),threshold:A().describe(`Alert threshold`),severity:x([`info`,`warning`,`critical`]).describe(`Alert severity`)})).optional().describe(`Alert configurations`),integrations:S(o()).optional().describe(`Monitoring service integrations`)}),vH=l({specificationSource:o().describe(`Path to ObjectStack specification`),codeGeneration:dH.describe(`Code generation settings`),testing:fH.optional().describe(`Testing configuration`),linting:l({enabled:v().optional().default(!0),autoFix:v().optional().default(!0),rules:u(o(),b()).optional()}).optional().describe(`Code linting configuration`),formatting:l({enabled:v().optional().default(!0),autoFormat:v().optional().default(!0),config:u(o(),b()).optional()}).optional().describe(`Code formatting configuration`)}),yH=l({connector:o().describe(`GitHub connector name`),repository:l({owner:o().describe(`Repository owner`),name:o().describe(`Repository name`)}).describe(`Repository configuration`),featureBranch:o().optional().default(`develop`).describe(`Default feature branch`),pullRequest:l({autoCreate:v().optional().default(!0).describe(`Automatically create PRs`),autoMerge:v().optional().default(!1).describe(`Automatically merge PRs when checks pass`),requireReviews:v().optional().default(!0).describe(`Require reviews before merge`),deleteBranchOnMerge:v().optional().default(!0).describe(`Delete feature branch after merge`)}).optional().describe(`Pull request settings`)}),bH=l({connector:o().describe(`Vercel connector name`),project:o().describe(`Vercel project name`),environments:l({production:o().optional().default(`main`).describe(`Production branch`),preview:S(o()).optional().default([`develop`,`feature/*`]).describe(`Preview branches`)}).optional().describe(`Environment mapping`),deployment:l({autoDeployProduction:v().optional().default(!1).describe(`Auto-deploy to production`),autoDeployPreview:v().optional().default(!0).describe(`Auto-deploy preview environments`),requireApproval:v().optional().default(!0).describe(`Require approval for production deployments`)}).optional().describe(`Deployment settings`)}),xH=l({github:yH.describe(`GitHub integration configuration`),vercel:bH.describe(`Vercel integration configuration`),additional:u(o(),b()).optional().describe(`Additional integration configurations`)}),Nde=RV.extend({developmentConfig:vH.describe(`Development configuration`),pipelines:S(mH).optional().describe(`CI/CD pipelines`),versionManagement:hH.optional().describe(`Version management configuration`),deploymentStrategy:gH.optional().describe(`Deployment strategy`),monitoring:_H.optional().describe(`Monitoring configuration`),integrations:xH.describe(`Integration configurations`),selfIteration:l({enabled:v().optional().default(!0).describe(`Enable self-iteration`),iterationFrequency:o().optional().describe(`Iteration frequency (cron expression)`),optimizationGoals:S(x([`performance`,`security`,`code_quality`,`test_coverage`,`documentation`])).optional().describe(`Optimization goals`),learningMode:x([`conservative`,`balanced`,`aggressive`]).optional().default(`balanced`).describe(`Learning mode`)}).optional().describe(`Self-iteration configuration`)}),Pde=NV.extend({type:x([`action`,`flow`,`query`,`vector_search`,`git_operation`,`code_generation`,`test_execution`,`deployment`,`monitoring`])}),Fde={name:`devops_automation_agent`,label:`DevOps Automation Agent`,visibility:`organization`,avatar:`/avatars/devops-bot.png`,role:`Senior Full-Stack DevOps Engineer`,instructions:`You are an autonomous DevOps agent specialized in enterprise management software development.
|
|
68
68
|
|
|
69
69
|
Your responsibilities:
|
|
70
70
|
1. Generate code based on ObjectStack specifications
|
|
@@ -97,7 +97,7 @@ Always prioritize code quality, security, and maintainability.`,model:{provider:
|
|
|
97
97
|
{{testing}}`,defaultReviewers:[`tech-lead`,`security-team`],defaultLabels:[`automated`],draftByDefault:!0,deleteHeadBranch:!0},releaseConfig:{tagPattern:`release/*`,semanticVersioning:!0,autoReleaseNotes:!0,preReleasePattern:`*-rc*`,draftByDefault:!0},status:`active`,enabled:!0},k1=x([`vercel`]).describe(`Vercel provider type`),A1=x([`nextjs`,`react`,`vue`,`nuxtjs`,`gatsby`,`remix`,`astro`,`sveltekit`,`solid`,`angular`,`static`,`other`]).describe(`Frontend framework`),j1=l({type:x([`github`,`gitlab`,`bitbucket`]).describe(`Git provider`),repo:o().describe(`Repository identifier (e.g., owner/repo)`),productionBranch:o().optional().default(`main`).describe(`Production branch name`),autoDeployProduction:v().optional().default(!0).describe(`Auto-deploy production branch`),autoDeployPreview:v().optional().default(!0).describe(`Auto-deploy preview branches`)}),M1=l({buildCommand:o().optional().describe(`Build command (e.g., npm run build)`),outputDirectory:o().optional().describe(`Output directory (e.g., .next, dist)`),installCommand:o().optional().describe(`Install command (e.g., npm install, pnpm install)`),devCommand:o().optional().describe(`Development command (e.g., npm run dev)`),nodeVersion:o().optional().describe(`Node.js version (e.g., 18.x, 20.x)`),env:u(o(),o()).optional().describe(`Build environment variables`)}),N1=l({autoDeployment:v().optional().default(!0).describe(`Enable automatic deployments`),regions:S(x([`iad1`,`sfo1`,`gru1`,`lhr1`,`fra1`,`sin1`,`syd1`,`hnd1`,`icn1`])).optional().describe(`Deployment regions`),enablePreview:v().optional().default(!0).describe(`Enable preview deployments`),previewComments:v().optional().default(!0).describe(`Post preview URLs in PR comments`),productionProtection:v().optional().default(!0).describe(`Require approval for production deployments`),deployHooks:S(l({name:o().describe(`Hook name`),url:o().url().describe(`Deploy hook URL`),branch:o().optional().describe(`Target branch`)})).optional().describe(`Deploy hooks`)}),P1=l({domain:o().describe(`Domain name (e.g., app.example.com)`),httpsRedirect:v().optional().default(!0).describe(`Redirect HTTP to HTTPS`),customCertificate:l({cert:o().describe(`SSL certificate`),key:o().describe(`Private key`),ca:o().optional().describe(`Certificate authority`)}).optional().describe(`Custom SSL certificate`),gitBranch:o().optional().describe(`Git branch to deploy to this domain`)}),F1=l({key:o().describe(`Environment variable name`),value:o().describe(`Environment variable value`),target:S(x([`production`,`preview`,`development`])).describe(`Target environments`),isSecret:v().optional().default(!1).describe(`Encrypt this variable`),gitBranch:o().optional().describe(`Specific git branch`)}),I1=l({name:o().describe(`Edge function name`),path:o().describe(`Function path (e.g., /api/*)`),regions:S(o()).optional().describe(`Specific regions for this function`),memoryLimit:A().int().min(128).max(3008).optional().default(1024).describe(`Memory limit in MB`),timeout:A().int().min(1).max(300).optional().default(10).describe(`Timeout in seconds`)}),L1=l({name:o().describe(`Vercel project name`),framework:A1.optional().describe(`Frontend framework`),gitRepository:j1.optional().describe(`Git repository configuration`),buildConfig:M1.optional().describe(`Build configuration`),deploymentConfig:N1.optional().describe(`Deployment configuration`),domains:S(P1).optional().describe(`Custom domains`),environmentVariables:S(F1).optional().describe(`Environment variables`),edgeFunctions:S(I1).optional().describe(`Edge functions`),rootDirectory:o().optional().describe(`Root directory (for monorepos)`)}),R1=l({enableWebAnalytics:v().optional().default(!1).describe(`Enable Vercel Web Analytics`),enableSpeedInsights:v().optional().default(!1).describe(`Enable Vercel Speed Insights`),logDrains:S(l({name:o().describe(`Log drain name`),url:o().url().describe(`Log drain URL`),headers:u(o(),o()).optional().describe(`Custom headers`),sources:S(x([`static`,`lambda`,`edge`])).optional().describe(`Log sources`)})).optional().describe(`Log drains configuration`)}),z1=l({teamId:o().optional().describe(`Team ID or slug`),teamName:o().optional().describe(`Team name`)}),Ipe=Q$.extend({type:p(`saas`),provider:k1.describe(`Vercel provider`),baseUrl:o().url().optional().default(`https://api.vercel.com`).describe(`Vercel API base URL`),team:z1.optional().describe(`Vercel team configuration`),projects:S(L1).describe(`Vercel projects`),monitoring:R1.optional().describe(`Monitoring configuration`),enableWebhooks:v().optional().default(!0).describe(`Enable Vercel webhooks`),webhookEvents:S(x([`deployment.created`,`deployment.succeeded`,`deployment.failed`,`deployment.ready`,`deployment.error`,`deployment.canceled`,`deployment-checks-completed`,`deployment-prepared`,`project.created`,`project.removed`])).optional().describe(`Webhook events to subscribe to`)}),Lpe={name:`vercel_production`,label:`Vercel Production`,type:`saas`,provider:`vercel`,baseUrl:`https://api.vercel.com`,authentication:{type:`bearer`,token:"${VERCEL_TOKEN}"},projects:[{name:`objectstack-app`,framework:`nextjs`,gitRepository:{type:`github`,repo:`objectstack-ai/app`,productionBranch:`main`,autoDeployProduction:!0,autoDeployPreview:!0},buildConfig:{buildCommand:`npm run build`,outputDirectory:`.next`,installCommand:`npm ci`,devCommand:`npm run dev`,nodeVersion:`20.x`,env:{NEXT_PUBLIC_API_URL:`https://api.objectstack.ai`}},deploymentConfig:{autoDeployment:!0,regions:[`iad1`,`sfo1`,`fra1`],enablePreview:!0,previewComments:!0,productionProtection:!0},domains:[{domain:`app.objectstack.ai`,httpsRedirect:!0,gitBranch:`main`},{domain:`staging.objectstack.ai`,httpsRedirect:!0,gitBranch:`develop`}],environmentVariables:[{key:`DATABASE_URL`,value:"${DATABASE_URL}",target:[`production`,`preview`],isSecret:!0},{key:`NEXT_PUBLIC_ANALYTICS_ID`,value:`UA-XXXXXXXX-X`,target:[`production`],isSecret:!1}],edgeFunctions:[{name:`api-middleware`,path:`/api/*`,regions:[`iad1`,`sfo1`],memoryLimit:1024,timeout:10}]}],monitoring:{enableWebAnalytics:!0,enableSpeedInsights:!0,logDrains:[{name:`datadog-logs`,url:`https://http-intake.logs.datadoghq.com/api/v2/logs`,headers:{"DD-API-KEY":"${DATADOG_API_KEY}"},sources:[`lambda`,`edge`]}]},enableWebhooks:!0,webhookEvents:[`deployment.succeeded`,`deployment.failed`,`deployment.ready`],status:`active`,enabled:!0},Rpe={name:`vercel_docs`,label:`Vercel Documentation`,type:`saas`,provider:`vercel`,baseUrl:`https://api.vercel.com`,authentication:{type:`bearer`,token:"${VERCEL_TOKEN}"},team:{teamId:`team_xxxxxx`,teamName:`ObjectStack`},projects:[{name:`objectstack-docs`,framework:`static`,gitRepository:{type:`github`,repo:`objectstack-ai/docs`,productionBranch:`main`,autoDeployProduction:!0,autoDeployPreview:!0},buildConfig:{buildCommand:`npm run build`,outputDirectory:`dist`,installCommand:`npm ci`,nodeVersion:`18.x`},deploymentConfig:{autoDeployment:!0,regions:[`iad1`,`lhr1`,`sin1`],enablePreview:!0,previewComments:!0,productionProtection:!1},domains:[{domain:`docs.objectstack.ai`,httpsRedirect:!0}],environmentVariables:[{key:`ALGOLIA_APP_ID`,value:"${ALGOLIA_APP_ID}",target:[`production`,`preview`],isSecret:!1},{key:`ALGOLIA_API_KEY`,value:"${ALGOLIA_API_KEY}",target:[`production`,`preview`],isSecret:!0}]}],monitoring:{enableWebAnalytics:!0,enableSpeedInsights:!1},enableWebhooks:!1,status:`active`,enabled:!0};EE({},{ActionContributionSchema:()=>W1,ActionLocationSchema:()=>U1,ActivationEventSchema:()=>X1,BUILT_IN_NODE_DESCRIPTORS:()=>Wpe,CanvasSnapSettingsSchema:()=>m0,CanvasZoomSettingsSchema:()=>h0,CommandContributionSchema:()=>J1,ERDiagramConfigSchema:()=>a0,ERLayoutAlgorithmSchema:()=>r0,ERNodeDisplaySchema:()=>i0,ElementPaletteItemSchema:()=>g0,FieldEditorConfigSchema:()=>e0,FieldGroupSchema:()=>$1,FieldPropertySectionSchema:()=>Q1,FlowBuilderConfigSchema:()=>C0,FlowCanvasEdgeSchema:()=>Upe,FlowCanvasEdgeStyleSchema:()=>b0,FlowCanvasNodeSchema:()=>Hpe,FlowLayoutAlgorithmSchema:()=>x0,FlowLayoutDirectionSchema:()=>S0,FlowNodeRenderDescriptorSchema:()=>y0,FlowNodeShapeSchema:()=>v0,InterfaceBuilderConfigSchema:()=>Vpe,MetadataIconContributionSchema:()=>G1,MetadataViewerContributionSchema:()=>V1,ObjectDesignerConfigSchema:()=>p0,ObjectDesignerDefaultViewSchema:()=>f0,ObjectFilterSchema:()=>c0,ObjectListDisplayModeSchema:()=>o0,ObjectManagerConfigSchema:()=>l0,ObjectPreviewConfigSchema:()=>d0,ObjectPreviewTabSchema:()=>u0,ObjectSortFieldSchema:()=>s0,PageBuilderConfigSchema:()=>_0,PanelContributionSchema:()=>q1,PanelLocationSchema:()=>K1,RelationshipDisplaySchema:()=>t0,RelationshipMapperConfigSchema:()=>n0,SidebarGroupContributionSchema:()=>H1,StudioPluginContributionsSchema:()=>Y1,StudioPluginManifestSchema:()=>Z1,ViewModeSchema:()=>B1,defineFlowBuilderConfig:()=>Gpe,defineObjectDesignerConfig:()=>Bpe,defineStudioPlugin:()=>zpe});var B1=x([`preview`,`design`,`code`,`data`]),V1=l({id:o().describe(`Unique viewer identifier`),metadataTypes:S(o()).min(1).describe(`Metadata types this viewer can handle`),label:o().describe(`Viewer display label`),priority:A().default(0).describe(`Viewer priority (higher wins)`),modes:S(B1).default([`preview`]).describe(`Supported view modes`)}),H1=l({key:o().describe(`Unique group key`),label:o().describe(`Group display label`),icon:o().optional().describe(`Lucide icon name`),metadataTypes:S(o()).describe(`Metadata types in this group`),order:A().default(100).describe(`Sort order (lower = higher)`)}),U1=x([`toolbar`,`contextMenu`,`commandPalette`]),W1=l({id:o().describe(`Unique action identifier`),label:o().describe(`Action display label`),icon:o().optional().describe(`Lucide icon name`),location:U1.describe(`UI location`),metadataTypes:S(o()).default([]).describe(`Applicable metadata types`)}),G1=l({metadataType:o().describe(`Metadata type`),label:o().describe(`Display label`),icon:o().describe(`Lucide icon name`)}),K1=x([`bottom`,`right`,`modal`]),q1=l({id:o().describe(`Unique panel identifier`),label:o().describe(`Panel display label`),icon:o().optional().describe(`Lucide icon name`),location:K1.default(`bottom`).describe(`Panel location`)}),J1=l({id:o().describe(`Unique command identifier`),label:o().describe(`Command display label`),shortcut:o().optional().describe(`Keyboard shortcut`),icon:o().optional().describe(`Lucide icon name`)}),Y1=l({metadataViewers:S(V1).default([]),sidebarGroups:S(H1).default([]),actions:S(W1).default([]),metadataIcons:S(G1).default([]),panels:S(q1).default([]),commands:S(J1).default([])}),X1=o().describe(`Activation event pattern`),Z1=l({id:o().regex(/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/).describe(`Plugin ID (dot-separated lowercase)`),name:o().describe(`Plugin display name`),version:o().default(`0.0.1`).describe(`Plugin version`),description:o().optional().describe(`Plugin description`),author:o().optional().describe(`Author`),contributes:Y1.default({metadataViewers:[],sidebarGroups:[],actions:[],metadataIcons:[],panels:[],commands:[]}),activationEvents:S(X1).default([`*`])});function zpe(e){return Z1.parse(e)}var Q1=l({key:o().describe(`Section key (e.g., "basics", "constraints", "security")`),label:o().describe(`Section display label`),icon:o().optional().describe(`Lucide icon name`),defaultExpanded:v().default(!0).describe(`Whether section is expanded by default`),order:A().default(0).describe(`Sort order (lower = higher)`)}),$1=l({key:o().describe(`Group key matching field.group values`),label:o().describe(`Group display label`),icon:o().optional().describe(`Lucide icon name`),defaultExpanded:v().default(!0).describe(`Whether group is expanded by default`),order:A().default(0).describe(`Sort order (lower = higher)`)}),e0=l({inlineEditing:v().default(!0).describe(`Enable inline editing of field properties`),dragReorder:v().default(!0).describe(`Enable drag-and-drop field reordering`),showFieldGroups:v().default(!0).describe(`Show field group headers`),showPropertyPanel:v().default(!0).describe(`Show the right-side property panel`),propertySections:S(Q1).default([{key:`basics`,label:`Basic Properties`,defaultExpanded:!0,order:0},{key:`constraints`,label:`Constraints & Validation`,defaultExpanded:!0,order:10},{key:`relationship`,label:`Relationship Config`,defaultExpanded:!0,order:20},{key:`display`,label:`Display & UI`,defaultExpanded:!1,order:30},{key:`security`,label:`Security & Compliance`,defaultExpanded:!1,order:40},{key:`advanced`,label:`Advanced`,defaultExpanded:!1,order:50}]).describe(`Property panel section definitions`),fieldGroups:S($1).default([]).describe(`Field group definitions`),paginationThreshold:A().default(50).describe(`Number of fields before pagination is enabled`),batchOperations:v().default(!0).describe(`Enable batch add/remove field operations`),showUsageStats:v().default(!1).describe(`Show field usage statistics`)}),t0=l({type:x([`lookup`,`master_detail`,`tree`]).describe(`Relationship type`),lineStyle:x([`solid`,`dashed`,`dotted`]).default(`solid`).describe(`Line style in diagrams`),color:o().default(`#94a3b8`).describe(`Line color (CSS value)`),highlightColor:o().default(`#0891b2`).describe(`Highlighted color on hover/select`),cardinalityLabel:o().default(`1:N`).describe(`Cardinality label (e.g., "1:N", "1:1", "N:M")`)}),n0=l({visualCreation:v().default(!0).describe(`Enable drag-to-create relationships`),showReverseRelationships:v().default(!0).describe(`Show reverse/child-to-parent relationships`),showCascadeWarnings:v().default(!0).describe(`Show cascade delete behavior warnings`),displayConfig:S(t0).default([{type:`lookup`,lineStyle:`dashed`,color:`#0891b2`,highlightColor:`#06b6d4`,cardinalityLabel:`1:N`},{type:`master_detail`,lineStyle:`solid`,color:`#ea580c`,highlightColor:`#f97316`,cardinalityLabel:`1:N`},{type:`tree`,lineStyle:`dotted`,color:`#8b5cf6`,highlightColor:`#a78bfa`,cardinalityLabel:`1:N`}]).describe(`Visual config per relationship type`)}),r0=x([`force`,`hierarchy`,`grid`,`circular`]).describe(`ER diagram layout algorithm`),i0=l({showFields:v().default(!0).describe(`Show field list inside entity nodes`),maxFieldsVisible:A().default(8).describe(`Max fields visible before "N more..." collapse`),showFieldTypes:v().default(!0).describe(`Show field type badges`),showRequiredIndicator:v().default(!0).describe(`Show required field indicators`),showRecordCount:v().default(!1).describe(`Show live record count on nodes`),showIcon:v().default(!0).describe(`Show object icon on node header`),showDescription:v().default(!0).describe(`Show description tooltip on hover`)}),a0=l({enabled:v().default(!0).describe(`Enable ER diagram panel`),layout:r0.default(`force`).describe(`Default layout algorithm`),nodeDisplay:i0.default({showFields:!0,maxFieldsVisible:8,showFieldTypes:!0,showRequiredIndicator:!0,showRecordCount:!1,showIcon:!0,showDescription:!0}).describe(`Node display configuration`),showMinimap:v().default(!0).describe(`Show minimap for large diagrams`),zoomControls:v().default(!0).describe(`Show zoom in/out/fit controls`),minZoom:A().default(.1).describe(`Minimum zoom level`),maxZoom:A().default(3).describe(`Maximum zoom level`),showEdgeLabels:v().default(!0).describe(`Show cardinality labels on relationship edges`),highlightOnHover:v().default(!0).describe(`Highlight connected entities on node hover`),clickToNavigate:v().default(!0).describe(`Click node to navigate to object detail`),dragToConnect:v().default(!0).describe(`Drag between nodes to create relationships`),hideOrphans:v().default(!1).describe(`Hide objects with no relationships`),autoFit:v().default(!0).describe(`Auto-fit diagram to viewport on load`),exportFormats:S(x([`png`,`svg`,`json`])).default([`png`,`svg`]).describe(`Available export formats for diagram`)}),o0=x([`table`,`cards`,`tree`]).describe(`Object list display mode`),s0=x([`name`,`label`,`fieldCount`,`updatedAt`]).describe(`Object list sort field`),c0=l({package:o().optional().describe(`Filter by owning package`),tags:S(o()).optional().describe(`Filter by object tags`),includeSystem:v().default(!0).describe(`Include system-level objects`),includeAbstract:v().default(!1).describe(`Include abstract base objects`),hasFieldType:o().optional().describe(`Filter to objects containing a specific field type`),hasRelationships:v().optional().describe(`Filter to objects with lookup/master_detail fields`),searchQuery:o().optional().describe(`Free-text search across name, label, and description`)}),l0=l({defaultDisplayMode:o0.default(`table`).describe(`Default list display mode`),defaultSortField:s0.default(`label`).describe(`Default sort field`),defaultSortDirection:x([`asc`,`desc`]).default(`asc`).describe(`Default sort direction`),defaultFilter:c0.default({includeSystem:!0,includeAbstract:!1}).describe(`Default filter configuration`),showFieldCount:v().default(!0).describe(`Show field count badge`),showRelationshipCount:v().default(!0).describe(`Show relationship count badge`),showQuickPreview:v().default(!0).describe(`Show quick field preview tooltip on hover`),enableComparison:v().default(!1).describe(`Enable side-by-side object comparison`),showERDiagramToggle:v().default(!0).describe(`Show ER diagram toggle in toolbar`),showCreateAction:v().default(!0).describe(`Show create object action`),showStatsSummary:v().default(!0).describe(`Show statistics summary bar`)}),u0=l({key:o().describe(`Tab key`),label:o().describe(`Tab display label`),icon:o().optional().describe(`Lucide icon name`),enabled:v().default(!0).describe(`Whether this tab is available`),order:A().default(0).describe(`Sort order (lower = higher)`)}),d0=l({tabs:S(u0).default([{key:`fields`,label:`Fields`,icon:`list`,enabled:!0,order:0},{key:`relationships`,label:`Relationships`,icon:`link`,enabled:!0,order:10},{key:`indexes`,label:`Indexes`,icon:`zap`,enabled:!0,order:20},{key:`validations`,label:`Validations`,icon:`shield-check`,enabled:!0,order:30},{key:`capabilities`,label:`Capabilities`,icon:`settings`,enabled:!0,order:40},{key:`data`,label:`Data`,icon:`table-2`,enabled:!0,order:50},{key:`api`,label:`API`,icon:`globe`,enabled:!0,order:60},{key:`code`,label:`Code`,icon:`code-2`,enabled:!0,order:70}]).describe(`Object detail preview tabs`),defaultTab:o().default(`fields`).describe(`Default active tab key`),showHeader:v().default(!0).describe(`Show object summary header`),showBreadcrumbs:v().default(!0).describe(`Show navigation breadcrumbs`)}),f0=x([`field-editor`,`relationship-mapper`,`er-diagram`,`object-manager`]).describe(`Default view when entering the Object Designer`),p0=l({defaultView:f0.default(`field-editor`).describe(`Default view`),fieldEditor:e0.default({inlineEditing:!0,dragReorder:!0,showFieldGroups:!0,showPropertyPanel:!0,propertySections:[{key:`basics`,label:`Basic Properties`,defaultExpanded:!0,order:0},{key:`constraints`,label:`Constraints & Validation`,defaultExpanded:!0,order:10},{key:`relationship`,label:`Relationship Config`,defaultExpanded:!0,order:20},{key:`display`,label:`Display & UI`,defaultExpanded:!1,order:30},{key:`security`,label:`Security & Compliance`,defaultExpanded:!1,order:40},{key:`advanced`,label:`Advanced`,defaultExpanded:!1,order:50}],fieldGroups:[],paginationThreshold:50,batchOperations:!0,showUsageStats:!1}).describe(`Field editor configuration`),relationshipMapper:n0.default({visualCreation:!0,showReverseRelationships:!0,showCascadeWarnings:!0,displayConfig:[{type:`lookup`,lineStyle:`dashed`,color:`#0891b2`,highlightColor:`#06b6d4`,cardinalityLabel:`1:N`},{type:`master_detail`,lineStyle:`solid`,color:`#ea580c`,highlightColor:`#f97316`,cardinalityLabel:`1:N`},{type:`tree`,lineStyle:`dotted`,color:`#8b5cf6`,highlightColor:`#a78bfa`,cardinalityLabel:`1:N`}]}).describe(`Relationship mapper configuration`),erDiagram:a0.default({enabled:!0,layout:`force`,nodeDisplay:{showFields:!0,maxFieldsVisible:8,showFieldTypes:!0,showRequiredIndicator:!0,showRecordCount:!1,showIcon:!0,showDescription:!0},showMinimap:!0,zoomControls:!0,minZoom:.1,maxZoom:3,showEdgeLabels:!0,highlightOnHover:!0,clickToNavigate:!0,dragToConnect:!0,hideOrphans:!1,autoFit:!0,exportFormats:[`png`,`svg`]}).describe(`ER diagram configuration`),objectManager:l0.default({defaultDisplayMode:`table`,defaultSortField:`label`,defaultSortDirection:`asc`,defaultFilter:{includeSystem:!0,includeAbstract:!1},showFieldCount:!0,showRelationshipCount:!0,showQuickPreview:!0,enableComparison:!1,showERDiagramToggle:!0,showCreateAction:!0,showStatsSummary:!0}).describe(`Object manager configuration`),objectPreview:d0.default({tabs:[{key:`fields`,label:`Fields`,icon:`list`,enabled:!0,order:0},{key:`relationships`,label:`Relationships`,icon:`link`,enabled:!0,order:10},{key:`indexes`,label:`Indexes`,icon:`zap`,enabled:!0,order:20},{key:`validations`,label:`Validations`,icon:`shield-check`,enabled:!0,order:30},{key:`capabilities`,label:`Capabilities`,icon:`settings`,enabled:!0,order:40},{key:`data`,label:`Data`,icon:`table-2`,enabled:!0,order:50},{key:`api`,label:`API`,icon:`globe`,enabled:!0,order:60},{key:`code`,label:`Code`,icon:`code-2`,enabled:!0,order:70}],defaultTab:`fields`,showHeader:!0,showBreadcrumbs:!0}).describe(`Object preview configuration`)});function Bpe(e){return p0.parse(e)}var m0=l({enabled:v().default(!0).describe(`Enable snap-to-grid`),gridSize:A().int().min(1).default(8).describe(`Snap grid size in pixels`),showGrid:v().default(!0).describe(`Show grid overlay on canvas`),showGuides:v().default(!0).describe(`Show alignment guides when dragging`)}),h0=l({min:A().min(.1).default(.25).describe(`Minimum zoom level`),max:A().max(10).default(3).describe(`Maximum zoom level`),default:A().default(1).describe(`Default zoom level`),step:A().default(.1).describe(`Zoom step increment`)}),g0=l({type:o().describe(`Component type (e.g. "element:button", "element:text")`),label:o().describe(`Display label in palette`),icon:o().optional().describe(`Icon name for palette display`),category:x([`content`,`interactive`,`data`,`layout`]).describe(`Palette category grouping`),defaultWidth:A().int().min(1).default(4).describe(`Default width in grid columns`),defaultHeight:A().int().min(1).default(2).describe(`Default height in grid rows`)}),_0=l({snap:m0.optional().describe(`Canvas snap settings`),zoom:h0.optional().describe(`Canvas zoom settings`),palette:S(g0).optional().describe(`Custom element palette (defaults to all registered elements)`),showLayerPanel:v().default(!0).describe(`Show layer ordering panel`),showPropertyPanel:v().default(!0).describe(`Show property inspector panel`),undoLimit:A().int().min(1).default(50).describe(`Maximum undo history steps`)}),Vpe=_0,v0=x([`rounded_rect`,`circle`,`diamond`,`parallelogram`,`hexagon`,`diamond_thick`,`attached_circle`,`screen_rect`]).describe(`Visual shape for rendering a flow node on the canvas`),y0=l({action:o().describe(`FlowNodeAction value (e.g., "parallel_gateway")`),shape:v0.describe(`Shape to render`),icon:o().describe(`Lucide icon name`),defaultLabel:o().describe(`Default display label`),defaultWidth:A().int().min(20).default(120).describe(`Default width in pixels`),defaultHeight:A().int().min(20).default(60).describe(`Default height in pixels`),fillColor:o().default(`#ffffff`).describe(`Node fill color (CSS value)`),borderColor:o().default(`#94a3b8`).describe(`Node border color (CSS value)`),allowBoundaryEvents:v().default(!1).describe(`Whether boundary events can be attached to this node type`),paletteCategory:x([`event`,`gateway`,`activity`,`data`,`subflow`]).describe(`Palette category for grouping`)}).describe(`Visual render descriptor for a flow node type`),Hpe=l({nodeId:o().describe(`Corresponding FlowNode.id`),x:A().describe(`X position on canvas`),y:A().describe(`Y position on canvas`),width:A().int().min(20).optional().describe(`Width override in pixels`),height:A().int().min(20).optional().describe(`Height override in pixels`),collapsed:v().default(!1).describe(`Whether the node is collapsed`),fillColor:o().optional().describe(`Fill color override`),borderColor:o().optional().describe(`Border color override`),annotation:o().optional().describe(`User annotation displayed near the node`)}).describe(`Canvas layout data for a flow node`),b0=x([`solid`,`dashed`,`dotted`,`bold`]).describe(`Edge line style`),Upe=l({edgeId:o().describe(`Corresponding FlowEdge.id`),style:b0.default(`solid`).describe(`Line style`),color:o().default(`#94a3b8`).describe(`Edge line color`),labelPosition:A().min(0).max(1).default(.5).describe(`Position of the condition label along the edge`),waypoints:S(l({x:A().describe(`Waypoint X`),y:A().describe(`Waypoint Y`)})).optional().describe(`Manual waypoints for edge routing`),animated:v().default(!1).describe(`Show animated flow indicator`)}).describe(`Canvas layout and visual data for a flow edge`),x0=x([`dagre`,`elk`,`force`,`manual`]).describe(`Auto-layout algorithm for the flow canvas`),S0=x([`TB`,`BT`,`LR`,`RL`]).describe(`Auto-layout direction`),C0=l({snap:l({enabled:v().default(!0).describe(`Enable snap-to-grid`),gridSize:A().int().min(1).default(16).describe(`Snap grid size in pixels`),showGrid:v().default(!0).describe(`Show grid overlay`)}).default({enabled:!0,gridSize:16,showGrid:!0}).describe(`Canvas snap-to-grid settings`),zoom:l({min:A().min(.1).default(.25).describe(`Minimum zoom level`),max:A().max(10).default(3).describe(`Maximum zoom level`),default:A().default(1).describe(`Default zoom level`),step:A().default(.1).describe(`Zoom step`)}).default({min:.25,max:3,default:1,step:.1}).describe(`Canvas zoom settings`),layoutAlgorithm:x0.default(`dagre`).describe(`Default auto-layout algorithm`),layoutDirection:S0.default(`TB`).describe(`Default auto-layout direction`),nodeDescriptors:S(y0).optional().describe(`Custom node render descriptors (merged with built-in defaults)`),showMinimap:v().default(!0).describe(`Show minimap panel`),showPropertyPanel:v().default(!0).describe(`Show property panel`),showPalette:v().default(!0).describe(`Show node palette sidebar`),undoLimit:A().int().min(1).default(50).describe(`Maximum undo history steps`),animateExecution:v().default(!0).describe(`Animate edges during execution preview`),connectionValidation:v().default(!0).describe(`Validate connections before creating edges`)}).describe(`Studio Flow Builder configuration`),Wpe=[{action:`start`,shape:`circle`,icon:`play`,defaultLabel:`Start`,defaultWidth:60,defaultHeight:60,fillColor:`#dcfce7`,borderColor:`#16a34a`,allowBoundaryEvents:!1,paletteCategory:`event`},{action:`end`,shape:`circle`,icon:`square`,defaultLabel:`End`,defaultWidth:60,defaultHeight:60,fillColor:`#fee2e2`,borderColor:`#dc2626`,allowBoundaryEvents:!1,paletteCategory:`event`},{action:`decision`,shape:`diamond`,icon:`git-branch`,defaultLabel:`Decision`,defaultWidth:80,defaultHeight:80,fillColor:`#fef9c3`,borderColor:`#ca8a04`,allowBoundaryEvents:!1,paletteCategory:`gateway`},{action:`parallel_gateway`,shape:`diamond_thick`,icon:`git-fork`,defaultLabel:`Parallel Gateway`,defaultWidth:80,defaultHeight:80,fillColor:`#dbeafe`,borderColor:`#2563eb`,allowBoundaryEvents:!1,paletteCategory:`gateway`},{action:`join_gateway`,shape:`diamond_thick`,icon:`git-merge`,defaultLabel:`Join Gateway`,defaultWidth:80,defaultHeight:80,fillColor:`#dbeafe`,borderColor:`#2563eb`,allowBoundaryEvents:!1,paletteCategory:`gateway`},{action:`wait`,shape:`hexagon`,icon:`clock`,defaultLabel:`Wait`,defaultWidth:100,defaultHeight:60,fillColor:`#f3e8ff`,borderColor:`#7c3aed`,allowBoundaryEvents:!0,paletteCategory:`event`},{action:`boundary_event`,shape:`attached_circle`,icon:`alert-circle`,defaultLabel:`Boundary Event`,defaultWidth:40,defaultHeight:40,fillColor:`#fff7ed`,borderColor:`#ea580c`,allowBoundaryEvents:!1,paletteCategory:`event`},{action:`assignment`,shape:`rounded_rect`,icon:`pen-line`,defaultLabel:`Assignment`,defaultWidth:120,defaultHeight:60,fillColor:`#ffffff`,borderColor:`#94a3b8`,allowBoundaryEvents:!0,paletteCategory:`activity`},{action:`create_record`,shape:`rounded_rect`,icon:`plus-circle`,defaultLabel:`Create Record`,defaultWidth:120,defaultHeight:60,fillColor:`#ffffff`,borderColor:`#94a3b8`,allowBoundaryEvents:!0,paletteCategory:`data`},{action:`update_record`,shape:`rounded_rect`,icon:`edit`,defaultLabel:`Update Record`,defaultWidth:120,defaultHeight:60,fillColor:`#ffffff`,borderColor:`#94a3b8`,allowBoundaryEvents:!0,paletteCategory:`data`},{action:`delete_record`,shape:`rounded_rect`,icon:`trash-2`,defaultLabel:`Delete Record`,defaultWidth:120,defaultHeight:60,fillColor:`#ffffff`,borderColor:`#94a3b8`,allowBoundaryEvents:!0,paletteCategory:`data`},{action:`get_record`,shape:`rounded_rect`,icon:`search`,defaultLabel:`Get Record`,defaultWidth:120,defaultHeight:60,fillColor:`#ffffff`,borderColor:`#94a3b8`,allowBoundaryEvents:!0,paletteCategory:`data`},{action:`http_request`,shape:`rounded_rect`,icon:`globe`,defaultLabel:`HTTP Request`,defaultWidth:120,defaultHeight:60,fillColor:`#ffffff`,borderColor:`#94a3b8`,allowBoundaryEvents:!0,paletteCategory:`activity`},{action:`script`,shape:`rounded_rect`,icon:`code`,defaultLabel:`Script`,defaultWidth:120,defaultHeight:60,fillColor:`#ffffff`,borderColor:`#94a3b8`,allowBoundaryEvents:!0,paletteCategory:`activity`},{action:`screen`,shape:`screen_rect`,icon:`monitor`,defaultLabel:`Screen`,defaultWidth:140,defaultHeight:80,fillColor:`#f0f9ff`,borderColor:`#0284c7`,allowBoundaryEvents:!1,paletteCategory:`activity`},{action:`loop`,shape:`parallelogram`,icon:`repeat`,defaultLabel:`Loop`,defaultWidth:120,defaultHeight:60,fillColor:`#fef3c7`,borderColor:`#d97706`,allowBoundaryEvents:!0,paletteCategory:`activity`},{action:`subflow`,shape:`rounded_rect`,icon:`layers`,defaultLabel:`Subflow`,defaultWidth:140,defaultHeight:70,fillColor:`#ede9fe`,borderColor:`#7c3aed`,allowBoundaryEvents:!0,paletteCategory:`subflow`},{action:`connector_action`,shape:`rounded_rect`,icon:`plug`,defaultLabel:`Connector`,defaultWidth:120,defaultHeight:60,fillColor:`#ffffff`,borderColor:`#94a3b8`,allowBoundaryEvents:!0,paletteCategory:`activity`}];function Gpe(e){return C0.parse(e)}var Kpe=l({manifest:cz.optional().describe(`Project Package Configuration`),datasources:S(Rk).optional().describe(`External Data Connections`),translations:S(jI).optional().describe(`I18n Translation Bundles`),i18n:PI.optional().describe(`Internationalization configuration`),objects:S(mO).optional().describe(`Business Objects definition (owned by this package)`),objectExtensions:S(hO).optional().describe(`Extensions to objects owned by other packages`),apps:S(rj).optional().describe(`Applications`),views:S(jj).optional().describe(`List Views`),pages:S(nM).optional().describe(`Custom Pages`),dashboards:S(Bj).optional().describe(`Dashboards`),reports:S(Gj).optional().describe(`Analytics Reports`),actions:S(rO).optional().describe(`Global and Object Actions`),themes:S(qM).optional().describe(`UI Themes`),workflows:S(OK).optional().describe(`Event-driven workflows`),approvals:S(n$).optional().describe(`Approval processes`),flows:S(sQ).optional().describe(`Screen Flows`),roles:S(gV).optional().describe(`User Roles hierarchy`),permissions:S(vA).optional().describe(`Permission Sets and Profiles`),sharingRules:S(EA).optional().describe(`Record Sharing Rules`),policies:S(MA).optional().describe(`Security & Compliance Policies`),apis:S(yW).optional().describe(`API Endpoints`),webhooks:S(ZQ).optional().describe(`Outbound Webhooks`),agents:S(RV).optional().describe(`AI Agents and Assistants`),ragPipelines:S(yU).optional().describe(`RAG Pipelines`),hooks:S(_O).optional().describe(`Object Lifecycle Hooks`),mappings:S(bO).optional().describe(`Data Import/Export Mappings`),analyticsCubes:S(Gk).optional().describe(`Analytics Semantic Layer Cubes`),connectors:S(Q$).optional().describe(`External System Connectors`),data:S(yk).optional().describe(`Seed Data / Fixtures for bootstrapping`),plugins:S(b()).optional().describe(`Plugins to load`),devPlugins:S(c([cz,o()])).optional().describe(`Plugins to load only in development (CLI dev command)`)});function qpe(e){let t=new Set;if(e.objects)for(let n of e.objects)t.add(n.name);return t}function Jpe(e){let t=[],n=qpe(e);if(n.size===0)return t;if(e.workflows)for(let r of e.workflows)r.objectName&&!n.has(r.objectName)&&t.push(`Workflow '${r.name}' references object '${r.objectName}' which is not defined in objects.`);if(e.approvals)for(let r of e.approvals)r.object&&!n.has(r.object)&&t.push(`Approval '${r.name}' references object '${r.object}' which is not defined in objects.`);if(e.hooks){for(let r of e.hooks)if(r.object){let e=Array.isArray(r.object)?r.object:[r.object];for(let i of e)n.has(i)||t.push(`Hook '${r.name}' references object '${i}' which is not defined in objects.`)}}if(e.views)for(let[r,i]of e.views.entries()){let e=(e,r)=>{if(e&&typeof e==`object`&&`provider`in e&&`object`in e){let i=e;i.provider===`object`&&i.object&&!n.has(i.object)&&t.push(`${r} references object '${i.object}' which is not defined in objects.`)}};i.list?.data&&e(i.list.data,`View[${r}].list`),i.form?.data&&e(i.form.data,`View[${r}].form`)}if(e.data)for(let r of e.data)r.object&&!n.has(r.object)&&t.push(`Seed data references object '${r.object}' which is not defined in objects.`);if(e.apps){let r=new Set;if(e.dashboards)for(let t of e.dashboards)r.add(t.name);let i=new Set;if(e.pages)for(let t of e.pages)i.add(t.name);let a=new Set;if(e.reports)for(let t of e.reports)a.add(t.name);for(let o of e.apps){if(!o.navigation)continue;let e=(o,s)=>{for(let c of o){if(!c||typeof c!=`object`)continue;let o=c;o.type===`object`&&typeof o.objectName==`string`&&!n.has(o.objectName)&&t.push(`App '${s}' navigation references object '${o.objectName}' which is not defined in objects.`),o.type===`dashboard`&&typeof o.dashboardName==`string`&&r.size>0&&!r.has(o.dashboardName)&&t.push(`App '${s}' navigation references dashboard '${o.dashboardName}' which is not defined in dashboards.`),o.type===`page`&&typeof o.pageName==`string`&&i.size>0&&!i.has(o.pageName)&&t.push(`App '${s}' navigation references page '${o.pageName}' which is not defined in pages.`),o.type===`report`&&typeof o.reportName==`string`&&a.size>0&&!a.has(o.reportName)&&t.push(`App '${s}' navigation references report '${o.reportName}' which is not defined in reports.`),o.type===`group`&&Array.isArray(o.children)&&e(o.children,s)}};e(o.navigation,o.name)}}if(e.actions){let r=new Set;if(e.flows)for(let t of e.flows)r.add(t.name);let i=new Set;if(e.pages)for(let t of e.pages)i.add(t.name);for(let a of e.actions)a.type===`flow`&&a.target&&r.size>0&&!r.has(a.target)&&t.push(`Action '${a.name}' references flow '${a.target}' which is not defined in flows.`),a.type===`modal`&&a.target&&i.size>0&&!i.has(a.target)&&t.push(`Action '${a.name}' references page '${a.target}' (via modal target) which is not defined in pages.`),a.objectName&&!n.has(a.objectName)&&t.push(`Action '${a.name}' references object '${a.objectName}' which is not defined in objects.`)}return t}function w0(e){if(!e.actions||!e.objects||e.objects.length===0)return e;let t=new Map;for(let n of e.actions)if(n.objectName){let e=t.get(n.objectName)??[];e.push(n),t.set(n.objectName,e)}if(t.size===0)return e;let n=e.objects.map(e=>{let n=t.get(e.name);return n?{...e,actions:[...e.actions??[],...n]}:e});return{...e,objects:n}}function Ype(e,t){let n=t?.strict!==!1,r=dD(e);if(!n)return w0(r);let i=Kpe.safeParse(r,{error:oD});if(!i.success)throw Error(cD(i.error,`defineStack validation failed`));let a=Jpe(i.data);if(a.length>0){let e=`defineStack cross-reference validation failed (${a.length} issue${a.length===1?``:`s`}):`,t=a.map(e=>` \u2717 ${e}`);throw Error(`${e}
|
|
98
98
|
|
|
99
99
|
${t.join(`
|
|
100
|
-
`)}`)}return w0(i.data)}l({objectConflict:x([`error`,`override`,`merge`]).default(`error`),manifest:c([x([`first`,`last`]),A().int().min(0)]).default(`last`),namespace:o().optional()});var Xpe=l({queryFilters:v().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:v().default(!0).describe(`Supports GROUP BY and aggregation functions`),querySorting:v().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:v().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:v().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:v().default(!1).describe(`Supports subqueries`),queryDistinct:v().default(!0).describe(`Supports SELECT DISTINCT`),queryHaving:v().default(!1).describe(`Supports HAVING clause for aggregations`),queryJoins:v().default(!1).describe(`Supports SQL-style joins`),fullTextSearch:v().default(!1).describe(`Supports full-text search`),vectorSearch:v().default(!1).describe(`Supports vector embeddings and similarity search for AI/RAG`),geoSpatial:v().default(!1).describe(`Supports geospatial queries and location fields`),jsonFields:v().default(!0).describe(`Supports JSON field types`),arrayFields:v().default(!1).describe(`Supports array field types`),validationRules:v().default(!0).describe(`Supports validation rules`),workflows:v().default(!0).describe(`Supports workflow automation`),triggers:v().default(!0).describe(`Supports database triggers`),formulas:v().default(!0).describe(`Supports formula fields`),transactions:v().default(!0).describe(`Supports database transactions`),bulkOperations:v().default(!0).describe(`Supports bulk create/update/delete`),supportedDrivers:S(o()).optional().describe(`Available database drivers (e.g., postgresql, mongodb, excel)`)}),Zpe=l({listView:v().default(!0).describe(`Supports list/grid views`),formView:v().default(!0).describe(`Supports form views`),kanbanView:v().default(!1).describe(`Supports kanban board views`),calendarView:v().default(!1).describe(`Supports calendar views`),ganttView:v().default(!1).describe(`Supports Gantt chart views`),dashboards:v().default(!0).describe(`Supports dashboard creation`),reports:v().default(!0).describe(`Supports report generation`),charts:v().default(!0).describe(`Supports chart widgets`),customPages:v().default(!0).describe(`Supports custom page creation`),customThemes:v().default(!1).describe(`Supports custom theme creation`),customComponents:v().default(!1).describe(`Supports custom UI components/widgets`),customActions:v().default(!0).describe(`Supports custom button actions`),screenFlows:v().default(!1).describe(`Supports interactive screen flows`),mobileOptimized:v().default(!1).describe(`UI optimized for mobile devices`),accessibility:v().default(!1).describe(`WCAG accessibility support`)}),Qpe=l({version:o().describe(`ObjectOS Kernel Version`),environment:x([`development`,`test`,`staging`,`production`]),restApi:v().default(!0).describe(`REST API available`),graphqlApi:v().default(!1).describe(`GraphQL API available`),odataApi:v().default(!1).describe(`OData API available`),websockets:v().default(!1).describe(`WebSocket support for real-time updates`),serverSentEvents:v().default(!1).describe(`Server-Sent Events support`),eventBus:v().default(!1).describe(`Internal event bus for pub/sub`),webhooks:v().default(!0).describe(`Outbound webhook support`),apiContracts:v().default(!1).describe(`API contract definitions`),authentication:v().default(!0).describe(`Authentication system`),rbac:v().default(!0).describe(`Role-Based Access Control`),fieldLevelSecurity:v().default(!1).describe(`Field-level permissions`),rowLevelSecurity:v().default(!1).describe(`Row-level security/sharing rules`),multiTenant:v().default(!1).describe(`Multi-tenant architecture support`),backgroundJobs:v().default(!1).describe(`Background job scheduling`),auditLogging:v().default(!1).describe(`Audit trail logging`),fileStorage:v().default(!0).describe(`File upload and storage`),i18n:v().default(!0).describe(`Internationalization support`),pluginSystem:v().default(!1).describe(`Plugin/extension system`),features:S(zR).optional().describe(`Active Feature Flags`),apis:S(yW).optional().describe(`Available System & Business APIs`),network:l({graphql:v().default(!1),search:v().default(!1),websockets:v().default(!1),files:v().default(!0),analytics:v().default(!1).describe(`Is the Analytics/BI engine enabled?`),ai:v().default(!1).describe(`Is the AI engine enabled?`),workflow:v().default(!1).describe(`Is the Workflow engine enabled?`),notifications:v().default(!1).describe(`Is the Notification service enabled?`),i18n:v().default(!1).describe(`Is the i18n service enabled?`)}).optional().describe(`Network Capabilities (GraphQL, WS, etc.)`),systemObjects:S(o()).optional().describe(`List of globally available System Objects`),limits:l({maxObjects:A().optional(),maxFieldsPerObject:A().optional(),maxRecordsPerQuery:A().optional(),apiRateLimit:A().optional(),fileUploadSizeLimit:A().optional().describe(`Max file size in bytes`)}).optional()});l({data:Xpe.describe(`Data Layer capabilities`),ui:Zpe.describe(`UI Layer capabilities`),system:Qpe.describe(`System/Runtime Layer capabilities`)});var $pe=Ype({name:`task_app`,label:`Task Management`,description:`MSW + React CRUD Example with ObjectStack`,version:`1.0.0`,icon:`check-square`,branding:{primaryColor:`#3b82f6`,logo:`/assets/logo.png`},objects:[{name:`task`,label:`Task`,description:`Task management object`,icon:`check-square`,titleFormat:`{subject}`,enable:{apiEnabled:!0,trackHistory:!1,feeds:!1,activities:!1,mru:!0},fields:{id:{name:`id`,label:`ID`,type:`text`,required:!0},subject:{name:`subject`,label:`Subject`,type:`text`,required:!0},status:{name:`status`,label:`Status`,type:`select`,options:[{label:`Not Started`,value:`not_started`},{label:`In Progress`,value:`in_progress`},{label:`Waiting`,value:`waiting`},{label:`Completed`,value:`completed`}]},priority:{name:`priority`,label:`Priority`,type:`select`,options:[{label:`Low`,value:`low`},{label:`Normal`,value:`normal`},{label:`High`,value:`high`},{label:`Urgent`,value:`urgent`}]},category:{name:`category`,label:`Category`,type:`text`},due_date:{name:`due_date`,label:`Due Date`,type:`date`},is_completed:{name:`is_completed`,label:`Completed`,type:`boolean`,defaultValue:!1},created_at:{name:`created_at`,label:`Created At`,type:`datetime`}}}],data:[{object:`task`,mode:`upsert`,externalId:`subject`,records:[{subject:`Learn ObjectStack`,status:`completed`,priority:`high`,category:`Work`},{subject:`Build a cool app`,status:`in_progress`,priority:`normal`,category:`Work`},{subject:`Review PR #102`,status:`completed`,priority:`high`,category:`Work`},{subject:`Write Documentation`,status:`not_started`,priority:`normal`,category:`Work`},{subject:`Fix Server bug`,status:`waiting`,priority:`urgent`,category:`Work`},{subject:`Buy groceries`,status:`not_started`,priority:`low`,category:`Shopping`},{subject:`Schedule dentist appointment`,status:`not_started`,priority:`normal`,category:`Health`},{subject:`Pay utility bills`,status:`not_started`,priority:`high`,category:`Finance`}]}],navigation:[{id:`group_tasks`,type:`group`,label:`Tasks`,children:[{id:`nav_tasks`,type:`object`,objectName:`task`,label:`My Tasks`}]}]}),eme=class{constructor(e,t){this.type=`driver`,this.version=`1.0.0`,this.init=async e=>{let t=`driver.${this.driver.name||`unknown`}`;e.registerService(t,this.driver),e.logger.info(`Driver service registered`,{serviceName:t,driverName:this.driver.name,driverVersion:this.driver.version})},this.start=async e=>{this.name.startsWith(`com.objectstack.driver.`);try{let t=e.getService(`metadata`);t&&t.addDatasource&&((t.getDatasources?t.getDatasources():[]).some(e=>e.name===`default`)||(e.logger.info(`[DriverPlugin] No 'default' datasource found. Auto-configuring '${this.driver.name}' as default.`),await t.addDatasource({name:`default`,driver:this.driver.name})))}catch(t){e.logger.debug(`[DriverPlugin] Failed to auto-configure default datasource (Metadata service missing?)`,{error:t})}e.logger.debug(`Driver plugin started`,{driverName:this.driver.name||`unknown`})},this.driver=e,this.name=`com.objectstack.driver.${t||e.name||`unknown`}`}},tme=`name`,nme=class{constructor(e,t,n){this.engine=e,this.metadata=t,this.logger=n}async load(e){let t=Date.now(),n=e.config,r=[],i=[],a=this.filterByEnv(e.datasets,n.env);if(a.length===0)return this.buildEmptyResult(n,Date.now()-t);let o=a.map(e=>e.object),s=await this.buildDependencyGraph(o);this.logger.info(`[SeedLoader] Dependency graph built`,{objects:o.length,insertOrder:s.insertOrder,circularDeps:s.circularDependencies.length});let c=this.orderDatasets(a,s.insertOrder),l=this.buildReferenceMap(s),u=new Map,d=[];for(let e of c){let t=await this.loadDataset(e,n,l,u,d,r);if(i.push(t),n.haltOnError&&t.errored>0){this.logger.warn(`[SeedLoader] Halting on first error`,{object:e.object});break}}n.multiPass&&d.length>0&&!n.dryRun&&(this.logger.info(`[SeedLoader] Pass 2: resolving deferred references`,{count:d.length}),await this.resolveDeferredUpdates(d,u,i,r));let f=Date.now()-t;return this.buildResult(n,s,i,r,f)}async buildDependencyGraph(e){let t=[],n=new Set(e);for(let r of e){let e=await this.metadata.getObject(r),i=[],a=[];if(e&&e.fields){let t=e.fields;for(let[e,r]of Object.entries(t))if((r.type===`lookup`||r.type===`master_detail`)&&r.reference){let t=r.reference;n.has(t)&&!i.includes(t)&&i.push(t),a.push({field:e,targetObject:t,targetField:tme,fieldType:r.type})}}t.push({object:r,dependsOn:i,references:a})}let{insertOrder:r,circularDependencies:i}=this.topologicalSort(t);return{nodes:t,insertOrder:r,circularDependencies:i}}async validate(e,t){let n=E.parse({...t,dryRun:!0});return this.load({datasets:e,config:n})}async loadDataset(e,t,n,r,i,a){let o=e.object,s=e.mode||t.defaultMode,c=e.externalId||`name`,l=0,u=0,d=0,f=0,p=0,m=0,h=[];r.has(o)||r.set(o,new Map);let g;(s===`upsert`||s===`update`||s===`ignore`)&&!t.dryRun&&(g=await this.loadExistingRecords(o,c));let _=n.get(o)||[];for(let n=0;n<e.records.length;n++){let v={...e.records[n]};for(let e of _){let s=v[e.field];if(s==null||typeof s!=`string`||this.looksLikeInternalId(s))continue;let l=r.get(e.targetObject)?.get(String(s));if(l)v[e.field]=l,p++;else if(!t.dryRun){let r=await this.resolveFromDatabase(e.targetObject,e.targetField,s);if(r)v[e.field]=r,p++;else if(t.multiPass)v[e.field]=null,i.push({objectName:o,recordExternalId:String(v[c]??``),field:e.field,targetObject:e.targetObject,targetField:e.targetField,attemptedValue:s,recordIndex:n}),m++;else{let t={sourceObject:o,field:e.field,targetObject:e.targetObject,targetField:e.targetField,attemptedValue:s,recordIndex:n,message:`Cannot resolve reference: ${o}.${e.field} = '${s}' \u2192 ${e.targetObject}.${e.targetField} not found`};h.push(t),a.push(t)}}else if(!r.get(e.targetObject)?.has(String(s))){let t={sourceObject:o,field:e.field,targetObject:e.targetObject,targetField:e.targetField,attemptedValue:s,recordIndex:n,message:`[dry-run] Reference may not resolve: ${o}.${e.field} = '${s}' \u2192 ${e.targetObject}.${e.targetField}`};h.push(t),a.push(t)}}if(t.dryRun){let e=String(v[c]??``);e&&r.get(o).set(e,`dry-run-id-${n}`),l++}else try{let e=await this.writeRecord(o,v,s,c,g);e.action===`inserted`?l++:e.action===`updated`?u++:e.action===`skipped`&&d++;let t=String(v[c]??``),n=e.id;t&&n&&r.get(o).set(t,String(n))}catch(e){f++,this.logger.warn(`[SeedLoader] Failed to write ${o} record`,{error:e.message,recordIndex:n})}}return{object:o,mode:s,inserted:l,updated:u,skipped:d,errored:f,total:e.records.length,referencesResolved:p,referencesDeferred:m,errors:h}}async resolveFromDatabase(e,t,n){try{let r=await this.engine.find(e,{where:{[t]:n},fields:[`id`],limit:1});if(r&&r.length>0)return String(r[0].id||r[0]._id)}catch{}return null}async resolveDeferredUpdates(e,t,n,r){for(let i of e){let e=t.get(i.targetObject)?.get(String(i.attemptedValue));if(e||=await this.resolveFromDatabase(i.targetObject,i.targetField,i.attemptedValue)??void 0,e){let r=t.get(i.objectName)?.get(i.recordExternalId);if(r)try{await this.engine.update(i.objectName,{id:r,[i.field]:e});let t=n.find(e=>e.object===i.objectName);t&&(t.referencesResolved++,t.referencesDeferred--)}catch(e){this.logger.warn(`[SeedLoader] Failed to resolve deferred reference`,{object:i.objectName,field:i.field,error:e.message})}}else{let e={sourceObject:i.objectName,field:i.field,targetObject:i.targetObject,targetField:i.targetField,attemptedValue:i.attemptedValue,recordIndex:i.recordIndex,message:`Deferred reference unresolved after pass 2: ${i.objectName}.${i.field} = '${i.attemptedValue}' \u2192 ${i.targetObject}.${i.targetField} not found`},t=n.find(e=>e.object===i.objectName);t&&t.errors.push(e),r.push(e)}}}async writeRecord(e,t,n,r,i){let a=t[r],o=i?.get(String(a??``));switch(n){case`insert`:{let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}case`update`:{if(!o)return{action:`skipped`};let n=this.extractId(o);return await this.engine.update(e,{...t,id:n}),{action:`updated`,id:n}}case`upsert`:if(o){let n=this.extractId(o);return await this.engine.update(e,{...t,id:n}),{action:`updated`,id:n}}else{let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}case`ignore`:{if(o)return{action:`skipped`,id:this.extractId(o)};let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}case`replace`:{let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}default:{let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}}}topologicalSort(e){let t=new Map,n=new Map,r=new Set(e.map(e=>e.object));for(let r of e)t.set(r.object,0),n.set(r.object,[]);for(let i of e)for(let e of i.dependsOn)r.has(e)&&e!==i.object&&(n.get(e).push(i.object),t.set(i.object,(t.get(i.object)||0)+1));let i=[];for(let[e,n]of t)n===0&&i.push(e);let a=[];for(;i.length>0;){let e=i.shift();a.push(e);for(let r of n.get(e)||[]){let e=(t.get(r)||0)-1;t.set(r,e),e===0&&i.push(r)}}let o=[],s=e.filter(e=>!a.includes(e.object));if(s.length>0){let e=this.findCycles(s);o.push(...e);for(let e of s)a.includes(e.object)||a.push(e.object)}return{insertOrder:a,circularDependencies:o}}findCycles(e){let t=[],n=new Map(e.map(e=>[e.object,e])),r=new Set,i=new Set,a=(e,o)=>{if(i.has(e)){let n=o.indexOf(e);n!==-1&&t.push([...o.slice(n),e]);return}if(r.has(e))return;r.add(e),i.add(e),o.push(e);let s=n.get(e);if(s)for(let e of s.dependsOn)n.has(e)&&a(e,[...o]);i.delete(e)};for(let t of e)r.has(t.object)||a(t.object,[]);return t}filterByEnv(e,t){return t?e.filter(e=>e.env.includes(t)):e}orderDatasets(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.object)??2**53-1)-(n.get(t.object)??2**53-1))}buildReferenceMap(e){let t=new Map;for(let n of e.nodes)n.references.length>0&&t.set(n.object,n.references);return t}async loadExistingRecords(e,t){let n=new Map;try{let r=await this.engine.find(e,{fields:[`id`,t]});for(let e of r||[]){let r=String(e[t]??``);r&&n.set(r,e)}}catch{}return n}looksLikeInternalId(e){return!!(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{24}$/i.test(e))}extractId(e){if(e)return String(e.id||e._id||``)}buildEmptyResult(e,t){return{success:!0,dryRun:e.dryRun,dependencyGraph:{nodes:[],insertOrder:[],circularDependencies:[]},results:[],errors:[],summary:{objectsProcessed:0,totalRecords:0,totalInserted:0,totalUpdated:0,totalSkipped:0,totalErrored:0,totalReferencesResolved:0,totalReferencesDeferred:0,circularDependencyCount:0,durationMs:t}}}buildResult(e,t,n,r,i){let a={objectsProcessed:n.length,totalRecords:n.reduce((e,t)=>e+t.total,0),totalInserted:n.reduce((e,t)=>e+t.inserted,0),totalUpdated:n.reduce((e,t)=>e+t.updated,0),totalSkipped:n.reduce((e,t)=>e+t.skipped,0),totalErrored:n.reduce((e,t)=>e+t.errored,0),totalReferencesResolved:n.reduce((e,t)=>e+t.referencesResolved,0),totalReferencesDeferred:n.reduce((e,t)=>e+t.referencesDeferred,0),circularDependencyCount:t.circularDependencies.length,durationMs:i};return{success:!(r.length>0||a.totalErrored>0),dryRun:e.dryRun,dependencyGraph:t,results:n,errors:r,summary:a}}},T0=class{constructor(e){this.type=`app`,this.init=async e=>{let t=this.bundle.manifest||this.bundle,n=t.id||t.name;e.logger.info(`Registering App Service`,{appId:n,pluginName:this.name,version:this.version});let r=`app.${n}`,i=this.bundle.manifest?{...this.bundle.manifest,...this.bundle}:this.bundle;e.registerService(r,i)},this.start=async e=>{let t=this.bundle.manifest||this.bundle,n=t.id||t.name,r;try{r=e.getService(`objectql`)}catch{}if(!r){e.logger.warn(`ObjectQL engine service not found`,{appName:this.name,appId:n});return}e.logger.debug(`Retrieved ObjectQL engine service`,{appId:n});let i=this.bundle.default||this.bundle;if(i&&typeof i.onEnable==`function`){e.logger.info(`Executing runtime.onEnable`,{appName:this.name,appId:n});let t={...e,ql:r,logger:e.logger,drivers:{register:t=>{e.logger.debug(`Registering driver via app runtime`,{driverName:t.name,appId:n}),r.registerDriver(t)}}};await i.onEnable(t),e.logger.debug(`Runtime.onEnable completed`,{appId:n})}else e.logger.debug(`No runtime.onEnable function found`,{appId:n});this.loadTranslations(e,n);let a=[];Array.isArray(this.bundle.data)&&a.push(...this.bundle.data);let o=this.bundle.manifest||this.bundle;o&&Array.isArray(o.data)&&a.push(...o.data);let s=(this.bundle.manifest||this.bundle)?.namespace,c=new Set([`base`,`system`]),l=e=>e.includes(`__`)||!s||c.has(s)?e:`${s}__${e}`;if(a.length>0){e.logger.info(`[AppPlugin] Found ${a.length} seed datasets for ${n}`);let t=a.filter(e=>e.object&&Array.isArray(e.records)).map(e=>({...e,object:l(e.object)}));try{let n=e.getService(`metadata`);if(n){let i=new nme(r,n,e.logger),{SeedLoaderRequestSchema:a}=await Jd(async()=>{let{SeedLoaderRequestSchema:e}=await import(`./data-ALkBmK2s.js`).then(e=>e.i);return{SeedLoaderRequestSchema:e}},__vite__mapDeps([2,1]),import.meta.url),o=a.parse({datasets:t,config:{defaultMode:`upsert`,multiPass:!0}}),s=await i.load(o);e.logger.info(`[Seeder] Seed loading complete`,{inserted:s.summary.totalInserted,updated:s.summary.totalUpdated,errors:s.errors.length})}else{e.logger.debug(`[Seeder] No metadata service; using basic insert fallback`);for(let n of t){e.logger.info(`[Seeder] Seeding ${n.records.length} records for ${n.object}`);for(let t of n.records)try{await r.insert(n.object,t)}catch(t){e.logger.warn(`[Seeder] Failed to insert ${n.object} record:`,{error:t.message})}}e.logger.info(`[Seeder] Data seeding complete.`)}}catch(n){e.logger.warn(`[Seeder] SeedLoaderService failed, falling back to basic insert`,{error:n.message});for(let n of t)for(let t of n.records)try{await r.insert(n.object,t)}catch(t){e.logger.warn(`[Seeder] Failed to insert ${n.object} record:`,{error:t.message})}e.logger.info(`[Seeder] Data seeding complete (fallback).`)}}},this.bundle=e;let t=e.manifest||e;this.name=`plugin.app.${t.id||t.name||`unnamed-app`}`,this.version=t.version}loadTranslations(e,t){let n;try{n=e.getService(`i18n`)}catch{}let r=[];Array.isArray(this.bundle.translations)&&r.push(...this.bundle.translations);let i=this.bundle.manifest||this.bundle;if(i&&Array.isArray(i.translations)&&i.translations!==this.bundle.translations&&r.push(...i.translations),!n){r.length>0?e.logger.warn(`[i18n] App "${t}" has ${r.length} translation bundle(s) but no i18n service is registered. Translations will not be served via REST API. Register I18nServicePlugin from @objectstack/service-i18n, or use DevPlugin which auto-detects translations and registers the i18n service automatically.`):e.logger.debug(`[i18n] No i18n service registered; skipping translation loading`,{appId:t});return}let a=this.bundle.i18n||(this.bundle.manifest||this.bundle)?.i18n;if(a?.defaultLocale&&typeof n.setDefaultLocale==`function`&&(n.setDefaultLocale(a.defaultLocale),e.logger.debug(`[i18n] Set default locale`,{appId:t,locale:a.defaultLocale})),r.length===0)return;let o=0;for(let i of r)for(let[r,a]of Object.entries(i))if(a&&typeof a==`object`)try{n.loadTranslations(r,a),o++}catch(n){e.logger.warn(`[i18n] Failed to load translations`,{appId:t,locale:r,error:n.message})}let s=n;s._fallback||s._dev?e.logger.info(`[i18n] Loaded ${o} locale(s) into in-memory i18n fallback for "${t}". For production, consider registering I18nServicePlugin from @objectstack/service-i18n.`):e.logger.info(`[i18n] Loaded translation bundles`,{appId:t,bundles:r.length,locales:o})}};function E0(){return globalThis.crypto&&typeof globalThis.crypto.randomUUID==`function`?globalThis.crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var rme=class{constructor(e){this.kernel=e}success(e,t){return{status:200,body:{success:!0,data:e,meta:t}}}error(e,t=500,n){return{status:t,body:{success:!1,error:{message:e,code:t,details:n}}}}ensureBroker(){if(!this.kernel.broker)throw{statusCode:500,message:`Kernel Broker not available`};return this.kernel.broker}async getDiscoveryInfo(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=await Promise.all([this.resolveService(xi.enum.auth),this.resolveService(xi.enum.graphql),this.resolveService(xi.enum.search),this.resolveService(xi.enum.realtime),this.resolveService(xi.enum[`file-storage`]),this.resolveService(xi.enum.analytics),this.resolveService(xi.enum.workflow),this.resolveService(xi.enum.ai),this.resolveService(xi.enum.notification),this.resolveService(xi.enum.i18n),this.resolveService(xi.enum.ui),this.resolveService(xi.enum.automation),this.resolveService(xi.enum.cache),this.resolveService(xi.enum.queue),this.resolveService(xi.enum.job)]),g=!!t,_=!!(n||this.kernel.graphql),v=!!r,y=!!i,b=!!a,x=!!o,S=!!s,C=!!c,w=!!l,T=!!u,E=!!d,ee=!!f,D=!!p,O=!!m,te=!!h,k={data:`${e}/data`,metadata:`${e}/meta`,packages:`${e}/packages`,auth:g?`${e}/auth`:void 0,ui:E?`${e}/ui`:void 0,graphql:_?`${e}/graphql`:void 0,storage:b?`${e}/storage`:void 0,analytics:x?`${e}/analytics`:void 0,automation:ee?`${e}/automation`:void 0,workflow:S?`${e}/workflow`:void 0,realtime:y?`${e}/realtime`:void 0,notifications:w?`${e}/notifications`:void 0,ai:C?`${e}/ai`:void 0,i18n:T?`${e}/i18n`:void 0},A=(e,t)=>({enabled:!0,status:`available`,route:e,provider:t}),j=e=>({enabled:!1,status:`unavailable`,message:`Install a ${e} plugin to enable`}),M={default:`en`,supported:[`en`],timezone:`UTC`};if(T&&u){let e=typeof u.getDefaultLocale==`function`?u.getDefaultLocale():`en`,t=typeof u.getLocales==`function`?u.getLocales():[];M={default:e,supported:t.length>0?t:[e],timezone:`UTC`}}return{name:`ObjectOS`,version:`1.0.0`,environment:Qd(`NODE_ENV`,`development`),routes:k,endpoints:k,features:{graphql:_,search:v,websockets:y,files:b,analytics:x,ai:C,workflow:S,notifications:w,i18n:T},services:{metadata:{enabled:!0,status:`degraded`,route:k.metadata,provider:`kernel`,message:`In-memory registry; DB persistence pending`},data:A(k.data,`kernel`),auth:g?A(k.auth):j(`auth`),automation:ee?A(k.automation):j(`automation`),analytics:x?A(k.analytics):j(`analytics`),cache:D?A():j(`cache`),queue:O?A():j(`queue`),job:te?A():j(`job`),ui:E?A(k.ui):j(`ui`),workflow:S?A(k.workflow):j(`workflow`),realtime:y?A(k.realtime):j(`realtime`),notification:w?A(k.notifications):j(`notification`),ai:C?A(k.ai):j(`ai`),i18n:T?A(k.i18n):j(`i18n`),graphql:_?A(k.graphql):j(`graphql`),"file-storage":b?A(k.storage):j(`file-storage`),search:v?A():j(`search`)},locale:M}}async handleGraphQL(e,t){if(!e||!e.query)throw{statusCode:400,message:`Missing query in request body`};if(typeof this.kernel.graphql!=`function`)throw{statusCode:501,message:`GraphQL service not available`};return this.kernel.graphql(e.query,e.variables,{request:t.request})}async handleAuth(e,t,n,r){let i=await this.getService(xi.enum.auth);if(i&&typeof i.handler==`function`)return{handled:!0,result:await i.handler(r.request,r.response)};let a=e.replace(/^\/+/,``);if(a===`login`&&t.toUpperCase()===`POST`)try{return{handled:!0,response:{status:200,body:await this.ensureBroker().call(`auth.login`,n,{request:r.request})}}}catch(e){if((e?.statusCode??e?.status)!==500||!e?.message?.includes(`Broker not available`))throw e}return this.mockAuthFallback(a,t,n)}mockAuthFallback(e,t,n){let r=t.toUpperCase(),i=864e5;if((e===`sign-up/email`||e===`register`)&&r===`POST`){let e=`mock_${E0()}`;return{handled:!0,response:{status:200,body:{user:{id:e,name:n?.name||`Mock User`,email:n?.email||`mock@test.local`,emailVerified:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},session:{id:`session_${e}`,userId:e,token:`mock_token_${e}`,expiresAt:new Date(Date.now()+i).toISOString()}}}}}if((e===`sign-in/email`||e===`login`)&&r===`POST`){let e=`mock_${E0()}`;return{handled:!0,response:{status:200,body:{user:{id:e,name:`Mock User`,email:n?.email||`mock@test.local`,emailVerified:!0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},session:{id:`session_${e}`,userId:e,token:`mock_token_${e}`,expiresAt:new Date(Date.now()+i).toISOString()}}}}}return e===`get-session`&&r===`GET`?{handled:!0,response:{status:200,body:{session:null,user:null}}}:e===`sign-out`&&r===`POST`?{handled:!0,response:{status:200,body:{success:!0}}}:{handled:!1}}async handleMetadata(e,t,n,r,i){let a=this.kernel.broker??null,o=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(o[0]===`types`){let e=await this.resolveService(`protocol`);if(e&&typeof e.getMetaTypes==`function`){let t=await e.getMetaTypes({});return{handled:!0,response:this.success(t)}}if(a)try{let e=await a.call(`metadata.types`,{},{request:t.request});return{handled:!0,response:this.success(e)}}catch{}return{handled:!0,response:this.success({types:[`object`,`app`,`plugin`]})}}if(o.length===3&&o[2]===`published`&&(!n||n===`GET`)){let[e,n]=o,r=await this.getService(xi.enum.metadata);if(r&&typeof r.getPublished==`function`){let t=await r.getPublished(e,n);return t===void 0?{handled:!0,response:this.error(`Not found`,404)}:{handled:!0,response:this.success(t)}}if(a)try{let r=await a.call(`metadata.getPublished`,{type:e,name:n},{request:t.request});return{handled:!0,response:this.success(r)}}catch(e){return{handled:!0,response:this.error(e.message,404)}}return{handled:!0,response:this.error(`Not found`,404)}}if(o.length===2){let[e,i]=o;if(n===`PUT`&&r){let n=await this.resolveService(`protocol`);if(n&&typeof n.saveMetaItem==`function`)try{let t=await n.saveMetaItem({type:e,name:i,item:r});return{handled:!0,response:this.success(t)}}catch(e){return{handled:!0,response:this.error(e.message,400)}}if(a)try{let n=await a.call(`metadata.saveItem`,{type:e,name:i,item:r},{request:t.request});return{handled:!0,response:this.success(n)}}catch(e){return{handled:!0,response:this.error(e.message||`Save not supported`,501)}}return{handled:!0,response:this.error(`Save not supported`,501)}}try{if(e===`objects`||e===`object`){if(a){let e=await a.call(`metadata.getObject`,{objectName:i},{request:t.request});return{handled:!0,response:this.success(e)}}let e=await this.getObjectQLService();if(e?.registry){let t=e.registry.getObject(i);if(t)return{handled:!0,response:this.success(t)}}return{handled:!0,response:this.error(`Not found`,404)}}let n=e.endsWith(`s`)?e.slice(0,-1):e,r=await this.resolveService(`protocol`);if(r&&typeof r.getMetaItem==`function`)try{let e=await r.getMetaItem({type:n,name:i});return{handled:!0,response:this.success(e)}}catch{}if(a){let e=`metadata.get${this.capitalize(n)}`,r=await a.call(e,{name:i},{request:t.request});return{handled:!0,response:this.success(r)}}return{handled:!0,response:this.error(`Not found`,404)}}catch(e){return{handled:!0,response:this.error(e.message,404)}}}if(o.length===1){let e=o[0],n=i?.package||void 0,r=await this.resolveService(`protocol`);if(r&&typeof r.getMetaItems==`function`)try{let t=await r.getMetaItems({type:e,packageId:n});if(t&&(t.items!==void 0||Array.isArray(t)))return{handled:!0,response:this.success(t)}}catch{}if(a){try{if(e===`objects`){let e=await a.call(`metadata.objects`,{packageId:n},{request:t.request});return{handled:!0,response:this.success(e)}}let r=await a.call(`metadata.${e}`,{packageId:n},{request:t.request});if(r!=null)return{handled:!0,response:this.success(r)}}catch{}try{let n=await a.call(`metadata.getObject`,{objectName:e},{request:t.request});return{handled:!0,response:this.success(n)}}catch(e){return{handled:!0,response:this.error(e.message,404)}}}let s=await this.getObjectQLService();if(s?.registry){if(e===`objects`){let e=s.registry.getAllObjects(n);return{handled:!0,response:this.success({type:`object`,items:e})}}let t=s.registry.listItems?.(e,n);if(t&&t.length>0)return{handled:!0,response:this.success({type:e,items:t})};let r=s.registry.getObject(e);if(r)return{handled:!0,response:this.success(r)}}return{handled:!0,response:this.error(`Not found`,404)}}if(o.length===0){let e=await this.resolveService(`protocol`);if(e&&typeof e.getMetaTypes==`function`){let t=await e.getMetaTypes({});return{handled:!0,response:this.success(t)}}if(a)try{let e=await a.call(`metadata.types`,{},{request:t.request});return{handled:!0,response:this.success(e)}}catch{}return{handled:!0,response:this.success({types:[`object`,`app`,`plugin`]})}}return{handled:!1}}async handleData(e,t,n,r,i){let a=this.ensureBroker(),o=e.replace(/^\/+/,``).split(`/`),s=o[0];if(!s)return{handled:!0,response:this.error(`Object name required`,400)};let c=t.toUpperCase();if(o.length>1){let e=o[1];if(e===`query`&&c===`POST`){let e=await a.call(`data.query`,{object:s,...n},{request:i.request});return{handled:!0,response:this.success(e)}}if(e===`batch`&&c===`POST`){let e=await a.call(`data.batch`,{object:s,...n},{request:i.request});return{handled:!0,response:this.success(e)}}if(o.length===2&&c===`GET`){let e=o[1],{select:t,expand:n}=r||{},c={};t!=null&&(c.select=t),n!=null&&(c.expand=n);let l=await a.call(`data.get`,{object:s,id:e,...c},{request:i.request});return{handled:!0,response:this.success(l)}}if(o.length===2&&c===`PATCH`){let e=o[1],t=await a.call(`data.update`,{object:s,id:e,data:n},{request:i.request});return{handled:!0,response:this.success(t)}}if(o.length===2&&c===`DELETE`){let e=o[1],t=await a.call(`data.delete`,{object:s,id:e},{request:i.request});return{handled:!0,response:this.success(t)}}}else{if(c===`GET`){let e={...r};(e.filter!=null||e.filters!=null)&&(e.where=e.where??e.filter??e.filters,delete e.filter,delete e.filters),e.select!=null&&e.fields==null&&(e.fields=e.select,delete e.select),e.sort!=null&&e.orderBy==null&&(e.orderBy=e.sort,delete e.sort),e.top!=null&&e.limit==null&&(e.limit=e.top,delete e.top),e.skip!=null&&e.offset==null&&(e.offset=e.skip,delete e.skip);let t=await a.call(`data.query`,{object:s,query:e},{request:i.request});return{handled:!0,response:this.success(t)}}if(c===`POST`){let e=await a.call(`data.create`,{object:s,data:n},{request:i.request}),t=this.success(e);return t.status=201,{handled:!0,response:t}}}return{handled:!1}}async handleAnalytics(e,t,n,r){let i=await this.getService(xi.enum.analytics);if(!i)return{handled:!1};let a=t.toUpperCase(),o=e.replace(/^\/+/,``);if(o===`query`&&a===`POST`){let e=await i.query(n);return{handled:!0,response:this.success(e)}}if(o===`meta`&&a===`GET`){let e=await i.getMeta();return{handled:!0,response:this.success(e)}}if(o===`sql`&&a===`POST`){let e=await i.generateSql(n);return{handled:!0,response:this.success(e)}}return{handled:!1}}async handleI18n(e,t,n,r){let i=await this.getService(xi.enum.i18n);if(!i)return{handled:!0,response:this.error(`i18n service not available`,501)};let a=t.toUpperCase(),o=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(a!==`GET`)return{handled:!1};if(o[0]===`locales`&&o.length===1){let e=i.getLocales();return{handled:!0,response:this.success({locales:e})}}if(o[0]===`translations`){let e=o[1]?decodeURIComponent(o[1]):n?.locale;if(!e)return{handled:!0,response:this.error(`Missing locale parameter`,400)};let t=i.getTranslations(e);if(Object.keys(t).length===0){let n=lf(e,typeof i.getLocales==`function`?i.getLocales():[]);if(n&&n!==e)return t=i.getTranslations(n),{handled:!0,response:this.success({locale:n,requestedLocale:e,translations:t})}}return{handled:!0,response:this.success({locale:e,translations:t})}}if(o[0]===`labels`&&o.length>=2){let e=decodeURIComponent(o[1]),t=o[2]?decodeURIComponent(o[2]):n?.locale;if(!t)return{handled:!0,response:this.error(`Missing locale parameter`,400)};let r=typeof i.getLocales==`function`?i.getLocales():[],a=lf(t,r);if(a&&(t=a),typeof i.getFieldLabels==`function`){let n=i.getFieldLabels(e,t);return{handled:!0,response:this.success({object:e,locale:t,labels:n})}}let s=i.getTranslations(t),c=`o.${e}.fields.`,l={};for(let[e,t]of Object.entries(s))e.startsWith(c)&&(l[e.substring(c.length)]=t);return{handled:!0,response:this.success({object:e,locale:t,labels:l})}}return{handled:!1}}async handlePackages(e,t,n,r,i){let a=t.toUpperCase(),o=e.replace(/^\/+/,``).split(`/`).filter(Boolean),s=(await this.getObjectQLService())?.registry;if(!s)return this.kernel.broker?this.handlePackagesViaBroker(o,a,n,r,i):{handled:!0,response:this.error(`Package service not available`,503)};try{if(o.length===0&&a===`GET`){let e=s.getAllPackages();return r?.status&&(e=e.filter(e=>e.status===r.status)),r?.type&&(e=e.filter(e=>e.manifest?.type===r.type)),{handled:!0,response:this.success({packages:e,total:e.length})}}if(o.length===0&&a===`POST`){let e=s.installPackage(n.manifest||n,n.settings),t=this.success(e);return t.status=201,{handled:!0,response:t}}if(o.length===2&&o[1]===`enable`&&a===`PATCH`){let e=decodeURIComponent(o[0]),t=s.enablePackage(e);return t?{handled:!0,response:this.success(t)}:{handled:!0,response:this.error(`Package '${e}' not found`,404)}}if(o.length===2&&o[1]===`disable`&&a===`PATCH`){let e=decodeURIComponent(o[0]),t=s.disablePackage(e);return t?{handled:!0,response:this.success(t)}:{handled:!0,response:this.error(`Package '${e}' not found`,404)}}if(o.length===2&&o[1]===`publish`&&a===`POST`){let e=decodeURIComponent(o[0]),t=await this.getService(xi.enum.metadata);if(t&&typeof t.publishPackage==`function`){let r=await t.publishPackage(e,n||{});return{handled:!0,response:this.success(r)}}if(this.kernel.broker){let t=await this.kernel.broker.call(`metadata.publishPackage`,{packageId:e,...n},{request:i.request});return{handled:!0,response:this.success(t)}}return{handled:!0,response:this.error(`Metadata service not available`,503)}}if(o.length===2&&o[1]===`revert`&&a===`POST`){let e=decodeURIComponent(o[0]),t=await this.getService(xi.enum.metadata);return t&&typeof t.revertPackage==`function`?(await t.revertPackage(e),{handled:!0,response:this.success({success:!0})}):this.kernel.broker?(await this.kernel.broker.call(`metadata.revertPackage`,{packageId:e},{request:i.request}),{handled:!0,response:this.success({success:!0})}):{handled:!0,response:this.error(`Metadata service not available`,503)}}if(o.length===1&&a===`GET`){let e=decodeURIComponent(o[0]),t=s.getPackage(e);return t?{handled:!0,response:this.success(t)}:{handled:!0,response:this.error(`Package '${e}' not found`,404)}}if(o.length===1&&a===`DELETE`){let e=decodeURIComponent(o[0]);return s.uninstallPackage(e)?{handled:!0,response:this.success({success:!0})}:{handled:!0,response:this.error(`Package '${e}' not found`,404)}}}catch(e){return{handled:!0,response:this.error(e.message,e.statusCode||500)}}return{handled:!1}}async handlePackagesViaBroker(e,t,n,r,i){let a=this.kernel.broker;try{if(e.length===0&&t===`GET`){let e=await a.call(`package.list`,r||{},{request:i.request});return{handled:!0,response:this.success(e)}}if(e.length===0&&t===`POST`){let e=await a.call(`package.install`,n,{request:i.request}),t=this.success(e);return t.status=201,{handled:!0,response:t}}if(e.length===2&&e[1]===`enable`&&t===`PATCH`){let t=decodeURIComponent(e[0]),n=await a.call(`package.enable`,{id:t},{request:i.request});return{handled:!0,response:this.success(n)}}if(e.length===2&&e[1]===`disable`&&t===`PATCH`){let t=decodeURIComponent(e[0]),n=await a.call(`package.disable`,{id:t},{request:i.request});return{handled:!0,response:this.success(n)}}if(e.length===1&&t===`GET`){let t=decodeURIComponent(e[0]),n=await a.call(`package.get`,{id:t},{request:i.request});return{handled:!0,response:this.success(n)}}if(e.length===1&&t===`DELETE`){let t=decodeURIComponent(e[0]),n=await a.call(`package.uninstall`,{id:t},{request:i.request});return{handled:!0,response:this.success(n)}}}catch(e){return{handled:!0,response:this.error(e.message,e.statusCode||500)}}return{handled:!1}}async handleStorage(e,t,n,r){let i=await this.getService(xi.enum[`file-storage`])||this.kernel.services?.[`file-storage`];if(!i)return{handled:!0,response:this.error(`File storage not configured`,501)};let a=t.toUpperCase(),o=e.replace(/^\/+/,``).split(`/`);if(o[0]===`upload`&&a===`POST`){if(!n)return{handled:!0,response:this.error(`No file provided`,400)};let e=await i.upload(n,{request:r.request});return{handled:!0,response:this.success(e)}}if(o[0]===`file`&&o[1]&&a===`GET`){let e=o[1],t=await i.download(e,{request:r.request});return t.url&&t.redirect?{handled:!0,result:{type:`redirect`,url:t.url}}:t.stream?{handled:!0,result:{type:`stream`,stream:t.stream,headers:{"Content-Type":t.mimeType||`application/octet-stream`,"Content-Length":t.size}}}:{handled:!0,response:this.success(t)}}return{handled:!1}}async handleUi(e,t,n){let r=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(r[0]===`view`&&r[1]){let e=r[1],n=r[2]||t?.type||`list`,i=await this.resolveService(`protocol`);if(i&&typeof i.getUiView==`function`)try{let t=await i.getUiView({object:e,type:n});return{handled:!0,response:this.success(t)}}catch(e){return{handled:!0,response:this.error(e.message,500)}}else return{handled:!0,response:this.error(`Protocol service not available`,503)}}return{handled:!1}}async handleAutomation(e,t,n,r,i){let a=await this.getService(xi.enum.automation);if(!a)return{handled:!1};let o=t.toUpperCase(),s=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(s[0]===`trigger`&&s[1]&&o===`POST`){let e=s[1];if(typeof a.trigger==`function`){let t=await a.trigger(e,n,{request:r.request});return{handled:!0,response:this.success(t)}}if(typeof a.execute==`function`){let t=await a.execute(e,n);return{handled:!0,response:this.success(t)}}}if(s.length===0&&o===`GET`&&typeof a.listFlows==`function`){let e=await a.listFlows();return{handled:!0,response:this.success({flows:e,total:e.length,hasMore:!1})}}if(s.length===0&&o===`POST`&&typeof a.registerFlow==`function`)return a.registerFlow(n?.name,n),{handled:!0,response:this.success(n)};if(s.length>=1){let e=s[0];if(s[1]===`trigger`&&o===`POST`&&typeof a.execute==`function`){let t=await a.execute(e,n);return{handled:!0,response:this.success(t)}}if(s[1]===`toggle`&&o===`POST`&&typeof a.toggleFlow==`function`)return await a.toggleFlow(e,n?.enabled??!0),{handled:!0,response:this.success({name:e,enabled:n?.enabled??!0})};if(s[1]===`runs`&&s[2]&&o===`GET`&&typeof a.getRun==`function`){let e=await a.getRun(s[2]);return e?{handled:!0,response:this.success(e)}:{handled:!0,response:this.error(`Execution not found`,404)}}if(s[1]===`runs`&&!s[2]&&o===`GET`&&typeof a.listRuns==`function`){let t=i?{limit:i.limit?Number(i.limit):void 0,cursor:i.cursor}:void 0,n=await a.listRuns(e,t);return{handled:!0,response:this.success({runs:n,hasMore:!1})}}if(s.length===1&&o===`GET`&&typeof a.getFlow==`function`){let t=await a.getFlow(e);return t?{handled:!0,response:this.success(t)}:{handled:!0,response:this.error(`Flow not found`,404)}}if(s.length===1&&o===`PUT`&&typeof a.registerFlow==`function`)return a.registerFlow(e,n?.definition??n),{handled:!0,response:this.success(n?.definition??n)};if(s.length===1&&o===`DELETE`&&typeof a.unregisterFlow==`function`)return a.unregisterFlow(e),{handled:!0,response:this.success({name:e,deleted:!0})}}return{handled:!1}}getServicesMap(){return this.kernel.services instanceof Map?Object.fromEntries(this.kernel.services):this.kernel.services||{}}async getService(e){return this.resolveService(e)}async resolveService(e){if(typeof this.kernel.getServiceAsync==`function`)try{let t=await this.kernel.getServiceAsync(e);if(t!=null)return t}catch{}if(typeof this.kernel.getService==`function`)try{let t=await this.kernel.getService(e);if(t!=null)return t}catch{}if(this.kernel?.context?.getService)try{let t=await this.kernel.context.getService(e);if(t!=null)return t}catch{}return this.getServicesMap()[e]}async getObjectQLService(){try{let e=await this.resolveService(`objectql`);if(e?.registry)return e}catch{}return null}capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}async dispatch(e,t,n,r,i){let a=t.replace(/\/$/,``);if((a===`/discovery`||a===``)&&e===`GET`){let e=await this.getDiscoveryInfo(``);return{handled:!0,response:this.success(e)}}if(a.startsWith(`/auth`))return this.handleAuth(a.substring(5),e,n,i);if(a.startsWith(`/meta`))return this.handleMetadata(a.substring(5),i,e,n,r);if(a.startsWith(`/data`))return this.handleData(a.substring(5),e,n,r,i);if(a.startsWith(`/graphql`)&&e===`POST`)return this.handleGraphQL(n,i);if(a.startsWith(`/storage`))return this.handleStorage(a.substring(8),e,n,i);if(a.startsWith(`/ui`))return this.handleUi(a.substring(3),r,i);if(a.startsWith(`/automation`))return this.handleAutomation(a.substring(11),e,n,i,r);if(a.startsWith(`/analytics`))return this.handleAnalytics(a.substring(10),e,n,i);if(a.startsWith(`/packages`))return this.handlePackages(a.substring(9),e,n,r,i);if(a.startsWith(`/i18n`))return this.handleI18n(a.substring(5),e,r,i);if(a===`/openapi.json`&&e===`GET`){let e=this.ensureBroker();try{let t=await e.call(`metadata.generateOpenApi`,{},{request:i.request});return{handled:!0,response:this.success(t)}}catch{}}let o=await this.handleApiEndpoint(a,e,n,r,i);return o.handled?o:{handled:!1}}async handleApiEndpoint(e,t,n,r,i){let a=this.ensureBroker();try{let o=await a.call(`metadata.matchEndpoint`,{path:e,method:t});if(o){if(o.type===`flow`){let e=await a.call(`automation.runFlow`,{flowId:o.target,inputs:{...r,...n,_request:i.request}});return{handled:!0,response:this.success(e)}}if(o.type===`script`){let e=await a.call(`automation.runScript`,{scriptName:o.target,context:{...r,...n,request:i.request}},{request:i.request});return{handled:!0,response:this.success(e)}}if(o.type===`object_operation`&&o.objectParams){let{object:e,operation:t}=o.objectParams;if(t===`find`){let t=await a.call(`data.query`,{object:e,query:r},{request:i.request});return{handled:!0,response:this.success(t.records,{total:t.total})}}if(t===`get`&&r.id){let t=await a.call(`data.get`,{object:e,id:r.id},{request:i.request});return{handled:!0,response:this.success(t)}}if(t===`create`){let t=await a.call(`data.create`,{object:e,data:n},{request:i.request});return{handled:!0,response:this.success(t)}}}if(o.type===`proxy`)return{handled:!0,response:{status:200,body:{proxy:!0,target:o.target,note:`Proxy execution requires http-client service`}}}}}catch{}return{handled:!1}}};l({name:o().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:o().optional().describe(`Command description for help text`),module:o().optional().describe(`Module path exporting oclif Command classes`)}),l({commands:l({strategy:x([`pattern`,`explicit`,`single`]).optional().describe(`Command discovery strategy`),target:o().optional().describe(`Target directory for command files`),glob:o().optional().describe(`Glob pattern for command file matching`)}).optional().describe(`Command discovery configuration`),topicSeparator:o().optional().describe(`Character separating topic and command names`)}).describe(`oclif plugin configuration section`);var D0=x([`objects`,`views`,`pages`,`flows`,`dashboards`,`permissions`,`agents`,`reports`,`actions`,`translations`,`themes`,`datasets`,`apis`,`triggers`,`workflows`]).describe(`Metadata category within the artifact`),ime=l({path:o().describe(`Relative file path within the artifact`),size:A().int().nonnegative().describe(`File size in bytes`),category:D0.optional().describe(`Metadata category this file belongs to`)}).describe(`A single file entry within the artifact`),O0=l({algorithm:x([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm used for checksums`),files:u(o(),o().regex(/^[a-f0-9]+$/)).describe(`File path to hash value mapping`)}).describe(`Checksum manifest for artifact integrity verification`),k0=l({algorithm:x([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).default(`RSA-SHA256`).describe(`Signing algorithm used`),publicKeyRef:o().describe(`Public key reference (URL or fingerprint) for signature verification`),signature:o().describe(`Base64-encoded digital signature`),signedAt:o().datetime().optional().describe(`ISO 8601 timestamp of when the artifact was signed`),signedBy:o().optional().describe(`Identity of the signer (publisher ID or email)`)}).describe(`Digital signature for artifact authenticity verification`),A0=l({formatVersion:o().regex(/^\d+\.\d+$/).default(`1.0`).describe(`Artifact format version (e.g. "1.0")`),packageId:o().describe(`Package identifier from manifest`),version:o().describe(`Package version from manifest`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Archive format of the artifact`),size:A().int().positive().optional().describe(`Total artifact file size in bytes`),builtAt:o().datetime().describe(`ISO 8601 timestamp of when the artifact was built`),builtWith:o().optional().describe(`Build tool identifier (e.g. "os-cli@3.2.0")`),files:S(ime).optional().describe(`List of files contained in the artifact`),metadataCategories:S(D0).optional().describe(`Metadata categories included in this artifact`),checksums:O0.optional().describe(`SHA256 checksums for artifact integrity verification`),signature:k0.optional().describe(`Digital signature for artifact authenticity verification`)}).describe(`Package artifact structure and metadata`);l({directory:o().optional().describe(`Project root directory (defaults to current working directory)`),outDir:o().optional().describe(`Output directory for the built artifact (defaults to ./dist)`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Archive format for the artifact`),sign:v().default(!1).describe(`Whether to digitally sign the artifact`),privateKeyPath:o().optional().describe(`Path to RSA/ECDSA private key file for signing`),signAlgorithm:x([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).optional().describe(`Signing algorithm to use`),checksumAlgorithm:x([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm for file checksums`),includeData:v().default(!0).describe(`Whether to include seed data in the artifact`),includeLocales:v().default(!0).describe(`Whether to include locale/translation files`)}).describe(`Options for the os plugin build command`),l({success:v().describe(`Whether the build succeeded`),artifactPath:o().optional().describe(`Absolute path to the generated artifact file`),artifact:A0.optional().describe(`Artifact metadata`),fileCount:A().int().min(0).optional().describe(`Total number of files in the artifact`),size:A().int().min(0).optional().describe(`Total artifact size in bytes`),durationMs:A().optional().describe(`Build duration in milliseconds`),errorMessage:o().optional().describe(`Error message if build failed`),warnings:S(o()).optional().describe(`Warnings emitted during build`)}).describe(`Result of the os plugin build command`);var ame=l({severity:x([`error`,`warning`,`info`]).describe(`Validation issue severity`).describe(`Issue severity level`),rule:o().describe(`Validation rule identifier`),message:o().describe(`Human-readable finding description`),path:o().optional().describe(`Relative file path within the artifact`)}).describe(`A single validation finding`);l({artifactPath:o().describe(`Path to the artifact file to validate`),verifySignature:v().default(!0).describe(`Whether to verify the digital signature`),publicKeyPath:o().optional().describe(`Path to the public key for signature verification`),verifyChecksums:v().default(!0).describe(`Whether to verify checksums of all files`),validateMetadata:v().default(!0).describe(`Whether to validate metadata against schemas`),platformVersion:o().optional().describe(`Platform version for compatibility verification`)}).describe(`Options for the os plugin validate command`),l({valid:v().describe(`Whether the artifact passed validation`),artifact:A0.optional().describe(`Extracted artifact metadata`),checksumVerification:l({passed:v().describe(`Whether all checksums match`),checksums:O0.optional().describe(`Verified checksums`),mismatches:S(o()).optional().describe(`Files with checksum mismatches`)}).optional().describe(`Checksum verification result`),signatureVerification:l({passed:v().describe(`Whether the signature is valid`),signature:k0.optional().describe(`Signature details`),failureReason:o().optional().describe(`Signature verification failure reason`)}).optional().describe(`Signature verification result`),platformCompatibility:l({compatible:v().describe(`Whether artifact is compatible`),requiredRange:o().optional().describe(`Required platform version range`),targetVersion:o().optional().describe(`Target platform version`)}).optional().describe(`Platform compatibility check result`),findings:S(ame).describe(`All validation findings`),summary:l({errors:A().int().min(0).describe(`Error count`),warnings:A().int().min(0).describe(`Warning count`),infos:A().int().min(0).describe(`Info count`)}).optional().describe(`Finding counts by severity`)}).describe(`Result of the os plugin validate command`),l({artifactPath:o().describe(`Path to the artifact file to publish`),registryUrl:o().url().optional().describe(`Marketplace API base URL`),token:o().optional().describe(`Authentication token for marketplace API`),releaseNotes:o().optional().describe(`Release notes for this version`),preRelease:v().default(!1).describe(`Whether this is a pre-release version`),skipValidation:v().default(!1).describe(`Whether to skip local validation before publish`),access:x([`public`,`restricted`]).default(`public`).describe(`Package access level on the marketplace`),tags:S(o()).optional().describe(`Tags for marketplace categorization`)}).describe(`Options for the os plugin publish command`),l({success:v().describe(`Whether the publish succeeded`),packageId:o().optional().describe(`Published package identifier`),version:o().optional().describe(`Published version string`),artifactUrl:o().url().optional().describe(`URL of the published artifact in the marketplace`),sha256:o().optional().describe(`SHA256 checksum of the uploaded artifact`),submissionId:o().optional().describe(`Marketplace submission ID for review tracking`),errorMessage:o().optional().describe(`Error message if publish failed`),message:o().optional().describe(`Human-readable status message`)}).describe(`Result of the os plugin publish command`);var ome=x([`shared_schema`,`isolated_schema`,`isolated_db`]),sme=x([`turso`,`postgres`,`memory`]).describe(`Database provider for tenant data`),cme=l({url:o().min(1).describe(`Database connection URL`),authToken:o().optional().describe(`Database auth token (encrypted at rest)`),group:o().optional().describe(`Turso database group name`)}).describe(`Tenant database connection configuration`),j0=l({maxUsers:A().int().positive().optional().describe(`Maximum number of users`),maxStorage:A().int().positive().optional().describe(`Maximum storage in bytes`),apiRateLimit:A().int().positive().optional().describe(`API requests per minute`),maxObjects:A().int().positive().optional().describe(`Maximum number of custom objects`),maxRecordsPerObject:A().int().positive().optional().describe(`Maximum records per object`),maxDeploymentsPerDay:A().int().positive().optional().describe(`Maximum deployments per day`),maxStorageBytes:A().int().positive().optional().describe(`Maximum storage in bytes`)});l({currentObjectCount:A().int().min(0).default(0).describe(`Current number of custom objects`),currentRecordCount:A().int().min(0).default(0).describe(`Total records across all objects`),currentStorageBytes:A().int().min(0).default(0).describe(`Current storage usage in bytes`),deploymentsToday:A().int().min(0).default(0).describe(`Deployments executed today`),currentUsers:A().int().min(0).default(0).describe(`Current number of active users`),apiRequestsThisMinute:A().int().min(0).default(0).describe(`API requests in the current minute`),lastUpdatedAt:o().datetime().optional().describe(`Last usage update time`)}).describe(`Current tenant resource usage`),l({allowed:v().describe(`Whether the operation is within quota`),exceededQuota:o().optional().describe(`Name of the exceeded quota`),currentUsage:A().optional().describe(`Current usage value`),limit:A().optional().describe(`Quota limit`),message:o().optional().describe(`Human-readable quota message`)}).describe(`Quota enforcement check result`),l({id:o().describe(`Unique tenant identifier`),name:o().describe(`Tenant display name`),isolationLevel:ome,databaseProvider:sme.optional().describe(`Database provider`),connectionConfig:cme.optional().describe(`Database connection config`),provisioningStatus:x([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).optional().describe(`Current provisioning lifecycle status`),plan:x([`free`,`pro`,`enterprise`]).optional().describe(`Subscription plan`),customizations:u(o(),b()).optional().describe(`Custom configuration values`),quotas:j0.optional()}),d(`strategy`,[l({strategy:p(`shared_schema`).describe(`Row-level isolation strategy`),database:l({enableRLS:v().default(!0).describe(`Enable PostgreSQL Row-Level Security`),contextMethod:x([`session_variable`,`search_path`,`application_name`]).default(`session_variable`).describe(`How to set tenant context`),contextVariable:o().default(`app.current_tenant`).describe(`Session variable name`),applicationValidation:v().default(!0).describe(`Application-level tenant validation`)}).optional().describe(`Database configuration`),performance:l({usePartialIndexes:v().default(!0).describe(`Use partial indexes per tenant`),usePartitioning:v().default(!1).describe(`Use table partitioning by tenant_id`),poolSizePerTenant:A().int().positive().optional().describe(`Connection pool size per tenant`)}).optional().describe(`Performance settings`)}),l({strategy:p(`isolated_schema`).describe(`Schema-level isolation strategy`),schema:l({namingPattern:o().default(`tenant_{tenant_id}`).describe(`Schema naming pattern`),includePublicSchema:v().default(!0).describe(`Include public schema`),sharedSchema:o().default(`public`).describe(`Schema for shared resources`),autoCreateSchema:v().default(!0).describe(`Auto-create schema`)}).optional().describe(`Schema configuration`),migrations:l({strategy:x([`parallel`,`sequential`,`on_demand`]).default(`parallel`).describe(`Migration strategy`),maxConcurrent:A().int().positive().default(10).describe(`Max concurrent migrations`),rollbackOnError:v().default(!0).describe(`Rollback on error`)}).optional().describe(`Migration configuration`),performance:l({poolPerSchema:v().default(!1).describe(`Separate pool per schema`),schemaCacheTTL:A().int().positive().default(3600).describe(`Schema cache TTL`)}).optional().describe(`Performance settings`)}),l({strategy:p(`isolated_db`).describe(`Database-level isolation strategy`),database:l({namingPattern:o().default(`tenant_{tenant_id}`).describe(`Database naming pattern`),serverStrategy:x([`shared`,`sharded`,`dedicated`]).default(`shared`).describe(`Server assignment strategy`),separateCredentials:v().default(!0).describe(`Separate credentials per tenant`),autoCreateDatabase:v().default(!0).describe(`Auto-create database`)}).optional().describe(`Database configuration`),connectionPool:l({poolSize:A().int().positive().default(10).describe(`Connection pool size`),maxActivePools:A().int().positive().default(100).describe(`Max active pools`),idleTimeout:A().int().positive().default(300).describe(`Idle pool timeout`),usePooler:v().default(!0).describe(`Use connection pooler`)}).optional().describe(`Connection pool configuration`),backup:l({strategy:x([`individual`,`consolidated`,`on_demand`]).default(`individual`).describe(`Backup strategy`),frequencyHours:A().int().positive().default(24).describe(`Backup frequency`),retentionDays:A().int().positive().default(30).describe(`Backup retention days`)}).optional().describe(`Backup configuration`),encryption:l({perTenantKeys:v().default(!1).describe(`Per-tenant encryption keys`),algorithm:o().default(`AES-256-GCM`).describe(`Encryption algorithm`),keyManagement:x([`aws_kms`,`azure_key_vault`,`gcp_kms`,`hashicorp_vault`,`custom`]).optional().describe(`Key management service`)}).optional().describe(`Encryption configuration`)})]),l({encryption:l({atRest:v().default(!0).describe(`Require encryption at rest`),inTransit:v().default(!0).describe(`Require encryption in transit`),fieldLevel:v().default(!1).describe(`Require field-level encryption`)}).optional().describe(`Encryption requirements`),accessControl:l({requireMFA:v().default(!1).describe(`Require MFA`),requireSSO:v().default(!1).describe(`Require SSO`),ipWhitelist:S(o()).optional().describe(`Allowed IP addresses`),sessionTimeout:A().int().positive().default(3600).describe(`Session timeout`)}).optional().describe(`Access control requirements`),compliance:l({standards:S(x([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),requireAuditLog:v().default(!0).describe(`Require audit logging`),auditRetentionDays:A().int().positive().default(365).describe(`Audit retention days`),dataResidency:l({region:o().optional().describe(`Required region (e.g., US, EU, APAC)`),excludeRegions:S(o()).optional().describe(`Prohibited regions`)}).optional().describe(`Data residency requirements`)}).optional().describe(`Compliance requirements`)});var lme=x([`development`,`production`,`test`,`provisioning`,`preview`]).describe(`Kernel operating mode`),ume=l({autoLogin:v().default(!0).describe(`Auto-login as simulated user, skipping login/registration pages`),simulatedRole:x([`admin`,`user`,`viewer`]).default(`admin`).describe(`Permission role for the simulated preview user`),simulatedUserName:o().default(`Preview User`).describe(`Display name for the simulated preview user`),readOnly:v().default(!1).describe(`Restrict the preview session to read-only operations`),expiresInSeconds:A().int().min(0).default(0).describe(`Preview session duration in seconds (0 = no expiration)`),bannerMessage:o().optional().describe(`Banner message displayed in the UI during preview mode`)});l({instanceId:o().uuid().describe(`Unique UUID for this running kernel process`),mode:lme.default(`production`),version:o().describe(`Kernel version`),appName:o().optional().describe(`Host application name`),cwd:o().describe(`Current working directory`),workspaceRoot:o().optional().describe(`Workspace root if different from cwd`),startTime:A().int().describe(`Boot timestamp (ms)`),features:u(o(),v()).default({}).describe(`Global feature toggles`),previewMode:ume.optional().describe(`Preview/demo mode configuration (used when mode is "preview")`)}).extend({tenantId:o().min(1).describe(`Resolved tenant identifier`),tenantPlan:x([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),tenantRegion:o().optional().describe(`Tenant deployment region`),tenantDbUrl:o().min(1).describe(`Tenant database connection URL`),tenantQuotas:j0.optional().describe(`Tenant resource quotas`)}).describe(`Tenant-aware kernel runtime context`);var dme=x([`satisfied`,`needs_install`,`needs_upgrade`,`conflict`]).describe(`Resolution status for a dependency`),fme=l({packageId:o().describe(`Dependency package identifier`),requiredRange:o().describe(`SemVer range required (e.g. "^2.0.0")`),resolvedVersion:o().optional().describe(`Actual version resolved from registry`),installedVersion:o().optional().describe(`Currently installed version`),status:dme.describe(`Resolution status`),conflictReason:o().optional().describe(`Explanation of the conflict`)}).describe(`Resolution result for a single dependency`),pme=l({type:x([`install`,`upgrade`,`confirm_conflict`]).describe(`Type of action required`),packageId:o().describe(`Target package identifier`),description:o().describe(`Human-readable action description`)}).describe(`Action required before installation can proceed`),mme=l({dependencies:S(fme).describe(`Resolution result for each dependency`),canProceed:v().describe(`Whether installation can proceed`),requiredActions:S(pme).describe(`Actions required before proceeding`),installOrder:S(o()).describe(`Topologically sorted package IDs for installation`),circularDependencies:S(S(o())).optional().describe(`Circular dependency chains detected (e.g. [["A", "B", "A"]])`)}).describe(`Complete dependency resolution result`),hme=l({service:o().min(1).describe(`Target service identifier`),enabled:v().default(!0).describe(`Enable or disable this service`),strategy:x([`mock`,`memory`,`stub`,`passthrough`]).default(`memory`).describe(`Implementation strategy for development`),config:u(o(),b()).optional().describe(`Strategy-specific configuration for this service override`)}),gme=l({enabled:v().default(!0).describe(`Load fixture data on startup`),paths:S(o()).optional().describe(`Glob patterns for fixture files`),resetBeforeLoad:v().default(!0).describe(`Clear existing data before loading fixtures`),envFilter:S(o()).optional().describe(`Only load fixtures matching these environment tags`)}),_me=l({hotReload:v().default(!0).describe(`Enable HMR / live-reload`),requestInspector:v().default(!1).describe(`Enable request inspector`),dbExplorer:v().default(!1).describe(`Enable database explorer UI`),verboseLogging:v().default(!0).describe(`Enable verbose logging`),apiDocs:v().default(!0).describe(`Serve OpenAPI docs at /_dev/docs`),mailCatcher:v().default(!1).describe(`Capture outbound emails in dev`)});l({preset:x([`minimal`,`standard`,`full`]).describe(`Predefined dev configuration profile`).default(`standard`).describe(`Base configuration preset`),services:u(o().min(1),hme.omit({service:!0})).optional().describe(`Per-service dev overrides keyed by service name`),fixtures:gme.optional().describe(`Fixture data loading configuration`),tools:_me.optional().describe(`Developer tooling settings`),port:A().int().min(1).max(65535).default(4400).describe(`Port for the dev-tools dashboard`),open:v().default(!1).describe(`Auto-open dev dashboard in browser`),seedAdminUser:v().default(!0).describe(`Create a default admin user for development`),simulatedLatency:A().int().min(0).default(0).describe(`Artificial latency (ms) added to service calls`)}),o().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`);var vme=o().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`),M0=o().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`),yme=x([`critical`,`high`,`normal`,`low`,`background`]),bme=l({source:o().describe(`Event source (e.g., plugin name, system component)`),timestamp:o().datetime().describe(`ISO 8601 datetime when event was created`),userId:o().optional().describe(`User who triggered the event`),tenantId:o().optional().describe(`Tenant identifier for multi-tenant systems`),correlationId:o().optional().describe(`Correlation ID for event tracing`),causationId:o().optional().describe(`ID of the event that caused this event`),priority:yme.optional().default(`normal`).describe(`Event priority`)}),xme=l({name:M0.describe(`Event type name (lowercase with dots)`),version:o().default(`1.0.0`).describe(`Event schema version`),schema:b().optional().describe(`JSON Schema for event payload validation`),description:o().optional().describe(`Event type description`),deprecated:v().optional().default(!1).describe(`Whether this event type is deprecated`),tags:S(o()).optional().describe(`Event type tags`)}),N0=l({id:o().optional().describe(`Unique event identifier`),name:M0.describe(`Event name (lowercase with dots, e.g., user.created, order.paid)`),payload:b().describe(`Event payload schema`),metadata:bme.describe(`Event metadata`)}),Sme=l({id:o().optional().describe(`Unique handler identifier`),eventName:o().describe(`Name of event to handle (supports wildcards like user.*)`),handler:b().describe(`Handler function`),priority:A().int().default(0).describe(`Execution priority (lower numbers execute first)`),async:v().default(!0).describe(`Execute in background (true) or block (false)`),retry:l({maxRetries:A().int().min(0).default(3).describe(`Maximum retry attempts`),backoffMs:A().int().positive().default(1e3).describe(`Initial backoff delay`),backoffMultiplier:A().positive().default(2).describe(`Backoff multiplier`)}).optional().describe(`Retry policy for failed handlers`),timeoutMs:A().int().positive().optional().describe(`Handler timeout in milliseconds`),filter:b().optional().describe(`Optional filter to determine if handler should execute`)});l({from:o().describe(`Source event pattern (supports wildcards, e.g., user.* or *.created)`),to:S(o()).describe(`Target event names to route to`),transform:b().optional().describe(`Optional function to transform payload`)});var Cme=l({enabled:v().default(!1).describe(`Enable event persistence`),retention:A().int().positive().describe(`Days to retain persisted events`),filter:b().optional().describe(`Optional filter function to select which events to persist`),storage:x([`database`,`file`,`s3`,`custom`]).default(`database`).describe(`Storage backend for persisted events`)}),wme=l({name:o().default(`events`).describe(`Event queue name`),concurrency:A().int().min(1).default(10).describe(`Max concurrent event handlers`),retryPolicy:l({maxRetries:A().int().min(0).default(3).describe(`Max retries for failed events`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:A().int().positive().default(6e4).describe(`Maximum retry delay`)}).optional().describe(`Default retry policy for events`),deadLetterQueue:o().optional().describe(`Dead letter queue name for failed events`),priorityEnabled:v().default(!0).describe(`Process events based on priority`)});l({fromTimestamp:o().datetime().describe(`Start timestamp for replay (ISO 8601)`),toTimestamp:o().datetime().optional().describe(`End timestamp for replay (ISO 8601)`),eventTypes:S(o()).optional().describe(`Event types to replay (empty = all)`),filters:u(o(),b()).optional().describe(`Additional filters for event selection`),speed:A().positive().default(1).describe(`Replay speed multiplier (1 = real-time)`),targetHandlers:S(o()).optional().describe(`Handler IDs to execute (empty = all)`)});var Tme=l({enabled:v().default(!1).describe(`Enable event sourcing`),snapshotInterval:A().int().positive().default(100).describe(`Create snapshot every N events`),snapshotRetention:A().int().positive().default(10).describe(`Number of snapshots to retain`),retention:A().int().positive().default(365).describe(`Days to retain events`),aggregateTypes:S(o()).optional().describe(`Aggregate types to enable event sourcing for`),storage:l({type:x([`database`,`file`,`s3`,`eventstore`]).default(`database`).describe(`Storage backend`),options:u(o(),b()).optional().describe(`Storage-specific options`)}).optional().describe(`Event store configuration`)});l({id:o().describe(`Unique entry identifier`),event:N0.describe(`Original event`),error:l({message:o().describe(`Error message`),stack:o().optional().describe(`Error stack trace`),code:o().optional().describe(`Error code`)}).describe(`Failure details`),retries:A().int().min(0).describe(`Number of retry attempts`),firstFailedAt:o().datetime().describe(`When event first failed`),lastFailedAt:o().datetime().describe(`When event last failed`),failedHandler:o().optional().describe(`Handler ID that failed`)}),l({id:o().describe(`Unique log entry identifier`),event:N0.describe(`The event`),status:x([`pending`,`processing`,`completed`,`failed`]).describe(`Processing status`),handlersExecuted:S(l({handlerId:o().describe(`Handler identifier`),status:x([`success`,`failed`,`timeout`]).describe(`Handler execution status`),durationMs:A().int().optional().describe(`Execution duration`),error:o().optional().describe(`Error message if failed`)})).optional().describe(`Handlers that processed this event`),receivedAt:o().datetime().describe(`When event was received`),processedAt:o().datetime().optional().describe(`When event was processed`),totalDurationMs:A().int().optional().describe(`Total processing time`)});var Eme=l({id:o().optional().describe(`Unique webhook identifier`),eventPattern:o().describe(`Event name pattern (supports wildcards)`),url:o().url().describe(`Webhook endpoint URL`),method:x([`GET`,`POST`,`PUT`,`PATCH`]).default(`POST`).describe(`HTTP method`),headers:u(o(),o()).optional().describe(`HTTP headers`),authentication:l({type:x([`none`,`bearer`,`basic`,`api-key`]).describe(`Auth type`),credentials:u(o(),o()).optional().describe(`Auth credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:l({maxRetries:A().int().min(0).default(3).describe(`Max retry attempts`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:A().int().positive().default(6e4).describe(`Max retry delay`)}).optional().describe(`Retry policy`),timeoutMs:A().int().positive().default(3e4).describe(`Request timeout in milliseconds`),transform:b().optional().describe(`Transform event before sending`),enabled:v().default(!0).describe(`Whether webhook is enabled`)}),Dme=l({provider:x([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Message queue provider`),topic:o().describe(`Topic or queue name`),eventPattern:o().default(`*`).describe(`Event name pattern to publish (supports wildcards)`),partitionKey:o().optional().describe(`JSON path for partition key (e.g., "metadata.tenantId")`),format:x([`json`,`avro`,`protobuf`]).default(`json`).describe(`Message serialization format`),includeMetadata:v().default(!0).describe(`Include event metadata in message`),compression:x([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression`),batchSize:A().int().min(1).default(1).describe(`Batch size for publishing`),flushIntervalMs:A().int().positive().default(1e3).describe(`Flush interval for batching`)}),Ome=l({enabled:v().default(!0).describe(`Enable real-time notifications`),protocol:x([`websocket`,`sse`,`long-polling`]).default(`websocket`).describe(`Real-time protocol`),eventPattern:o().default(`*`).describe(`Event pattern to broadcast`),userFilter:v().default(!0).describe(`Filter events by user`),tenantFilter:v().default(!0).describe(`Filter events by tenant`),channels:S(l({name:o().describe(`Channel name`),eventPattern:o().describe(`Event pattern for channel`),filter:b().optional().describe(`Additional filter function`)})).optional().describe(`Named channels for event broadcasting`),rateLimit:l({maxEventsPerSecond:A().int().positive().describe(`Max events per second per client`),windowMs:A().int().positive().default(1e3).describe(`Rate limit window`)}).optional().describe(`Rate limiting configuration`)});l({persistence:Cme.optional().describe(`Event persistence configuration`),queue:wme.optional().describe(`Event queue configuration`),eventSourcing:Tme.optional().describe(`Event sourcing configuration`),replay:l({enabled:v().default(!0).describe(`Enable event replay capability`)}).optional().describe(`Event replay configuration`),webhooks:S(Eme).optional().describe(`Webhook configurations`),messageQueue:Dme.optional().describe(`Message queue integration`),realtime:Ome.optional().describe(`Real-time notification configuration`),eventTypes:S(xme).optional().describe(`Event type definitions`),handlers:S(Sme).optional().describe(`Global event handlers`)});var kme=x([`boolean`,`percentage`,`user_list`,`group`,`custom`]),Ame=l({name:vme.describe(`Feature key (snake_case)`),label:o().optional().describe(`Display label`),description:o().optional(),enabled:v().default(!1).describe(`Is globally enabled`),strategy:kme.default(`boolean`),conditions:l({percentage:A().min(0).max(100).optional(),users:S(o()).optional(),groups:S(o()).optional(),expression:o().optional().describe(`Custom formula expression`)}).optional(),environment:x([`dev`,`staging`,`prod`,`all`]).default(`all`).describe(`Environment validity`),expiresAt:o().datetime().optional().describe(`Feature flag expiration date`)});Object.assign(Ame,{create:e=>e});var jme=x([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),P0=l({major:A().int().min(0),minor:A().int().min(0),patch:A().int().min(0)}).describe(`Semantic version of the protocol`),Mme=l({id:o().regex(/^([a-z][a-z0-9]*\.)+protocol\.[a-z][a-z0-9._]*\.v\d+$/).describe(`Unique protocol identifier (e.g., com.objectstack.protocol.storage.v1)`),label:o(),version:P0,specification:o().optional().describe(`URL or path to protocol specification`),description:o().optional()}),Nme=l({name:o().describe(`Feature identifier within the protocol`),enabled:v().default(!0),description:o().optional(),sinceVersion:o().optional().describe(`Version when this feature was added`),deprecatedSince:o().optional().describe(`Version when deprecated`)}),Pme=l({protocol:Mme,conformance:jme.default(`full`),implementedFeatures:S(o()).optional().describe(`List of implemented feature names`),features:S(Nme).optional(),metadata:u(o(),b()).optional(),certified:v().default(!1).describe(`Has passed official conformance tests`),certificationDate:o().datetime().optional()}),Fme=l({id:o().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:o(),description:o().optional(),version:P0,methods:S(l({name:o().describe(`Method name`),description:o().optional(),parameters:S(l({name:o(),type:o().describe(`Type notation (e.g., string, number, User)`),required:v().default(!0),description:o().optional()})).optional(),returnType:o().optional().describe(`Return value type`),async:v().default(!1).describe(`Whether method returns a Promise`)})),events:S(l({name:o().describe(`Event name`),description:o().optional(),payload:o().optional().describe(`Event payload type`)})).optional(),stability:x([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),Ime=l({pluginId:o().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:o().describe(`Semantic version constraint`),optional:v().default(!1),reason:o().optional(),requiredCapabilities:S(o()).optional().describe(`Protocol IDs the dependency must support`)}),Lme=l({id:o().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:o(),description:o().optional(),type:x([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:l({input:o().optional().describe(`Input type/schema`),output:o().optional().describe(`Output type/schema`),signature:o().optional().describe(`Function signature if applicable`)}).optional(),cardinality:x([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),F0=l({implements:S(Pme).optional().describe(`List of protocols this plugin conforms to`),provides:S(Fme).optional().describe(`Services/APIs this plugin offers to others`),requires:S(Ime).optional().describe(`Required plugins and their capabilities`),extensionPoints:S(Lme).optional().describe(`Points where other plugins can extend this plugin`),extensions:S(l({targetPluginId:o().describe(`Plugin ID being extended`),extensionPointId:o().describe(`Extension point identifier`),implementation:o().describe(`Path to implementation module`),priority:A().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),Rme=x([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),zme=l({enabled:v().default(!1),priority:A().int().min(0).default(100),resources:S(x([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:l({routes:S(o()).optional(),roles:S(o()).optional(),deviceType:S(x([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:x([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),Bme=l({enabled:v().default(!0),strategy:x([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:x([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:A().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:l({enabled:v().default(!0),minChunks:A().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),Vme=l({enabled:v().default(!0),mode:x([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:v().default(!1).describe(`Prefetch module in idle time`),preload:v().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:o().optional().describe(`Custom chunk name for webpack`),timeout:A().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:l({enabled:v().default(!0),maxAttempts:A().int().min(1).max(10).default(3),backoffMs:A().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),Hme=l({mode:x([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:A().int().min(100).default(3e4),priority:A().int().min(0).default(100),critical:v().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:l({enabled:v().default(!1),maxAttempts:A().int().min(1).max(5).default(3),backoffMs:A().int().min(0).default(1e3)}).optional(),healthCheckInterval:A().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),Ume=l({strategy:x([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:l({resolve:v().default(!0),onMissing:x([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:x([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:l({load:v().default(!0),onFailure:x([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:x([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:x([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),Wme=l({enabled:v().default(!1),environment:x([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:x([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:S(o()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:S(o()).optional().describe(`Glob patterns for files to ignore`),debounceMs:A().int().min(0).default(300),preserveState:v().default(!1),stateSerialization:l({enabled:v().default(!1),handler:o().optional()}).optional(),hooks:l({beforeReload:o().optional().describe(`Function to call before reload`),afterReload:o().optional().describe(`Function to call after reload`),onError:o().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:l({healthValidation:v().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:v().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:A().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:v().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:A().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:A().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:A().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),Gme=l({enabled:v().default(!0),storage:x([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:x([`version`,`hash`,`timestamp`]).default(`version`),ttl:A().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:A().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:S(x([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:l({enabled:v().default(!1),algorithm:x([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),Kme=l({enabled:v().default(!1),scope:x([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:x([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:S(o()).optional().describe(`List of allowed capability IDs`),resourceQuotas:l({maxMemoryMB:A().int().min(1).optional(),maxCpuTimeMs:A().int().min(100).optional(),maxFileDescriptors:A().int().min(1).optional(),maxNetworkKBps:A().int().min(1).optional()}).optional(),permissions:l({allowedAPIs:S(o()).optional(),allowedPaths:S(o()).optional(),allowedEndpoints:S(o()).optional(),allowedEnvVars:S(o()).optional()}).optional(),ipc:l({enabled:v().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:x([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:A().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:A().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:S(o()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),qme=l({enabled:v().default(!1),metrics:S(x([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:A().min(0).max(1).default(1),reportingInterval:A().int().min(1).default(60),budgets:l({maxLoadTimeMs:A().int().min(0).optional(),maxInitTimeMs:A().int().min(0).optional(),maxMemoryMB:A().int().min(0).optional()}).optional(),onBudgetViolation:x([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),Jme=l({strategy:Rme.default(`lazy`),preload:zme.optional(),codeSplitting:Bme.optional(),dynamicImport:Vme.optional(),initialization:Hme.optional(),dependencyResolution:Ume.optional(),hotReload:Wme.optional(),caching:Gme.optional(),sandboxing:Kme.optional(),monitoring:qme.optional()}).describe(`Complete plugin loading configuration`);l({type:x([`load-started`,`load-completed`,`load-failed`,`init-started`,`init-completed`,`init-failed`,`preload-started`,`preload-completed`,`cache-hit`,`cache-miss`,`hot-reload`,`dynamic-load`,`dynamic-unload`,`dynamic-discover`]),pluginId:o(),timestamp:A().int().min(0),durationMs:A().int().min(0).optional(),metadata:u(o(),b()).optional(),error:l({message:o(),code:o().optional(),stack:o().optional()}).optional()}).describe(`Plugin loading lifecycle event`),l({pluginId:o(),state:x([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:A().min(0).max(100).default(0),startedAt:A().int().min(0).optional(),completedAt:A().int().min(0).optional(),lastError:o().optional(),retryCount:A().int().min(0).default(0)}).describe(`Plugin loading state`),l({ql:l({object:O().describe(`Get object handle for method chaining`),query:O().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:l({getCurrentUser:O().describe(`Get the current authenticated user`),getConfig:O().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:l({debug:O().describe(`Log debug message`),info:O().describe(`Log info message`),warn:O().describe(`Log warning message`),error:O().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:l({get:O().describe(`Get a value from storage`),set:O().describe(`Set a value in storage`),delete:O().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:l({t:O().describe(`Translate a key`),getLocale:O().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:u(o(),b()),events:u(o(),b()),app:l({router:l({get:O().describe(`Register GET route handler`),post:O().describe(`Register POST route handler`),use:O().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:l({register:O().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),l({previousVersion:o().describe(`Version before upgrade`),newVersion:o().describe(`Version after upgrade`),isMajorUpgrade:v().describe(`Whether this is a major version bump`),previousMetadata:u(o(),b()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`);var Yme=l({onInstall:O().optional().describe(`Called when plugin is installed`),onEnable:O().optional().describe(`Called when plugin is enabled`),onDisable:O().optional().describe(`Called when plugin is disabled`),onUninstall:O().optional().describe(`Called when plugin is uninstalled`),onUpgrade:O().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),I0=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`];Yme.extend({id:o().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:x([`standard`,...I0]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:o().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:o().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:v().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:o().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:o().optional(),author:o().optional(),homepage:o().url().optional()});var Xme=x([`insert`,`update`,`upsert`,`replace`,`ignore`]),Zme=l({object:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:o().default(`name`).describe(`Field match for uniqueness check`),mode:Xme.default(`upsert`).describe(`Conflict resolution strategy`),env:S(x([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:S(u(o(),b())).describe(`Data records`)}),L0=l({id:o().describe(`Unique package identifier (reverse domain style)`),namespace:o().regex(/^[a-z][a-z0-9_]{1,19}$/,`Namespace must be 2-20 chars, lowercase alphanumeric + underscore`).optional().describe(`Short namespace identifier for metadata scoping (e.g. "crm", "todo")`),version:o().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:x([`plugin`,...I0,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:o().describe(`Human-readable package name`),description:o().optional().describe(`Package description`),permissions:S(o()).optional().describe(`Array of required permission strings`),objects:S(o()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:S(o()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:u(o(),o()).optional().describe(`Package dependencies`),configuration:l({title:o().optional(),properties:u(o(),l({type:x([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:b().optional().describe(`Default value`),description:o().optional().describe(`Tooltip description`),required:v().optional().describe(`Is this setting required?`),secret:v().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:S(o()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:l({kinds:S(l({id:o().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:S(o()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:o().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:S(o()).optional().describe(`Events this plugin listens to`),menus:u(o(),S(l({id:o(),label:o(),command:o().optional()}))).optional().describe(`UI Menu contributions`),themes:S(l({id:o(),label:o(),path:o()})).optional().describe(`Theme contributions`),translations:S(l({locale:o(),path:o()})).optional().describe(`Translation resources`),actions:S(l({name:o().describe(`Unique action name`),label:o().optional(),description:o().optional(),input:b().optional().describe(`Input validation schema`),output:b().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:S(l({id:o().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:o().describe(`Human readable name`),description:o().optional()})).optional().describe(`Driver contributions`),fieldTypes:S(l({name:o().describe(`Unique field type name (e.g. "vector")`),label:o().describe(`Display label`),description:o().optional()})).optional().describe(`Field Type contributions`),functions:S(l({name:o().describe(`Function name (e.g. "distance")`),description:o().optional(),args:S(o()).optional().describe(`Argument types`),returnType:o().optional()})).optional().describe(`Query Function contributions`),routes:S(l({prefix:o().regex(/^\//).describe(`API path prefix`),service:o().describe(`Service name this plugin provides`),methods:S(o()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:S(l({name:o().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:o().optional().describe(`Command description for help text`),module:o().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:S(Zme).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:F0.optional().describe(`Plugin capability declarations for interoperability`),extensions:u(o(),b()).optional().describe(`Extension points and contributions`),loading:Jme.optional().describe(`Plugin loading and runtime behavior configuration`),engine:l({objectstack:o().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)});x([`package`,`admin`,`user`,`migration`,`api`]);var Qme=l({path:o().describe(`JSON path to the changed field`),originalValue:b().optional().describe(`Original value from the package`),currentValue:b().describe(`Current customized value`),changedBy:o().optional().describe(`User or admin who made this change`),changedAt:o().datetime().optional().describe(`Timestamp of the change`)});l({id:o().describe(`Overlay record ID (UUID)`),baseType:o().describe(`Metadata type being customized`),baseName:o().describe(`Metadata name being customized`),packageId:o().optional().describe(`Package ID that delivered the base metadata`),packageVersion:o().optional().describe(`Package version when overlay was created`),scope:x([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:o().optional().describe(`Tenant identifier`),owner:o().optional().describe(`Owner user ID for user-scope overlays`),patch:u(o(),b()).describe(`JSON Merge Patch payload (changed fields only)`),changes:S(Qme).optional().describe(`Field-level change tracking for conflict detection`),active:v().default(!0).describe(`Whether this overlay is active`),createdAt:o().datetime().optional(),createdBy:o().optional(),updatedAt:o().datetime().optional(),updatedBy:o().optional()});var $me=l({path:o().describe(`JSON path to the conflicting field`),baseValue:b().describe(`Value in the old package version`),incomingValue:b().describe(`Value in the new package version`),customValue:b().describe(`Customer customized value`),suggestedResolution:x([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:o().optional().describe(`Explanation for the suggested resolution`)}),ehe=l({defaultStrategy:x([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:S(o()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:S(o()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:v().default(!0).describe(`Auto-resolve changes that do not conflict`)});l({success:v().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:u(o(),b()).optional().describe(`Merged metadata result`),updatedOverlay:u(o(),b()).optional().describe(`Updated overlay after merge`),conflicts:S($me).optional().describe(`Unresolved merge conflicts`),autoResolved:S(l({path:o(),resolution:o(),description:o().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:l({totalFields:A().int().min(0).describe(`Total fields evaluated`),unchanged:A().int().min(0).describe(`Fields with no changes`),autoResolved:A().int().min(0).describe(`Fields auto-resolved`),conflicts:A().int().min(0).describe(`Fields with conflicts`)}).optional()});var the=l({metadataType:o().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:v().default(!0),lockedFields:S(o()).optional().describe(`Field paths that cannot be customized`),customizableFields:S(o()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:v().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:v().default(!1).describe(`Whether admins can delete package-delivered fields`)}),R0=x([`json`,`yaml`,`typescript`,`javascript`]),nhe=l({size:A().int().min(0).describe(`File size in bytes`),modifiedAt:o().datetime().describe(`Last modified date`),etag:o().describe(`Entity tag for cache validation`),format:R0.describe(`Serialization format`),path:o().optional().describe(`File system path`),metadata:u(o(),b()).optional().describe(`Provider-specific metadata`)});l({patterns:S(o()).optional().describe(`File glob patterns`),ifNoneMatch:o().optional().describe(`ETag for conditional request`),ifModifiedSince:o().datetime().optional().describe(`Only load if modified after this date`),validate:v().default(!0).describe(`Validate against schema`),useCache:v().default(!0).describe(`Enable caching`),filter:o().optional().describe(`Filter predicate as string`),limit:A().int().min(1).optional().describe(`Maximum items to load`),recursive:v().default(!0).describe(`Search subdirectories`)}),l({format:R0.default(`typescript`).describe(`Output format`),prettify:v().default(!0).describe(`Format with indentation`),indent:A().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:v().default(!1).describe(`Sort object keys`),includeDefaults:v().default(!1).describe(`Include default values`),backup:v().default(!1).describe(`Create backup file`),overwrite:v().default(!0).describe(`Overwrite existing file`),atomic:v().default(!0).describe(`Use atomic write operation`),path:o().optional().describe(`Custom output path`)}),l({output:o().describe(`Output file path`),format:R0.default(`json`).describe(`Export format`),filter:o().optional().describe(`Filter items to export`),includeStats:v().default(!1).describe(`Include metadata statistics`),compress:v().default(!1).describe(`Compress output (gzip)`),prettify:v().default(!0).describe(`Pretty print output`)}),l({conflictResolution:x([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:v().default(!0).describe(`Validate before import`),dryRun:v().default(!1).describe(`Simulate import without saving`),continueOnError:v().default(!1).describe(`Continue if validation fails`),transform:o().optional().describe(`Transform items before import`)}),l({data:b().nullable().describe(`Loaded metadata`),fromCache:v().default(!1).describe(`Loaded from cache`),notModified:v().default(!1).describe(`Not modified since last request`),etag:o().optional().describe(`Entity tag`),stats:nhe.optional().describe(`Metadata statistics`),loadTime:A().min(0).optional().describe(`Load duration in ms`)}),l({success:v().describe(`Save successful`),path:o().describe(`Output path`),etag:o().optional().describe(`Generated entity tag`),size:A().int().min(0).optional().describe(`File size`),saveTime:A().min(0).optional().describe(`Save duration in ms`),backupPath:o().optional().describe(`Backup file path`)}),l({type:x([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:o().describe(`Type of metadata`),name:o().describe(`Item identifier`),path:o().describe(`File path`),data:b().optional().describe(`Item data`),timestamp:o().datetime().describe(`Event timestamp`)}),l({type:o().describe(`Collection type`),count:A().int().min(0).describe(`Number of items`),formats:S(R0).describe(`Formats in collection`),totalSize:A().int().min(0).optional().describe(`Total size in bytes`),lastModified:o().datetime().optional().describe(`Last modification date`),location:o().optional().describe(`Collection location`)}),l({name:o().describe(`Loader identifier`),protocol:x([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:l({read:v().default(!0),write:v().default(!1),watch:v().default(!1),list:v().default(!0)}).describe(`Loader capabilities`),supportedFormats:S(R0).describe(`Supported formats`),supportsWatch:v().default(!1).describe(`Supports file watching`),supportsWrite:v().default(!0).describe(`Supports write operations`),supportsCache:v().default(!0).describe(`Supports caching`)});var rhe=x([`filesystem`,`memory`,`none`]),ihe=l({datasource:o().optional().describe(`Datasource name reference for database persistence`),tableName:o().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:rhe.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:o().optional().describe(`Root directory path`),formats:S(R0).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:l({enabled:v().default(!0).describe(`Enable caching`),ttl:A().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:A().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:v().default(!1).describe(`Enable file watching`),watchOptions:l({ignored:S(o()).optional().describe(`Patterns to ignore`),persistent:v().default(!0).describe(`Keep process running`),ignoreInitial:v().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:l({strict:v().default(!0).describe(`Strict validation`),throwOnError:v().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:u(o(),b()).optional().describe(`Loader-specific configuration`)}),z0=x([`object`,`field`,`trigger`,`validation`,`hook`,`view`,`page`,`dashboard`,`app`,`action`,`report`,`flow`,`workflow`,`approval`,`datasource`,`translation`,`router`,`function`,`service`,`permission`,`profile`,`role`,`agent`,`tool`,`skill`]),ahe=l({type:z0.describe(`Metadata type identifier`),label:o().describe(`Display label for the metadata type`),description:o().optional().describe(`Description of the metadata type`),filePatterns:S(o()).describe(`Glob patterns to discover files of this type`),supportsOverlay:v().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:v().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:v().default(!1).describe(`Whether version history is tracked`),loadOrder:A().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:x([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)});l({types:S(z0).optional().describe(`Filter by metadata types`),namespaces:S(o()).optional().describe(`Filter by namespaces`),packageId:o().optional().describe(`Filter by owning package`),search:o().optional().describe(`Full-text search query`),scope:x([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:x([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:S(o()).optional().describe(`Filter by tags`),sortBy:x([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:x([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:A().int().min(1).default(1).describe(`Page number`),pageSize:A().int().min(1).max(500).default(50).describe(`Items per page`)}),l({items:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),namespace:o().optional().describe(`Namespace`),label:o().optional().describe(`Display label`),scope:x([`system`,`platform`,`user`]).optional(),state:x([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:o().optional(),updatedAt:o().datetime().optional()})).describe(`Matched metadata items`),total:A().int().min(0).describe(`Total matching items`),page:A().int().min(1).describe(`Current page`),pageSize:A().int().min(1).describe(`Page size`)}),l({event:x([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:z0.describe(`Metadata type`),name:o().describe(`Metadata item name`),namespace:o().optional().describe(`Namespace`),packageId:o().optional().describe(`Owning package ID`),timestamp:o().datetime().describe(`Event timestamp`),actor:o().optional().describe(`User or system that triggered the event`),payload:u(o(),b()).optional().describe(`Event-specific payload`)}),l({valid:v().describe(`Whether the metadata is valid`),errors:S(l({path:o().describe(`JSON path to the invalid field`),message:o().describe(`Error description`),code:o().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:S(l({path:o().describe(`JSON path to the field`),message:o().describe(`Warning description`)})).optional().describe(`Validation warnings`)});var ohe=l({storage:ihe.describe(`Storage backend configuration`),customizationPolicies:S(the).optional().describe(`Default customization policies per type`),mergeStrategy:ehe.optional().describe(`Merge strategy for package upgrades`),additionalTypes:S(ahe.omit({type:!0}).extend({type:o().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:v().default(!0).describe(`Emit metadata change events`),validateOnWrite:v().default(!0).describe(`Validate metadata on write`),enableVersioning:v().default(!1).describe(`Track metadata version history`),cacheMaxItems:A().int().min(0).default(1e4).describe(`Max items in memory cache`)});l({id:p(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:p(`ObjectStack Metadata Service`).describe(`Plugin name`),version:o().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:p(`standard`).describe(`Plugin type`),description:o().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:l({crud:v().default(!0).describe(`Supports metadata CRUD`),query:v().default(!0).describe(`Supports metadata query`),overlay:v().default(!0).describe(`Supports customization overlays`),watch:v().default(!1).describe(`Supports file watching`),importExport:v().default(!0).describe(`Supports import/export`),validation:v().default(!0).describe(`Supports schema validation`),versioning:v().default(!1).describe(`Supports version history`),events:v().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:ohe.optional().describe(`Plugin configuration`)}),l({items:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),data:u(o(),b()).describe(`Metadata payload`),namespace:o().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:v().default(!1).describe(`Continue if individual item fails`),validate:v().default(!0).describe(`Validate before register`)}),l({total:A().int().min(0).describe(`Total items processed`),succeeded:A().int().min(0).describe(`Successfully processed`),failed:A().int().min(0).describe(`Failed items`),errors:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),error:o().describe(`Error message`)})).optional().describe(`Per-item errors`)}),l({sourceType:o().describe(`Dependent metadata type`),sourceName:o().describe(`Dependent metadata name`),targetType:o().describe(`Referenced metadata type`),targetName:o().describe(`Referenced metadata name`),kind:x([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)});var B0=x([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),V0=l({manifest:L0.describe(`Full package manifest`),status:B0.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:v().default(!0).describe(`Whether the package is currently enabled`),installedAt:o().datetime().optional().describe(`Installation timestamp`),updatedAt:o().datetime().optional().describe(`Last update timestamp`),installedVersion:o().optional().describe(`Currently installed version for quick access`),previousVersion:o().optional().describe(`Version before the last upgrade`),statusChangedAt:o().datetime().optional().describe(`Status change timestamp`),errorMessage:o().optional().describe(`Error message when status is error`),settings:u(o(),b()).optional().describe(`User-provided configuration settings`),upgradeHistory:S(l({fromVersion:o().describe(`Version before upgrade`),toVersion:o().describe(`Version after upgrade`),upgradedAt:o().datetime().describe(`Upgrade timestamp`),status:x([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:S(o()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:S(o()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`);l({namespace:o().describe(`Namespace prefix`),packageId:o().describe(`Owning package ID`),registeredAt:o().datetime().describe(`Registration timestamp`),status:x([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),l({type:p(`namespace_conflict`).describe(`Error type`),requestedNamespace:o().describe(`Requested namespace`),conflictingPackageId:o().describe(`Conflicting package ID`),conflictingPackageName:o().describe(`Conflicting package display name`),suggestion:o().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),l({status:B0.optional().describe(`Filter by package status`),type:L0.shape.type.optional().describe(`Filter by package type`),enabled:v().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),l({packages:S(V0).describe(`List of installed packages`),total:A().describe(`Total package count`)}).describe(`List packages response`),l({id:o().describe(`Package identifier`)}).describe(`Get package request`),l({package:V0.describe(`Package details`)}).describe(`Get package response`),l({manifest:L0.describe(`Package manifest to install`),settings:u(o(),b()).optional().describe(`User-provided settings at install time`),enableOnInstall:v().default(!0).describe(`Whether to enable immediately after install`),platformVersion:o().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),l({package:V0.describe(`Installed package details`),message:o().optional().describe(`Installation status message`),dependencyResolution:mme.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),l({id:o().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),l({id:o().describe(`Uninstalled package ID`),success:v().describe(`Whether uninstall succeeded`),message:o().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),l({id:o().describe(`Package ID to enable`)}).describe(`Enable package request`),l({package:V0.describe(`Enabled package details`),message:o().optional().describe(`Enable status message`)}).describe(`Enable package response`),l({id:o().describe(`Package ID to disable`)}).describe(`Disable package request`),l({package:V0.describe(`Disabled package details`),message:o().optional().describe(`Disable status message`)}).describe(`Disable package response`);var she=x([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),che=l({type:o().describe(`Metadata type`),name:o().describe(`Metadata name`),changeType:she.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:v().default(!1).describe(`Whether this change may conflict with customizations`),summary:o().optional().describe(`Human-readable change summary`),previousName:o().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),lhe=x([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),uhe=l({packageId:o().describe(`Package identifier`),fromVersion:o().describe(`Currently installed version`),toVersion:o().describe(`Target upgrade version`),impactLevel:lhe.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:S(che).describe(`All metadata changes`),affectedCustomizations:A().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:v().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:S(o()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:S(l({packageId:o(),fromVersion:o(),toVersion:o()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:A().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:o().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`);l({id:o().describe(`Snapshot identifier`),packageId:o().describe(`Package identifier`),fromVersion:o().describe(`Version before upgrade`),toVersion:o().describe(`Target upgrade version`),tenantId:o().optional().describe(`Tenant identifier`),previousManifest:L0.describe(`Complete manifest of the previous package version`),metadataSnapshot:S(l({type:o(),name:o(),metadata:u(o(),b())})).describe(`Snapshot of all package metadata`),customizationSnapshot:S(u(o(),b())).optional().describe(`Snapshot of customer customizations`),createdAt:o().datetime().describe(`Snapshot creation timestamp`),expiresAt:o().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),l({packageId:o().describe(`Package ID to upgrade`),targetVersion:o().optional().describe(`Target version (defaults to latest)`),manifest:L0.optional().describe(`New manifest (if installing from local)`),createSnapshot:v().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:x([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:v().default(!1).describe(`Preview upgrade without making changes`),skipValidation:v().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`);var dhe=x([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`);l({success:v().describe(`Whether the upgrade succeeded`),phase:dhe.describe(`Current upgrade phase`),plan:uhe.optional().describe(`Upgrade plan`),snapshotId:o().optional().describe(`Snapshot ID for rollback`),conflicts:S(l({path:o(),baseValue:b(),incomingValue:b(),customValue:b()})).optional().describe(`Unresolved merge conflicts`),errorMessage:o().optional().describe(`Error message if upgrade failed`),message:o().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),l({packageId:o().describe(`Package ID to rollback`),snapshotId:o().describe(`Snapshot ID to restore from`),rollbackCustomizations:v().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),l({success:v().describe(`Whether the rollback succeeded`),restoredVersion:o().optional().describe(`Version restored to`),message:o().optional().describe(`Rollback status message`)}).describe(`Rollback package response`);var H0=x([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),fhe=l({interval:A().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:A().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:A().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:A().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:o().optional().describe(`Method name to call for health check`),autoRestart:v().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:A().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)});l({status:H0,timestamp:o().datetime(),message:o().optional(),metrics:l({uptime:A().describe(`Plugin uptime in milliseconds`),memoryUsage:A().optional().describe(`Memory usage in bytes`),cpuUsage:A().optional().describe(`CPU usage percentage`),activeConnections:A().optional().describe(`Number of active connections`),errorRate:A().optional().describe(`Error rate (errors per minute)`),responseTime:A().optional().describe(`Average response time in ms`)}).partial().optional(),checks:S(l({name:o().describe(`Check name`),status:x([`passed`,`failed`,`warning`]),message:o().optional(),data:u(o(),b()).optional()})).optional(),dependencies:S(l({pluginId:o(),status:H0,message:o().optional()})).optional()});var phe=l({provider:x([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:S(o()).optional().describe(`Backend connection endpoints`),keyPrefix:o().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:A().int().min(0).optional().describe(`State expiration time in seconds`),auth:l({username:o().optional(),password:o().optional(),token:o().optional(),certificate:o().optional()}).optional(),replication:l({enabled:v().default(!0),minReplicas:A().int().min(1).default(1)}).optional(),customConfig:u(o(),b()).optional().describe(`Provider-specific configuration`)}),mhe=l({enabled:v().default(!1),watchPatterns:S(o()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:A().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:v().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:x([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:phe.optional().describe(`Configuration for distributed state management`),shutdownTimeout:A().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:S(o()).optional().describe(`Hook names to call before reload`),afterReload:S(o()).optional().describe(`Hook names to call after reload`)}),hhe=l({enabled:v().default(!0),fallbackMode:x([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:S(o()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:S(o()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:S(l({feature:o().describe(`Feature name`),enabled:v().describe(`Whether feature is available in degraded mode`),reason:o().optional()})).optional(),autoRecovery:l({enabled:v().default(!0),retryInterval:A().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:A().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),ghe=l({mode:x([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:l({major:v().default(!1).describe(`Allow major version updates`),minor:v().default(!0).describe(`Allow minor version updates`),patch:v().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:l({cron:o().optional(),timezone:o().default(`UTC`),maintenanceWindow:A().int().min(1).default(60)}).optional(),rollback:l({enabled:v().default(!0),automatic:v().default(!0),keepVersions:A().int().min(1).default(3),timeout:A().int().min(1e3).default(3e4)}).optional(),validation:l({checkCompatibility:v().default(!0),runTests:v().default(!1),testSuite:o().optional()}).optional()});l({pluginId:o(),version:o(),timestamp:o().datetime(),state:u(o(),b()),metadata:l({checksum:o().optional().describe(`State checksum for verification`),compressed:v().default(!1),encryption:o().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),l({health:fhe.optional(),hotReload:mhe.optional(),degradation:hhe.optional(),updates:ghe.optional(),resources:l({maxMemory:A().int().optional().describe(`Maximum memory in bytes`),maxCpu:A().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:A().int().optional().describe(`Maximum concurrent connections`),timeout:A().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:l({enableMetrics:v().default(!0),enableTracing:v().default(!0),enableProfiling:v().default(!1),metricsInterval:A().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()});var U0=x([`init`,`start`,`destroy`]).describe(`Plugin lifecycle phase`),W0=l({pluginName:o().describe(`Name of the plugin`),timestamp:A().int().describe(`Unix timestamp in milliseconds when event occurred`)});W0.extend({version:o().optional().describe(`Plugin version`)}),W0.extend({duration:A().min(0).optional().describe(`Duration of the lifecycle phase in milliseconds`),phase:U0.optional().describe(`Lifecycle phase`)}),W0.extend({error:l({name:o().describe(`Error class name`),message:o().describe(`Error message`),stack:o().optional().describe(`Stack trace`),code:o().optional().describe(`Error code`)}).describe(`Serializable error representation`),phase:U0.describe(`Lifecycle phase where error occurred`),errorMessage:o().optional().describe(`Error message`),errorStack:o().optional().describe(`Error stack trace`)}),l({serviceName:o().describe(`Name of the registered service`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),serviceType:o().optional().describe(`Type or interface name of the service`)}),l({serviceName:o().describe(`Name of the unregistered service`),timestamp:A().int().describe(`Unix timestamp in milliseconds`)}),l({hookName:o().describe(`Name of the hook`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),handlerCount:A().int().min(0).describe(`Number of handlers registered for this hook`)}),l({hookName:o().describe(`Name of the hook`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),args:S(b()).describe(`Arguments passed to the hook handlers`),handlerCount:A().int().min(0).optional().describe(`Number of handlers that will handle this event`)});var G0=l({timestamp:A().int().describe(`Unix timestamp in milliseconds`)});G0.extend({duration:A().min(0).optional().describe(`Total initialization duration in milliseconds`),pluginCount:A().int().min(0).optional().describe(`Number of plugins initialized`)}),G0.extend({reason:o().optional().describe(`Reason for kernel shutdown`)}),x([`kernel:ready`,`kernel:shutdown`,`kernel:before-init`,`kernel:after-init`,`plugin:registered`,`plugin:before-init`,`plugin:init`,`plugin:after-init`,`plugin:before-start`,`plugin:started`,`plugin:after-start`,`plugin:before-destroy`,`plugin:destroyed`,`plugin:after-destroy`,`plugin:error`,`service:registered`,`service:unregistered`,`hook:registered`,`hook:triggered`]).describe(`Plugin lifecycle event type`);var _he=x([`load`,`unload`,`reload`,`enable`,`disable`]).describe(`Runtime plugin operation type`),vhe=l({type:x([`npm`,`local`,`url`,`registry`,`git`]).describe(`Plugin source type`),location:o().describe(`Package name, file path, URL, or git repository`),version:o().optional().describe(`Semver version range (e.g., "^1.0.0")`),integrity:o().optional().describe(`Subresource Integrity hash (e.g., "sha384-...")`)}).describe(`Plugin source location for dynamic resolution`),yhe=l({type:x([`onCommand`,`onRoute`,`onObject`,`onEvent`,`onService`,`onSchedule`,`onStartup`]).describe(`Trigger type for lazy activation`),pattern:o().describe(`Match pattern for the activation trigger`)}).describe(`Lazy activation trigger for a dynamic plugin`);l({pluginId:o().describe(`Unique plugin identifier`),source:vhe,activationEvents:S(yhe).optional().describe(`Lazy activation triggers; if omitted plugin starts immediately`),config:u(o(),b()).optional().describe(`Runtime configuration overrides`),priority:A().int().min(0).default(100).describe(`Loading priority (lower is higher)`),sandbox:v().default(!1).describe(`Run in an isolated sandbox`),timeout:A().int().min(1e3).default(6e4).describe(`Maximum time to complete loading in ms`)}).describe(`Request to dynamically load a plugin at runtime`),l({pluginId:o().describe(`Plugin to unload`),strategy:x([`graceful`,`forceful`,`drain`]).default(`graceful`).describe(`How to handle in-flight work during unload`),timeout:A().int().min(1e3).default(3e4).describe(`Maximum time to complete unloading in ms`),cleanupCache:v().default(!1).describe(`Remove cached code and assets after unload`),dependentAction:x([`cascade`,`warn`,`block`]).default(`block`).describe(`How to handle plugins that depend on this one`)}).describe(`Request to dynamically unload a plugin at runtime`),l({success:v(),operation:_he,pluginId:o(),durationMs:A().int().min(0).optional(),version:o().optional(),error:l({code:o().describe(`Machine-readable error code`),message:o().describe(`Human-readable error message`),details:u(o(),b()).optional()}).optional(),warnings:S(o()).optional()}).describe(`Result of a dynamic plugin operation`);var bhe=l({type:x([`registry`,`npm`,`directory`,`url`]).describe(`Discovery source type`),endpoint:o().describe(`Registry URL, directory path, or manifest URL`),pollInterval:A().int().min(0).default(0).describe(`How often to re-scan for new plugins (0 = manual)`),filter:l({tags:S(o()).optional(),vendors:S(o()).optional(),minTrustLevel:x([`verified`,`trusted`,`community`,`untrusted`]).optional()}).optional()}).describe(`Source for runtime plugin discovery`),xhe=l({enabled:v().default(!1),sources:S(bhe).default([]),autoLoad:v().default(!1).describe(`Automatically load newly discovered plugins`),requireApproval:v().default(!0).describe(`Require admin approval before loading discovered plugins`)}).describe(`Runtime plugin discovery configuration`);l({enabled:v().default(!1).describe(`Enable runtime load/unload of plugins`),maxDynamicPlugins:A().int().min(1).default(50).describe(`Upper limit on runtime-loaded plugins`),discovery:xhe.optional(),defaultSandbox:v().default(!0).describe(`Sandbox dynamically loaded plugins by default`),allowedSources:S(x([`npm`,`local`,`url`,`registry`,`git`])).optional().describe(`Restrict which source types are permitted`),requireIntegrity:v().default(!0).describe(`Require integrity hash verification for remote sources`),operationTimeout:A().int().min(1e3).default(6e4).describe(`Default timeout for load/unload operations in ms`)}).describe(`Dynamic plugin loading subsystem configuration`);var She=x([`global`,`tenant`,`user`,`resource`,`plugin`]).describe(`Scope of permission application`),Che=x([`create`,`read`,`update`,`delete`,`execute`,`manage`,`configure`,`share`,`export`,`import`,`admin`]).describe(`Type of action being permitted`),whe=x([`data.object`,`data.record`,`data.field`,`ui.view`,`ui.dashboard`,`ui.report`,`system.config`,`system.plugin`,`system.api`,`system.service`,`storage.file`,`storage.database`,`network.http`,`network.websocket`,`process.spawn`,`process.env`]).describe(`Type of resource being accessed`),The=l({permissions:S(l({id:o().describe(`Unique permission identifier`),resource:whe,actions:S(Che),scope:She.default(`plugin`),filter:l({resourceIds:S(o()).optional(),condition:o().optional().describe(`Filter expression (e.g., owner = currentUser)`),fields:S(o()).optional().describe(`Allowed fields for data resources`)}).optional(),description:o(),required:v().default(!0),justification:o().optional().describe(`Why this permission is needed`)})),groups:S(l({name:o().describe(`Group name`),description:o(),permissions:S(o()).describe(`Permission IDs in this group`)})).optional(),defaultGrant:x([`prompt`,`allow`,`deny`,`inherit`]).default(`prompt`)}),Ehe=l({engine:x([`v8-isolate`,`wasm`,`container`,`process`]).default(`v8-isolate`).describe(`Execution environment engine`),engineConfig:l({wasm:l({maxMemoryPages:A().int().min(1).max(65536).optional().describe(`Maximum WASM memory pages (64KB each)`),instructionLimit:A().int().min(1).optional().describe(`Maximum instructions before timeout`),enableSimd:v().default(!1).describe(`Enable WebAssembly SIMD support`),enableThreads:v().default(!1).describe(`Enable WebAssembly threads`),enableBulkMemory:v().default(!0).describe(`Enable bulk memory operations`)}).optional(),container:l({image:o().optional().describe(`Container image to use`),runtime:x([`docker`,`podman`,`containerd`]).default(`docker`),resources:l({cpuLimit:o().optional().describe(`CPU limit (e.g., "0.5", "2")`),memoryLimit:o().optional().describe(`Memory limit (e.g., "512m", "1g")`)}).optional(),networkMode:x([`none`,`bridge`,`host`]).default(`bridge`)}).optional(),v8Isolate:l({heapSizeMb:A().int().min(1).optional(),enableSnapshot:v().default(!0)}).optional()}).optional(),resourceLimits:l({maxMemory:A().int().optional().describe(`Maximum memory allocation`),maxCpu:A().min(0).max(100).optional().describe(`Maximum CPU usage percentage`),timeout:A().int().min(0).optional().describe(`Maximum execution time`)}).optional()}),Dhe=l({enabled:v().default(!0),level:x([`none`,`minimal`,`standard`,`strict`,`paranoid`]).default(`standard`),runtime:Ehe.optional().describe(`Execution environment and isolation settings`),filesystem:l({mode:x([`none`,`readonly`,`restricted`,`full`]).default(`restricted`),allowedPaths:S(o()).optional().describe(`Whitelisted paths`),deniedPaths:S(o()).optional().describe(`Blacklisted paths`),maxFileSize:A().int().optional().describe(`Maximum file size in bytes`)}).optional(),network:l({mode:x([`none`,`local`,`restricted`,`full`]).default(`restricted`),allowedHosts:S(o()).optional().describe(`Whitelisted hosts`),deniedHosts:S(o()).optional().describe(`Blacklisted hosts`),allowedPorts:S(A()).optional().describe(`Allowed port numbers`),maxConnections:A().int().optional()}).optional(),process:l({allowSpawn:v().default(!1).describe(`Allow spawning child processes`),allowedCommands:S(o()).optional().describe(`Whitelisted commands`),timeout:A().int().optional().describe(`Process timeout in ms`)}).optional(),memory:l({maxHeap:A().int().optional().describe(`Maximum heap size in bytes`),maxStack:A().int().optional().describe(`Maximum stack size in bytes`)}).optional(),cpu:l({maxCpuPercent:A().min(0).max(100).optional(),maxThreads:A().int().optional()}).optional(),environment:l({mode:x([`none`,`readonly`,`restricted`,`full`]).default(`readonly`),allowedVars:S(o()).optional(),deniedVars:S(o()).optional()}).optional()}),K0=l({cve:o().optional(),id:o(),severity:x([`critical`,`high`,`medium`,`low`,`info`]),category:o().optional(),title:o(),location:o().optional(),remediation:o().optional(),description:o(),affectedVersions:S(o()),fixedIn:S(o()).optional(),cvssScore:A().min(0).max(10).optional(),exploitAvailable:v().default(!1),patchAvailable:v().default(!1),workaround:o().optional(),references:S(o()).optional(),discoveredDate:o().datetime().optional(),publishedDate:o().datetime().optional()}),Ohe=l({timestamp:o().datetime(),scanner:l({name:o(),version:o()}),status:x([`passed`,`failed`,`warning`]),vulnerabilities:S(K0).optional(),codeIssues:S(l({severity:x([`error`,`warning`,`info`]),type:o().describe(`Issue type (e.g., sql-injection, xss)`),file:o(),line:A().int().optional(),message:o(),suggestion:o().optional()})).optional(),dependencyVulnerabilities:S(l({package:o(),version:o(),vulnerability:K0})).optional(),licenseCompliance:l({status:x([`compliant`,`non-compliant`,`unknown`]),issues:S(l({package:o(),license:o(),reason:o()})).optional()}).optional(),summary:l({totalVulnerabilities:A().int(),criticalCount:A().int(),highCount:A().int(),mediumCount:A().int(),lowCount:A().int(),infoCount:A().int()})}),khe=l({csp:l({directives:u(o(),S(o())).optional(),reportOnly:v().default(!1)}).optional(),cors:l({allowedOrigins:S(o()),allowedMethods:S(o()),allowedHeaders:S(o()),allowCredentials:v().default(!1),maxAge:A().int().optional()}).optional(),rateLimit:l({enabled:v().default(!0),maxRequests:A().int(),windowMs:A().int().describe(`Time window in milliseconds`),strategy:x([`fixed`,`sliding`,`token-bucket`]).default(`sliding`)}).optional(),authentication:l({required:v().default(!0),methods:S(x([`jwt`,`oauth2`,`api-key`,`session`,`certificate`])),tokenExpiration:A().int().optional().describe(`Token expiration in seconds`)}).optional(),encryption:l({dataAtRest:v().default(!1).describe(`Encrypt data at rest`),dataInTransit:v().default(!0).describe(`Enforce HTTPS/TLS`),algorithm:o().optional().describe(`Encryption algorithm`),minKeyLength:A().int().optional().describe(`Minimum key length in bits`)}).optional(),auditLog:l({enabled:v().default(!0),events:S(o()).optional().describe(`Events to log`),retention:A().int().optional().describe(`Log retention in days`)}).optional()}),Ahe=x([`verified`,`trusted`,`community`,`untrusted`,`blocked`]).describe(`Trust level of the plugin`);l({pluginId:o(),trustLevel:Ahe,permissions:The,sandbox:Dhe,policy:khe.optional(),scanResults:S(Ohe).optional(),vulnerabilities:S(K0).optional(),codeSigning:l({signed:v(),signature:o().optional(),certificate:o().optional(),algorithm:o().optional(),timestamp:o().datetime().optional()}).optional(),certifications:S(l({name:o().describe(`Certification name (e.g., SOC 2, ISO 27001)`),issuer:o(),issuedDate:o().datetime(),expiryDate:o().datetime().optional(),certificateUrl:o().url().optional()})).optional(),securityContact:l({email:o().email().optional(),url:o().url().optional(),pgpKey:o().optional()}).optional(),vulnerabilityDisclosure:l({policyUrl:o().url().optional(),responseTime:A().int().optional().describe(`Expected response time in hours`),bugBounty:v().default(!1)}).optional()});var q0=/^[a-z][a-z0-9_]*$/,jhe=o().describe(`Validates a file path against OPS naming conventions`).superRefine((e,t)=>{if(!e.startsWith(`src/`))return;let n=e.split(`/`);if(n.length>2){let e=n[1];q0.test(e)||t.addIssue({code:le.custom,message:`Domain directory '${e}' must be lowercase snake_case`})}let r=n[n.length-1];r===`index.ts`||r===`main.ts`||q0.test(r.split(`.`)[0])||t.addIssue({code:le.custom,message:`Filename '${r}' base name must be lowercase snake_case`})});l({name:o().regex(q0).describe(`Module name (snake_case)`),files:S(o()).describe(`List of files in this module`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}).describe(`Scanned domain module representing a plugin folder`).superRefine((e,t)=>{e.files.includes(`index.ts`)||t.addIssue({code:le.custom,message:`Module '${e.name}' is missing an 'index.ts' entry point.`})}),l({root:o().describe(`Root directory path of the plugin project`),files:S(o()).describe(`List of all file paths relative to root`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}).describe(`Full plugin project layout validated against OPS conventions`).superRefine((e,t)=>{e.files.includes(`objectstack.config.ts`)||t.addIssue({code:le.custom,message:`Missing 'objectstack.config.ts' configuration file.`}),e.files.filter(e=>e.startsWith(`src/`)).forEach(e=>{let n=jhe.safeParse(e);n.success||n.error.issues.forEach(n=>{t.addIssue({...n,path:[e]})})})});var Mhe=l({field:o().describe(`Field name that failed validation`),message:o().describe(`Human-readable error message`),code:o().optional().describe(`Machine-readable error code`)}),Nhe=l({field:o().describe(`Field name with warning`),message:o().describe(`Human-readable warning message`),code:o().optional().describe(`Machine-readable warning code`)});l({valid:v().describe(`Whether the plugin passed validation`),errors:S(Mhe).optional().describe(`Validation errors`),warnings:S(Nhe).optional().describe(`Validation warnings`)}),l({name:o().min(1).describe(`Unique plugin identifier`),version:o().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic version (e.g., 1.0.0)`),dependencies:S(o()).optional().describe(`Array of plugin names this plugin depends on`),signature:o().optional().describe(`Cryptographic signature for plugin verification`)}).passthrough().describe(`Plugin metadata for validation`);var Phe=l({major:A().int().min(0).describe(`Major version (breaking changes)`),minor:A().int().min(0).describe(`Minor version (backward compatible features)`),patch:A().int().min(0).describe(`Patch version (backward compatible fixes)`),preRelease:o().optional().describe(`Pre-release identifier (alpha, beta, rc.1)`),build:o().optional().describe(`Build metadata`)}).describe(`Semantic version number`);c([o().regex(/^[\d.]+$/).describe("Exact version: `1.2.3`"),o().regex(/^\^[\d.]+$/).describe("Compatible with: `^1.2.3` (`>=1.2.3 <2.0.0`)"),o().regex(/^~[\d.]+$/).describe("Approximately: `~1.2.3` (`>=1.2.3 <1.3.0`)"),o().regex(/^>=[\d.]+$/).describe("Greater than or equal: `>=1.2.3`"),o().regex(/^>[\d.]+$/).describe("Greater than: `>1.2.3`"),o().regex(/^<=[\d.]+$/).describe("Less than or equal: `<=1.2.3`"),o().regex(/^<[\d.]+$/).describe("Less than: `<1.2.3`"),o().regex(/^[\d.]+ - [\d.]+$/).describe("Range: `1.2.3 - 2.3.4`"),p(`*`).describe(`Any version`),p(`latest`).describe(`Latest stable version`)]);var Fhe=x([`fully-compatible`,`backward-compatible`,`deprecated-compatible`,`breaking-changes`,`incompatible`]).describe(`Compatibility level between versions`),J0=l({introducedIn:o().describe(`Version that introduced this breaking change`),type:x([`api-removed`,`api-renamed`,`api-signature-changed`,`behavior-changed`,`dependency-changed`,`configuration-changed`,`protocol-changed`]),description:o(),migrationGuide:o().optional().describe(`How to migrate from old to new`),deprecatedIn:o().optional().describe(`Version where old API was deprecated`),removedIn:o().optional().describe(`Version where old API will be removed`),automatedMigration:v().default(!1).describe(`Whether automated migration tool is available`),severity:x([`critical`,`major`,`minor`]).describe(`Impact severity`)}),Ihe=l({feature:o().describe(`Deprecated feature identifier`),deprecatedIn:o(),removeIn:o().optional(),reason:o(),alternative:o().optional().describe(`What to use instead`),migrationPath:o().optional().describe(`How to migrate to alternative`)}),Y0=l({from:o().describe(`Version being upgraded from`),to:o().describe(`Version being upgraded to`),compatibility:Fhe,breakingChanges:S(J0).optional(),migrationRequired:v().default(!1),migrationComplexity:x([`trivial`,`simple`,`moderate`,`complex`,`major`]).optional(),estimatedMigrationTime:A().optional(),migrationScript:o().optional().describe(`Path to migration script`),testCoverage:A().min(0).max(100).optional().describe(`Percentage of migration covered by tests`)});l({pluginId:o(),currentVersion:o(),compatibilityMatrix:S(Y0),supportedVersions:S(l({version:o(),supported:v(),endOfLife:o().datetime().optional().describe(`End of support date`),securitySupport:v().default(!1).describe(`Still receives security updates`)})),minimumCompatibleVersion:o().optional().describe(`Oldest version that can be directly upgraded`)});var Lhe=l({type:x([`version-mismatch`,`missing-dependency`,`circular-dependency`,`incompatible-versions`,`conflicting-interfaces`]),plugins:S(l({pluginId:o(),version:o(),requirement:o().optional().describe(`What this plugin requires`)})),description:o(),resolutions:S(l({strategy:x([`upgrade`,`downgrade`,`replace`,`disable`,`manual`]),description:o(),automaticResolution:v().default(!1),riskLevel:x([`low`,`medium`,`high`])})).optional(),severity:x([`critical`,`error`,`warning`,`info`])});l({success:v(),resolved:S(l({pluginId:o(),version:o(),resolvedVersion:o()})).optional(),conflicts:S(Lhe).optional(),warnings:S(o()).optional(),installationOrder:S(o()).optional().describe(`Plugin IDs in order they should be installed`),dependencyGraph:u(o(),S(o())).optional().describe(`Map of plugin ID to its dependencies`)}),l({enabled:v().default(!1),maxConcurrentVersions:A().int().min(1).default(2).describe(`How many versions can run at the same time`),selectionStrategy:x([`latest`,`stable`,`compatible`,`pinned`,`canary`,`custom`]).default(`latest`),routing:S(l({condition:o().describe(`Routing condition (e.g., tenant, user, feature flag)`),version:o().describe(`Version to use when condition matches`),priority:A().int().default(100).describe(`Rule priority`)})).optional(),rollout:l({enabled:v().default(!1),strategy:x([`percentage`,`blue-green`,`canary`]),percentage:A().min(0).max(100).optional().describe(`Percentage of traffic to new version`),duration:A().int().optional().describe(`Rollout duration in milliseconds`)}).optional()}),l({pluginId:o(),version:Phe,versionString:o().describe(`Full version string (e.g., 1.2.3-beta.1+build.123)`),releaseDate:o().datetime(),releaseNotes:o().optional(),breakingChanges:S(J0).optional(),deprecations:S(Ihe).optional(),compatibilityMatrix:S(Y0).optional(),securityFixes:S(l({cve:o().optional().describe(`CVE identifier`),severity:x([`critical`,`high`,`medium`,`low`]),description:o(),fixedIn:o().describe(`Version where vulnerability was fixed`)})).optional(),statistics:l({downloads:A().int().min(0).optional(),installations:A().int().min(0).optional(),ratings:A().min(0).max(5).optional()}).optional(),support:l({status:x([`active`,`maintenance`,`deprecated`,`eol`]),endOfLife:o().datetime().optional(),securitySupport:v().default(!0)})});var X0=x([`singleton`,`transient`,`scoped`]).describe(`Service scope type`);l({name:o().min(1).describe(`Unique service name identifier`),scope:X0.optional().default(`singleton`).describe(`Service scope type`),type:o().optional().describe(`Service type or interface name`),registeredAt:A().int().optional().describe(`Unix timestamp in milliseconds when service was registered`),metadata:u(o(),b()).optional().describe(`Additional service-specific metadata`)}),l({strictMode:v().optional().default(!0).describe(`Throw errors on invalid operations (duplicate registration, service not found, etc.)`),allowOverwrite:v().optional().default(!1).describe(`Allow overwriting existing service registrations`),enableLogging:v().optional().default(!1).describe(`Enable logging for service registration and retrieval`),scopeTypes:S(o()).optional().describe(`Supported scope types`),maxServices:A().int().min(1).optional().describe(`Maximum number of services that can be registered`)}),l({name:o().min(1).describe(`Unique service name identifier`),scope:X0.optional().default(`singleton`).describe(`Service scope type`),factoryType:x([`sync`,`async`]).optional().default(`sync`).describe(`Whether factory is synchronous or asynchronous`),singleton:v().optional().default(!0).describe(`Whether to cache the factory result (singleton pattern)`)}),l({scopeType:o().describe(`Type of scope`),scopeId:o().optional().describe(`Unique scope identifier`),metadata:u(o(),b()).optional().describe(`Scope-specific context metadata`)}),l({scopeId:o().describe(`Unique scope identifier`),scopeType:o().describe(`Type of scope`),createdAt:A().int().describe(`Unix timestamp in milliseconds when scope was created`),serviceCount:A().int().min(0).optional().describe(`Number of services registered in this scope`),metadata:u(o(),b()).optional().describe(`Scope-specific context metadata`)}),l({timeout:A().int().min(0).optional().default(3e4).describe(`Maximum time in milliseconds to wait for each plugin to start`),rollbackOnFailure:v().optional().default(!0).describe(`Whether to rollback already-started plugins if any plugin fails`),healthCheck:v().optional().default(!1).describe(`Whether to run health checks after plugin startup`),parallel:v().optional().default(!1).describe(`Whether to start plugins in parallel when dependencies allow`),context:b().optional().describe(`Custom context object to pass to plugin lifecycle methods`)});var Rhe=l({healthy:v().describe(`Whether the plugin is healthy`),timestamp:A().int().describe(`Unix timestamp in milliseconds when health check was performed`),details:u(o(),b()).optional().describe(`Optional plugin-specific health details`),message:o().optional().describe(`Error message if plugin is unhealthy`)});l({results:S(l({plugin:l({name:o(),version:o().optional()}).passthrough().describe(`Plugin metadata`),success:v().describe(`Whether the plugin started successfully`),duration:A().min(0).describe(`Time taken to start the plugin in milliseconds`),error:l({name:o().describe(`Error class name`),message:o().describe(`Error message`),stack:o().optional().describe(`Stack trace`),code:o().optional().describe(`Error code`)}).optional().describe(`Serializable error representation if startup failed`),health:Rhe.optional().describe(`Health status after startup if health check was enabled`)})).describe(`Startup results for each plugin`),totalDuration:A().min(0).describe(`Total time taken for all plugins in milliseconds`),allSuccessful:v().describe(`Whether all plugins started successfully`),rolledBack:S(o()).optional().describe(`Names of plugins that were rolled back`)});var zhe=l({id:o().regex(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/).describe(`Vendor identifier (reverse domain)`),name:o(),website:o().url().optional(),email:o().email().optional(),verified:v().default(!1).describe(`Whether vendor is verified by ObjectStack`),trustLevel:x([`official`,`verified`,`community`,`unverified`]).default(`unverified`)}),Bhe=l({testCoverage:A().min(0).max(100).optional(),documentationScore:A().min(0).max(100).optional(),codeQuality:A().min(0).max(100).optional(),securityScan:l({lastScanDate:o().datetime().optional(),vulnerabilities:l({critical:A().int().min(0).default(0),high:A().int().min(0).default(0),medium:A().int().min(0).default(0),low:A().int().min(0).default(0)}).optional(),passed:v().default(!1)}).optional(),conformanceTests:S(l({protocolId:o().describe(`Protocol being tested`),passed:v(),totalTests:A().int().min(0),passedTests:A().int().min(0),lastRunDate:o().datetime().optional()})).optional()}),Vhe=l({downloads:A().int().min(0).default(0),downloadsLastMonth:A().int().min(0).default(0),activeInstallations:A().int().min(0).default(0),ratings:l({average:A().min(0).max(5).default(0),count:A().int().min(0).default(0),distribution:l({5:A().int().min(0).default(0),4:A().int().min(0).default(0),3:A().int().min(0).default(0),2:A().int().min(0).default(0),1:A().int().min(0).default(0)}).optional()}).optional(),stars:A().int().min(0).optional(),dependents:A().int().min(0).default(0)});l({id:o().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Plugin identifier (reverse domain notation)`),version:o().regex(/^\d+\.\d+\.\d+$/),name:o(),description:o().optional(),readme:o().optional(),category:x([`data`,`integration`,`ui`,`analytics`,`security`,`automation`,`ai`,`utility`,`driver`,`gateway`,`adapter`]).optional(),tags:S(o()).optional(),vendor:zhe,capabilities:F0.optional(),compatibility:l({minObjectStackVersion:o().optional(),maxObjectStackVersion:o().optional(),nodeVersion:o().optional(),platforms:S(x([`linux`,`darwin`,`win32`,`browser`])).optional()}).optional(),links:l({homepage:o().url().optional(),repository:o().url().optional(),documentation:o().url().optional(),bugs:o().url().optional(),changelog:o().url().optional()}).optional(),media:l({icon:o().url().optional(),logo:o().url().optional(),screenshots:S(o().url()).optional(),video:o().url().optional()}).optional(),quality:Bhe.optional(),statistics:Vhe.optional(),license:o().optional().describe(`SPDX license identifier`),pricing:l({model:x([`free`,`freemium`,`paid`,`enterprise`]),price:A().min(0).optional(),currency:o().default(`USD`).optional(),billingPeriod:x([`one-time`,`monthly`,`yearly`]).optional()}).optional(),publishedAt:o().datetime().optional(),updatedAt:o().datetime().optional(),deprecated:v().default(!1),deprecationMessage:o().optional(),replacedBy:o().optional().describe(`Plugin ID that replaces this one`),flags:l({experimental:v().default(!1),beta:v().default(!1),featured:v().default(!1),verified:v().default(!1)}).optional()}),l({query:o().optional(),category:S(o()).optional(),tags:S(o()).optional(),trustLevel:S(x([`official`,`verified`,`community`,`unverified`])).optional(),implementsProtocols:S(o()).optional(),pricingModel:S(x([`free`,`freemium`,`paid`,`enterprise`])).optional(),minRating:A().min(0).max(5).optional(),sortBy:x([`relevance`,`downloads`,`rating`,`updated`,`name`]).optional(),sortOrder:x([`asc`,`desc`]).default(`desc`).optional(),page:A().int().min(1).default(1).optional(),limit:A().int().min(1).max(100).default(20).optional()}),l({pluginId:o(),version:o().optional().describe(`Defaults to latest`),config:u(o(),b()).optional(),autoUpdate:v().default(!1).optional(),options:l({skipDependencies:v().default(!1).optional(),force:v().default(!1).optional(),target:x([`system`,`space`,`user`]).default(`space`).optional()}).optional()});var Hhe=x([`critical`,`high`,`medium`,`low`,`info`]).describe(`Severity level of a security vulnerability`),Uhe=l({cve:o().regex(/^CVE-\d{4}-\d+$/).optional().describe(`CVE identifier`),id:o().describe(`Vulnerability ID`),title:o().describe(`Short title summarizing the vulnerability`),description:o().describe(`Detailed description of the vulnerability`),severity:Hhe.describe(`Severity level of this vulnerability`),cvss:A().min(0).max(10).optional().describe(`CVSS score ranging from 0 to 10`),package:l({name:o().describe(`Name of the affected package`),version:o().describe(`Version of the affected package`),ecosystem:o().optional().describe(`Package ecosystem (e.g., npm, pip, maven)`)}).describe(`Affected package information`),vulnerableVersions:o().describe(`Semver range of vulnerable versions`),patchedVersions:o().optional().describe(`Semver range of patched versions`),references:S(l({type:x([`advisory`,`article`,`report`,`web`]).describe(`Type of reference source`),url:o().url().describe(`URL of the reference`)})).default([]).describe(`External references related to the vulnerability`),cwe:S(o()).default([]).describe(`CWE identifiers associated with this vulnerability`),publishedAt:o().datetime().optional().describe(`ISO 8601 date when the vulnerability was published`),mitigation:o().optional().describe(`Recommended steps to mitigate the vulnerability`)}).describe(`A known security vulnerability in a package dependency`);l({scanId:o().uuid().describe(`Unique identifier for this security scan`),plugin:l({id:o().describe(`Plugin identifier`),version:o().describe(`Plugin version that was scanned`)}).describe(`Plugin that was scanned`),scannedAt:o().datetime().describe(`ISO 8601 timestamp when the scan was performed`),scanner:l({name:o().describe(`Scanner name (e.g., snyk, osv, trivy)`),version:o().describe(`Version of the scanner tool`)}).describe(`Information about the scanner tool used`),status:x([`passed`,`failed`,`warning`]).describe(`Overall result status of the security scan`),vulnerabilities:S(Uhe).describe(`List of vulnerabilities discovered during the scan`),summary:l({critical:A().int().min(0).default(0).describe(`Count of critical severity vulnerabilities`),high:A().int().min(0).default(0).describe(`Count of high severity vulnerabilities`),medium:A().int().min(0).default(0).describe(`Count of medium severity vulnerabilities`),low:A().int().min(0).default(0).describe(`Count of low severity vulnerabilities`),info:A().int().min(0).default(0).describe(`Count of informational severity vulnerabilities`),total:A().int().min(0).default(0).describe(`Total count of all vulnerabilities`)}).describe(`Summary counts of vulnerabilities by severity`),licenseIssues:S(l({package:o().describe(`Name of the package with a license issue`),license:o().describe(`License identifier of the package`),reason:o().describe(`Reason the license is flagged`),severity:x([`error`,`warning`,`info`]).describe(`Severity of the license compliance issue`)})).default([]).describe(`License compliance issues found during the scan`),codeQuality:l({score:A().min(0).max(100).optional().describe(`Overall code quality score from 0 to 100`),issues:S(l({type:x([`security`,`quality`,`style`]).describe(`Category of the code quality issue`),severity:x([`error`,`warning`,`info`]).describe(`Severity of the code quality issue`),message:o().describe(`Description of the code quality issue`),file:o().optional().describe(`File path where the issue was found`),line:A().int().optional().describe(`Line number where the issue was found`)})).default([]).describe(`List of individual code quality issues`)}).optional().describe(`Code quality analysis results`),nextScanAt:o().datetime().optional().describe(`ISO 8601 timestamp for the next scheduled scan`)}).describe(`Result of a security scan performed on a plugin`),l({id:o().describe(`Unique identifier for the security policy`),name:o().describe(`Human-readable name of the security policy`),autoScan:l({enabled:v().default(!0).describe(`Whether automatic scanning is enabled`),frequency:x([`on-publish`,`daily`,`weekly`,`monthly`]).default(`daily`).describe(`How often automatic scans are performed`)}).describe(`Automatic security scanning configuration`),thresholds:l({maxCritical:A().int().min(0).default(0).describe(`Maximum allowed critical vulnerabilities before blocking`),maxHigh:A().int().min(0).default(0).describe(`Maximum allowed high vulnerabilities before blocking`),maxMedium:A().int().min(0).default(5).describe(`Maximum allowed medium vulnerabilities before warning`)}).describe(`Vulnerability count thresholds for policy enforcement`),allowedLicenses:S(o()).default([`MIT`,`Apache-2.0`,`BSD-3-Clause`,`BSD-2-Clause`,`ISC`]).describe(`List of SPDX license identifiers that are permitted`),prohibitedLicenses:S(o()).default([`GPL-3.0`,`AGPL-3.0`]).describe(`List of SPDX license identifiers that are prohibited`),codeSigning:l({required:v().default(!1).describe(`Whether code signing is required for plugins`),allowedSigners:S(o()).default([]).describe(`List of trusted signer identities`)}).optional().describe(`Code signing requirements for plugin artifacts`),sandbox:l({networkAccess:x([`none`,`localhost`,`allowlist`,`all`]).default(`all`).describe(`Level of network access granted to the plugin`),allowedDestinations:S(o()).default([]).describe(`Permitted network destinations when using allowlist mode`),filesystemAccess:x([`none`,`read-only`,`temp-only`,`full`]).default(`full`).describe(`Level of file system access granted to the plugin`),maxMemoryMB:A().int().positive().optional().describe(`Maximum memory allocation in megabytes`),maxCPUSeconds:A().int().positive().optional().describe(`Maximum CPU time allowed in seconds`)}).optional().describe(`Sandbox restrictions for plugin execution`)}).describe(`Security policy governing plugin scanning and enforcement`);var Whe=l({name:o().describe(`Package name or identifier`),versionConstraint:o().describe("Semver range (e.g., `^1.0.0`, `>=2.0.0 <3.0.0`)"),type:x([`required`,`optional`,`peer`,`dev`]).default(`required`).describe(`Category of the dependency relationship`),resolvedVersion:o().optional().describe(`Concrete version resolved during dependency resolution`)}).describe(`A package dependency with its version constraint`),Ghe=l({id:o().describe(`Unique identifier of the package`),version:o().describe(`Resolved version of the package`),dependencies:S(Whe).default([]).describe(`Dependencies required by this package`),depth:A().int().min(0).describe(`Depth level in the dependency tree (0 = root)`),isDirect:v().describe(`Whether this is a direct (top-level) dependency`),metadata:l({name:o().describe(`Display name of the package`),description:o().optional().describe(`Short description of the package`),license:o().optional().describe(`SPDX license identifier of the package`),homepage:o().url().optional().describe(`Homepage URL of the package`)}).optional().describe(`Additional metadata about the package`)}).describe(`A node in the dependency graph representing a resolved package`),Khe=l({root:l({id:o().describe(`Identifier of the root package`),version:o().describe(`Version of the root package`)}).describe(`Root package of the dependency graph`),nodes:S(Ghe).describe(`All resolved package nodes in the dependency graph`),edges:S(l({from:o().describe(`Package ID`),to:o().describe(`Package ID`),constraint:o().describe(`Version constraint`)})).describe(`Directed edges representing dependency relationships`),stats:l({totalDependencies:A().int().min(0).describe(`Total number of resolved dependencies`),directDependencies:A().int().min(0).describe(`Number of direct (top-level) dependencies`),maxDepth:A().int().min(0).describe(`Maximum depth of the dependency tree`)}).describe(`Summary statistics for the dependency graph`)}).describe(`Complete dependency graph for a package and its transitive dependencies`),qhe=l({package:o().describe(`Name of the package with conflicting version requirements`),conflicts:S(l({version:o().describe(`Conflicting version of the package`),requestedBy:S(o()).describe(`Packages that require this version`),constraint:o().describe(`Semver constraint that produced this version requirement`)})).describe(`List of conflicting version requirements`),resolution:l({strategy:x([`pick-highest`,`pick-lowest`,`manual`]).describe(`Strategy used to resolve the conflict`),version:o().optional().describe(`Resolved version selected by the strategy`),reason:o().optional().describe(`Explanation of why this resolution was chosen`)}).optional().describe(`Suggested resolution for the conflict`),severity:x([`error`,`warning`,`info`]).describe(`Severity level of the dependency conflict`)}).describe(`A detected conflict between dependency version requirements`);l({status:x([`success`,`conflict`,`error`]).describe(`Overall status of the dependency resolution`),graph:Khe.optional().describe(`Resolved dependency graph if resolution succeeded`),conflicts:S(qhe).default([]).describe(`List of dependency conflicts detected during resolution`),errors:S(l({package:o().describe(`Name of the package that caused the error`),error:o().describe(`Error message describing what went wrong`)})).default([]).describe(`Errors encountered during dependency resolution`),installOrder:S(o()).default([]).describe(`Topologically sorted list of package IDs for installation`),resolvedIn:A().int().min(0).optional().describe(`Time taken to resolve dependencies in milliseconds`)}).describe(`Result of a dependency resolution process`);var Jhe=l({name:o().describe(`Name of the software component`),version:o().describe(`Version of the software component`),purl:o().optional().describe(`Package URL identifier`),license:o().optional().describe(`SPDX license identifier of the component`),hashes:l({sha256:o().optional().describe(`SHA-256 hash of the component artifact`),sha512:o().optional().describe(`SHA-512 hash of the component artifact`)}).optional().describe(`Cryptographic hashes for integrity verification`),supplier:l({name:o().describe(`Name of the component supplier`),url:o().url().optional().describe(`URL of the component supplier`)}).optional().describe(`Supplier information for the component`),externalRefs:S(l({type:x([`website`,`repository`,`documentation`,`issue-tracker`]).describe(`Type of external reference`),url:o().url().describe(`URL of the external reference`)})).default([]).describe(`External references related to the component`)}).describe(`A single entry in a Software Bill of Materials`);l({format:x([`spdx`,`cyclonedx`]).default(`cyclonedx`).describe(`SBOM standard format used`),version:o().describe(`Version of the SBOM specification`),plugin:l({id:o().describe(`Plugin identifier`),version:o().describe(`Plugin version`),name:o().describe(`Human-readable plugin name`)}).describe(`Metadata about the plugin this SBOM describes`),components:S(Jhe).describe(`List of software components included in the plugin`),generatedAt:o().datetime().describe(`ISO 8601 timestamp when the SBOM was generated`),generator:l({name:o().describe(`Name of the SBOM generator tool`),version:o().describe(`Version of the SBOM generator tool`)}).optional().describe(`Tool used to generate this SBOM`)}).describe(`Software Bill of Materials for a plugin`),l({pluginId:o().describe(`Unique identifier of the plugin`),version:o().describe(`Version of the plugin artifact`),build:l({timestamp:o().datetime().describe(`ISO 8601 timestamp when the build was produced`),environment:l({os:o().describe(`Operating system used for the build`),arch:o().describe(`CPU architecture used for the build`),nodeVersion:o().describe(`Node.js version used for the build`)}).optional().describe(`Environment details where the build was executed`),source:l({repository:o().url().describe(`URL of the source repository`),commit:o().regex(/^[a-f0-9]{40}$/).describe(`Full SHA-1 commit hash of the source`),branch:o().optional().describe(`Branch name the build was produced from`),tag:o().optional().describe(`Git tag associated with the build`)}).optional().describe(`Source repository information for the build`),builder:l({name:o().describe(`Name of the person or system that produced the build`),email:o().email().optional().describe(`Email address of the builder`)}).optional().describe(`Identity of the builder who produced the artifact`)}).describe(`Build provenance information`),artifacts:S(l({filename:o().describe(`Name of the artifact file`),sha256:o().describe(`SHA-256 hash of the artifact`),size:A().int().positive().describe(`Size of the artifact in bytes`)})).describe(`List of build artifacts with integrity hashes`),signatures:S(l({algorithm:x([`rsa`,`ecdsa`,`ed25519`]).describe(`Cryptographic algorithm used for signing`),publicKey:o().describe(`Public key used to verify the signature`),signature:o().describe(`Digital signature value`),signedBy:o().describe(`Identity of the signer`),timestamp:o().datetime().describe(`ISO 8601 timestamp when the signature was created`)})).default([]).describe(`Cryptographic signatures for the plugin artifact`),attestations:S(l({type:x([`code-review`,`security-scan`,`test-results`,`ci-build`]).describe(`Type of attestation`),status:x([`passed`,`failed`]).describe(`Result status of the attestation`),url:o().url().optional().describe(`URL with details about the attestation`),timestamp:o().datetime().describe(`ISO 8601 timestamp when the attestation was issued`)})).default([]).describe(`Verification attestations for the plugin`)}).describe(`Verifiable provenance and chain of custody for a plugin artifact`),l({pluginId:o().describe(`Unique identifier of the plugin`),score:A().min(0).max(100).describe(`Overall trust score from 0 to 100`),components:l({vendorReputation:A().min(0).max(100).describe(`Vendor reputation score from 0 to 100`),securityScore:A().min(0).max(100).describe(`Security scan results score from 0 to 100`),codeQuality:A().min(0).max(100).describe(`Code quality score from 0 to 100`),communityScore:A().min(0).max(100).describe(`Community engagement score from 0 to 100`),maintenanceScore:A().min(0).max(100).describe(`Maintenance and update frequency score from 0 to 100`)}).describe(`Individual score components contributing to the overall trust score`),level:x([`verified`,`trusted`,`neutral`,`untrusted`,`blocked`]).describe(`Computed trust level based on the overall score`),badges:S(x([`official`,`verified-vendor`,`security-scanned`,`code-signed`,`open-source`,`popular`])).default([]).describe(`Verification badges earned by the plugin`),updatedAt:o().datetime().describe(`ISO 8601 timestamp when the trust score was last updated`)}).describe(`Trust score and verification status for a plugin`);var Yhe=l({userId:o().optional(),tenantId:o().optional(),roles:S(o()).default([]),permissions:S(o()).default([]),isSystem:v().default(!1),accessToken:o().optional(),transaction:b().optional(),traceId:o().optional()}),Xhe=l({key:o().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:o().optional().describe(`Fallback value when translation key is not found`),params:u(o(),c([o(),A(),v()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}),q=c([o(),Xhe]).describe(`Display label: plain string or i18n translation object`),Z0=l({ariaLabel:q.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:o().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:o().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);l({key:o().describe(`Translation key`),zero:o().optional().describe(`Zero form (e.g., "No items")`),one:o().optional().describe(`Singular form (e.g., "{count} item")`),two:o().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:o().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:o().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:o().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var Zhe=l({style:x([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:o().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:o().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:A().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:A().optional().describe(`Maximum number of fraction digits`),useGrouping:v().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),Qhe=l({dateStyle:x([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:x([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:o().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:v().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);l({code:o().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:S(o()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:x([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:Zhe.optional().describe(`Default number formatting rules`),dateFormat:Qhe.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var Q0=x(`bar.horizontal-bar.column.grouped-bar.stacked-bar.bi-polar-bar.line.area.stacked-area.step-line.spline.pie.donut.funnel.pyramid.scatter.bubble.treemap.sunburst.sankey.word-cloud.gauge.solid-gauge.metric.kpi.bullet.choropleth.bubble-map.gl-map.heatmap.radar.waterfall.box-plot.violin.candlestick.stock.table.pivot`.split(`.`)),$0=l({field:o().describe(`Data field key`),title:q.optional().describe(`Axis display title`),format:o().optional().describe(`Value format string (e.g., "$0,0.00")`),min:A().optional().describe(`Minimum value`),max:A().optional().describe(`Maximum value`),stepSize:A().optional().describe(`Step size for ticks`),showGridLines:v().default(!0),position:x([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:v().default(!1)}),$he=l({name:o().describe(`Field name or series identifier`),label:q.optional().describe(`Series display label`),type:Q0.optional().describe(`Override chart type for this series`),color:o().optional().describe(`Series color (hex/rgb/token)`),stack:o().optional().describe(`Stack identifier to group series`),yAxis:x([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`)}),ege=l({type:x([`line`,`region`]).default(`line`),axis:x([`x`,`y`]).default(`y`),value:c([A(),o()]).describe(`Start value`),endValue:c([A(),o()]).optional().describe(`End value for regions`),color:o().optional(),label:q.optional(),style:x([`solid`,`dashed`,`dotted`]).default(`dashed`)}),tge=l({tooltips:v().default(!0),zoom:v().default(!1),brush:v().default(!1),clickAction:o().optional().describe(`Action ID to trigger on click`)}),e2=l({type:Q0,title:q.optional().describe(`Chart title`),subtitle:q.optional().describe(`Chart subtitle`),description:q.optional().describe(`Accessibility description`),xAxis:$0.optional().describe(`X-Axis configuration`),yAxis:S($0).optional().describe(`Y-Axis configuration (support dual axis)`),series:S($he).optional().describe(`Defined series configuration`),colors:S(o()).optional().describe(`Color palette`),height:A().optional().describe(`Fixed height in pixels`),showLegend:v().default(!0).describe(`Display legend`),showDataLabels:v().default(!1).describe(`Display data labels`),annotations:S(ege).optional(),interaction:tge.optional(),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),t2=x([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),nge=l({xs:A().min(1).max(12).optional(),sm:A().min(1).max(12).optional(),md:A().min(1).max(12).optional(),lg:A().min(1).max(12).optional(),xl:A().min(1).max(12).optional(),"2xl":A().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),rge=l({xs:A().optional(),sm:A().optional(),md:A().optional(),lg:A().optional(),xl:A().optional(),"2xl":A().optional()}).describe(`Display order per breakpoint`),n2=l({breakpoint:t2.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:S(t2).optional().describe(`Hide on these breakpoints`),columns:nge.optional().describe(`Grid columns per breakpoint`),order:rge.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),r2=l({lazyLoad:v().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:l({enabled:v().default(!1).describe(`Enable virtual scrolling`),itemHeight:A().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:A().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:x([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:v().optional().describe(`Prefetch data before component is visible`),pageSize:A().optional().describe(`Number of items per page for pagination`),debounceMs:A().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),ige=o().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`),i2=o().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`);o().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`);var a2=l({enabled:v().default(!1).describe(`Enable public sharing`),publicLink:o().optional().describe(`Generated public share URL`),password:o().optional().describe(`Password required to access shared link`),allowedDomains:S(o()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:o().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:v().optional().default(!1).describe(`Allow access without authentication`)}),age=l({enabled:v().default(!1).describe(`Enable iframe embedding`),allowedOrigins:S(o()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:o().optional().default(`100%`).describe(`Embed width (CSS value)`),height:o().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:v().optional().default(!0).describe(`Show interface header in embed`),showNavigation:v().optional().default(!1).describe(`Show navigation in embed`),responsive:v().optional().default(!0).describe(`Enable responsive resizing`)}),o2=l({id:i2.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:q.describe(`Display proper label`),icon:o().optional().describe(`Icon name`),order:A().optional().describe(`Sort order within the same level (lower = first)`),badge:c([o(),A()]).optional().describe(`Badge text or count displayed on the item`),visible:o().optional().describe(`Visibility formula condition`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this item`)}),oge=o2.extend({type:p(`object`),objectName:o().describe(`Target object name`),viewName:o().optional().describe(`Default list view to open. Defaults to "all"`)}),sge=o2.extend({type:p(`dashboard`),dashboardName:o().describe(`Target dashboard name`)}),cge=o2.extend({type:p(`page`),pageName:o().describe(`Target custom page component name`),params:u(o(),b()).optional().describe(`Parameters passed to the page context`)}),lge=o2.extend({type:p(`url`),url:o().describe(`Target external URL`),target:x([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),uge=o2.extend({type:p(`report`),reportName:o().describe(`Target report name`)}),dge=o2.extend({type:p(`action`),actionDef:l({actionName:o().describe(`Action machine name to execute`),params:u(o(),b()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),fge=o2.extend({type:p(`group`),expanded:v().default(!1).describe(`Default expansion state in sidebar`)}),s2=j(()=>c([oge.extend({children:S(s2).optional().describe(`Child navigation items (e.g. specific views)`)}),sge,cge,lge,uge,dge,fge.extend({children:S(s2).describe(`Child navigation items`)})])),pge=l({primaryColor:o().optional().describe(`Primary theme color hex code`),logo:o().optional().describe(`Custom logo URL for this app`),favicon:o().optional().describe(`Custom favicon URL for this app`)}),mge=l({id:i2.describe(`Unique area identifier (lowercase snake_case)`),label:q.describe(`Area display label`),icon:o().optional().describe(`Area icon name`),order:A().optional().describe(`Sort order among areas (lower = first)`),description:q.optional().describe(`Area description`),visible:o().optional().describe(`Visibility formula condition for this area`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this area`),navigation:S(s2).describe(`Navigation items within this area`)}),hge=l({name:i2.describe(`App unique machine name (lowercase snake_case)`),label:q.describe(`App display label`),version:o().optional().describe(`App version`),description:q.optional().describe(`App description`),icon:o().optional().describe(`App icon used in the App Launcher`),branding:pge.optional().describe(`App-specific branding`),active:v().optional().default(!0).describe(`Whether the app is enabled`),isDefault:v().optional().default(!1).describe(`Is default app`),navigation:S(s2).optional().describe(`Full navigation tree for the app sidebar`),areas:S(mge).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:o().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this app`),objects:S(b()).optional().describe(`Objects belonging to this app`),apis:S(b()).optional().describe(`Custom APIs belonging to this app`),sharing:a2.optional().describe(`Public sharing configuration`),embed:age.optional().describe(`Iframe embedding configuration`),mobileNavigation:l({mode:x([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:S(o()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes for the application`)}),gge=x([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),_ge=x([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),c2=l({url:o().describe(`API endpoint URL`),method:_ge.optional().default(`GET`).describe(`HTTP method`),headers:u(o(),o()).optional().describe(`Custom HTTP headers`),params:u(o(),b()).optional().describe(`Query parameters`),body:b().optional().describe(`Request body for POST/PUT/PATCH`)});l({enabled:v().default(!0).describe(`Enable CORS`),origins:c([o(),S(o())]).default(`*`).describe(`Allowed origins (* for all)`),methods:S(gge).optional().describe(`Allowed HTTP methods`),credentials:v().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:A().int().optional().describe(`Preflight cache duration in seconds`)}),l({enabled:v().default(!1).describe(`Enable rate limiting`),windowMs:A().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:A().int().default(100).describe(`Max requests per window`)}),l({path:o().describe(`URL path to serve from`),directory:o().describe(`Physical directory to serve`),cacheControl:o().optional().describe(`Cache-Control header value`)});var l2=d(`provider`,[l({provider:p(`object`),object:o().describe(`Target object name`)}),l({provider:p(`api`),read:c2.optional().describe(`Configuration for fetching data`),write:c2.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),l({provider:p(`value`),items:S(b()).describe(`Static data array`)})]),u2=l({field:o().describe(`Field name to filter on`),operator:o().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:c([o(),A(),v(),h(),S(c([o(),A()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),vge=x([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),yge=l({field:o().describe(`Field name (snake_case)`),label:q.optional().describe(`Display label override`),width:A().positive().optional().describe(`Column width in pixels`),align:x([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:v().optional().describe(`Hide column by default`),sortable:v().optional().describe(`Allow sorting by this column`),resizable:v().optional().describe(`Allow resizing this column`),wrap:v().optional().describe(`Allow text wrapping`),type:o().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:x([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:vge.optional().describe(`Footer aggregation function for this column`),link:v().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:o().optional().describe(`Registered Action ID to execute when clicked`)}),bge=l({type:x([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),xge=l({pageSize:A().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:S(A().int().positive()).optional().describe(`Available page size options`)}),Sge=x([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),Cge=l({fields:S(l({field:o().describe(`Field name to group by`),order:x([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:v().default(!1).describe(`Collapse groups by default`)})).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),wge=l({coverField:o().optional().describe(`Attachment/image field to display as card cover`),coverFit:x([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:x([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:o().optional().describe(`Field to display as card title`),visibleFields:S(o()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),Tge=l({startDateField:o().describe(`Field for timeline item start date`),endDateField:o().optional().describe(`Field for timeline item end date`),titleField:o().describe(`Field to display as timeline item title`),groupByField:o().optional().describe(`Field to group timeline rows`),colorField:o().optional().describe(`Field to determine item color`),scale:x([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),Ege=l({type:x([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:o().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),Dge=l({field:o().describe(`Field to derive color from (typically a select/status field)`),colors:u(o(),o()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),Oge=x([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),d2=l({sort:v().default(!0).describe(`Allow users to sort records`),search:v().default(!0).describe(`Allow users to search records`),filter:v().default(!0).describe(`Allow users to filter records`),rowHeight:v().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:v().default(!1).describe(`Add records through a form instead of inline`),buttons:S(o()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),f2=l({showDescription:v().default(!0).describe(`Show the view description text`),allowedVisualizations:S(Oge).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),p2=l({name:i2.describe(`Tab identifier (snake_case)`),label:q.optional().describe(`Display label`),icon:o().optional().describe(`Tab icon name`),view:o().optional().describe(`Referenced list view name from listViews`),filter:S(u2).optional().describe(`Tab-specific filter criteria`),order:A().int().min(0).optional().describe(`Tab display order`),pinned:v().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:v().default(!1).describe(`Set as the default active tab`),visible:v().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),m2=l({enabled:v().default(!0).describe(`Show the add record entry point`),position:x([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:x([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:o().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),kge=l({groupByField:o().describe(`Field to group columns by (usually status/select)`),summarizeField:o().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:S(o()).describe(`Fields to show on cards`)}),Age=l({startDateField:o(),endDateField:o().optional(),titleField:o(),colorField:o().optional()}),jge=l({startDateField:o(),endDateField:o(),titleField:o(),progressField:o().optional(),dependenciesField:o().optional()}),Mge=l({mode:x([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]).default(`page`),view:o().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:v().default(!1).describe(`Disable standard navigation entirely`),openNewTab:v().default(!1).describe(`Force open in new tab (applies to page mode)`),width:c([o(),A()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),h2=l({name:i2.optional().describe(`Internal view name (lowercase snake_case)`),label:q.optional(),type:x([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:l2.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:c([S(o()),S(yge)]).describe(`Fields to display as columns`),filter:S(u2).optional().describe(`Filter criteria (JSON Rules)`),sort:c([o(),S(l({field:o(),order:x([`asc`,`desc`])}))]).optional(),searchableFields:S(o()).optional().describe(`Fields enabled for search`),filterableFields:S(o()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:S(l({field:o().describe(`Field name to filter by`),label:o().optional().describe(`Display label for the chip`),operator:x([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:c([o(),A(),v(),h(),S(c([o(),A()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:v().optional().describe(`Enable column resizing`),striped:v().optional().describe(`Striped row styling`),bordered:v().optional().describe(`Show borders`),selection:bge.optional().describe(`Row selection configuration`),navigation:Mge.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:xge.optional().describe(`Pagination configuration`),kanban:kge.optional(),calendar:Age.optional(),gantt:jge.optional(),gallery:wge.optional(),timeline:Tge.optional(),description:q.optional().describe(`View description for documentation/tooltips`),sharing:Ege.optional().describe(`View sharing and access configuration`),rowHeight:Sge.optional().describe(`Row height / density setting`),grouping:Cge.optional().describe(`Group records by one or more fields`),rowColor:Dge.optional().describe(`Color rows based on field value`),hiddenFields:S(o()).optional().describe(`Fields to hide in this specific view`),fieldOrder:S(o()).optional().describe(`Explicit field display order for this view`),rowActions:S(o()).optional().describe(`Actions available for individual row items`),bulkActions:S(o()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:v().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:S(l({condition:o().describe(`Condition expression to evaluate`),style:u(o(),o()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:v().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:S(x([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:d2.optional().describe(`User action toggles for the view toolbar`),appearance:f2.optional().describe(`Appearance and visualization configuration`),tabs:S(p2).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:m2.optional().describe(`Add record entry point configuration`),showRecordCount:v().optional().describe(`Show record count at the bottom of the list`),allowPrinting:v().optional().describe(`Allow users to print the view`),emptyState:l({title:q.optional(),message:q.optional(),icon:o().optional()}).optional().describe(`Empty state configuration when no records found`),aria:Z0.optional().describe(`ARIA accessibility attributes for the list view`),responsive:n2.optional().describe(`Responsive layout configuration`),performance:r2.optional().describe(`Performance optimization settings`)}),Nge=l({field:o().describe(`Field name (snake_case)`),label:q.optional().describe(`Display label override`),placeholder:q.optional().describe(`Placeholder text`),helpText:q.optional().describe(`Help/hint text`),readonly:v().optional().describe(`Read-only override`),required:v().optional().describe(`Required override`),hidden:v().optional().describe(`Hidden override`),colSpan:A().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:o().optional().describe(`Custom widget/component name`),dependsOn:o().optional().describe(`Parent field name for cascading`),visibleOn:o().optional().describe(`Visibility condition expression`)}),g2=l({label:q.optional(),collapsible:v().default(!1),collapsed:v().default(!1),columns:x([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:S(c([o(),Nge]))}),_2=l({type:x([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:l2.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:S(g2).optional(),groups:S(g2).optional(),defaultSort:S(l({field:o().describe(`Field name to sort by`),order:x([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:a2.optional().describe(`Public sharing configuration for this form`),aria:Z0.optional().describe(`ARIA accessibility attributes for the form view`)});l({list:h2.optional(),form:_2.optional(),listViews:u(o(),h2).optional().describe(`Additional named list views`),formViews:u(o(),_2).optional().describe(`Additional named form views`)});var v2=l({$field:o().describe(`Field Reference/Column Name`)});l({$eq:T().optional(),$ne:T().optional()}),l({$gt:c([A(),_(),v2]).optional(),$gte:c([A(),_(),v2]).optional(),$lt:c([A(),_(),v2]).optional(),$lte:c([A(),_(),v2]).optional()}),l({$in:S(T()).optional(),$nin:S(T()).optional()}),l({$between:a([c([A(),_(),v2]),c([A(),_(),v2])]).optional()}),l({$contains:o().optional(),$notContains:o().optional(),$startsWith:o().optional(),$endsWith:o().optional()}),l({$null:v().optional(),$exists:v().optional()});var y2=l({$eq:T().optional(),$ne:T().optional(),$gt:c([A(),_(),v2]).optional(),$gte:c([A(),_(),v2]).optional(),$lt:c([A(),_(),v2]).optional(),$lte:c([A(),_(),v2]).optional(),$in:S(T()).optional(),$nin:S(T()).optional(),$between:a([c([A(),_(),v2]),c([A(),_(),v2])]).optional(),$contains:o().optional(),$notContains:o().optional(),$startsWith:o().optional(),$endsWith:o().optional(),$null:v().optional(),$exists:v().optional()}),b2=j(()=>u(o(),b()).and(l({$and:S(b2).optional(),$or:S(b2).optional(),$not:b2.optional()})));l({where:b2.optional()});var x2=j(()=>l({$and:S(c([u(o(),y2),x2])).optional(),$or:S(c([u(o(),y2),x2])).optional(),$not:c([u(o(),y2),x2]).optional()})),Pge=x([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`),S2=x([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`),Fge=l({label:q.describe(`Action button label`),actionUrl:o().describe(`URL or target for the action`),actionType:S2.optional().describe(`Type of action`),icon:o().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`),Ige=l({showTitle:v().default(!0).describe(`Show dashboard title in header`),showDescription:v().default(!0).describe(`Show dashboard description in header`),actions:S(Fge).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`),Lge=l({valueField:o().describe(`Field to aggregate`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:q.optional().describe(`Measure display label`),format:o().optional().describe(`Number format string`)}).describe(`Widget measure definition`),Rge=l({id:i2.describe(`Unique widget identifier (snake_case)`),title:q.optional().describe(`Widget title`),description:q.optional().describe(`Widget description text below the header`),type:Q0.default(`metric`).describe(`Visualization type`),chartConfig:e2.optional().describe(`Chart visualization configuration`),colorVariant:Pge.optional().describe(`Widget color variant for theming`),actionUrl:o().optional().describe(`URL or target for the widget action button`),actionType:S2.optional().describe(`Type of action for the widget action button`),actionIcon:o().optional().describe(`Icon identifier for the widget action button`),object:o().optional().describe(`Data source object name`),filter:b2.optional().describe(`Data filter criteria`),categoryField:o().optional().describe(`Field for grouping (X-Axis)`),valueField:o().optional().describe(`Field for values (Y-Axis)`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:S(Lge).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:l({x:A(),y:A(),w:A(),h:A()}).describe(`Grid layout position`),options:b().optional().describe(`Widget specific configuration`),responsive:n2.optional().describe(`Responsive layout configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),zge=l({object:o().describe(`Source object name`),valueField:o().describe(`Field to use as option value`),labelField:o().describe(`Field to use as option label`),filter:b2.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`),Bge=l({field:o().describe(`Field name to filter on`),label:q.optional().describe(`Display label for the filter`),type:x([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:S(l({value:c([o(),A(),v()]).describe(`Option value`),label:q})).optional().describe(`Static filter options`),optionsFrom:zge.optional().describe(`Dynamic filter options from object`),defaultValue:c([o(),A(),v()]).optional().describe(`Default filter value`),scope:x([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:S(o()).optional().describe(`Widget IDs to apply this filter to`)});l({name:i2.describe(`Dashboard unique name`),label:q.describe(`Dashboard label`),description:q.optional().describe(`Dashboard description`),header:Ige.optional().describe(`Dashboard header configuration`),widgets:S(Rge).describe(`Widgets to display`),refreshInterval:A().optional().describe(`Auto-refresh interval in seconds`),dateRange:l({field:o().optional().describe(`Default date field name for time-based filtering`),defaultRange:x([`today`,`yesterday`,`this_week`,`last_week`,`this_month`,`last_month`,`this_quarter`,`last_quarter`,`this_year`,`last_year`,`last_7_days`,`last_30_days`,`last_90_days`,`custom`]).default(`this_month`).describe(`Default date range preset`),allowCustomRange:v().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:S(Bge).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:Z0.optional().describe(`ARIA accessibility attributes`),performance:r2.optional().describe(`Performance optimization settings`)});var Vge=x([`tabular`,`summary`,`matrix`,`joined`]),Hge=l({field:o().describe(`Field name`),label:q.optional().describe(`Override label`),aggregate:x([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:n2.optional().describe(`Responsive visibility for this column`)}),C2=l({field:o().describe(`Field to group by`),sortOrder:x([`asc`,`desc`]).default(`asc`),dateGranularity:x([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)}),Uge=e2.extend({xAxis:o().describe(`Grouping field for X-Axis`),yAxis:o().describe(`Summary field for Y-Axis`),groupBy:o().optional().describe(`Additional grouping field`)});l({name:i2.describe(`Report unique name`),label:q.describe(`Report label`),description:q.optional(),objectName:o().describe(`Primary object`),type:Vge.default(`tabular`).describe(`Report format type`),columns:S(Hge).describe(`Columns to display`),groupingsDown:S(C2).optional().describe(`Row groupings`),groupingsAcross:S(C2).optional().describe(`Column groupings (Matrix only)`),filter:b2.optional().describe(`Filter criteria`),chart:Uge.optional().describe(`Embedded chart configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes`),performance:r2.optional().describe(`Performance optimization settings`)});var Wge=x([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),Gge=x([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),Kge=l({enabled:v().default(!1).describe(`Enable automatic key rotation`),frequencyDays:A().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:A().default(3).describe(`Number of old key versions to retain`),autoRotate:v().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),w2=l({enabled:v().default(!1).describe(`Enable field-level encryption`),algorithm:Wge.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:l({provider:Gge.describe(`Key management service provider`),keyId:o().optional().describe(`Key identifier in the provider`),rotationPolicy:Kge.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:x([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:v().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:v().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);l({fieldName:o().describe(`Name of the field to encrypt`),encryptionConfig:w2.describe(`Encryption settings for this field`),indexable:v().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var qge=x([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),T2=l({field:o().describe(`Field name to apply masking to`),strategy:qge.describe(`Masking strategy to use`),pattern:o().optional().describe(`Regex pattern for partial masking`),preserveFormat:v().default(!0).describe(`Keep the original data format after masking`),preserveLength:v().default(!0).describe(`Keep the original data length after masking`),roles:S(o()).optional().describe(`Roles that see masked data`),exemptRoles:S(o()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);l({enabled:v().default(!1).describe(`Enable data masking`),rules:S(T2).describe(`List of field-level masking rules`),auditUnmasking:v().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var E2=x(`text.textarea.email.url.phone.password.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),Jge=l({label:o().describe(`Display label (human-readable, any case allowed)`),value:ige.describe(`Stored value (lowercase machine identifier)`),color:o().optional().describe(`Color code for badges/charts`),default:v().optional().describe(`Is default option`)});l({latitude:A().min(-90).max(90).describe(`Latitude coordinate`),longitude:A().min(-180).max(180).describe(`Longitude coordinate`),altitude:A().optional().describe(`Altitude in meters`),accuracy:A().optional().describe(`Accuracy in meters`)});var Yge=l({precision:A().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:x([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:o().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});l({value:A().describe(`Monetary amount`),currency:o().length(3).describe(`Currency code (ISO 4217)`)}),l({street:o().optional().describe(`Street address`),city:o().optional().describe(`City name`),state:o().optional().describe(`State/Province`),postalCode:o().optional().describe(`Postal/ZIP code`),country:o().optional().describe(`Country name or code`),countryCode:o().optional().describe(`ISO country code (e.g., US, GB)`),formatted:o().optional().describe(`Formatted address string`)});var Xge=l({dimensions:A().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:x([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:v().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:v().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:x([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),Zge=l({minSize:A().min(0).optional().describe(`Minimum file size in bytes`),maxSize:A().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:S(o()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:S(o()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:S(o()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:S(o()).optional().describe(`Blocked MIME types`),virusScan:v().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:x([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:v().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:v().default(!0).describe(`Quarantine files if threat detected`),storageProvider:o().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:o().optional().describe(`Target bucket name`),storagePrefix:o().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:l({minWidth:A().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:A().min(1).optional().describe(`Maximum image width in pixels`),minHeight:A().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:A().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:o().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:v().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:S(l({name:o().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:A().min(1).describe(`Thumbnail width in pixels`),height:A().min(1).describe(`Thumbnail height in pixels`),crop:v().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:v().default(!1).describe(`Preserve EXIF metadata`),autoRotate:v().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:v().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:v().default(!0).describe(`Allow replacing existing files`),allowDelete:v().default(!0).describe(`Allow deleting uploaded files`),requireUpload:v().default(!1).describe(`Require at least one file when field is required`),extractMetadata:v().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:v().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:v().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:A().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:v().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:A().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`}),Qge=l({uniqueness:v().default(!1).describe(`Enforce unique values across all records`),completeness:A().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:l({source:o().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:A().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),$ge=l({enabled:v().describe(`Enable caching for computed field results`),ttl:A().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:S(o()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),e_e=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:o().optional().describe(`Human readable label`),type:E2.describe(`Field Data Type`),description:o().optional().describe(`Tooltip/Help text`),format:o().optional().describe(`Format string (e.g. email, phone)`),columnName:o().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:v().default(!1).describe(`Is required`),searchable:v().default(!1).describe(`Is searchable`),multiple:v().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:v().default(!1).describe(`Is unique constraint`),defaultValue:b().optional().describe(`Default value`),maxLength:A().optional().describe(`Max character length`),minLength:A().optional().describe(`Min character length`),precision:A().optional().describe(`Total digits`),scale:A().optional().describe(`Decimal places`),min:A().optional().describe(`Minimum value`),max:A().optional().describe(`Maximum value`),options:S(Jge).optional().describe(`Static options for select/multiselect`),reference:o().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:S(o()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:v().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:x([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:o().optional().describe(`Formula expression`),summaryOperations:l({object:o().describe(`Source child object name for roll-up`),field:o().describe(`Field on child object to aggregate`),function:x([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:o().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:o().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:v().optional().describe(`Show line numbers in code editor`),maxRating:A().optional().describe(`Maximum rating value (default: 5)`),allowHalf:v().optional().describe(`Allow half-star ratings`),displayMap:v().optional().describe(`Display map widget for location field`),allowGeocoding:v().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:x([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:x([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:v().optional().describe(`Allow transparency/alpha channel`),presetColors:S(o()).optional().describe(`Preset color options`),step:A().optional().describe(`Step increment for slider (default: 1)`),showValue:v().optional().describe(`Display current value on slider`),marks:u(o(),o()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:x([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:x([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:v().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:v().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:Yge.optional().describe(`Configuration for currency field type`),vectorConfig:Xge.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:Zge.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:w2.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:T2.optional().describe(`Data masking rules for PII protection`),auditTrail:v().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:S(o()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:$ge.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Qge.optional().describe(`Data quality validation and monitoring rules`),group:o().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:o().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:v().default(!1).describe(`Hidden from default UI`),readonly:v().default(!1).describe(`Read-only in UI`),sortable:v().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:o().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:v().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:v().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:o().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:v().default(!1).describe(`Create standard database index`),externalId:v().default(!1).describe(`Is external ID for upsert operations`)}),t_e=l({name:o(),label:q,type:E2,required:v().default(!1),options:S(l({label:q,value:o()})).optional()}),D2=x([`script`,`url`,`modal`,`flow`,`api`]),n_e=new Set(D2.options.filter(e=>e!==`script`));l({name:i2.describe(`Machine name (lowercase snake_case)`),label:q.describe(`Display label`),objectName:o().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:o().optional().describe(`Icon name`),locations:S(x([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:x([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:D2.default(`script`).describe(`Action functionality type`),target:o().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:o().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:S(t_e).optional().describe(`Input parameters required from user`),variant:x([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:q.optional().describe(`Confirmation message before execution`),successMessage:q.optional().describe(`Success message to show after execution`),refreshAfter:v().default(!1).describe(`Refresh view after execution`),visible:o().optional().describe(`Formula returning boolean`),disabled:c([v(),o()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:o().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:v().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:A().optional().describe(`Maximum execution time in milliseconds for the action`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(n_e.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var r_e=x([`asc`,`desc`]).describe(`Sort order direction`),O2=l({field:o().describe(`Field name to sort by`),order:r_e.describe(`Sort direction`)}).describe(`Sort field and direction pair`);x([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),x([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),x([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var i_e=l({name:o().describe(`Region name (e.g. "sidebar", "main", "header")`),width:x([`small`,`medium`,`large`,`full`]).optional(),components:S(j(()=>s_e)).describe(`Components in this region`)}),a_e=x(`page:header.page:footer.page:sidebar.page:tabs.page:accordion.page:card.page:section.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.ai:chat_window.ai:suggestion.element:text.element:number.element:image.element:divider.element:button.element:filter.element:form.element:record_picker`.split(`.`)),o_e=l({object:o().describe(`Object to query`),view:o().optional().describe(`Named view to apply`),filter:b2.optional().describe(`Additional filter criteria`),sort:S(O2).optional().describe(`Sort order`),limit:A().int().positive().optional().describe(`Max records to display`)}),s_e=l({type:c([a_e,o()]).describe(`Component Type (Standard enum or custom string)`),id:o().optional().describe(`Unique instance ID`),label:q.optional(),properties:u(o(),b()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:u(o(),o()).optional().describe(`Event handlers map`),style:u(o(),o()).optional().describe(`Inline styles or utility classes`),className:o().optional().describe(`CSS class names`),visibility:o().optional().describe(`Visibility filter/formula`),dataSource:o_e.optional().describe(`Per-element data binding for multi-object pages`),responsive:n2.optional().describe(`Responsive layout configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),c_e=l({name:o().describe(`Variable name`),type:x([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:b().optional(),source:o().optional().describe(`Component ID that writes to this variable`)}),l_e=l({componentId:o().describe(`Reference to a PageComponent.id in the page`),x:A().int().min(0).describe(`Grid column position (0-based)`),y:A().int().min(0).describe(`Grid row position (0-based)`),width:A().int().min(1).describe(`Width in grid columns`),height:A().int().min(1).describe(`Height in grid rows`)}),u_e=l({columns:A().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:A().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:A().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:S(l_e).describe(`Positioned components on the canvas`)}),d_e=x([`record`,`home`,`app`,`utility`,`dashboard`,`grid`,`list`,`gallery`,`kanban`,`calendar`,`timeline`,`form`,`record_detail`,`record_review`,`overview`,`blank`]).describe(`Page type — platform or interface page types`),f_e=l({object:o().describe(`Target object for review`),filter:b2.optional().describe(`Filter criteria for review queue`),sort:S(O2).optional().describe(`Sort order for review queue`),displayFields:S(o()).optional().describe(`Fields to display on the review page`),actions:S(l({label:o().describe(`Action button label`),type:x([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:o().optional().describe(`Field to update on action`),value:c([o(),A(),v()]).optional().describe(`Value to set on action`),nextRecord:v().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:x([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:v().optional().default(!0).describe(`Show review progress indicator`)}),p_e=l({source:o().optional().describe(`Source object name for the page`),levels:A().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:S(u2).optional().describe(`Page-level filter criteria`),appearance:f2.optional().describe(`Appearance and visualization configuration`),userFilters:l({elements:S(x([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:S(p2).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:d2.optional().describe(`User action toggles`),addRecord:m2.optional().describe(`Add record entry point configuration`),showRecordCount:v().optional().describe(`Show record count at page bottom`),allowPrinting:v().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`);l({name:i2.describe(`Page unique name (lowercase snake_case)`),label:q,description:q.optional(),icon:o().optional().describe(`Page icon name`),type:d_e.default(`record`).describe(`Page type`),variables:S(c_e).optional().describe(`Local page state variables`),object:o().optional().describe(`Bound object (for Record pages)`),recordReview:f_e.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:u_e.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:o().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:S(i_e).describe(`Defined regions with components`),isDefault:v().default(!1),assignedProfiles:S(o()).optional(),interfaceConfig:p_e.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:le.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:le.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`})});var m_e=l({onMount:o().optional().describe(`Initialization code when widget mounts`),onUpdate:o().optional().describe(`Code to run when props change`),onUnmount:o().optional().describe(`Cleanup code when widget unmounts`),onValidate:o().optional().describe(`Custom validation logic`),onFocus:o().optional().describe(`Code to run on focus`),onBlur:o().optional().describe(`Code to run on blur`),onError:o().optional().describe(`Error handling code`)}),h_e=l({name:o().describe(`Event name`),label:q.optional().describe(`Human-readable event label`),description:q.optional().describe(`Event description and usage`),bubbles:v().default(!1).describe(`Whether event bubbles`),cancelable:v().default(!1).describe(`Whether event is cancelable`),payload:u(o(),b()).optional().describe(`Event payload schema`)}),g_e=l({name:o().describe(`Property name (camelCase)`),label:q.optional().describe(`Human-readable label`),type:x([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:v().default(!1).describe(`Whether property is required`),default:b().optional().describe(`Default value`),description:q.optional().describe(`Property description`),validation:u(o(),b()).optional().describe(`Validation rules`),category:o().optional().describe(`Property category`)}),__e=d(`type`,[l({type:p(`npm`),packageName:o().describe(`NPM package name`),version:o().default(`latest`),exportName:o().optional().describe(`Named export (default: default)`)}),l({type:p(`remote`),url:o().url().describe(`Remote entry URL (.js)`),moduleName:o().describe(`Exposed module name`),scope:o().describe(`Remote scope name`)}),l({type:p(`inline`),code:o().describe(`JavaScript code body`)})]);l({name:i2.describe(`Widget identifier (snake_case)`),label:q.describe(`Widget display name`),description:q.optional().describe(`Widget description`),version:o().optional().describe(`Widget version (semver)`),author:o().optional().describe(`Widget author`),icon:o().optional().describe(`Widget icon`),fieldTypes:S(o()).optional().describe(`Supported field types`),category:x([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:m_e.optional().describe(`Lifecycle hooks`),events:S(h_e).optional().describe(`Custom events`),properties:S(g_e).optional().describe(`Configuration properties`),implementation:__e.optional().describe(`Widget implementation source`),dependencies:S(l({name:o(),version:o().optional(),url:o().url().optional()})).optional().describe(`Widget dependencies`),screenshots:S(o().url()).optional().describe(`Screenshot URLs`),documentation:o().url().optional().describe(`Documentation URL`),license:o().optional().describe(`License (SPDX identifier)`),tags:S(o()).optional().describe(`Tags for categorization`),aria:Z0.optional().describe(`ARIA accessibility attributes`),performance:r2.optional().describe(`Performance optimization settings`)}),l({value:b().describe(`Current field value`),onChange:O().input(a([b()])).output(g()).describe(`Callback to update field value`),readonly:v().default(!1).describe(`Read-only mode flag`),required:v().default(!1).describe(`Required field flag`),error:o().optional().describe(`Validation error message`),field:e_e.describe(`Field schema definition`),record:u(o(),b()).optional().describe(`Complete record data`),options:u(o(),b()).optional().describe(`Custom widget options`)});var k2=x([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),v_e=l({type:x([`user`,`team`,`record`]).describe(`Mention target type`),id:o().describe(`Target ID`),name:o().describe(`Display name for rendering`),offset:A().int().min(0).describe(`Character offset in body text`),length:A().int().min(1).describe(`Length of mention token in body text`)}),y_e=l({field:o().describe(`Field machine name`),fieldLabel:o().optional().describe(`Field display label`),oldValue:b().optional().describe(`Previous value`),newValue:b().optional().describe(`New value`),oldDisplayValue:o().optional().describe(`Human-readable old value`),newDisplayValue:o().optional().describe(`Human-readable new value`)}),b_e=l({emoji:o().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:S(o()).describe(`Users who reacted`),count:A().int().min(1).describe(`Total reaction count`)}),x_e=l({type:x([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:o().describe(`Actor ID`),name:o().optional().describe(`Actor display name`),avatarUrl:o().url().optional().describe(`Actor avatar URL`),source:o().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),S_e=x([`public`,`internal`,`private`]);l({id:o().describe(`Feed item ID`),type:k2.describe(`Activity type`),object:o().describe(`Object name (e.g., "account")`),recordId:o().describe(`Record ID this feed item belongs to`),actor:x_e.describe(`Who performed this action`),body:o().optional().describe(`Rich text body (Markdown supported)`),mentions:S(v_e).optional().describe(`Mentioned users/teams/records`),changes:S(y_e).optional().describe(`Field-level changes`),reactions:S(b_e).optional().describe(`Emoji reactions on this item`),parentId:o().optional().describe(`Parent feed item ID for threaded replies`),replyCount:A().int().min(0).default(0).describe(`Number of replies`),pinned:v().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:o().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:o().optional().describe(`User ID who pinned the item`),starred:v().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:o().datetime().optional().describe(`Timestamp when the item was starred`),visibility:S_e.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:o().datetime().describe(`Creation timestamp`),updatedAt:o().datetime().optional().describe(`Last update timestamp`),editedAt:o().datetime().optional().describe(`When comment was last edited`),isEdited:v().default(!1).describe(`Whether comment has been edited`)});var C_e=x([`all`,`comments_only`,`changes_only`,`tasks_only`]);l({}),l({title:q.describe(`Page title`),subtitle:q.optional().describe(`Page subtitle`),icon:o().optional().describe(`Icon name`),breadcrumb:v().default(!0).describe(`Show breadcrumb`),actions:S(o()).optional().describe(`Action IDs to show in header`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({type:x([`line`,`card`,`pill`]).default(`line`),position:x([`top`,`left`]).default(`top`),items:S(l({label:q,icon:o().optional(),children:S(b()).describe(`Child components`)})),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({title:q.optional(),bordered:v().default(!0),actions:S(o()).optional(),body:S(b()).optional().describe(`Card content components (slot)`),footer:S(b()).optional().describe(`Card footer components (slot)`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({columns:x([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:x([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:S(o()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:S(o()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({objectName:o().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:o().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:S(o()).describe(`Fields to display in the related list`),sort:c([o(),S(l({field:o(),order:x([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:A().int().positive().default(5).describe(`Number of records to display initially`),filter:S(u2).optional().describe(`Additional filter criteria for related records`),title:q.optional().describe(`Custom title for the related list`),showViewAll:v().default(!0).describe(`Show "View All" link to see all related records`),actions:S(o()).optional().describe(`Action IDs available for related records`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({fields:S(o()).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards)`),layout:x([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:Z0.optional().describe(`ARIA accessibility attributes`)});var w_e=l({types:S(k2).optional().describe(`Feed item types to show (default: all)`),filterMode:C_e.default(`all`).describe(`Default activity filter`),showFilterToggle:v().default(!0).describe(`Show filter dropdown in panel header`),limit:A().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:v().default(!1).describe(`Include completed activities`),unifiedTimeline:v().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:v().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:v().default(!0).describe(`Enable @mentions in comments`),enableReactions:v().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:v().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:v().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:Z0.optional().describe(`ARIA accessibility attributes`)});l({position:x([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:c([o(),A()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:v().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:v().default(!1).describe(`Whether the panel starts collapsed`),feed:w_e.optional().describe(`Embedded activity feed configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({statusField:o().describe(`Field name representing the current status/stage`),stages:S(l({value:o(),label:q})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({items:S(l({label:q,icon:o().optional(),collapsed:v().default(!1),children:S(b()).describe(`Child components`)})),allowMultiple:v().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({mode:x([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:o().optional().describe(`Specific AI agent to use`),context:u(o(),b()).optional().describe(`Contextual data to pass to the AI`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({content:o().describe(`Text or Markdown content`),variant:x([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:x([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({object:o().describe(`Source object`),field:o().optional().describe(`Field to aggregate`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:b2.optional().describe(`Filter criteria`),format:x([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:o().optional().describe(`Prefix text (e.g. "$")`),suffix:o().optional().describe(`Suffix text (e.g. "%")`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({src:o().describe(`Image URL or attachment field`),alt:o().optional().describe(`Alt text for accessibility`),fit:x([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:A().optional().describe(`Fixed height in pixels`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({label:q.describe(`Button display label`),variant:x([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:x([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:o().optional().describe(`Icon name (Lucide icon)`),iconPosition:x([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:v().optional().default(!1).describe(`Disable the button`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({object:o().describe(`Object to filter`),fields:S(o()).describe(`Filterable field names`),targetVariable:o().optional().describe(`Page variable to store filter state`),layout:x([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:v().optional().default(!0).describe(`Show search input`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({object:o().describe(`Object for the form`),fields:S(o()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:x([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:q.optional().describe(`Submit button label`),onSubmit:o().optional().describe(`Action expression on form submit`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({object:o().describe(`Object to pick records from`),displayField:o().describe(`Field to display as the record label`),searchFields:S(o()).optional().describe(`Fields to search against`),filter:b2.optional().describe(`Filter criteria for available records`),multiple:v().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:o().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:q.optional().describe(`Placeholder text`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({context:o().optional()});var A2=l({minWidth:A().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:A().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:A().optional().describe(`Additional padding around touch target in pixels`),hitSlop:l({top:A().optional().describe(`Extra hit area above the element`),right:A().optional().describe(`Extra hit area to the right of the element`),bottom:A().optional().describe(`Extra hit area below the element`),left:A().optional().describe(`Extra hit area to the left of the element`)}).optional().describe(`Invisible hit area extension beyond the visible bounds`)}).describe(`Touch target sizing configuration (WCAG accessible)`),T_e=x([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`),E_e=l({direction:S(x([`up`,`down`,`left`,`right`])).describe(`Allowed swipe directions`),threshold:A().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:A().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`),D_e=l({minScale:A().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:A().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`),O_e=l({duration:A().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:A().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`);l({gestures:S(l({type:T_e.describe(`Gesture type to configure`),label:q.optional().describe(`Descriptive label for the gesture action`),enabled:v().default(!0).describe(`Whether this gesture is active`),swipe:E_e.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:D_e.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:O_e.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`)).optional().describe(`Configured gesture recognizers`),touchTarget:A2.optional().describe(`Touch target sizing and hit area`),hapticFeedback:v().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(Z0.partial()).describe(`Touch and gesture interaction configuration`);var k_e=l({enabled:v().default(!1).describe(`Enable focus trapping within this container`),initialFocus:o().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:v().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:v().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`),A_e=l({key:o().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:o().describe(`Action identifier to invoke when shortcut is triggered`),description:q.optional().describe(`Human-readable description of what the shortcut does`),scope:x([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`),j2=l({tabOrder:x([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:v().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:v().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:k_e.optional().describe(`Focus trap settings`),arrowNavigation:v().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`);l({shortcuts:S(A_e).optional().describe(`Registered keyboard shortcuts`),focusManagement:j2.optional().describe(`Focus and tab order management`),rovingTabindex:v().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(Z0.partial()).describe(`Keyboard navigation and shortcut configuration`);var j_e=l({primary:o().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:o().optional().describe(`Secondary brand color`),accent:o().optional().describe(`Accent color for highlights`),success:o().optional().describe(`Success state color (default: green)`),warning:o().optional().describe(`Warning state color (default: yellow)`),error:o().optional().describe(`Error state color (default: red)`),info:o().optional().describe(`Info state color (default: blue)`),background:o().optional().describe(`Background color`),surface:o().optional().describe(`Surface/card background color`),text:o().optional().describe(`Primary text color`),textSecondary:o().optional().describe(`Secondary text color`),border:o().optional().describe(`Border color`),disabled:o().optional().describe(`Disabled state color`),primaryLight:o().optional().describe(`Lighter shade of primary`),primaryDark:o().optional().describe(`Darker shade of primary`),secondaryLight:o().optional().describe(`Lighter shade of secondary`),secondaryDark:o().optional().describe(`Darker shade of secondary`)}),M_e=l({fontFamily:l({base:o().optional().describe(`Base font family (default: system fonts)`),heading:o().optional().describe(`Heading font family`),mono:o().optional().describe(`Monospace font family for code`)}).optional(),fontSize:l({xs:o().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:o().optional().describe(`Small font size (e.g., 0.875rem)`),base:o().optional().describe(`Base font size (e.g., 1rem)`),lg:o().optional().describe(`Large font size (e.g., 1.125rem)`),xl:o().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":o().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":o().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":o().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:l({light:A().optional().describe(`Light weight (default: 300)`),normal:A().optional().describe(`Normal weight (default: 400)`),medium:A().optional().describe(`Medium weight (default: 500)`),semibold:A().optional().describe(`Semibold weight (default: 600)`),bold:A().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:l({tight:o().optional().describe(`Tight line height (e.g., 1.25)`),normal:o().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:o().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:o().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:l({tighter:o().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:o().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:o().optional().describe(`Normal letter spacing (e.g., 0)`),wide:o().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:o().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()}),N_e=l({0:o().optional().describe(`0 spacing (0)`),1:o().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:o().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:o().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:o().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:o().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:o().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:o().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:o().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:o().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:o().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:o().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:o().optional().describe(`Spacing unit 24 (e.g., 6rem)`)}),P_e=l({none:o().optional().describe(`No border radius (0)`),sm:o().optional().describe(`Small border radius (e.g., 0.125rem)`),base:o().optional().describe(`Base border radius (e.g., 0.25rem)`),md:o().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:o().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:o().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":o().optional().describe(`2X large border radius (e.g., 1rem)`),full:o().optional().describe(`Full border radius (50%)`)}),F_e=l({none:o().optional().describe(`No shadow`),sm:o().optional().describe(`Small shadow`),base:o().optional().describe(`Base shadow`),md:o().optional().describe(`Medium shadow`),lg:o().optional().describe(`Large shadow`),xl:o().optional().describe(`Extra large shadow`),"2xl":o().optional().describe(`2X large shadow`),inner:o().optional().describe(`Inner shadow (inset)`)}),I_e=l({xs:o().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:o().optional().describe(`Small breakpoint (e.g., 640px)`),md:o().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:o().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:o().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":o().optional().describe(`2X large breakpoint (e.g., 1536px)`)}),L_e=l({duration:l({fast:o().optional().describe(`Fast animation (e.g., 150ms)`),base:o().optional().describe(`Base animation (e.g., 300ms)`),slow:o().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:l({linear:o().optional().describe(`Linear timing function`),ease:o().optional().describe(`Ease timing function`),ease_in:o().optional().describe(`Ease-in timing function`),ease_out:o().optional().describe(`Ease-out timing function`),ease_in_out:o().optional().describe(`Ease-in-out timing function`)}).optional()}),R_e=l({base:A().optional().describe(`Base z-index (e.g., 0)`),dropdown:A().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:A().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:A().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:A().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:A().optional().describe(`Modal z-index (e.g., 1050)`),popover:A().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:A().optional().describe(`Tooltip z-index (e.g., 1070)`)}),z_e=x([`light`,`dark`,`auto`]),B_e=x([`compact`,`regular`,`spacious`]),V_e=x([`AA`,`AAA`]);l({name:i2.describe(`Unique theme identifier (snake_case)`),label:o().describe(`Human-readable theme name`),description:o().optional().describe(`Theme description`),mode:z_e.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:j_e.describe(`Color palette configuration`),typography:M_e.optional().describe(`Typography settings`),spacing:N_e.optional().describe(`Spacing scale`),borderRadius:P_e.optional().describe(`Border radius scale`),shadows:F_e.optional().describe(`Box shadow effects`),breakpoints:I_e.optional().describe(`Responsive breakpoints`),animation:L_e.optional().describe(`Animation settings`),zIndex:R_e.optional().describe(`Z-index scale for layering`),customVars:u(o(),o()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:l({light:o().optional().describe(`Logo URL for light mode`),dark:o().optional().describe(`Logo URL for dark mode`),favicon:o().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:o().optional().describe(`Base theme to extend from`),density:B_e.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:V_e.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:v().optional().describe(`Enable right-to-left layout direction`),touchTarget:A2.optional().describe(`Touch target sizing defaults`),keyboardNavigation:j2.optional().describe(`Keyboard focus management settings`)});var M2=x([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`),H_e=x([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`),U_e=l({strategy:M2.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:H_e.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:A().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:A().optional().describe(`Maximum number of sync retry attempts`),batchSize:A().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`),W_e=x([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`),G_e=x([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`),K_e=l({maxSize:A().optional().describe(`Maximum cache size in bytes`),ttl:A().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:W_e.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:G_e.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`);l({enabled:v().default(!1).describe(`Enable offline support`),strategy:M2.default(`network_first`).describe(`Default offline fetch strategy`),cache:K_e.optional().describe(`Cache settings for offline data`),sync:U_e.optional().describe(`Sync settings for offline mutations`),offlineIndicator:v().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:q.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:A().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`);var N2=x([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`),P2=x([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`),F2=l({preset:N2.optional().describe(`Transition preset to apply`),duration:A().optional().describe(`Transition duration in milliseconds`),easing:P2.optional().describe(`Easing function for the transition`),delay:A().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:o().optional().describe(`CSS @keyframes name for custom animations`),themeToken:o().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`),q_e=x([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`),J_e=l({label:q.optional().describe(`Descriptive label for this animation configuration`),enter:F2.optional().describe(`Enter/mount animation`),exit:F2.optional().describe(`Exit/unmount animation`),hover:F2.optional().describe(`Hover state animation`),trigger:q_e.optional().describe(`When to trigger the animation`),reducedMotion:x([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(Z0.partial()).describe(`Component-level animation configuration`),Y_e=l({type:N2.default(`fade`).describe(`Page transition type`),duration:A().default(300).describe(`Transition duration in milliseconds`),easing:P2.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:v().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`);l({label:q.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:F2.optional().describe(`Default transition applied to all animations`),pageTransitions:Y_e.optional().describe(`Page navigation transition settings`),componentAnimations:u(o(),J_e).optional().describe(`Component name to animation configuration mapping`),reducedMotion:v().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:v().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`);var X_e=x([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`),Z_e=x([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`),I2=x([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`),Q_e=l({label:q.describe(`Action button label`),action:o().describe(`Action identifier to execute`),variant:x([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`);l({type:X_e.default(`toast`).describe(`Notification presentation style`),severity:Z_e.default(`info`).describe(`Notification severity level`),title:q.optional().describe(`Notification title`),message:q.describe(`Notification message body`),icon:o().optional().describe(`Icon name override`),duration:A().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:v().default(!0).describe(`Allow user to dismiss the notification`),actions:S(Q_e).optional().describe(`Action buttons`),position:I2.optional().describe(`Override default position`)}).merge(Z0.partial()).describe(`Notification instance definition`),l({defaultPosition:I2.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:A().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:A().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:x([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:v().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`);var $_e=x([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`),eve=x([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`),tve=l({axis:x([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:x([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:a([A(),A()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`),nve=l({label:q.optional().describe(`Accessible label for the drop zone`),accept:S(o()).describe(`Accepted drag item types`),maxItems:A().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:v().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:eve.default(`move`).describe(`Visual effect on drop`)}).merge(Z0.partial()).describe(`Drop zone configuration`),rve=l({type:o().describe(`Drag item type identifier for matching with drop zones`),label:q.optional().describe(`Accessible label describing the draggable item`),handle:$_e.default(`element`).describe(`How to initiate drag`),constraint:tve.optional().describe(`Drag movement constraints`),preview:x([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:v().default(!1).describe(`Disable dragging`)}).merge(Z0.partial()).describe(`Draggable item configuration`);l({enabled:v().default(!1).describe(`Enable drag and drop`),dragItem:rve.optional().describe(`Configuration for draggable item`),dropZone:nve.optional().describe(`Configuration for drop target`),sortable:v().default(!1).describe(`Enable sortable list behavior`),autoScroll:v().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:A().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`);var ive=e({DEFAULT_EXTENDER_PRIORITY:()=>200,DEFAULT_OWNER_PRIORITY:()=>100,MetadataFacade:()=>K2,ObjectQL:()=>U2,ObjectQLPlugin:()=>q2,ObjectRepository:()=>W2,ObjectStackProtocolImplementation:()=>V2,RESERVED_NAMESPACES:()=>L2,SchemaRegistry:()=>J,ScopedContext:()=>G2,computeFQN:()=>R2,parseFQN:()=>z2}),L2=new Set([`base`,`system`]);function R2(e,t){return!e||L2.has(e)?t:`${e}__${t}`}function z2(e){let t=e.indexOf(`__`);return t===-1?{namespace:void 0,shortName:e}:{namespace:e.slice(0,t),shortName:e.slice(t+2)}}function ave(e,t){let n={...e};return t.fields&&(n.fields={...e.fields,...t.fields}),t.validations&&(n.validations=[...e.validations||[],...t.validations]),t.indexes&&(n.indexes=[...e.indexes||[],...t.indexes]),t.label!==void 0&&(n.label=t.label),t.pluralLabel!==void 0&&(n.pluralLabel=t.pluralLabel),t.description!==void 0&&(n.description=t.description),n}var J=class{static get logLevel(){return this._logLevel}static set logLevel(e){this._logLevel=e}static log(e){this._logLevel===`silent`||this._logLevel===`error`||this._logLevel===`warn`||console.log(e)}static registerNamespace(e,t){if(!e)return;let n=this.namespaceRegistry.get(e);if(n&&n!==t)throw Error(`Namespace "${e}" is already registered to package "${n}". Package "${t}" cannot use the same namespace.`);this.namespaceRegistry.set(e,t),this.log(`[Registry] Registered namespace: ${e} \u2192 ${t}`)}static unregisterNamespace(e,t){this.namespaceRegistry.get(e)===t&&(this.namespaceRegistry.delete(e),this.log(`[Registry] Unregistered namespace: ${e}`))}static getNamespaceOwner(e){return this.namespaceRegistry.get(e)}static registerObject(e,t,n,r=`own`,i=r===`own`?100:200){let a=e.name,o=R2(n,a);n&&this.registerNamespace(n,t);let s=this.objectContributors.get(o);if(s||(s=[],this.objectContributors.set(o,s)),r===`own`){let e=s.find(e=>e.ownership===`own`);if(e&&e.packageId!==t)throw Error(`Object "${o}" is already owned by package "${e.packageId}". Package "${t}" cannot claim ownership. Use 'extend' to add fields.`);let n=s.findIndex(e=>e.packageId===t&&e.ownership===`own`);n!==-1&&(s.splice(n,1),console.warn(`[Registry] Re-registering owned object: ${o} from ${t}`))}else{let e=s.findIndex(e=>e.packageId===t&&e.ownership===`extend`);e!==-1&&s.splice(e,1)}let c={packageId:t,namespace:n||``,ownership:r,priority:i,definition:{...e,name:o}};return s.push(c),s.sort((e,t)=>e.priority-t.priority),this.mergedObjectCache.delete(o),this.log(`[Registry] Registered object: ${o} (${r}, priority=${i}) from ${t}`),o}static resolveObject(e){let t=this.mergedObjectCache.get(e);if(t)return t;let n=this.objectContributors.get(e);if(!n||n.length===0)return;let r=n.find(e=>e.ownership===`own`);if(!r){console.warn(`[Registry] Object "${e}" has extenders but no owner. Skipping.`);return}let i={...r.definition};for(let e of n)e.ownership===`extend`&&(i=ave(i,e.definition));return this.mergedObjectCache.set(e,i),i}static getObject(e){let t=this.resolveObject(e);if(t)return t;for(let t of this.objectContributors.keys()){let{shortName:n}=z2(t);if(n===e)return this.resolveObject(t)}for(let t of this.objectContributors.keys()){let n=this.resolveObject(t);if(n?.tableName===e)return n}}static getAllObjects(e){let t=[];for(let n of this.objectContributors.keys()){if(e&&!this.objectContributors.get(n)?.some(t=>t.packageId===e))continue;let r=this.resolveObject(n);r&&(r._packageId=this.getObjectOwner(n)?.packageId,t.push(r))}return t}static getObjectContributors(e){return this.objectContributors.get(e)||[]}static getObjectOwner(e){return this.objectContributors.get(e)?.find(e=>e.ownership===`own`)}static unregisterObjectsByPackage(e,t=!1){for(let[n,r]of this.objectContributors.entries()){let i=r.filter(t=>t.packageId===e);for(let a of i){if(a.ownership===`own`&&!t){let t=r.filter(t=>t.packageId!==e&&t.ownership===`extend`);if(t.length>0)throw Error(`Cannot uninstall package "${e}": object "${n}" is extended by ${t.map(e=>e.packageId).join(`, `)}. Uninstall extenders first.`)}let i=r.indexOf(a);i!==-1&&(r.splice(i,1),this.log(`[Registry] Removed ${a.ownership} contribution to ${n} from ${e}`))}r.length===0&&this.objectContributors.delete(n),this.mergedObjectCache.delete(n)}}static registerItem(e,t,n=`name`,r){this.metadata.has(e)||this.metadata.set(e,new Map);let i=this.metadata.get(e),a=String(t[n]);r&&(t._packageId=r);try{this.validate(e,t)}catch(t){console.error(`[Registry] Validation failed for ${e} ${a}: ${t.message}`)}let o=r?`${r}:${a}`:a;i.has(o)&&console.warn(`[Registry] Overwriting ${e}: ${o}`),i.set(o,t),this.log(`[Registry] Registered ${e}: ${o}`)}static validate(e,t){return e===`object`?C.parse(t):e===`apps`?hge.parse(t):e===`package`?V0.parse(t):e===`plugin`?L0.parse(t):!0}static unregisterItem(e,t){let n=this.metadata.get(e);if(!n){console.warn(`[Registry] Attempted to unregister non-existent ${e}: ${t}`);return}if(n.has(t)){n.delete(t),this.log(`[Registry] Unregistered ${e}: ${t}`);return}for(let r of n.keys())if(r.endsWith(`:${t}`)){n.delete(r),this.log(`[Registry] Unregistered ${e}: ${r}`);return}console.warn(`[Registry] Attempted to unregister non-existent ${e}: ${t}`)}static getItem(e,t){if(e===`object`||e===`objects`)return this.getObject(t);let n=this.metadata.get(e);if(!n)return;let r=n.get(t);if(r)return r;for(let[e,r]of n)if(e.endsWith(`:${t}`))return r}static listItems(e,t){if(e===`object`||e===`objects`)return this.getAllObjects(t);let n=Array.from(this.metadata.get(e)?.values()||[]);return t?n.filter(e=>e._packageId===t):n}static getRegisteredTypes(){let e=Array.from(this.metadata.keys());return!e.includes(`object`)&&this.objectContributors.size>0&&e.push(`object`),e}static installPackage(e,t){let n=new Date().toISOString(),r={manifest:e,status:`installed`,enabled:!0,installedAt:n,updatedAt:n,settings:t};e.namespace&&this.registerNamespace(e.namespace,e.id),this.metadata.has(`package`)||this.metadata.set(`package`,new Map);let i=this.metadata.get(`package`);return i.has(e.id)&&console.warn(`[Registry] Overwriting package: ${e.id}`),i.set(e.id,r),this.log(`[Registry] Installed package: ${e.id} (${e.name})`),r}static uninstallPackage(e){let t=this.getPackage(e);if(!t)return console.warn(`[Registry] Package not found for uninstall: ${e}`),!1;t.manifest.namespace&&this.unregisterNamespace(t.manifest.namespace,e),this.unregisterObjectsByPackage(e);let n=this.metadata.get(`package`);return n?(n.delete(e),this.log(`[Registry] Uninstalled package: ${e}`),!0):!1}static getPackage(e){return this.metadata.get(`package`)?.get(e)}static getAllPackages(){return this.listItems(`package`)}static enablePackage(e){let t=this.getPackage(e);return t&&(t.enabled=!0,t.status=`installed`,t.statusChangedAt=new Date().toISOString(),t.updatedAt=new Date().toISOString(),this.log(`[Registry] Enabled package: ${e}`)),t}static disablePackage(e){let t=this.getPackage(e);return t&&(t.enabled=!1,t.status=`disabled`,t.statusChangedAt=new Date().toISOString(),t.updatedAt=new Date().toISOString(),this.log(`[Registry] Disabled package: ${e}`)),t}static registerApp(e,t){this.registerItem(`apps`,e,`name`,t)}static getApp(e){return this.getItem(`apps`,e)}static getAllApps(){return this.listItems(`apps`)}static registerPlugin(e){this.registerItem(`plugin`,e,`id`)}static getAllPlugins(){return this.listItems(`plugin`)}static registerKind(e){this.registerItem(`kind`,e,`id`)}static getAllKinds(){return this.listItems(`kind`)}static reset(){this.objectContributors.clear(),this.mergedObjectCache.clear(),this.namespaceRegistry.clear(),this.metadata.clear(),this.log(`[Registry] Reset complete`)}};J._logLevel=`info`,J.objectContributors=new Map,J.mergedObjectCache=new Map,J.namespaceRegistry=new Map,J.metadata=new Map;function ove(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}var B2={auth:{route:`/api/v1/auth`,plugin:`plugin-auth`},automation:{route:`/api/v1/automation`,plugin:`plugin-automation`},cache:{route:`/api/v1/cache`,plugin:`plugin-redis`},queue:{route:`/api/v1/queue`,plugin:`plugin-bullmq`},job:{route:`/api/v1/jobs`,plugin:`job-scheduler`},ui:{route:`/api/v1/ui`,plugin:`ui-plugin`},workflow:{route:`/api/v1/workflow`,plugin:`plugin-workflow`},realtime:{route:`/api/v1/realtime`,plugin:`plugin-realtime`},notification:{route:`/api/v1/notifications`,plugin:`plugin-notifications`},ai:{route:`/api/v1/ai`,plugin:`plugin-ai`},i18n:{route:`/api/v1/i18n`,plugin:`service-i18n`},graphql:{route:`/graphql`,plugin:`plugin-graphql`},"file-storage":{route:`/api/v1/storage`,plugin:`plugin-storage`},search:{route:`/api/v1/search`,plugin:`plugin-search`}},V2=class{constructor(e,t,n){this.engine=e,this.getServicesRegistry=t,this.getFeedService=n}requireFeedService(){let e=this.getFeedService?.();if(!e)throw Error(`Feed service not available. Install and register service-feed to enable feed operations.`);return e}async getDiscovery(){let e=this.getServicesRegistry?this.getServicesRegistry():new Map,t={metadata:{enabled:!0,status:`available`,route:`/api/v1/meta`,provider:`objectql`},data:{enabled:!0,status:`available`,route:`/api/v1/data`,provider:`objectql`},analytics:{enabled:!0,status:`available`,route:`/api/v1/analytics`,provider:`objectql`}};for(let[n,r]of Object.entries(B2))e.has(n)?t[n]={enabled:!0,status:`available`,route:r.route,provider:r.plugin}:t[n]={enabled:!1,status:`unavailable`,message:`Install ${r.plugin} to enable`};let n={auth:`auth`,automation:`automation`,ui:`ui`,workflow:`workflow`,realtime:`realtime`,notification:`notifications`,ai:`ai`,i18n:`i18n`,graphql:`graphql`,"file-storage":`storage`},r={analytics:`/api/v1/analytics`};for(let[t,i]of Object.entries(B2))if(e.has(t)){let e=n[t];e&&(r[e]=i.route)}e.has(`feed`)?t.feed={enabled:!0,status:`available`,route:`/api/v1/data`,provider:`service-feed`}:t.feed={enabled:!1,status:`unavailable`,message:`Install service-feed to enable`};let i={data:`/api/v1/data`,metadata:`/api/v1/meta`,...r},a={feed:e.has(`feed`),comments:e.has(`feed`),automation:e.has(`automation`),cron:e.has(`job`),search:e.has(`search`),export:e.has(`automation`)||e.has(`queue`),chunkedUpload:e.has(`file-storage`)},o={};for(let[e,t]of Object.entries(a))o[e]={enabled:t};return{version:`1.0`,apiName:`ObjectStack API`,routes:i,services:t,capabilities:o}}async getMetaTypes(){return{types:J.getRegisteredTypes()}}async getMetaItems(e){let t=J.listItems(e.type);if(t.length===0){let n=e.type.endsWith(`s`)?e.type.slice(0,-1):e.type+`s`;t=J.listItems(n)}if(t.length===0)try{let n=await this.engine.find(`sys_metadata`,{where:{type:e.type,state:`active`}});if(n&&n.length>0)t=n.map(t=>{let n=typeof t.metadata==`string`?JSON.parse(t.metadata):t.metadata;return J.registerItem(e.type,n,`name`),n});else{let n=e.type.endsWith(`s`)?e.type.slice(0,-1):e.type+`s`,r=await this.engine.find(`sys_metadata`,{where:{type:n,state:`active`}});r&&r.length>0&&(t=r.map(t=>{let n=typeof t.metadata==`string`?JSON.parse(t.metadata):t.metadata;return J.registerItem(e.type,n,`name`),n}))}}catch{}return{type:e.type,items:t}}async getMetaItem(e){let t=J.getItem(e.type,e.name);if(t===void 0){let n=e.type.endsWith(`s`)?e.type.slice(0,-1):e.type+`s`;t=J.getItem(n,e.name)}if(t===void 0)try{let n=await this.engine.findOne(`sys_metadata`,{where:{type:e.type,name:e.name,state:`active`}});if(n)t=typeof n.metadata==`string`?JSON.parse(n.metadata):n.metadata,J.registerItem(e.type,t,`name`);else{let n=e.type.endsWith(`s`)?e.type.slice(0,-1):e.type+`s`,r=await this.engine.findOne(`sys_metadata`,{where:{type:n,name:e.name,state:`active`}});r&&(t=typeof r.metadata==`string`?JSON.parse(r.metadata):r.metadata,J.registerItem(e.type,t,`name`))}}catch{}return{type:e.type,name:e.name,item:t}}async getUiView(e){let t=J.getObject(e.object);if(!t)throw Error(`Object ${e.object} not found`);let n=t.fields||{},r=Object.keys(n);if(e.type===`list`){let i=[`name`,`title`,`label`,`subject`,`email`,`status`,`type`,`category`,`created_at`],a=r.filter(e=>i.includes(e));if(a.length<5){let e=r.filter(e=>!a.includes(e)&&e!==`id`&&!n[e].hidden);a=[...a,...e.slice(0,5-a.length)]}return{list:{type:`grid`,object:e.object,label:t.label||t.name,columns:a.map(e=>({field:e,label:n[e]?.label||e,sortable:!0})),sort:n.created_at?[{field:`created_at`,order:`desc`}]:void 0,searchableFields:a.slice(0,3)}}}else{let i=r.filter(e=>e!==`id`&&e!==`created_at`&&e!==`updated_at`&&!n[e].hidden).map(e=>({field:e,label:n[e]?.label,required:n[e]?.required,readonly:n[e]?.readonly,type:n[e]?.type,colSpan:n[e]?.type===`textarea`||n[e]?.type===`html`?2:1}));return{form:{type:`simple`,object:e.object,label:`Edit ${t.label||t.name}`,sections:[{label:`General Information`,columns:2,collapsible:!1,collapsed:!1,fields:i}]}}}}async findData(e){let t={...e.query};t.top!=null&&(t.limit=Number(t.top),delete t.top),t.skip!=null&&(t.offset=Number(t.skip),delete t.skip),t.limit!=null&&(t.limit=Number(t.limit)),t.offset!=null&&(t.offset=Number(t.offset)),typeof t.select==`string`?t.fields=t.select.split(`,`).map(e=>e.trim()).filter(Boolean):Array.isArray(t.select)&&(t.fields=t.select),t.select!==void 0&&delete t.select;let n=t.orderBy??t.sort;typeof n==`string`?t.orderBy=n.split(`,`).map(e=>{let t=e.trim();if(t.startsWith(`-`))return{field:t.slice(1),order:`desc`};let[n,r]=t.split(/\s+/);return{field:n,order:r?.toLowerCase()===`desc`?`desc`:`asc`}}).filter(e=>e.field):Array.isArray(n)&&(t.orderBy=n),delete t.sort;let r=t.filter??t.filters??t.$filter??t.where;if(delete t.filter,delete t.filters,delete t.$filter,r!==void 0){let e=r;if(typeof e==`string`)try{e=JSON.parse(e)}catch{}f(e)&&(e=w(e)),t.where=e}let i=t.populate,a=t.$expand??t.expand,o=[];if(typeof i==`string`?o.push(...i.split(`,`).map(e=>e.trim()).filter(Boolean)):Array.isArray(i)&&o.push(...i),!o.length&&a&&(typeof a==`string`?o.push(...a.split(`,`).map(e=>e.trim()).filter(Boolean)):Array.isArray(a)&&o.push(...a)),delete t.populate,delete t.$expand,(typeof t.expand!=`object`||t.expand===null)&&delete t.expand,o.length>0&&!t.expand){t.expand={};for(let e of o)t.expand[e]={object:e}}for(let e of[`distinct`,`count`])t[e]===`true`?t[e]=!0:t[e]===`false`&&(t[e]=!1);let s=new Set([`top`,`limit`,`offset`,`orderBy`,`fields`,`where`,`expand`,`distinct`,`count`,`aggregations`,`groupBy`,`search`,`context`,`cursor`]);if(!t.where){let e={};for(let n of Object.keys(t))s.has(n)||(e[n]=t[n],delete t[n]);Object.keys(e).length>0&&(t.where=e)}let c=await this.engine.find(e.object,t);return{object:e.object,value:c,records:c,total:c.length,hasMore:!1}}async getData(e){let t={where:{id:e.id}};if(e.select&&(t.fields=typeof e.select==`string`?e.select.split(`,`).map(e=>e.trim()).filter(Boolean):e.select),e.expand){let n=typeof e.expand==`string`?e.expand.split(`,`).map(e=>e.trim()).filter(Boolean):e.expand;t.expand={};for(let e of n)t.expand[e]={object:e}}let n=await this.engine.findOne(e.object,t);if(n)return{object:e.object,id:e.id,record:n};throw Error(`Record ${e.id} not found in ${e.object}`)}async createData(e){let t=await this.engine.insert(e.object,e.data);return{object:e.object,id:t.id,record:t}}async updateData(e){let t=await this.engine.update(e.object,e.data,{where:{id:e.id}});return{object:e.object,id:e.id,record:t}}async deleteData(e){return await this.engine.delete(e.object,{where:{id:e.id}}),{object:e.object,id:e.id,success:!0}}async getMetaItemCached(e){try{let t=J.getItem(e.type,e.name);if(!t)throw Error(`Metadata item ${e.type}/${e.name} not found`);let n=ove(JSON.stringify(t)),r={value:n,weak:!1};return e.cacheRequest?.ifNoneMatch&&e.cacheRequest.ifNoneMatch.replace(/^"(.*)"$/,`$1`).replace(/^W\/"(.*)"$/,`$1`)===n?{notModified:!0,etag:r}:{data:t,etag:r,lastModified:new Date().toISOString(),cacheControl:{directives:[`public`,`max-age`],maxAge:3600},notModified:!1}}catch(e){throw e}}async batchData(e){let{object:t,request:n}=e,{operation:r,records:i,options:a}=n,o=[],s=0,c=0;for(let e of i)try{switch(r){case`create`:{let n=await this.engine.insert(t,e.data||e);o.push({id:n.id,success:!0,record:n}),s++;break}case`update`:{if(!e.id)throw Error(`Record id is required for update`);let n=await this.engine.update(t,e.data||{},{where:{id:e.id}});o.push({id:e.id,success:!0,record:n}),s++;break}case`upsert`:if(e.id)try{if(await this.engine.findOne(t,{where:{id:e.id}})){let n=await this.engine.update(t,e.data||{},{where:{id:e.id}});o.push({id:e.id,success:!0,record:n})}else{let n=await this.engine.insert(t,{id:e.id,...e.data||{}});o.push({id:n.id,success:!0,record:n})}}catch{let n=await this.engine.insert(t,{id:e.id,...e.data||{}});o.push({id:n.id,success:!0,record:n})}else{let n=await this.engine.insert(t,e.data||e);o.push({id:n.id,success:!0,record:n})}s++;break;case`delete`:if(!e.id)throw Error(`Record id is required for delete`);await this.engine.delete(t,{where:{id:e.id}}),o.push({id:e.id,success:!0}),s++;break;default:o.push({id:e.id,success:!1,error:`Unknown operation: ${r}`}),c++}}catch(t){if(o.push({id:e.id,success:!1,error:t.message}),c++,a?.atomic||!a?.continueOnError)break}return{success:c===0,operation:r,total:i.length,succeeded:s,failed:c,results:a?.returnRecords===!1?o.map(e=>({id:e.id,success:e.success,error:e.error})):o}}async createManyData(e){let t=await this.engine.insert(e.object,e.records);return{object:e.object,records:t,count:t.length}}async updateManyData(e){let{object:t,records:n,options:r}=e,i=[],a=0,o=0;for(let e of n)try{let n=await this.engine.update(t,e.data,{where:{id:e.id}});i.push({id:e.id,success:!0,record:n}),a++}catch(t){if(i.push({id:e.id,success:!1,error:t.message}),o++,!r?.continueOnError)break}return{success:o===0,operation:`update`,total:n.length,succeeded:a,failed:o,results:i}}async analyticsQuery(e){let{query:t,cube:n}=e,r=n,i=t.dimensions||[],a=[];if(t.measures)for(let e of t.measures)if(e===`count`||e===`count_all`)a.push({field:`*`,method:`count`,alias:`count`});else if(e.includes(`.`)){let[t,n]=e.split(`.`);a.push({field:t,method:n,alias:`${t}_${n}`})}else a.push({field:e,method:`sum`,alias:e});let o;if(t.filters&&t.filters.length>0){let e=t.filters.map(e=>{let t=this.mapAnalyticsOperator(e.operator);return e.values&&e.values.length===1?{[e.member]:{[t]:e.values[0]}}:e.values&&e.values.length>1?{[e.member]:{$in:e.values}}:{[e.member]:{[t]:!0}}});o=e.length===1?e[0]:{$and:e}}return{success:!0,data:{rows:await this.engine.aggregate(r,{where:o,groupBy:i.length>0?i:void 0,aggregations:a.length>0?a.map(e=>({function:e.method,field:e.field,alias:e.alias})):[{function:`count`,alias:`count`}]}),fields:[...i.map(e=>({name:e,type:`string`})),...a.map(e=>({name:e.alias,type:`number`}))]}}}async getAnalyticsMeta(e){let t=J.listItems(`object`),n=e?.cube,r=[];for(let e of t){let t=e;if(n&&t.name!==n)continue;let i={},a={},o=t.fields||{};i.count={name:`count`,label:`Count`,type:`count`,sql:`*`};for(let[e,t]of Object.entries(o)){let n=t,r=n.type||`text`;[`number`,`currency`,`percent`].includes(r)?(i[`${e}_sum`]={name:`${e}_sum`,label:`${n.label||e} (Sum)`,type:`sum`,sql:e},i[`${e}_avg`]={name:`${e}_avg`,label:`${n.label||e} (Avg)`,type:`avg`,sql:e},a[e]={name:e,label:n.label||e,type:`number`,sql:e}):[`date`,`datetime`].includes(r)?a[e]={name:e,label:n.label||e,type:`time`,sql:e,granularities:[`day`,`week`,`month`,`quarter`,`year`]}:[`boolean`].includes(r)?a[e]={name:e,label:n.label||e,type:`boolean`,sql:e}:a[e]={name:e,label:n.label||e,type:`string`,sql:e}}r.push({name:t.name,title:t.label||t.name,description:t.description,sql:t.name,measures:i,dimensions:a,public:!0})}return{success:!0,data:{cubes:r}}}mapAnalyticsOperator(e){return{equals:`$eq`,notEquals:`$ne`,contains:`$contains`,notContains:`$notContains`,gt:`$gt`,gte:`$gte`,lt:`$lt`,lte:`$lte`,set:`$ne`,notSet:`$eq`}[e]||`$eq`}async triggerAutomation(e){throw Error(`triggerAutomation requires plugin-automation service. Install and register a plugin that provides the "automation" service.`)}async deleteManyData(e){return this.engine.delete(e.object,{where:{id:{$in:e.ids}},...e.options})}async saveMetaItem(e){if(!e.item)throw Error(`Item data is required`);J.registerItem(e.type,e.item,`name`);try{let t=new Date().toISOString(),n=await this.engine.findOne(`sys_metadata`,{where:{type:e.type,name:e.name}});if(n)await this.engine.update(`sys_metadata`,{metadata:JSON.stringify(e.item),updated_at:t,version:(n.version||0)+1},{where:{id:n.id}});else{let n=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`meta_${Date.now()}_${Math.random().toString(36).slice(2)}`;await this.engine.insert(`sys_metadata`,{id:n,name:e.name,type:e.type,scope:`platform`,metadata:JSON.stringify(e.item),state:`active`,version:1,created_at:t,updated_at:t})}return{success:!0,message:`Saved to database and registry`}}catch(t){return console.warn(`[Protocol] DB persistence failed for ${e.type}/${e.name}: ${t.message}`),{success:!0,message:`Saved to memory registry (DB persistence unavailable)`,warning:t.message}}}async loadMetaFromDb(){let e=0,t=0;try{let n=await this.engine.find(`sys_metadata`,{where:{state:`active`}});for(let r of n)try{let t=typeof r.metadata==`string`?JSON.parse(r.metadata):r.metadata;r.type===`object`?J.registerObject(t,r.packageId||`sys_metadata`):J.registerItem(r.type,t,`name`),e++}catch(e){t++,console.warn(`[Protocol] Failed to hydrate ${r.type}/${r.name}: ${e instanceof Error?e.message:String(e)}`)}}catch(e){console.warn(`[Protocol] DB hydration skipped: ${e.message}`)}return{loaded:e,errors:t}}async listFeed(e){return{success:!0,data:await this.requireFeedService().listFeed({object:e.object,recordId:e.recordId,filter:e.type,limit:e.limit,cursor:e.cursor})}}async createFeedItem(e){return{success:!0,data:await this.requireFeedService().createFeedItem({object:e.object,recordId:e.recordId,type:e.type,actor:{type:`user`,id:`current_user`},body:e.body,mentions:e.mentions,parentId:e.parentId,visibility:e.visibility})}}async updateFeedItem(e){return{success:!0,data:await this.requireFeedService().updateFeedItem(e.feedId,{body:e.body,mentions:e.mentions,visibility:e.visibility})}}async deleteFeedItem(e){return await this.requireFeedService().deleteFeedItem(e.feedId),{success:!0,data:{feedId:e.feedId}}}async addReaction(e){return{success:!0,data:{reactions:await this.requireFeedService().addReaction(e.feedId,e.emoji,`current_user`)}}}async removeReaction(e){return{success:!0,data:{reactions:await this.requireFeedService().removeReaction(e.feedId,e.emoji,`current_user`)}}}async pinFeedItem(e){let t=this.requireFeedService(),n=await t.getFeedItem(e.feedId);if(!n)throw Error(`Feed item ${e.feedId} not found`);return await t.updateFeedItem(e.feedId,{visibility:n.visibility}),{success:!0,data:{feedId:e.feedId,pinned:!0,pinnedAt:new Date().toISOString()}}}async unpinFeedItem(e){let t=this.requireFeedService(),n=await t.getFeedItem(e.feedId);if(!n)throw Error(`Feed item ${e.feedId} not found`);return await t.updateFeedItem(e.feedId,{visibility:n.visibility}),{success:!0,data:{feedId:e.feedId,pinned:!1}}}async starFeedItem(e){let t=this.requireFeedService(),n=await t.getFeedItem(e.feedId);if(!n)throw Error(`Feed item ${e.feedId} not found`);return await t.updateFeedItem(e.feedId,{visibility:n.visibility}),{success:!0,data:{feedId:e.feedId,starred:!0,starredAt:new Date().toISOString()}}}async unstarFeedItem(e){let t=this.requireFeedService(),n=await t.getFeedItem(e.feedId);if(!n)throw Error(`Feed item ${e.feedId} not found`);return await t.updateFeedItem(e.feedId,{visibility:n.visibility}),{success:!0,data:{feedId:e.feedId,starred:!1}}}async searchFeed(e){let t=await this.requireFeedService().listFeed({object:e.object,recordId:e.recordId,filter:e.type,limit:e.limit,cursor:e.cursor}),n=(e.query||``).toLowerCase(),r=t.items.filter(e=>e.body?.toLowerCase().includes(n));return{success:!0,data:{items:r,total:r.length,hasMore:!1}}}async getChangelog(e){let t=await this.requireFeedService().listFeed({object:e.object,recordId:e.recordId,filter:`changes_only`,limit:e.limit,cursor:e.cursor});return{success:!0,data:{entries:t.items.map(e=>({id:e.id,object:e.object,recordId:e.recordId,actor:e.actor,changes:e.changes||[],timestamp:e.createdAt,source:e.source})),total:t.total,nextCursor:t.nextCursor,hasMore:t.hasMore}}}async feedSubscribe(e){return{success:!0,data:await this.requireFeedService().subscribe({object:e.object,recordId:e.recordId,userId:`current_user`,events:e.events,channels:e.channels})}}async feedUnsubscribe(e){let t=await this.requireFeedService().unsubscribe(e.object,e.recordId,`current_user`);return{success:!0,data:{object:e.object,recordId:e.recordId,unsubscribed:t}}}},H2=class e{constructor(e={}){this.drivers=new Map,this.defaultDriver=null,this.hooks=new Map([[`beforeFind`,[]],[`afterFind`,[]],[`beforeInsert`,[]],[`afterInsert`,[]],[`beforeUpdate`,[]],[`afterUpdate`,[]],[`beforeDelete`,[]],[`afterDelete`,[]]]),this.middlewares=[],this.actions=new Map,this.hostContext={},this.hostContext=e,this.logger=e.logger||nf({level:`info`,format:`pretty`}),this.logger.info(`ObjectQL Engine Instance Created`)}getStatus(){return{name:xi.enum.data,status:`running`,version:`0.9.0`,features:[`crud`,`query`,`aggregate`,`transactions`,`metadata`]}}get registry(){return J}async use(e,t){if(this.logger.debug(`Loading plugin`,{hasManifest:!!e,hasRuntime:!!t}),e&&this.registerApp(e),t){let e=t.default||t;if(e.onEnable){this.logger.debug(`Executing plugin runtime onEnable`);let t={ql:this,logger:this.logger,drivers:{register:e=>this.registerDriver(e)},...this.hostContext};await e.onEnable(t),this.logger.debug(`Plugin runtime onEnable completed`)}}}registerHook(e,t,n){this.hooks.has(e)||this.hooks.set(e,[]);let r=this.hooks.get(e);r.push({handler:t,object:n?.object,priority:n?.priority??100,packageId:n?.packageId}),r.sort((e,t)=>e.priority-t.priority),this.logger.debug(`Registered hook`,{event:e,object:n?.object,priority:n?.priority??100,totalHandlers:r.length})}async triggerHooks(e,t){let n=this.hooks.get(e)||[];if(n.length===0){this.logger.debug(`No hooks registered for event`,{event:e});return}this.logger.debug(`Triggering hooks`,{event:e,count:n.length});for(let e of n){if(e.object){let n=Array.isArray(e.object)?e.object:[e.object];if(!n.includes(`*`)&&!n.includes(t.object))continue}await e.handler(t)}}registerAction(e,t,n,r){let i=`${e}:${t}`;this.actions.set(i,{handler:n,package:r}),this.logger.debug(`Registered action`,{objectName:e,actionName:t,package:r})}async executeAction(e,t,n){let r=this.actions.get(`${e}:${t}`);if(!r)throw Error(`Action '${t}' on object '${e}' not found`);return r.handler(n)}removeActionsByPackage(e){for(let[t,n]of this.actions.entries())n.package===e&&this.actions.delete(t)}registerMiddleware(e,t){this.middlewares.push({fn:e,object:t?.object}),this.logger.debug(`Registered middleware`,{object:t?.object,total:this.middlewares.length})}async executeWithMiddleware(e,t){let n=this.middlewares.filter(t=>!t.object||t.object===`*`||t.object===e.object),r=0,i=async()=>{r<n.length?await n[r++].fn(e,i):e.result=await t()};return await i(),e.result}buildSession(e){if(e)return{userId:e.userId,tenantId:e.tenantId,roles:e.roles,accessToken:e.accessToken}}registerApp(e){let t=e.id||e.name,n=e.namespace;if(this.logger.debug(`Registering package manifest`,{id:t,namespace:n}),J.installPackage(e),this.logger.debug(`Installed Package`,{id:e.id,name:e.name,namespace:n}),e.objects)if(Array.isArray(e.objects)){this.logger.debug(`Registering objects from manifest (Array)`,{id:t,objectCount:e.objects.length});for(let r of e.objects){let e=J.registerObject(r,t,n,`own`);this.logger.debug(`Registered Object`,{fqn:e,from:t})}}else{this.logger.debug(`Registering objects from manifest (Map)`,{id:t,objectCount:Object.keys(e.objects).length});for(let[r,i]of Object.entries(e.objects)){i.name=r;let e=J.registerObject(i,t,n,`own`);this.logger.debug(`Registered Object`,{fqn:e,from:t})}}if(Array.isArray(e.objectExtensions)&&e.objectExtensions.length>0){this.logger.debug(`Registering object extensions`,{id:t,count:e.objectExtensions.length});for(let n of e.objectExtensions){let e=n.extend,r=n.priority??200,i={name:e,fields:n.fields,label:n.label,pluralLabel:n.pluralLabel,description:n.description,validations:n.validations,indexes:n.indexes};J.registerObject(i,t,void 0,`extend`,r),this.logger.debug(`Registered Object Extension`,{target:e,priority:r,from:t})}}if(Array.isArray(e.apps)&&e.apps.length>0){this.logger.debug(`Registering apps from manifest`,{id:t,count:e.apps.length});for(let n of e.apps){let e=n.name||n.id;e&&(J.registerApp(n,t),this.logger.debug(`Registered App`,{app:e,from:t}))}}e.name&&e.navigation&&!e.apps?.length&&(J.registerApp(e,t),this.logger.debug(`Registered manifest-as-app`,{app:e.name,from:t}));for(let n of[`actions`,`views`,`pages`,`dashboards`,`reports`,`themes`,`flows`,`workflows`,`approvals`,`webhooks`,`roles`,`permissions`,`profiles`,`sharingRules`,`policies`,`agents`,`ragPipelines`,`apis`,`hooks`,`mappings`,`analyticsCubes`,`connectors`]){let r=e[n];if(Array.isArray(r)&&r.length>0){this.logger.debug(`Registering ${n} from manifest`,{id:t,count:r.length});for(let e of r)(e.name||e.id)&&J.registerItem(n,e,`name`,t)}}let r=e.data;if(Array.isArray(r)&&r.length>0){this.logger.debug(`Registering seed data datasets`,{id:t,count:r.length});for(let e of r)e.object&&J.registerItem(`data`,e,`object`,t)}if(e.contributes?.kinds){this.logger.debug(`Registering kinds from manifest`,{id:t,kindCount:e.contributes.kinds.length});for(let n of e.contributes.kinds)J.registerKind(n),this.logger.debug(`Registered Kind`,{kind:n.name||n.type,from:t})}if(Array.isArray(e.plugins)&&e.plugins.length>0){this.logger.debug(`Processing nested plugins`,{id:t,count:e.plugins.length});for(let r of e.plugins)if(r&&typeof r==`object`){let e=r.name||r.id||`unnamed-plugin`;this.logger.debug(`Registering nested plugin`,{pluginName:e,parentId:t}),this.registerPlugin(r,t,n)}}}registerPlugin(e,t,n){let r=e.name||e.id||`unnamed`,i=e.namespace||n,a=t;if(e.objects)try{if(Array.isArray(e.objects)){this.logger.debug(`Registering plugin objects (Array)`,{pluginName:r,count:e.objects.length});for(let t of e.objects){let e=J.registerObject(t,a,i,`own`);this.logger.debug(`Registered Object`,{fqn:e,from:r})}}else{let t=Object.entries(e.objects);this.logger.debug(`Registering plugin objects (Map)`,{pluginName:r,count:t.length});for(let[e,n]of t){n.name=e;let t=J.registerObject(n,a,i,`own`);this.logger.debug(`Registered Object`,{fqn:t,from:r})}}}catch(e){this.logger.warn(`Failed to register plugin objects`,{pluginName:r,error:e.message})}if(e.name&&e.navigation)try{J.registerApp(e,a),this.logger.debug(`Registered plugin-as-app`,{app:e.name,from:r})}catch(e){this.logger.warn(`Failed to register plugin as app`,{pluginName:r,error:e.message})}for(let t of[`actions`,`views`,`pages`,`dashboards`,`reports`,`themes`,`flows`,`workflows`,`approvals`,`webhooks`,`roles`,`permissions`,`profiles`,`sharingRules`,`policies`,`agents`,`ragPipelines`,`apis`,`hooks`,`mappings`,`analyticsCubes`,`connectors`]){let n=e[t];if(Array.isArray(n)&&n.length>0)for(let e of n)(e.name||e.id)&&J.registerItem(t,e,`name`,a)}}registerDriver(e,t=!1){if(this.drivers.has(e.name)){this.logger.warn(`Driver already registered, skipping`,{driverName:e.name});return}this.drivers.set(e.name,e),this.logger.info(`Registered driver`,{driverName:e.name,version:e.version}),(t||this.drivers.size===1)&&(this.defaultDriver=e.name,this.logger.info(`Set default driver`,{driverName:e.name}))}getSchema(e){return J.getObject(e)}resolveObjectName(e){let t=J.getObject(e);return t?t.tableName||t.name:e}getDriver(e){let t=J.getObject(e);if(t){let n=t.datasource||`default`;if(n===`default`){if(this.defaultDriver&&this.drivers.has(this.defaultDriver))return this.drivers.get(this.defaultDriver)}else{if(this.drivers.has(n))return this.drivers.get(n);throw Error(`[ObjectQL] Datasource '${n}' configured for object '${e}' is not registered.`)}}if(this.defaultDriver)return this.drivers.get(this.defaultDriver);throw Error(`[ObjectQL] No driver available for object '${e}'`)}async init(){this.logger.info(`Initializing ObjectQL engine`,{driverCount:this.drivers.size,drivers:Array.from(this.drivers.keys())});for(let[e,t]of this.drivers)try{await t.connect(),this.logger.info(`Driver connected successfully`,{driverName:e})}catch(t){this.logger.error(`Failed to connect driver`,t,{driverName:e})}this.logger.info(`ObjectQL engine initialization complete`)}async destroy(){this.logger.info(`Destroying ObjectQL engine`,{driverCount:this.drivers.size});for(let[e,t]of this.drivers.entries())try{await t.disconnect()}catch(t){this.logger.error(`Error disconnecting driver`,t,{driverName:e})}this.logger.info(`ObjectQL engine destroyed`)}async expandRelatedRecords(t,n,r,i=0){if(!n||n.length===0||i>=e.MAX_EXPAND_DEPTH)return n;let a=J.getObject(t);if(!a||!a.fields)return n;for(let[e,o]of Object.entries(r)){let r=a.fields[e];if(!r||!r.reference||r.type!==`lookup`&&r.type!==`master_detail`)continue;let s=r.reference,c=[];for(let t of n){let n=t[e];if(n!=null)if(Array.isArray(n))c.push(...n.filter(e=>e!=null));else if(typeof n==`object`)continue;else c.push(n)}let l=[...new Set(c)];if(l.length!==0)try{let t={object:s,where:{id:{$in:l}},...o.fields?{fields:o.fields}:{},...o.orderBy?{orderBy:o.orderBy}:{}},r=await this.getDriver(s).find(s,t)??[],a=new Map;for(let e of r){let t=e.id;t!=null&&a.set(String(t),e)}if(o.expand&&Object.keys(o.expand).length>0){let e=await this.expandRelatedRecords(s,r,o.expand,i+1);a.clear();for(let t of e){let e=t.id;e!=null&&a.set(String(e),t)}}for(let t of n){let n=t[e];n!=null&&(Array.isArray(n)?t[e]=n.map(e=>a.get(String(e))??e):typeof n!=`object`&&(t[e]=a.get(String(n))??n))}}catch(n){this.logger.warn(`Failed to expand relationship field; retaining foreign key IDs`,{object:t,field:e,reference:s,error:n.message})}}return n}async find(e,t){e=this.resolveObjectName(e),this.logger.debug(`Find operation starting`,{object:e,query:t});let n=this.getDriver(e),r={object:e,...t};delete r.context,r.top!=null&&r.limit==null&&(r.limit=r.top),delete r.top;let i={object:e,operation:`find`,ast:r,options:t,context:t?.context};return await this.executeWithMiddleware(i,async()=>{let t={object:e,event:`beforeFind`,input:{ast:i.ast,options:i.options},session:this.buildSession(i.context),transaction:i.context?.transaction,ql:this};await this.triggerHooks(`beforeFind`,t);try{let i=await n.find(e,t.input.ast,t.input.options);return r.expand&&Object.keys(r.expand).length>0&&Array.isArray(i)&&(i=await this.expandRelatedRecords(e,i,r.expand,0)),t.event=`afterFind`,t.result=i,await this.triggerHooks(`afterFind`,t),t.result}catch(t){throw this.logger.error(`Find operation failed`,t,{object:e}),t}}),i.result}async findOne(e,t){e=this.resolveObjectName(e),this.logger.debug(`FindOne operation`,{objectName:e});let n=this.getDriver(e),r={object:e,...t,limit:1};delete r.context,delete r.top;let i={object:e,operation:`findOne`,ast:r,options:t,context:t?.context};return await this.executeWithMiddleware(i,async()=>{let t=await n.findOne(e,i.ast);return r.expand&&Object.keys(r.expand).length>0&&t!=null&&(t=(await this.expandRelatedRecords(e,[t],r.expand,0))[0]),t}),i.result}async insert(e,t,n){e=this.resolveObjectName(e),this.logger.debug(`Insert operation starting`,{object:e,isBatch:Array.isArray(t)});let r=this.getDriver(e),i={object:e,operation:`insert`,data:t,options:n,context:n?.context};return await this.executeWithMiddleware(i,async()=>{let t={object:e,event:`beforeInsert`,input:{data:i.data,options:i.options},session:this.buildSession(i.context),transaction:i.context?.transaction,ql:this};await this.triggerHooks(`beforeInsert`,t);try{let n;return n=Array.isArray(t.input.data)?r.bulkCreate?await r.bulkCreate(e,t.input.data,t.input.options):await Promise.all(t.input.data.map(n=>r.create(e,n,t.input.options))):await r.create(e,t.input.data,t.input.options),t.event=`afterInsert`,t.result=n,await this.triggerHooks(`afterInsert`,t),t.result}catch(t){throw this.logger.error(`Insert operation failed`,t,{object:e}),t}}),i.result}async update(e,t,n){e=this.resolveObjectName(e),this.logger.debug(`Update operation starting`,{object:e});let r=this.getDriver(e),i=t.id;!i&&n?.where&&typeof n.where==`object`&&`id`in n.where&&(i=n.where.id);let a={object:e,operation:`update`,data:t,options:n,context:n?.context};return await this.executeWithMiddleware(a,async()=>{let t={object:e,event:`beforeUpdate`,input:{id:i,data:a.data,options:a.options},session:this.buildSession(a.context),transaction:a.context?.transaction,ql:this};await this.triggerHooks(`beforeUpdate`,t);try{let i;if(t.input.id)i=await r.update(e,t.input.id,t.input.data,t.input.options);else if(n?.multi&&r.updateMany){let a={object:e,where:n.where};i=await r.updateMany(e,a,t.input.data,t.input.options)}else throw Error(`Update requires an ID or options.multi=true`);return t.event=`afterUpdate`,t.result=i,await this.triggerHooks(`afterUpdate`,t),t.result}catch(t){throw this.logger.error(`Update operation failed`,t,{object:e}),t}}),a.result}async delete(e,t){e=this.resolveObjectName(e),this.logger.debug(`Delete operation starting`,{object:e});let n=this.getDriver(e),r;t?.where&&typeof t.where==`object`&&`id`in t.where&&(r=t.where.id);let i={object:e,operation:`delete`,options:t,context:t?.context};return await this.executeWithMiddleware(i,async()=>{let a={object:e,event:`beforeDelete`,input:{id:r,options:i.options},session:this.buildSession(i.context),transaction:i.context?.transaction,ql:this};await this.triggerHooks(`beforeDelete`,a);try{let r;if(a.input.id)r=await n.delete(e,a.input.id,a.input.options);else if(t?.multi&&n.deleteMany){let i={object:e,where:t.where};r=await n.deleteMany(e,i,a.input.options)}else throw Error(`Delete requires an ID or options.multi=true`);return a.event=`afterDelete`,a.result=r,await this.triggerHooks(`afterDelete`,a),a.result}catch(t){throw this.logger.error(`Delete operation failed`,t,{object:e}),t}}),i.result}async count(e,t){e=this.resolveObjectName(e);let n=this.getDriver(e),r={object:e,operation:`count`,options:t,context:t?.context};return await this.executeWithMiddleware(r,async()=>{if(n.count){let r={object:e,where:t?.where};return n.count(e,r)}return(await this.find(e,{where:t?.where,fields:[`id`]})).length}),r.result}async aggregate(e,t){e=this.resolveObjectName(e);let n=this.getDriver(e);this.logger.debug(`Aggregate on ${e} using ${n.name}`,t);let r={object:e,operation:`aggregate`,options:t,context:t?.context};return await this.executeWithMiddleware(r,async()=>{let r={object:e,where:t.where,groupBy:t.groupBy,aggregations:t.aggregations};return n.find(e,r)}),r.result}async execute(e,t){if(t?.object){let n=this.getDriver(t.object);if(n.execute)return n.execute(e,void 0,t)}throw Error(`Execute requires options.object to select driver`)}registerObject(e,t=`__runtime__`,n){if(e.fields)for(let[t,n]of Object.entries(e.fields))n&&typeof n==`object`&&!(`name`in n)&&(n.name=t);return J.registerObject(e,t,n)}unregisterObject(e,t){t?J.unregisterObjectsByPackage(t):J.unregisterItem(`object`,e)}getObject(e){return this.getSchema(e)}getConfigs(){let e={},t=J.getAllObjects();for(let n of t)n.name&&(e[n.name]=n);return e}getDriverByName(e){return this.drivers.get(e)}getDriverForObject(e){try{return this.getDriver(e)}catch{return}}datasource(e){let t=this.drivers.get(e);if(!t)throw Error(`[ObjectQL] Datasource '${e}' not found`);return t}on(e,t,n,r){this.registerHook(e,n,{object:t,packageId:r})}removePackage(e){for(let[t,n]of this.hooks.entries()){let r=n.filter(t=>t.packageId!==e);r.length!==n.length&&this.hooks.set(t,r)}this.removeActionsByPackage(e),J.unregisterObjectsByPackage(e,!0)}async close(){return this.destroy()}createContext(e){return new G2(Yhe.parse(e),this)}static async create(t){let n=new e;if(t.datasources)for(let[e,r]of Object.entries(t.datasources))r.name||=e,n.registerDriver(r,e===`default`);if(t.objects)for(let[e,r]of Object.entries(t.objects))n.registerObject(r);if(t.hooks)for(let e of t.hooks)n.on(e.event,e.object,e.handler);return await n.init(),n}};H2.MAX_EXPAND_DEPTH=3;var U2=H2,W2=class{constructor(e,t,n){this.objectName=e,this.context=t,this.engine=n}async find(e={}){return this.engine.find(this.objectName,{...e,context:this.context})}async findOne(e={}){return this.engine.findOne(this.objectName,{...e,context:this.context})}async insert(e){return this.engine.insert(this.objectName,e,{context:this.context})}async create(e){return this.insert(e)}async update(e,t={}){return this.engine.update(this.objectName,e,{...t,context:this.context})}async updateById(e,t){return this.engine.update(this.objectName,{...t,id:e},{where:{id:e},context:this.context})}async delete(e={}){return this.engine.delete(this.objectName,{...e,context:this.context})}async deleteById(e){return this.engine.delete(this.objectName,{where:{id:e},context:this.context})}async count(e={}){return this.engine.count(this.objectName,{...e,context:this.context})}async aggregate(e={}){return this.engine.aggregate(this.objectName,{...e,context:this.context})}async execute(e,t){if(this.engine.executeAction)return this.engine.executeAction(this.objectName,e,{...t,userId:this.context.userId,tenantId:this.context.tenantId,roles:this.context.roles});throw Error(`Actions not supported by engine`)}},G2=class e{constructor(e,t){this.executionContext=e,this.engine=t}object(e){return new W2(e,this.executionContext,this.engine)}sudo(){return new e({...this.executionContext,isSystem:!0},this.engine)}async transaction(t){let n=this.engine,r=n.defaultDriver?n.drivers?.get(n.defaultDriver):void 0;if(!r?.beginTransaction)return t(this);let i=await r.beginTransaction(),a=new e({...this.executionContext,transaction:i},this.engine);try{let e=await t(a);return r.commit?await r.commit(i):r.commitTransaction&&await r.commitTransaction(i),e}catch(e){throw r.rollback?await r.rollback(i):r.rollbackTransaction&&await r.rollbackTransaction(i),e}}get userId(){return this.executionContext.userId}get tenantId(){return this.executionContext.tenantId}get spaceId(){return this.executionContext.tenantId}get roles(){return this.executionContext.roles}get isSystem(){return this.executionContext.isSystem}get transactionHandle(){return this.executionContext.transaction}},K2=class{async register(e,t,n){let r=typeof n==`object`&&n?{...n,name:n.name??t}:n;e===`object`?J.registerItem(e,r,`name`):J.registerItem(e,r,r.id?`id`:`name`)}async get(e,t){let n=J.getItem(e,t);return n?.content??n}getEntry(e,t){return J.getItem(e,t)}async list(e){return J.listItems(e).map(e=>e?.content??e)}async unregister(e,t){J.unregisterItem(e,t)}async exists(e,t){return J.getItem(e,t)!=null}async listNames(e){return J.listItems(e).map(e=>e?.name??e?.content?.name??``).filter(Boolean)}async unregisterPackage(e){J.unregisterObjectsByPackage(e)}async getObject(e){return J.getObject(e)}async listObjects(){return J.getAllObjects()}},q2=class{constructor(e,t){this.name=`com.objectstack.engine.objectql`,this.type=`objectql`,this.version=`1.0.0`,this.init=async e=>{this.ql||=new U2({...this.hostContext,logger:e.logger}),e.registerService(`objectql`,this.ql);let t=!1,n=`objectql`;try{e.getService(`metadata`)&&(t=!0,n=`external`)}catch{}if(t)e.logger.info(`External metadata service detected`,{provider:n,mode:`will-sync-in-start-phase`});else try{let t=new K2;e.registerService(`metadata`,t),e.logger.info(`MetadataFacade registered as metadata service`,{mode:`in-memory`,features:[`registry`,`fast-lookup`]})}catch(e){if(!e.message?.includes(`already registered`))throw e}e.registerService(`data`,this.ql),e.logger.info(`ObjectQL engine registered`,{services:[`objectql`,`data`],metadataProvider:n});let r=new V2(this.ql,()=>e.getServices?e.getServices():new Map);e.registerService(`protocol`,r),e.logger.info(`Protocol service registered`)},this.start=async e=>{e.logger.info(`ObjectQL engine starting...`);try{let t=e.getService(`metadata`);t&&!(t instanceof K2)&&this.ql&&await this.loadMetadataFromService(t,e)}catch{e.logger.debug(`No external metadata service to sync from`)}if(e.getServices&&this.ql){let t=e.getServices();for(let[n,r]of t.entries())n.startsWith(`driver.`)&&(this.ql.registerDriver(r),e.logger.debug(`Discovered and registered driver service`,{serviceName:n})),n.startsWith(`app.`)&&(this.ql.registerApp(r),e.logger.debug(`Discovered and registered app service`,{serviceName:n}))}await this.ql?.init(),await this.syncRegisteredSchemas(e),this.registerAuditHooks(e),this.registerTenantMiddleware(e),e.logger.info(`ObjectQL engine started`,{driversRegistered:this.ql?.drivers?.size||0,objectsRegistered:this.ql?.registry?.getAllObjects?.()?.length||0})},e?this.ql=e:this.hostContext=t}registerAuditHooks(e){this.ql&&(this.ql.registerHook(`beforeInsert`,async e=>{if(e.session?.userId&&e.input?.data){let t=e.input.data;typeof t==`object`&&t&&(t.created_by=t.created_by??e.session.userId,t.updated_by=e.session.userId,t.created_at=t.created_at??new Date().toISOString(),t.updated_at=new Date().toISOString(),e.session.tenantId&&(t.tenant_id=t.tenant_id??e.session.tenantId))}},{object:`*`,priority:10}),this.ql.registerHook(`beforeUpdate`,async e=>{if(e.session?.userId&&e.input?.data){let t=e.input.data;typeof t==`object`&&t&&(t.updated_by=e.session.userId,t.updated_at=new Date().toISOString())}},{object:`*`,priority:10}),this.ql.registerHook(`beforeUpdate`,async e=>{if(e.input?.id&&!e.previous)try{let t=await this.ql.findOne(e.object,{where:{id:e.input.id}});t&&(e.previous=t)}catch{}},{object:`*`,priority:5}),this.ql.registerHook(`beforeDelete`,async e=>{if(e.input?.id&&!e.previous)try{let t=await this.ql.findOne(e.object,{where:{id:e.input.id}});t&&(e.previous=t)}catch{}},{object:`*`,priority:5}),e.logger.debug(`Audit hooks registered (created_by/updated_by, previousData)`))}registerTenantMiddleware(e){this.ql&&(this.ql.registerMiddleware(async(e,t)=>{if(!e.context?.tenantId||e.context?.isSystem)return t();if([`find`,`findOne`,`count`,`aggregate`].includes(e.operation)&&e.ast){let t={tenant_id:e.context.tenantId};e.ast.where?e.ast.where={$and:[e.ast.where,t]}:e.ast.where=t}await t()}),e.logger.debug(`Tenant isolation middleware registered`))}async syncRegisteredSchemas(e){if(!this.ql)return;let t=this.ql.registry?.getAllObjects?.()??[];if(t.length===0)return;let n=0,r=0,i=new Map;for(let n of t){let t=this.ql.getDriverForObject(n.name);if(!t){e.logger.debug(`No driver available for object, skipping schema sync`,{object:n.name}),r++;continue}if(typeof t.syncSchema!=`function`){e.logger.debug(`Driver does not support syncSchema, skipping`,{object:n.name,driver:t.name}),r++;continue}let a=n.tableName||n.name,o=i.get(t);o||(o=[],i.set(t,o)),o.push({obj:n,tableName:a})}for(let[t,r]of i)if(t.supports?.batchSchemaSync&&typeof t.syncSchemasBatch==`function`){let i=r.map(e=>({object:e.tableName,schema:e.obj}));try{await t.syncSchemasBatch(i),n+=r.length,e.logger.debug(`Batch schema sync succeeded`,{driver:t.name,count:r.length})}catch(i){e.logger.warn(`Batch schema sync failed, falling back to sequential`,{driver:t.name,error:i instanceof Error?i.message:String(i)});for(let{obj:i,tableName:a}of r)try{await t.syncSchema(a,i),n++}catch(n){e.logger.warn(`Failed to sync schema for object`,{object:i.name,tableName:a,driver:t.name,error:n instanceof Error?n.message:String(n)})}}}else for(let{obj:i,tableName:a}of r)try{await t.syncSchema(a,i),n++}catch(n){e.logger.warn(`Failed to sync schema for object`,{object:i.name,tableName:a,driver:t.name,error:n instanceof Error?n.message:String(n)})}(n>0||r>0)&&e.logger.info(`Schema sync complete`,{synced:n,skipped:r,total:t.length})}async loadMetadataFromService(e,t){t.logger.info(`Syncing metadata from external service into ObjectQL registry...`);let n=[`object`,`view`,`app`,`flow`,`workflow`,`function`],r=0;for(let i of n)try{if(typeof e.loadMany==`function`){let n=await e.loadMany(i);n&&n.length>0&&(n.forEach(e=>{let t=e.id?`id`:`name`;i===`object`&&this.ql||this.ql?.registry?.registerItem&&this.ql.registry.registerItem(i,e,t)}),r+=n.length,t.logger.info(`Synced ${n.length} ${i}(s) from metadata service`))}}catch(e){t.logger.debug(`No ${i} metadata found or error loading`,{error:e.message})}r>0&&t.logger.info(`Metadata sync complete: ${r} items loaded into ObjectQL registry`)}},sve=16777619;function J2(e,t){return e*sve^t>>>0}function Y2(e){if(Number.isNaN(e))return 2143289344;if(!Number.isFinite(e))return e>0?2139095040:4286578688;let t=Math.trunc(e),n=e-t,r=t|0;if(n!==0){let e=Math.floor(n*4294967296);r=J2(r,e|0)}return r>>>0}function X2(e){let t=0;for(let n=0;n<e.length;n++)t=J2(t,e.charCodeAt(n));return t>>>0}function cve(e){let t=0,n=e<0n,r=n?-e:e;if(r===0n)t=J2(t,0);else for(;r>0n;){let e=Number(r&255n);t=J2(t,e),r>>=8n}return J2(t,+n)>>>0}function lve(e){let t=X2((e.name||``)+e.toString());return t=J2(t,e.length),t>>>0}function uve(e){let t=0;for(let n=0;n<e.length;n++)t=J2(t,e[n]);return t>>>0}function dve(e){let t=X2(e.constructor.name),n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return t=J2(t,uve(n)),t>>>0}function fve(e,t){if(t.has(e))return 13;t.add(e);let n=1;for(let r=0;r<e.length;r++)n=J2(n,Z2(e[r],t));return t.delete(e),n>>>0}function pve(e,t){if(t.has(e))return 13;t.add(e);let n=Object.keys(e).sort(),r=X2(e?.constructor?.name);for(let i of n)r=J2(r,X2(i)),r=J2(r,Z2(e[i],t));return t.delete(e),r>>>0}var mve=[3735928559,305441741].map(e=>J2(3,e)),hve=J2(1,0),gve=J2(2,0);function Z2(e,t){if(e===null)return hve;switch(typeof e){case`undefined`:return gve;case`boolean`:return mve[+e];case`number`:return J2(4,Y2(e));case`string`:return J2(5,X2(e));case`bigint`:return J2(6,cve(e));case`function`:return J2(7,lve(e));default:return ArrayBuffer.isView(e)&&!(e instanceof DataView)?J2(12,dve(e)):e instanceof Date?J2(10,Y2(e.getTime())):e instanceof RegExp?J2(11,J2(X2(e.source),X2(e.flags))):Array.isArray(e)?J2(8,fve(e,t)):J2(9,pve(e,t))}}function Q2(e){return Z2(e,new WeakSet)>>>0}var $2=class extends Error{},e4=Symbol(`missing`),_ve=`mingo: cycle detected while processing object/array`,t4=e=>typeof e!=`object`&&typeof e!=`function`||e===null,n4=e=>t4(e)||_4(e)||v4(e),r4={undefined:1,null:2,number:3,string:4,symbol:5,object:6,array:7,arraybuffer:8,boolean:9,date:10,regexp:11,function:12},i4=Object.keys(r4).length*2,a4=(e,t)=>e<t?-1:e>t?1:0,vve=(e,t)=>{let n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=a4(n[e],r[e]);if(t!==0)return t}return a4(n.length,r.length)};function o4(e,t,n=!1){let r=0;if(e===e4&&(e=void 0),t===e4&&(t=void 0),e===t||Object.is(e,t))return 0;let i=C4(e)?`arraybuffer`:d4(e),a=C4(t)?`arraybuffer`:d4(t);if(i!==a){if(i==`undefined`)return-1;if(a==`undefined`)return 1;if(n&&i==`array`&&!e.length)return-1;if(n&&a==`array`&&!t.length)return 1;if(n){if(Z(e)){let n=e.slice().sort(o4);r=1;for(let e of n)if((r=Math.min(r,o4(e,t)))<0)return r;return r}else if(Z(t)){let n=t.slice().sort(o4);r=-1;for(let t of n)if((r=Math.max(r,o4(e,t)))>0)return r;return r}}let o=r4[i]??i4,s=r4[a]??i4;if(o!==s)return a4(o,s)}switch(i){case`number`:case`string`:return a4(e,t);case`boolean`:case`date`:return a4(+e,+t);case`regexp`:return(r=a4(e.source,t.source))||(r=a4(e.flags,t.flags))?r:0;case`arraybuffer`:return vve(e,t);case`array`:{let n=e.slice().sort(o4),i=t.slice().sort(o4),a=Math.min(n.length,i.length);for(let e=0;e<a;e++)if(r=o4(n[e],i[e]))return r;return a4(n.length,i.length)}default:{if(i!==`object`){if(e?.constructor===t?.constructor&&c4(e))return a4(e.toString(),t.toString());if(r=a4(e?.constructor?.name,t?.constructor?.name))return r}let n=Object.keys(e).sort();if(r=o4(n,Object.keys(t).sort()))return r;for(let i of n)if(r=o4(e[i],t[i]))return r;return 0}}}var s4=(e,t)=>o4(e,t,!0),c4=e=>e!=null&&e.toString!==Object.prototype.toString;function l4(e,t){if(e===t||Object.is(e,t))return!0;if(e===null||t===null||typeof e!=typeof t||typeof e!=`object`||e.constructor!==t.constructor)return!1;if(_4(e))return _4(t)&&+e==+t;if(v4(e))return v4(t)&&e.source===t.source&&e.flags===t.flags;if(Z(e)&&Z(t))return e.length===t.length&&e.every((e,n)=>l4(e,t[n]));if(e?.constructor!==Object&&c4(e))return e?.toString()===t?.toString();let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>S4(t,n)&&l4(e[n],t[n])):!1}var u4=class e extends Map{#e=new Map;#t=e=>{let t=Q2(e);return[(this.#e.get(t)||[]).find(t=>l4(t,e)),t]};constructor(){super()}static init(){return new e}clear(){super.clear(),this.#e.clear()}delete(e){if(t4(e))return super.delete(e);let[t,n]=this.#t(e);return super.delete(t)?(this.#e.set(n,this.#e.get(n).filter(e=>!l4(e,t))),!0):!1}get(e){if(t4(e))return super.get(e);let[t,n]=this.#t(e);return super.get(t)}has(e){if(t4(e))return super.has(e);let[t,n]=this.#t(e);return super.has(t)}set(e,t){if(t4(e))return super.set(e,t);let[n,r]=this.#t(e);if(super.has(n))super.set(n,t);else{super.set(e,t);let n=this.#e.get(r)||[];n.push(e),this.#e.set(r,n)}return this}get size(){return super.size}};function Y(e,t){if(!e)throw new $2(t)}function d4(e){if(e===null)return`null`;let t=typeof e;return t!==`object`&&r4[t]?t:Z(e)?`array`:_4(e)?`date`:v4(e)?`regexp`:e?.constructor?.name?.toLowerCase()??`object`}var f4=e=>typeof e==`boolean`,p4=e=>typeof e==`string`,X=e=>!Number.isNaN(e)&&typeof e==`number`,m4=Number.isInteger,Z=Array.isArray,h4=e=>d4(e)===`object`,g4=e=>!t4(e),_4=e=>e instanceof Date,v4=e=>e instanceof RegExp,yve=e=>typeof e==`function`,Q=e=>e==null,y4=(e,t=!0)=>!!e||t&&e===``,b4=e=>Q(e)||p4(e)&&!e||Z(e)&&e.length===0||h4(e)&&Object.keys(e).length===0,x4=e=>Z(e)?e:[e],S4=(e,...t)=>!!e&&t.every(t=>Object.prototype.hasOwnProperty.call(e,t)),C4=e=>typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e),w4=(e,t)=>{if(Q(e)||f4(e)||X(e)||p4(e))return e;if(_4(e))return new Date(e);if(v4(e))return new RegExp(e);if(C4(e)){let t=e.constructor;return new t(e)}if(t instanceof Set||(t=new Set),t.has(e))throw Error(_ve);t.add(e);try{if(Z(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=w4(e[r],t);return n}if(h4(e)){let n={};for(let r of Object.keys(e))n[r]=w4(e[r],t);return n}}finally{t.delete(e)}return e};function T4(e){if(e.length===0||e.some(e=>e.length===0))return[];if(e.length===1)return e[0].slice();let t=[u4.init(),u4.init()];e[e.length-1].forEach(e=>t[0].set(e,!0));for(let n=e.length-2;n>-1;n--){if(e[n].forEach(e=>{t[0].has(e)&&t[1].set(e,!0)}),t[1].size===0)return[];t.reverse(),t[1].clear()}return Array.from(t[0].keys())}function E4(e,t=1){let n=[];function r(e,t){for(let i=0,a=e.length;i<a;i++)Z(e[i])&&(t>0||t<0)?r(e[i],Math.max(-1,t-1)):n.push(e[i])}return r(e,t),n}function D4(e){let t=u4.init();return e.forEach(e=>t.set(e,!0)),Array.from(t.keys())}function O4(e,t){if(e.length<1)return new Map;let n=u4.init();for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r)??null,o=n.get(a);o?o.push(i):(o=[i],n.set(a,o))}return n}function k4(e,t){return g4(e)?e[t]:void 0}function bve(e,t){if(t<1)return e;for(;t--&&e.length===1&&Z(e[0]);)e=e[0];return e}function A4(e,t,n){let r=0;function i(e,t){let n=e;for(let e=0;e<t.length;e++){let a=t[e];if(/^\d+$/.exec(a)===null&&Z(n)){if(e===0&&r>0)break;r+=1;let a=t.slice(e);n=n.reduce((e,t)=>{let n=i(t,a);return n!==void 0&&e.push(n),e},[]);break}else n=k4(n,a);if(n===void 0)break}return n}let a=n4(e)?e:i(e,t.split(`.`));return Z(a)&&n?.unwrapArray?bve(a,r):a}function j4(e,t,n){let r=t.indexOf(`.`),i=r==-1?t:t.substring(0,r),a=t.substring(r+1),o=r!=-1;if(Z(e)){let r=/^\d+$/.test(i),s=r&&n?.preserveIndex?e.slice():[];if(r){let t=parseInt(i),r=k4(e,t);o&&(r=j4(r,a,n)),n?.preserveIndex?s[t]=r:s.push(r)}else for(let r of e){let e=j4(r,t,n);n?.preserveMissing?s.push(e??e4):(e!=null||n?.preserveIndex)&&s.push(e)}return s}let s=n?.preserveKeys?{...e}:{},c=k4(e,i);if(o&&(c=j4(c,a,n)),c!==void 0)return s[i]=c,s}function M4(e){if(Z(e))for(let t=e.length-1;t>=0;t--)e[t]===e4?e.splice(t,1):M4(e[t]);else if(h4(e))for(let t of Object.keys(e))S4(e,t)&&M4(e[t])}var N4=/^\d+$/;function P4(e,t,n,r){let i=t.split(`.`),a=i[0],o=i.slice(1).join(`.`);if(i.length===1)(h4(e)||Z(e)&&N4.test(a))&&n(e,a);else{r?.buildGraph&&Q(e[a])&&(e[a]={});let t=e[a];if(!t)return;let s=!!(i.length>1&&N4.test(i[1]));Z(t)&&r?.descendArray&&!s?t.forEach((e=>P4(e,o,n,r))):P4(t,o,n,r)}}function F4(e,t,n){P4(e,t,(e,t)=>e[t]=n,{buildGraph:!0})}function I4(e,t,n){P4(e,t,((e,t)=>{Z(e)?e.splice(parseInt(t),1):h4(e)&&delete e[t]}),n)}var L4=e=>e&&e[0]===`$`&&/^\$[a-zA-Z0-9_]+$/.test(e);function R4(e){if(n4(e))return v4(e)?{$regex:e}:{$eq:e};if(g4(e)){if(!Object.keys(e).some(L4))return{$eq:e};if(S4(e,`$regex`)){let t={...e};return t.$regex=new RegExp(e.$regex,e.$options),delete t.$options,t}}return e}function z4(e,t,n=s4){let r=0,i=e.length-1;for(;r<=i;){let a=Math.round(r+(i-r)/2);if(n(t,e[a])<0)i=a-1;else if(n(t,e[a])>0)r=a+1;else return a}return r}var xve=class{constructor(){this.root={children:new Map,isTerminal:!1}}add(e){let t=e.split(`.`),n=this.root;for(let e of t){if(n.isTerminal)return!1;n.children.has(e)||n.children.set(e,{children:new Map,isTerminal:!1}),n=n.children.get(e)}return n.isTerminal||n.children.size?!1:n.isTerminal=!0}},B4=(e=>(e[e.CLONE_OFF=0]=`CLONE_OFF`,e[e.CLONE_INPUT=1]=`CLONE_INPUT`,e[e.CLONE_OUTPUT=2]=`CLONE_OUTPUT`,e[e.CLONE_ALL=3]=`CLONE_ALL`,e))(B4||{}),V4=class e{constructor(e,t){this.options=e,this.#e=t?{...t}:{}}#e;static init(t){return t instanceof e?new e(t.options,t.#e):new e({idKey:`_id`,scriptEnabled:!0,useStrictMode:!0,failOnError:!0,processingMode:0,...t,context:t?.context?U4.from(t?.context):U4.init()})}update(e){return Object.assign(this.#e,e,{timestamp:this.#e.timestamp,variables:{...this.#e?.variables,...e?.variables}}),this}get local(){return this.#e}get now(){return this.#e?.timestamp||Object.assign(this.#e,{timestamp:Date.now()}),new Date(this.#e.timestamp)}get idKey(){return this.options.idKey}get collation(){return this.options?.collation}get processingMode(){return this.options?.processingMode}get useStrictMode(){return this.options?.useStrictMode}get scriptEnabled(){return this.options?.scriptEnabled}get failOnError(){return this.options?.failOnError}get collectionResolver(){return this.options?.collectionResolver}get jsonSchemaValidator(){return this.options?.jsonSchemaValidator}get variables(){return this.options?.variables}get context(){return this.options?.context}},H4=(e=>(e.ACCUMULATOR=`accumulator`,e.EXPRESSION=`expression`,e.PIPELINE=`pipeline`,e.PROJECTION=`projection`,e.QUERY=`query`,e.WINDOW=`window`,e))(H4||{}),U4=class e{#e=new Map(Object.values(H4).map(e=>[e,{}]));constructor(){}static init(t={}){let n=new e;for(let[e,r]of Object.entries(t))n.#e.has(e)&&r&&n.addOps(e,r);return n}static from(...t){let n=new e;for(let e of t)for(let t of Object.values(H4))n.addOps(t,e.#e.get(t));return n}addOps(e,t){return this.#e.set(e,Object.assign({},t,this.#e.get(e))),this}getOperator(e,t){return this.#e.get(e)[t]??null}addAccumulatorOps(e){return this.addOps(`accumulator`,e)}addExpressionOps(e){return this.addOps(`expression`,e)}addQueryOps(e){return this.addOps(`query`,e)}addPipelineOps(e){return this.addOps(`pipeline`,e)}addProjectionOps(e){return this.addOps(`projection`,e)}addWindowOps(e){return this.addOps(`window`,e)}};function $(e,t,n,r){let i=!(r instanceof V4)||Q(r.local.root)?V4.init(r).update({root:e}):r;return L4(n)?G4(e,t,n,i):W4(e,t,i)}var Sve=[`$$ROOT`,`$$CURRENT`,`$$REMOVE`,`$$NOW`];function W4(e,t,n){if(p4(t)&&t.length>0&&t[0]===`$`){if(t===`$$KEEP`||t===`$$PRUNE`||t===`$$DESCEND`)return t;let r=n.local.root,i=t.split(`.`);if(Sve.includes(i[0])){switch(i[0]){case`$$ROOT`:break;case`$$CURRENT`:r=e;break;case`$$REMOVE`:r=void 0;break;case`$$NOW`:r=new Date(n.now);break}t=t.slice(i[0].length+1)}else if(i[0].slice(0,2)===`$$`){r=Object.assign({},n.variables,{this:e},n?.local?.variables);let a=i[0].slice(2);Y(S4(r,a),`Use of undefined variable: ${a}`),t=t.slice(2)}else t=t.slice(1);return t===``?r:A4(r,t)}if(Z(t))return t.map(t=>W4(e,t,n));if(h4(t)){let r={},i=Object.entries(t);for(let[a,o]of i){if(L4(a))return Y(i.length===1,`Expression must contain a single operator. got [${Object.keys(t).join(`,`)}]`),G4(e,o,a,n);r[a]=W4(e,o,n)}return r}return t}function G4(e,t,n,r){let i=r.context,a=i.getOperator(`expression`,n);if(a)return a(e,t,r);let o=i.getOperator(`accumulator`,n);return Y(!!o,`accumulator '${n}' is not registered.`),Z(e)||(e=W4(e,t,r),t=null),Y(Z(e),`arguments must resolve to array for ${n}.`),o(e,t,r)}function K4(e){return e instanceof J4?e:new J4(e)}function q4(...e){let t=0;return K4(()=>{for(;t<e.length;){let n=e[t].next();if(!n.done)return n;t++}return{done:!0,value:void 0}})}function Cve(e){return!!e&&typeof e==`object`&&typeof e?.next==`function`}function wve(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e[Symbol.iterator]==`function`}var J4=class{#e=[];#t=[];#n;#r=!1;constructor(e){let t=wve(e)?e[Symbol.iterator]():Cve(e)?e:typeof e==`function`?{next:e}:null;Y(!!t,`Iterator must be initialized with an iterable or function.`);let n=-1,r={done:!1};this.#n=()=>{for(;!r.done&&(r=t.next(),!r.done);){let e=r.value;if(n++,this.#e.every(({op:t,fn:r})=>{let i=r(e,n);return t===`map`?!!(e=i)||!0:i}))return{value:e,done:!1}}return{done:!0}}}push(e,t){return this.#e.push({op:e,fn:t}),this}next(){return this.#n()}map(e){return this.push(`map`,e)}filter(e){return this.push(`filter`,e)}take(e){return Y(e>=0,`value must be a non‑negative integer`),this.filter(t=>e-- >0)}drop(e){return Y(e>=0,`value must be a non‑negative integer`),this.filter(t=>e--<=0)}transform(e){let t=this,n;return K4(()=>(n||=K4(e(t.collect())),n.next()))}collect(){for(;!this.#r;){let{done:e,value:t}=this.#n();e||this.#t.push(t),this.#r=e}return this.#t}each(e){for(let t=this.next();t.done!==!0;t=this.next())e(t.value)}reduce(e,t){let n=this.next();for(t===void 0&&!n.done&&(t=n.value,n=this.next());!n.done;)t=e(t,n.value),n=this.next();return t}size(){return this.collect().length}[Symbol.iterator](){return this}},Y4=class{#e;#t;constructor(e,t){this.#e=e,this.#t=V4.init(t)}stream(e,t){let n=K4(e),r=t??this.#t,i=r.processingMode;return i&B4.CLONE_INPUT&&n.map(e=>w4(e)),n=this.#e.map((e,t)=>{let n=Object.keys(e);Y(n.length===1,`aggregation stage must have single operator, got ${n.toString()}.`);let i=n[0];Y(i!==`$documents`||t==0,`$documents must be first stage in pipeline.`);let a=r.context.getOperator(H4.PIPELINE,i);return Y(!!a,`unregistered pipeline operator ${i}.`),[a,e[i]]}).reduce((e,[t,n])=>t(e,n,r),n),i&B4.CLONE_OUTPUT&&n.map(e=>w4(e)),n}run(e,t){return this.stream(e,t).collect()}},X4=(e,t,n)=>{if(Q(t))return e;let r=V4.init(n);return e.map(e=>$(e,t,null,r.update({root:e}))??null)},Tve=(e,t,n)=>{Y(n.scriptEnabled,`$accumulator requires 'scriptEnabled' option to be true`);let r=V4.init(n),i=$(r?.local?.groupId,t.initArgs||[],null,r.update({root:r?.local?.groupId})),a=X4(e,t.accumulateArgs,r);a.forEach(e=>e.forEach((t,n)=>e[n]=t??null));let o=t.init.apply(null,i),s=a.reduce((e,n)=>t.accumulate.apply(null,[e,...n]),o);return t.finalize?t.finalize.call(null,s):s},Eve=(e,t,n)=>D4(X4(e,t,n)),Dve=(e,t,n)=>{let r=X4(e,t,n).filter(X);return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length},Z4=(e,t,n)=>{if(b4(t)||!h4(t))return e;Y(h4(t)&&Object.keys(t).length>0,`$sort specification is invalid`);let r=s4,i=n.collation;return h4(i)&&p4(i.locale)&&(r=kve(i)),e.transform(e=>{let n=Object.keys(t);for(let i of n.reverse()){let n=O4(e,e=>A4(e,i)),a=Array.from(n.keys()),o=!1;if(r===s4){let e=!0,t=!0;o=a.every(n=>(e&&=p4(n))^+(t&&=X(n))),e?a.sort():t&&new Float64Array(a).sort().forEach((e,t)=>a[t]=e)}o||a.sort(r),t[i]===-1&&a.reverse();let s=0;for(let t of a)for(let r of n.get(t))e[s++]=r;Y(s==e.length,`bug: counter must match collection size.`)}return e})},Ove={1:`base`,2:`accent`,3:`variant`};function kve(e){let t={sensitivity:Ove[e.strength||3],caseFirst:e.caseFirst===`off`?`false`:e.caseFirst||`false`,numeric:e.numericOrdering||!1,ignorePunctuation:e.alternate===`shifted`};e.caseLevel===!0&&(t.sensitivity===`base`&&(t.sensitivity=`case`),t.sensitivity===`accent`&&(t.sensitivity=`variant`));let n=new Intl.Collator(e.locale,t);return(e,t)=>{if(!p4(e)||!p4(t))return s4(e,t);let r=n.compare(e,t);return r<0?-1:r>0?1:0}}var Q4=(e,t,n)=>{let r=n,i=$(r?.local?.groupId,t.n,null,r),a=Z4(K4(e),t.sortBy,n).collect(),o=a.length;return X4(o<=i?a:a.slice(o-i),t.output,r)},Ave=(e,t,n)=>Q4(e,{...t,n:1},n),jve=(e,t,n)=>e.length;function $4(e,t=!0){let n=e.reduce((e,t)=>e+t,0),r=Math.max(e.length,1),i=n/r;return Math.sqrt(e.reduce((e,t)=>e+(t-i)**2,0)/(r-Number(t)))}function e3(e,t=!0){if(e.length<2)return t?null:0;let n=0,r=0;for(let[t,i]of e)n+=t,r+=i;n/=e.length,r/=e.length;let i=0;for(let[t,a]of e)i+=(t-n)*(a-r);return i/(e.length-Number(t))}var Mve=(e,t,n)=>e3(X4(e,t,n),!1),Nve=(e,t,n)=>e3(X4(e,t,n),!0),t3=(e,t,n)=>{let r=e[0];return $(r,t,null,V4.init(n).update({root:r}))??null},n3={int:{int:!0},pos:{min:1,int:!0},index:{min:0,int:!0},nzero:{min:0,max:0,int:!0}},Pve={int:{type:`integers`},obj:{type:`objects`}};function r3(e,t){return Y(!e,t),null}function i3(e,t){let n=`${t} expression must resolve to object`;return Y(!e,n),null}function a3(e,t){let n=`${t} expression must resolve to string`;return Y(!e,n),null}function o3(e,t,n){let r=n?.int?`integer`:`number`,i=n?.min??-1/0,a=n?.max??1/0,o;return o=i===0&&a===0?`${t} expression must resolve to non-zero ${r}`:i===0&&a===1/0?`${t} expression must resolve to non-negative ${r}`:i!==-1/0&&a!==1/0?`${t} expression must resolve to ${r} in range [${i}, ${a}]`:i>0?`${t} expression must resolve to positive ${r}`:`${t} expression must resolve to ${r}`,Y(!e,o),null}function s3(e,t,n){let r=`array`;!Q(n?.size)&&n?.size>=0&&(r=n.size===0?`non-zero array`:`array(${n.size})`),n?.type&&(r=`array of ${n.type}`);let i=`${t} expression must resolve to ${r}`;return Y(!e,i),null}var c3=(e,t,n)=>{let r=n.failOnError,i=n,a=e.length,o=$(i?.local?.groupId,t.n,null,i);return!m4(o)||o<1?o3(r,`$firstN 'n'`,n3.pos):X4(a<=o?e:e.slice(0,o),t.input,n)},l3=(e,t,n)=>{let r=e[e.length-1];return $(r,t,null,V4.init(n).update({root:r}))??null},u3=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,null,r),o=n.failOnError;return!m4(a)||a<1?o3(o,`$lastN 'n'`,n3.pos):X4(i<=a?e:e.slice(i-a),t.input,n)},Fve=(e,t,n)=>{let r=X4(e,t,n).filter(e=>!Q(e));return r.length?r.reduce((e,t)=>s4(e,t)>=0?e:t):null},d3=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,null,r);if(!m4(a)||a<1)return o3(n.failOnError,`$maxN 'n'`,n3.pos);let o=X4(e,t.input,n).filter(e=>!Q(e));return o.sort((e,t)=>-1*s4(e,t)),i<=a?o:o.slice(0,a)},f3=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`p`)&&Z(t.p),`$percentile expects object { input, p }`);let r=X4(e,t.input,n).filter(X).sort(),i=X4(t.p,`$$CURRENT`,n),a=t.method||`approximate`;for(let e of i)if(!X(e)||e<0||e>1)return r3(n.failOnError,`$percentile 'p' must resolve to array of numbers between [0.0, 1.0]`);return i.map(e=>{let t=e*(r.length-1)+1,n=Math.floor(t),i=t===n?r[t-1]:r[n-1]+t%1*(r[n]-r[n-1]||0);switch(a){case`exact`:return i;case`approximate`:{let t=z4(r,i);return t/r.length>=e?r[Math.max(t-1,0)]:r[t]}}})},p3=(e,t,n)=>f3(e,{...t,p:[.5]},n).pop(),m3=(e,t,n)=>{let r={};for(let t of e)if(!Q(t))for(let e of Object.keys(t))t[e]!==void 0&&(r[e]=t[e]);return r},Ive=(e,t,n)=>{let r=X4(e,t,n).filter(e=>!Q(e));return r.length?r.reduce((e,t)=>s4(e,t)<=0?e:t):null},h3=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,null,r);if(!m4(a)||a<1)return o3(n.failOnError,`$minN 'n'`,n3.pos);let o=X4(e,t.input,n).filter(e=>!Q(e));return o.sort(s4),i<=a?o:o.slice(0,a)},Lve=(e,t,n)=>$4(X4(e,t,n).filter(X),!1),Rve=(e,t,n)=>$4(X4(e,t,n).filter(X),!0),zve=(e,t,n)=>X(t)?e.length*t:X4(e,t,n).filter(X).reduce((e,t)=>e+t,0),g3=(e,t,n)=>{let r=n,{n:i,sortBy:a}=$(r?.local?.groupId,t,null,r);return X4(Z4(K4(e),a,n).take(i).collect(),t.output,r)},Bve=(e,t,n)=>g3(e,{...t,n:1},n),Vve=e({$accumulator:()=>Tve,$addToSet:()=>Eve,$avg:()=>Dve,$bottom:()=>Ave,$bottomN:()=>Q4,$count:()=>jve,$covariancePop:()=>Mve,$covarianceSamp:()=>Nve,$first:()=>t3,$firstN:()=>c3,$last:()=>l3,$lastN:()=>u3,$max:()=>Fve,$maxN:()=>d3,$median:()=>p3,$mergeObjects:()=>m3,$min:()=>Ive,$minN:()=>h3,$percentile:()=>f3,$push:()=>X4,$stdDevPop:()=>Lve,$stdDevSamp:()=>Rve,$sum:()=>zve,$top:()=>Bve,$topN:()=>g3}),Hve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.abs(r):o3(n.failOnError,`$abs`)},_3=`$add expression must resolve to array of numbers.`,Uve=(e,t,n)=>{let r=$(e,t,null,n),i=n.failOnError,a=!1,o=0;if(!Z(r))return r3(i,_3);for(let e of r){if(Q(e))return null;if(typeof e==`number`)o+=e;else if(_4(e)){if(a)return r3(i,`$add must only have one date`);a=!0,o+=+e}else return r3(i,_3)}return a?new Date(o):o},Wve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.ceil(r):o3(n.failOnError,`$ceil`)},Gve=(e,t,n)=>{Y(Z(t),`$divide expects array(2)`);let r=$(e,t,null,n),i=n.failOnError;if(r.some(Q))return null;if(!r.every(X))return s3(i,`$divide`,{size:2,type:`number`});let[a,o]=r;return o===0?r3(i,`$divide cannot divide by zero`):a/o},Kve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.exp(r):o3(n.failOnError,`$exp`)},qve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.floor(r):o3(n.failOnError,`$floor`)},Jve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.log(r):o3(n.failOnError,`$ln`)},Yve=(e,t,n)=>{let r=$(e,t,null,n);if(Z(r)&&r.length==2){if(r.some(Q))return null;if(r.every(e=>typeof e==`number`))return Math.log10(r[0])/Math.log10(r[1])}return s3(n.failOnError,`$log`,{size:2,type:`number`})},Xve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.log10(r):o3(n.failOnError,`$log10`)},Zve=(e,t,n)=>{let r=$(e,t,null,n),i=!Z(r)||r.length!=2;return i||=!r.every(e=>typeof e==`number`),i?s3(n.failOnError,`$mod`,{size:2,type:`number`}):r[0]%r[1]},Qve=(e,t,n)=>{Y(Z(t),`$multiply expects array`);let r=$(e,t,null,n),i=n.failOnError;if(r.some(Q))return null;let a=1;for(let e of r){if(!X(e))return s3(i,`$multiply`,{type:`number`});a*=e}return a},$ve=(e,t,n)=>{Y(Z(t)&&t.length===2,`$pow expects array(2)`);let r=$(e,t,null,n),i=n.failOnError;if(r.some(Q))return null;if(!r.every(X))return s3(i,`$pow`,{size:2,type:`number`});let[a,o]=r;return a===0&&o<0?r3(i,`$pow cannot raise 0 to a negative exponent`):a**+o};function v3(e,t,n){let{name:r,roundOff:i,failOnError:a}=n;if(Q(e))return null;if(Number.isNaN(e)||Math.abs(e)===1/0)return e;if(!X(e))return o3(a,`${r} arg1 <number>`);if(!m4(t)||t<-20||t>100)return o3(a,`${r} arg2 <precision>`,{min:-20,max:100,int:!0});let o=Math.abs(e)===e?1:-1;e=Math.abs(e);let s=Math.trunc(e),c=parseFloat((e-s).toFixed(Math.abs(t)+1));if(t===0){let e=Math.trunc(10*c);i&&((s&1)==1&&e>=5||e>5)&&s++}else if(t>0){let e=10**t,n=Math.trunc(c*e),r=Math.trunc(c*e*10)%10;i&&r>5&&(n+=1),s=(s*e+n)/e}else if(t<0){let e=10**(-1*t),n=s%e;if(s=Math.max(0,s-n),i&&o===-1){for(;n>10;)n-=n/10;s>0&&n>=5&&(s+=e)}}return s*o}var eye=(e,t,n)=>{Y(Z(t),`$round expects array(2)`);let[r,i]=$(e,t,null,n);return v3(r,i??0,{name:`$round`,roundOff:!0,failOnError:n.failOnError})},y3=1e10,tye=(e,t,n)=>{if(Q(t))return null;let r=$(e,t,null,n),{input:i,onNull:a}=h4(r)?r:{input:r};if(Q(i))return X(a)?a:null;if(X(i)){let e=1/(1+Math.exp(-i));return Math.round(e*y3)/y3}return o3(n.failOnError,`$sigmoid`)},nye=(e,t,n)=>{let r=$(e,t,null,n),i=!n.failOnError;return Q(r)?null:typeof r!=`number`||r<0?(Y(i,`$sqrt expression must resolve to non-negative number.`),null):Math.sqrt(r)},rye=(e,t,n)=>{Y(Z(t),`$subtract expects array(2)`);let r=$(e,t,null,n);if(r.some(Q))return null;let i=n.failOnError,[a,o]=r;return _4(a)&&X(o)?new Date(+a-Math.round(o)):_4(a)&&_4(o)?a-+o:r.every(e=>typeof e==`number`)?a-o:X(a)&&_4(o)?r3(i,`$subtract cannot subtract date from number`):s3(i,`$subtract`,{size:2,type:`number|date`})},iye=(e,t,n)=>{Y(Z(t),`$trunc expects array(2)`);let[r,i]=$(e,t,null,n);return v3(r,i??0,{name:`$trunc`,roundOff:!1,failOnError:n.failOnError})},b3=`$arrayElemAt`,aye=(e,t,n)=>{Y(Z(t)&&t.length===2,`${b3} expects array(2)`);let r=$(e,t,null,n);if(r.some(Q))return null;let i=n.failOnError,[a,o]=r;if(!Z(a))return s3(i,`${b3} arg1 <array>`);if(!m4(o))return o3(i,`${b3} arg2 <index>`,n3.int);if(o<0&&Math.abs(o)<=a.length)return a[(o+a.length)%a.length];if(o>=0&&o<a.length)return a[o]},x3={generic:{type:`key-value pairs`},array:{type:`[k,v]`},object:{type:`{k,v}`}},oye=(e,t,n)=>{let r=n.failOnError,i=$(e,t,null,n);if(Q(i))return null;if(!Z(i))return s3(r,`$arrayToObject`,x3.generic);let a=0,o={};for(let e of i)if(Z(e)){let t=E4(e);if(a||=1,a!==1)return s3(r,`$arrayToObject`,x3.object);let[n,i]=t;o[n]=i}else if(h4(e)&&S4(e,`k`)&&S4(e,`v`)){if(a||=2,a!==2)return s3(r,`$arrayToObject`,x3.array);let{k:t,v:n}=e;o[t]=n}else return s3(r,`$arrayToObject`,x3.generic);return o},sye=(e,t,n)=>{let r=$(e,t,null,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return s3(i,`$concatArrays`);let a=0;for(let e of r){if(Q(e))return null;if(!Z(e))return s3(i,`$concatArrays`);a+=e.length}let o=Array(a),s=0;for(let e of r)for(let t of e)o[s++]=t;return o},cye=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`cond`),`$filter expects object { input, as, cond, limit }`);let r=$(e,t.input,null,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return s3(i,`$filter 'input'`);let a=t.limit??Math.max(r.length,1);if(!m4(a)||a<1)return o3(i,`$filter 'limit'`,{min:1,int:!0});if(r.length===0)return[];let o=V4.init(n),s=t?.as||`this`,c={variables:{[s]:null}},l=[];for(let i=0,u=0;i<r.length&&u<a;i++)c.variables[s]=r[i],y4($(e,t.cond,null,o.update(c)),n.useStrictMode)&&(l.push(r[i]),u++);return l},lye=(e,t,n)=>{if(Z(e))return t3(e,t,n);let r=$(e,t,null,n);return Q(r)?null:Z(r)?E4(r)[0]:s3(n.failOnError,`$first`)},uye=(e,t,n)=>{if(Y(h4(t)&&S4(t,`input`,`n`),`$firstN expects object { input, n }`),Z(e))return c3(e,t,n);let{input:r,n:i}=$(e,t,null,n);return Q(r)?null:Z(r)?c3(r,{n:i,input:`$$this`},n):s3(n.failOnError,`$firstN 'input'`)},dye=(e,t,n)=>{Y(Z(t)&&t.length===2,`$in expects array(2)`);let[r,i]=$(e,t,null,n);return Z(i)?i.some(e=>l4(e,r)):r3(n.failOnError,`$in arg2 <array>`)},S3=`$indexOfArray`,fye=(e,t,n)=>{Y(Z(t)&&t.length>1&&t.length<5,`${S3} expects array(4)`);let r=$(e,t,null,n),i=n.failOnError,a=r[0];if(Q(a))return null;if(!Z(a))return s3(i,`${S3} arg1 <array>`);let o=r[1],s=r[2]??0,c=r[3]??a.length;return!m4(s)||s<0?o3(i,`${S3} arg3 <start>`,n3.pos):!m4(c)||c<0?o3(i,`${S3} arg4 <end>`,n3.pos):s>c?-1:(s>0||c<a.length?a.slice(s,c):a).findIndex(e=>l4(e,o))+s},pye=(e,t,n)=>{let r=t;return Z(t)&&(Y(t.length===1,`$isArray expects array(1)`),r=t[0]),Z($(e,r,null,n))},mye=(e,t,n)=>{if(Z(e))return l3(e,t,n);let r=$(e,t,null,n);return Q(r)?null:!Z(r)||r.length===0?s3(n.failOnError,`$last`,{size:0}):E4(r)[r.length-1]},hye=(e,t,n)=>{if(Y(h4(t)&&S4(t,`input`,`n`),`$lastN expects object { input, n }`),Z(e))return u3(e,t,n);let{input:r,n:i}=$(e,t,null,n);return Q(r)?null:Z(r)?u3(r,{n:i,input:`$$this`},n):s3(n.failOnError,`$lastN 'input'`)},gye=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`in`),`$map expects object { input, as, in }`);let r=$(e,t.input,null,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return s3(i,`$map 'input'`);if(!Q(t.as)&&!p4(t.as))return a3(i,`$map 'as'`);let a=V4.init(n),o=t.as||`this`,s={variables:{[o]:null}};return r.map(n=>(s.variables[o]=n,$(e,t.in,null,a.update(s))))},_ye=(e,t,n)=>{if(Y(h4(t)&&S4(t,`input`,`n`),`$maxN expects object { input, n }`),Z(e))return d3(e,t,n);let{input:r,n:i}=$(e,t,null,n);return Q(r)?null:Z(r)?d3(r,{n:i,input:`$$this`},n):s3(n.failOnError,`$maxN 'input'`)},vye=(e,t,n)=>{if(Y(h4(t)&&S4(t,`input`,`n`),`$minN expects object { input, n }`),Z(e))return h3(e,t,n);let{input:r,n:i}=$(e,t,null,n);return Q(r)?null:Z(r)?h3(r,{n:i,input:`$$this`},n):s3(n.failOnError,`$minN 'input'`)},yye=(e,t,n)=>{Y(Z(t)&&t.length>1&&t.length<4,`$range expects array(3)`);let[r,i,a]=$(e,t,null,n),o=n.failOnError,s=a??1;if(!m4(r))return o3(o,`$range arg1 <start>`,n3.int);if(!m4(i))return o3(o,`$range arg2 <end>`,n3.int);if(!m4(s)||s===0)return o3(o,`$range arg3 <step>`,n3.nzero);let c=[],l=r;for(;l<i&&s>0||l>i&&s<0;)c.push(l),l+=s;return c},bye=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`initialValue`,`in`),`$reduce expects object { input, initialValue, in }`);let r=$(e,t.input,null,n),i=$(e,t.initialValue,null,n),a=t.in;if(Q(r))return null;if(!Z(r))return s3(n.failOnError,`$reduce 'input'`);let o=V4.init(n),s={variables:{value:null}};return r.reduce((e,t)=>(s.variables.value=e,$(t,a,null,o.update(s))),i)},xye=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:Z(r)?r.slice().reverse():s3(n.failOnError,`$reverseArray`)},Sye=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:Z(r)?r.length:o3(n.failOnError,`$size`)},C3=(e,t,n)=>{Y(Z(t)&&t.length>1&&t.length<4,`$slice expects array(3)`);let r=n.failOnError,i=$(e,t,null,n),a=i[0],o=i[1],s=i[2];if(!Z(a))return s3(r,`$slice arg1 <array>`);if(!m4(o))return o3(r,`$slice arg2 <n>`,n3.int);if(!Q(s)&&!m4(s))return o3(r,`$slice arg3 <n>`,n3.int);if(Q(s))o<0?o=Math.max(0,a.length+o):(s=o,o=0);else{if(o<0&&(o=Math.max(0,a.length+o)),s<1)return o3(r,`$slice arg3 <n>`,n3.pos);s+=o}return a.slice(o,s)},Cye=(e,t,n)=>{Y(h4(t)&&`input`in t&&`sortBy`in t,`$sortArray expects object { input, sortBy }`);let{input:r,sortBy:i}=$(e,t,null,n);if(Q(r))return null;if(!Z(r))return s3(n.failOnError,`$sortArray 'input'`);if(h4(i))return Z4(K4(r),i,n).collect();let a=r.slice().sort(s4);return i===-1&&a.reverse(),a},wye=(e,t,n)=>{Y(h4(t)&&S4(t,`inputs`),`$zip received invalid arguments`);let r=$(e,t.inputs,null,n),i=$(e,t.defaults,null,n)??[],a=t.useLongestLength??!1,o=n.failOnError;if(Q(r))return null;if(!Z(r))return s3(o,`$zip 'inputs'`);let s=0;for(let e of r){if(Q(e))return null;Z(e)||s++}if(s)return s3(o,`$zip elements of 'inputs'`);f4(a)||r3(o,`$zip 'useLongestLength' must be boolean`),Z(i)&&i.length>0&&Y(a&&i.length===r.length,`$zip 'useLongestLength' must be set to true to use 'defaults'`);let c=0;for(let e of r)c=a?Math.max(c,e.length):Math.min(c||e.length,e.length);let l=[];for(let e=0;e<c;e++){let t=r.map((t,n)=>Q(t[e])?i[n]??null:t[e]);l.push(t)}return l};function w3(e,t,n,r,i){Y(Z(t),`${r} expects array as argument`);let a=$(e,t,null,n);return a.some(Q)?null:a.every(X)?i(a):r3(n.failOnError,`${r} array elements must resolve to integers`)}var Tye=(e,t,n)=>w3(e,t,n,`$bitAnd`,e=>e.reduce((e,t)=>e&t,-1)),Eye=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:m4(r)?~r:o3(n.failOnError,`$bitNot`,n3.int)},Dye=(e,t,n)=>w3(e,t,n,`$bitOr`,e=>e.reduce((e,t)=>e|t,0)),Oye=(e,t,n)=>w3(e,t,n,`$bitXor`,e=>e.reduce((e,t)=>e^t,0)),kye=(e,t,n)=>{Y(Z(t),`$and expects array`);let r=n.useStrictMode;return t.every(t=>y4($(e,t,null,n),r))},Aye=(e,t,n)=>{let r=x4(t);return r.length===0?!1:r.length>1?s3(n.failOnError,`$not`,{size:1}):!$(e,r[0],null,n)},jye=(e,t,n)=>{Y(Z(t),`$or expects array of expressions`);let r=n.useStrictMode;return t.some(t=>y4($(e,t,null,n),r))},Mye=(e,t,n)=>{Y(Z(t)&&t.length===2,`$cmp expects array(2)`);let[r,i]=$(e,t,null,n);return s4(r,i)},T3=(e,t,n)=>e.take(t),E3=(e,t,n)=>{let r=$(null,t,null,n);Y(Z(r),`$documents: expression must resolve to an array.`);let i=K4(r);return n.processingMode&B4.CLONE_ALL?i.map(e=>w4(e)):i};function D3(e,t){let n=!!e&&e[0]?.$documents;return n?{documents:E3(null,n,t).collect(),pipeline:e.slice(1)}:{pipeline:e}}function O3(e,t,n=!0){let r={exclusions:[],inclusions:[],positional:0},i=Object.keys(e);Y(i.length,`Invalid empty sub-projection`);let a=t?.idKey,o=!1;for(let s of i){if(s.startsWith(`$`))return Y(!n&&i.length===1,`FieldPath field names may not start with '$', given '${s}'.`),r;s.endsWith(`.$`)&&r.positional++;let c=e[s];if(c===!1||X(c)&&c===0)s===a?o=!0:r.exclusions.push(s);else if(!h4(c))r.inclusions.push(s);else{let e=O3(c,t,!1);!e.inclusions.length&&!e.exclusions.length?r.inclusions.includes(s)||r.inclusions.push(s):(e.inclusions.forEach(e=>r.inclusions.push(`${s}.${e}`)),e.exclusions.forEach(e=>r.exclusions.push(`${s}.${e}`))),r.positional+=e.positional}Y(!(r.exclusions.length&&r.inclusions.length),`Cannot do exclusion and inclusion in projection.`),Y(r.positional<=1,`Cannot specify more than one positional projection.`)}if(o&&r.exclusions.push(a),n){let e=new xve;r.exclusions.forEach(t=>Y(e.add(t),`Path collision at ${t}.`)),r.inclusions.forEach(t=>Y(e.add(t),`Path collision at ${t}.`)),r.exclusions.sort(),r.inclusions.sort()}return r}var k3=(e,t,n)=>{if(b4(t))return e;let r=O3(t,n),i=Nye(t,V4.init(n),r);return e.map(i)};function Nye(e,t,n){let r=t.idKey,{exclusions:i,inclusions:a}=n,o={},s={preserveMissing:!0};for(let e of i)o[e]=(t,n)=>{I4(t,e,{descendArray:!0})};for(let n of a){let r=A4(e,n)??e[n];if(n.endsWith(`.$`)&&r===1){let e=t?.local?.condition;Y(e,`positional operator '.$' couldn't find matching element in the array.`);let r=n.slice(0,-2);o[r]=Iye(r,e,t);continue}if(Z(r))o[n]=(e,i)=>{t.update({root:i}),F4(e,n,r.map(e=>$(i,e,null,t)??null))};else if(X(r)||r===!0)o[n]=(e,r)=>{t.update({root:r}),j3(e,j4(r,n,s))};else if(h4(r)==0)o[n]=(e,i)=>{t.update({root:i}),F4(e,n,$(i,r,null,t))};else{let e=Object.keys(r);Y(e.length===1&&L4(e[0]),`Not a valid operator`);let i=e[0],a=r[i],s=t.context.getOperator(H4.PROJECTION,i);!s||i===`$slice`&&!x4(a).every(X)?o[n]=(e,r)=>{t.update({root:r}),F4(e,n,$(r,a,i,t))}:o[n]=(e,r)=>{t.update({root:r}),F4(e,n,s(r,a,n,t))}}}let c=i.length===1&&i.includes(r),l=!i.includes(r),u=!a.length,d=u&&c||u&&i.length&&!c;return e=>{let t={};d&&Object.assign(t,e);for(let n in o)o[n](t,e);return u||M4(t),l&&!S4(t,r)&&S4(e,r)&&(t[r]=A4(e,r)),t}}var A3=(e,t,n,r)=>{let i=A4(e,t);Z(i)||(i=A4(i,n)),Y(Z(i),`must resolve to array`);let a=[];return i.forEach((e,t)=>r({[n]:[e]})&&a.push(t)),a},Pye=e=>t=>!e(t),Fye={$and:1,$or:1,$nor:1};function Iye(e,t,n){let r=Object.entries(t).slice(),i={$and:[],$or:[]};for(let t=0;t<r.length;t++){let[a,o,s]=r[t];if(a===e||a.startsWith(e+`.`)){let[e,t]=Object.entries(R4(o)).pop(),r=n.context.getOperator(H4.QUERY,e),c=a.substring(a.lastIndexOf(`.`)+1),l=r(c,t,n);!s||s===`$and`?i.$and.push([a,l,c]):s===`$nor`?i.$and.push([a,Pye(l),c]):s===`$or`&&i.$or.push([a,l,c])}else if(L4(a)){Y(Fye[a],`${a} is not allowed in this context`);for(let e of o)Object.entries(e).forEach(([e,t])=>r.push([e,t,a]))}}let a=e.lastIndexOf(`.`),o=e.substring(0,a)||e,s=e.substring(a+1);return(t,n)=>{let r=[];for(let[e,t,a]of i.$and)r.push(A3(n,e,a,t));if(i.$or.length){let e=[];for(let[t,r,a]of i.$or)e.push(...A3(n,t,a,r));r.push(D4(e))}let a=T4(r).sort()[0],c=A4(n,e)[a];o!=s&&!h4(c)&&(c={[s]:c}),F4(t,o,[c])}}function j3(e,t){if(e===e4||Q(e))return t;if(Q(t))return e;for(let n of Object.keys(t))e[n]=j3(e[n],t[n]);return e}var M3=(e,t,n)=>(Y(t>=0,`$skip value must be a non-negative integer`),e.drop(t)),Lye={$sort:Z4,$skip:M3,$limit:T3},Rye=class{#e;#t;#n;#r;#i={};#a=null;#o=[];constructor(e,t,n,r){this.#e=e,this.#t=t,this.#n=n,this.#r=r}fetch(){if(this.#a)return this.#a;this.#a=K4(this.#e).filter(this.#t);let e=this.#r.processingMode;e&B4.CLONE_INPUT&&this.#a.map(e=>w4(e));for(let e of[`$sort`,`$skip`,`$limit`])S4(this.#i,e)&&(this.#a=Lye[e](this.#a,this.#i[e],this.#r));return Object.keys(this.#n).length&&(this.#a=k3(this.#a,this.#n,this.#r)),e&B4.CLONE_OUTPUT&&this.#a.map(e=>w4(e)),this.#a}fetchAll(){let e=K4(Array.from(this.#o));return this.#o.length=0,q4(e,this.fetch())}all(){return this.fetchAll().collect()}skip(e){return this.#i.$skip=e,this}limit(e){return this.#i.$limit=e,this}sort(e){return this.#i.$sort=e,this}collation(e){return this.#r={...this.#r,collation:e},this}next(){if(this.#o.length>0)return this.#o.pop();let e=this.fetch().next();if(!e.done)return e.value}hasNext(){if(this.#o.length>0)return!0;let e=this.fetch().next();return e.done?!1:(this.#o.push(e.value),!0)}[Symbol.iterator](){return this.fetchAll()}},zye=/^\$(and|or|nor|expr|jsonSchema)$/,N3=class{#e;#t;#n;constructor(e,t){this.#t=w4(e),this.#n=V4.init(t).update({condition:e}),this.#e=[],this.compile()}compile(){Y(h4(this.#t),`query criteria must be an object: ${JSON.stringify(this.#t)}`);let e={},t=Object.entries(this.#t);for(let[n,r]of t){if(n===`$where`)Y(this.#n.scriptEnabled,`$where operator requires 'scriptEnabled' option to be true.`),Object.assign(e,{field:n,expr:r});else if(zye.test(n))this.processOperator(n,n,r);else{Y(!L4(n),`unknown top level operator: ${n}`);for(let[e,t]of Object.entries(R4(r)))this.processOperator(n,e,t)}e.field&&this.processOperator(e.field,e.field,e.expr)}}processOperator(e,t,n){let r=this.#n.context.getOperator(H4.QUERY,t);Y(!!r,`unknown query operator ${t}`),this.#e.push(r(e,n,this.#n))}test(e){return this.#e.every(t=>t(e))}find(e,t){return new Rye(e,e=>this.test(e),t||{},this.#n)}};function P3(e,t,n,r){let i={unwrapArray:!0},a=Math.max(1,e.split(`.`).length-1),o=V4.init(n).update({depth:a});return n=>r(A4(n,e,i),t,o)}function F3(e,t,n,r){Y(Z(t)&&t.length===2,`${r.name} expects array(2)`);let[i,a]=$(e,t,null,n);return r(i,a,n)}function I3(e,t,n){if(l4(e,t)||Q(e)&&Q(t))return!0;if(Z(e)){let r=n?.local?.depth??1;return e.some(e=>l4(e,t))||E4(e,r).some(e=>l4(e,t))}return!1}function L3(e,t,n){return!I3(e,t,n)}function R3(e,t,n){return Q(e)?t.some(e=>e===null):T4([x4(e),t]).length>0}function Bye(e,t,n){return!R3(e,t,n)}function z3(e,t,n){return K3(e,t,(e,t)=>s4(e,t)<0)}function B3(e,t,n){return K3(e,t,(e,t)=>s4(e,t)<=0)}function V3(e,t,n){return K3(e,t,(e,t)=>s4(e,t)>0)}function H3(e,t,n){return K3(e,t,(e,t)=>s4(e,t)>=0)}function Vye(e,t,n){return x4(e).some((e=>t.length===2&&e%t[0]===t[1]))}function Hye(e,t,n){let r=x4(e),i=e=>p4(e)&&y4(t.exec(e),n?.useStrictMode);return r.some(i)||E4(r,1).some(i)}function Uye(e,t,n){if(!Z(e)||!Z(t)||!e.length||!t.length)return!1;let r=!0;for(let i of t){if(!r)break;r=h4(i)&&Object.keys(i).includes(`$elemMatch`)?U3(e,i.$elemMatch,n):v4(i)?e.some(e=>typeof e==`string`&&i.test(e)):e.some(e=>l4(i,e))}return r}function Wye(e,t,n){return Array.isArray(e)&&e.length===t}function Gye(e){return L4(e)&&[`$and`,`$or`,`$nor`].indexOf(e)===-1}function U3(e,t,n){if(Z(e)&&!b4(e)){let r=e=>e,i=t;Object.keys(t).every(Gye)&&(i={temp:t},r=e=>({temp:e}));let a=new N3(i,n);for(let t=0,n=e.length;t<n;t++)if(a.test(r(e[t])))return!0}return!1}var W3=e=>e===null,Kye={array:Z,boolean:f4,bool:f4,date:_4,number:X,int:X,long:X,double:X,decimal:X,null:W3,object:h4,regexp:v4,regex:v4,string:p4,undefined:Q,1:X,2:p4,3:h4,4:Z,6:Q,8:f4,9:_4,10:W3,11:v4,16:X,18:X,19:X};function G3(e,t,n){let r=Kye[t];return r?r(e):!1}function qye(e,t,n){return Z(t)?t.findIndex(t=>G3(e,t,n))>=0:G3(e,t,n)}function K3(e,t,n){return x4(e).some(e=>d4(e)===d4(t)&&n(e,t))}var Jye=(e,t,n)=>F3(e,t,n,I3),Yye=(e,t,n)=>F3(e,t,n,V3),Xye=(e,t,n)=>F3(e,t,n,H3),Zye=(e,t,n)=>F3(e,t,n,z3),Qye=(e,t,n)=>F3(e,t,n,B3),$ye=(e,t,n)=>F3(e,t,n,L3),q3=`$cond expects array(3) or object with 'if-then-else' expressions`,ebe=(e,t,n)=>{let r,i,a;return Z(t)?(Y(t.length===3,q3),r=t[0],i=t[1],a=t[2]):(Y(h4(t),q3),r=t.if,i=t.then,a=t.else),$(e,y4($(e,r,null,n),n.useStrictMode)?i:a,null,n)},J3=(e,t,n)=>{Y(Z(t),`$ifNull expects an array`);let r;for(let i of t)if(r=$(e,i,null,n),!Q(r))return r;return r},tbe=(e,t,n)=>{Y(h4(t),`$switch received invalid arguments`);for(let{case:r,then:i}of t.branches)if(y4($(e,r,null,n),n.useStrictMode))return $(e,i,null,n);return $(e,t.default,null,n)},Y3=(e,t,n)=>{Y(n.scriptEnabled,`$function requires 'scriptEnabled' option to be true`);let r=$(e,t,null,n);return r.body.apply(null,r.args)},X3=[`year`,`quarter`,`month`,`week`,`day`,`hour`,`minute`,`second`,`millisecond`],nbe={mon:1,tue:2,wed:3,thu:4,fri:5,sat:6,sun:7},rbe=-1e9,Z3=e=>(e&3)==0&&(e%100!=0||e%400==0),ibe=[365,366],abe=[[0,31,59,90,120,151,181,212,243,273,304,334],[0,31,60,91,121,152,182,213,244,274,305,335]],Q3=e=>abe[+Z3(e.getUTCFullYear())][e.getUTCMonth()]+e.getUTCDate(),$3=(e,t)=>((e.getUTCDay()||7)-nbe[t.toLowerCase().substring(0,3)]+7)%7,e6=e=>(e+Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400))%7,t6=e=>52+Number(e6(e)==4||e6(e-1)==3);function n6(e){let t=e.getUTCDay()||7,n=Math.floor((10+Q3(e)-t)/7);return n<1?t6(e.getUTCFullYear()-1):n>t6(e.getUTCFullYear())?1:n}function r6(e){return e.getUTCFullYear()-Number(e.getUTCMonth()===0&&e.getUTCDate()==1&&e.getUTCDay()<1)}var i6={week:6048e5,day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},a6=[[`year`,0,9999],[`month`,1,12],[`day`,1,31],[`hour`,0,23],[`minute`,0,59],[`second`,0,59],[`millisecond`,0,999]],o6={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},s6={"%b":{name:`abbr_month`,padding:3,re:/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i},"%B":{name:`full_month`,padding:0,re:/(January|February|March|April|May|June|July|August|September|October|November|December)/i},"%Y":{name:`year`,padding:4,re:/([0-9]{4})/},"%G":{name:`year`,padding:4,re:/([0-9]{4})/},"%m":{name:`month`,padding:2,re:/(0[1-9]|1[012])/},"%d":{name:`day`,padding:2,re:/(0[1-9]|[12][0-9]|3[01])/},"%j":{name:`day_of_year`,padding:3,re:/(0[0-9][1-9]|[12][0-9]{2}|3[0-5][0-9]|36[0-6])/},"%H":{name:`hour`,padding:2,re:/([01][0-9]|2[0-3])/},"%M":{name:`minute`,padding:2,re:/([0-5][0-9])/},"%S":{name:`second`,padding:2,re:/([0-5][0-9]|60)/},"%L":{name:`millisecond`,padding:3,re:/([0-9]{3})/},"%w":{name:`day_of_week`,padding:1,re:/([0-6])/},"%u":{name:`day_of_week_iso`,padding:1,re:/([1-7])/},"%U":{name:`week_of_year`,padding:2,re:/([1-4][0-9]?|5[0-3]?)/},"%V":{name:`week_of_year_iso`,padding:2,re:/([1-4][0-9]?|5[0-3]?)/},"%z":{name:`timezone`,padding:2,re:/(([+-][01][0-9]|2[0-3]):?([0-5][0-9])?)/},"%Z":{name:`minute_offset`,padding:3,re:/([+-][0-9]{3})/},"%%":{name:`percent_literal`,padding:1,re:/%%/}},c6=/(%[bBYGmdjHMSLwuUVzZ%])/g,obe=/%[bBYGmdjHMSLwuUVzZ%]/,sbe=/^[a-zA-Z_]+\/[a-zA-Z_]+$/;function l6(e,t){if(Q(e))return 0;if(sbe.test(e)){let n=new Date(t.toLocaleString(`en-US`,{timeZone:`UTC`})),r=new Date(t.toLocaleString(`en-US`,{timeZone:e}));return Math.round((r.getTime()-n.getTime())/6e4)}let n=s6[`%z`].re.exec(e);Y(!!n,`timezone '${e}' is invalid or not supported.`);let r=parseInt(n[2])||0,i=parseInt(n[3])||0;return(Math.abs(r*60)+i)*(r<0?-1:1)}function cbe(e){return(e<0?`-`:`+`)+f6(Math.abs(Math.floor(e/60)),2)+f6(Math.abs(e)%60,2)}function u6(e,t){e.setUTCMinutes(e.getUTCMinutes()+t)}function d6(e,t,n){if(_4(e))return e;let r=$(e,t,null,n);if(_4(r))return new Date(r);if(X(r))return new Date(r*1e3);Y(!!r?.date,`cannot convert ${JSON.stringify(t)} to date`);let i=_4(r.date)?new Date(r.date):new Date(r.date*1e3);return r.timezone&&u6(i,l6(r.timezone,i)),i}function f6(e,t){return Array(Math.max(t-String(e).length+1,0)).join(`0`)+e.toString()}var p6=e=>{let t=e-rbe;return Math.trunc(t/4)-Math.trunc(t/100)+Math.trunc(t/400)};function lbe(e,t){return Math.trunc(p6(t-1)-p6(e-1)+(t-e)*ibe[0])}var m6=(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),h6=(e,t)=>t.getUTCMonth()-e.getUTCMonth()+m6(e,t)*12,g6=(e,t)=>{let n=Math.trunc(e.getUTCMonth()/3);return Math.trunc(t.getUTCMonth()/3)-n+m6(e,t)*4},_6=(e,t)=>Q3(t)-Q3(e)+lbe(e.getUTCFullYear(),t.getUTCFullYear()),v6=(e,t,n)=>{let r=(n||`sun`).substring(0,3);return Math.trunc((_6(e,t)+$3(e,r)-$3(t,r))/7)},ube=(e,t)=>t.getUTCHours()-e.getUTCHours()+_6(e,t)*24,y6=(e,t)=>{let n=e.getUTCMonth()+t,r=Math.floor(n/12);if(n<0){let t=n%12+12;e.setUTCFullYear(e.getUTCFullYear()+r,t,e.getUTCDate())}else e.setUTCFullYear(e.getUTCFullYear()+r,n%12,e.getUTCDate())},b6=(e,t,n,r)=>{let i=new Date(e);switch(t){case`year`:i.setUTCFullYear(i.getUTCFullYear()+n);break;case`quarter`:y6(i,3*n);break;case`month`:y6(i,n);break;default:i.setTime(i.getTime()+i6[t]*n)}return i},x6=(e,t,n)=>{let r=$(e,t,null,n);return b6(r.startDate,r.unit,r.amount,r.timezone)},dbe=(e,t,n)=>{let{startDate:r,endDate:i,unit:a,timezone:o,startOfWeek:s}=$(e,t,null,n),c=new Date(r),l=new Date(i);switch(u6(c,l6(o,c)),u6(l,l6(o,l)),a){case`year`:return m6(c,l);case`quarter`:return g6(c,l);case`month`:return h6(c,l);case`week`:return v6(c,l,s);case`day`:return _6(c,l);case`hour`:return ube(c,l);case`minute`:return c.setUTCSeconds(0),c.setUTCMilliseconds(0),l.setUTCSeconds(0),l.setUTCMilliseconds(0),Math.round((l.getTime()-c.getTime())/i6[a]);default:return Math.round((l.getTime()-c.getTime())/i6[a])}},fbe=[31,28,31,30,31,30,31,31,30,31,30,31],pbe=e=>e.month==2&&Z3(e.year)?29:fbe[e.month-1],mbe=(e,t,n)=>{let r=$(e,t,null,n),i=l6(r.timezone,new Date);for(let e=a6.length-1,t=0;e>=0;e--){let n=a6[e],a=n[0],o=n[1],s=n[2],c=(r[a]||0)+t;t=0;let l=s+1;if(a==`hour`&&(c+=Math.floor(i/60)*-1),a==`minute`&&(c+=i%60*-1),c<o){let e=o-c;t=-1*Math.ceil(e/l),c=l-e%l}else c>s&&(c+=o,t=Math.trunc(c/l),c%=l);r[a]=c}return r.day=Math.min(r.day,pbe(r)),new Date(Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond))};function hbe(e){return e===`Z`?0:e>=`A`&&e<`N`?e.charCodeAt(0)-64:77-e.charCodeAt(0)}var gbe=e=>e.replace(/^\//,``).replace(/\/$/,``).replace(/\/i/,``),_be=[`^`,`.`,`-`,`*`,`?`,`$`];function vbe(e){return _be.forEach(t=>{e=e.replace(t,`\\${t}`)}),e}var ybe=(e,t,n)=>{let r=$(e,t,null,n);r.format=r.format||`%Y-%m-%dT%H:%M:%S.%LZ`,r.onNull=r.onNull||null;let i=r.dateString;if(Q(i))return r.onNull;let a=r.format.split(obe);a.reverse();let o=r.format.match(c6),s={},c=``;for(let e=0,t=o.length;e<t;e++){let t=s6[o[e]];if(h4(t)){let e=t.re.exec(i),n=a.pop()||``;e===null?s[t.name]=null:(s[t.name]=/^\d+$/.exec(e[0])?parseInt(e[0]):e[0],i=i.substring(e.index+e[0].length+1),c+=vbe(n)+gbe(t.re.toString()))}}if(Q(s.month)){let e=(s.full_month?.slice(0,3)??s.abbr_month??``).toLowerCase();o6[e]&&(s.month=o6[e])}if(Q(s.year)||Q(s.month)||Q(s.day)||!RegExp(`^`+c+`[A-Z]?$`).test(r.dateString))return r.onError;let l=r.dateString.match(/([A-Z])$/);Y(!(l&&r.timezone),`$dateFromString: you cannot pass in a date/time string with time zone information ('${l&&l[0]}') together with a timezone argument`);let u=l?hbe(l[0])*60:l6(r.timezone,new Date),d=new Date(Date.UTC(s.year,s.month-1,s.day,0,0,0));return Q(s.hour)||d.setUTCHours(s.hour),Q(s.minute)||d.setUTCMinutes(s.minute),Q(s.second)||d.setUTCSeconds(s.second),Q(s.millisecond)||d.setUTCMilliseconds(s.millisecond),u6(d,-u),d},bbe=(e,t,n)=>{let r=$(e,t?.amount,null,n);return x6(e,{...t,amount:-1*r},n)},xbe=(e,t,n)=>{let r=$(e,t,null,n),i=new Date(r.date);u6(i,l6(r.timezone,i));let a={hour:i.getUTCHours(),minute:i.getUTCMinutes(),second:i.getUTCSeconds(),millisecond:i.getUTCMilliseconds()};return r.iso8601==1?Object.assign(a,{isoWeekYear:r6(i),isoWeek:n6(i),isoDayOfWeek:i.getUTCDay()||7}):Object.assign(a,{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate()})},S6=(e,t,n)=>d6(e,t,n).getUTCDate(),C6=(e,t,n)=>d6(e,t,n).getUTCDay()+1,w6=(e,t,n)=>Q3(d6(e,t,n)),T6=(e,t,n)=>d6(e,t,n).getUTCHours(),E6=(e,t,n)=>d6(e,t,n).getUTCDay()||7,D6=(e,t,n)=>n6(d6(e,t,n)),O6=(e,t,n)=>d6(e,t,n).getUTCMilliseconds(),k6=(e,t,n)=>d6(e,t,n).getUTCMinutes(),A6=(e,t,n)=>d6(e,t,n).getUTCMonth()+1,j6=(e,t,n)=>d6(e,t,n).getUTCSeconds(),M6=(e,t,n)=>{let r=d6(e,t,n),i=n6(r);return r.getUTCDay()>0&&r.getUTCDate()==1&&r.getUTCMonth()==0?0:r.getUTCDay()==0?i+1:i},N6=(e,t,n)=>d6(e,t,n).getUTCFullYear(),Sbe={"%Y":N6,"%G":N6,"%m":A6,"%d":S6,"%H":T6,"%M":k6,"%S":j6,"%L":O6,"%u":E6,"%U":M6,"%V":D6,"%j":w6,"%w":(e,t,n)=>C6(e,t,n)-1},Cbe=(e,t,n)=>{let r=$(e,t,null,n);if(Q(r.onNull)&&(r.onNull=null),Q(r.date))return r.onNull;let i=d6(e,r.date,n),a=r.format||`%Y-%m-%dT%H:%M:%S.%LZ`,o=l6(r.timezone,i),s=a.match(c6);u6(i,o);for(let t=0,r=s.length;t<r;t++){let r=s[t];Y(r in s6,`$dateToString: invalid format specifier ${r}`);let{name:c,padding:l}=s6[r],u=Sbe[r],d;if(u)d=f6(u(e,i,n),l);else switch(c){case`timezone`:d=cbe(o);break;case`minute_offset`:d=o.toString();break;case`abbr_month`:case`full_month`:{let e=c.startsWith(`abbr`)?`short`:`long`;d=i.toLocaleString(`en-US`,{month:e});break}}a=a.replace(r,d)}return a},P6=9466848e5,F6=(e,t)=>{let n=e%t;return n<0&&(n+=t),n},wbe={day:_6,month:h6,quarter:g6,year:m6},Tbe=/(mon(day)?|tue(sday)?|wed(nesday)?|thu(rsday)?|fri(day)?|sat(urday)?|sun(day)?)/i,Ebe=(e,t,n)=>{let{date:r,unit:i,binSize:a,timezone:o,startOfWeek:s}=$(e,t,null,n);if(Q(r)||Q(i))return null;let c=(s??`sun`).toLowerCase().substring(0,3);Y(_4(r),`$dateTrunc: 'date' must resolve to a valid Date object.`),Y(X3.includes(i),`$dateTrunc: unit is invalid.`),Y(i!=`week`||Tbe.test(c),`$dateTrunc: startOfWeek '${c}' is not a valid.`),Y(Q(a)||a>0,`$dateTrunc requires 'binSize' to be greater than 0, but got value 0.`);let l=a??1;switch(i){case`millisecond`:case`second`:case`minute`:case`hour`:{let e=l*i6[i],t=r.getTime()-P6;return new Date(r.getTime()-F6(t,e))}default:{Y(l<=1e11,`dateTrunc unsupported binSize value`);let e=new Date(r),t=new Date(P6),n=0;if(i==`week`){let r=(7-$3(t,c))%7;t.setTime(t.getTime()+r*i6.day),n=v6(t,e,c)}else n=wbe[i](t,e);let a=b6(t,i,n-F6(n,l),o);return u6(a,-l6(o,a)),a}}},Dbe=(e,t,n)=>r6(d6(e,t,n)),Obe=(e,t,n)=>t,kbe=(e,t,n)=>p3($(e,t.input,null,n),{input:`$$CURRENT`},n),Abe=(e,t,n)=>{let r=$(e,t,null,n),[i,a]=h4(r)?[r.field,r.input||e]:[r,e];return Q(a)?null:(Y(h4(a),`$getField expression 'input' must evaluate to an object`),Y(p4(i),`$getField expression 'field' must evaluate to a string`),a[i])},jbe=(e,t,n)=>Math.random(),Mbe=(e,t,n)=>Math.random()<=$(e,t,null,n),I6=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?{}:Z(r)?m3(r,t,n):s3(n.failOnError,`$mergeObjects`,Pve.obj)},Nbe=(e,t,n)=>{let r=$(e,t,null,n);if(Q(r))return null;if(!h4(r))return i3(n.failOnError,`$objectToArray`);let i=Object.entries(r),a=Array(i.length),o=0;for(let[e,t]of i)a[o++]={k:e,v:t};return a},L6=`$setField`,R6=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`field`,`value`),`$setField expects object { input, field, value }`);let{input:r,field:i,value:a}=$(e,t,null,n);if(Q(r))return null;let o=n.failOnError;if(!h4(r))return i3(o,`${L6} 'input'`);if(!p4(i))return a3(o,`${L6} 'field'`);let s={...r};return t.value==`$$REMOVE`?delete s[i]:s[i]=a,s},Pbe=(e,t,n)=>R6(e,{...t,value:`$$REMOVE`},n),Fbe=(e,t,n)=>f3($(e,t.input,null,n),{...t,input:`$$CURRENT`},n),Ibe=(e,t,n)=>{if(Z(t)){if(t.length===0)return!0;Y(t.length===1,`$allElementsTrue expects array(1)`),t=t[0]}let r=n.failOnError,i=$(e,t,null,n);return Z(i)?i.every(e=>y4(e,n.useStrictMode)):s3(r,`$allElementsTrue argument`)},Lbe=(e,t,n)=>{if(Z(t)){if(t.length===0)return!1;Y(t.length===1,`$anyElementTrue expects array(1)`),t=t[0]}let r=n.failOnError,i=$(e,t,null,n);return Z(i)?i.some(e=>y4(e,n.useStrictMode)):s3(r,`$anyElementTrue argument`)},z6=`$setDifference`,Rbe=(e,t,n)=>{Y(Z(t)&&t.length==2,`${z6} expects array(2)`);let r=$(e,t,null,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=Z(e)}if(!a)return s3(i,`${z6} arguments`);let o=u4.init();return r[0].forEach(e=>o.set(e,!0)),r[1].forEach(e=>o.delete(e)),Array.from(o.keys())},zbe=(e,t,n)=>{Y(Z(t),`$setEquals expects array`);let r=$(e,t,null,n),i=n.failOnError;if(!r.every(Z))return s3(i,`$setEquals arguments`);let a=u4.init();r[0].every((e,t)=>a.set(e,t));for(let e=1;e<r.length;e++){let t=r[e],n=new Set;for(let e=0;e<t.length;e++){let r=a.get(t[e])??-1;if(r===-1)return!1;n.add(r)}if(n.size!==a.size)return!1}return!0},B6=`$setIntersection`,Bbe=(e,t,n)=>{Y(Z(t),`${B6} expects array`);let r=$(e,t,null,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=Z(e)}return a?T4(r):s3(i,`${B6} arguments`)},V6=`$setIsSubset`,Vbe=(e,t,n)=>{Y(Z(t)&&t.length===2,`${V6} expects array(2)`);let r=$(e,t,null,n);if(!r.every(Z))return s3(n.failOnError,`${V6} arguments`);let[i,a]=r,o=u4.init(),s=new Set;i.every((e,t)=>o.set(e,t));for(let e of a)if(s.add(o.get(e)??-1),s.size>o.size)return!0;return s.delete(-1),s.size==o.size},Hbe=(e,t,n)=>{let r=$(e,t,null,n),i=n.failOnError;return Q(r)?null:Z(r)?Z(t)?r.every(Z)?D4(E4(r)):s3(i,`$setUnion arguments`):D4(r):s3(i,`$setUnion`)},Ube=(e,t,n)=>{Y(Z(t),`$concat expects array`);let r=n.failOnError,i=$(e,t,null,n),a=!0;for(let e of i){if(Q(e))return null;a&&=p4(e)}return a?i.join(``):s3(r,`$concat`,{type:`string`})},H6=`$indexOfBytes`,Wbe=(e,t,n)=>{Y(Z(t)&&t.length>1&&t.length<5,`${H6} expects array(4)`);let r=$(e,t,null,n),i=n.failOnError,a=r[0];if(Q(a))return null;if(!p4(a))return a3(i,`${H6} arg1 <string>`);let o=r[1];if(!p4(o))return a3(i,`${H6} arg2 <search>`);let s=r[2]??0,c=r[3]??a.length;if(!m4(s)||s<0)return o3(i,`${H6} arg3 <start>`,n3.index);if(!m4(c)||c<0)return o3(i,`${H6} arg4 <end>`,n3.index);if(s>c)return-1;let l=a.substring(s,c).indexOf(o);return l>-1?l+s:l},Gbe=[0,32,9,10,11,12,13,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202];function U6(e,t,n,r){let i=$(e,t,null,n),a=i.input;if(Q(a))return null;let o=Q(i.chars)?Gbe:i.chars.split(``).map(e=>e.codePointAt(0)),s=0,c=a.length-1;for(;r.left&&s<=c&&o.indexOf(a[s].codePointAt(0))!==-1;)s++;for(;r.right&&s<=c&&o.indexOf(a[c].codePointAt(0))!==-1;)c--;return a.substring(s,c+1)}function W6(e,t,n,r){let i=$(e,t,null,n);if(!p4(i.input))return[];let a=i.options;a&&(Y(a.indexOf(`x`)===-1,`extended capability option 'x' not supported`),Y(a.indexOf(`g`)===-1,`global option 'g' not supported`));let o=i.input,s=new RegExp(i.regex,a),c,l=[],u=0;for(;c=s.exec(o);){let e={match:c[0],idx:c.index+u,captures:[]};for(let t=1;t<c.length;t++)e.captures.push(c[t]||null);if(l.push(e),!r.global)break;u=c.index+c[0].length,o=o.substring(u)}return l}var Kbe=(e,t,n)=>U6(e,t,n,{left:!0,right:!1}),qbe=(e,t,n)=>{let r=W6(e,t,n,{global:!1});return Z(r)&&r.length>0?r[0]:null},Jbe=(e,t,n)=>W6(e,t,n,{global:!0}),Ybe=(e,t,n)=>W6(e,t,n,{global:!1}).length!=0,G6=`$replaceAll`,Xbe=(e,t,n)=>{Y(h4(t),`${G6} expects an object argument`);let r=n.failOnError,{input:i,find:a,replacement:o}=$(e,t,null,n);return Q(i)||Q(a)||Q(o)?null:p4(i)?p4(a)?p4(o)?i.replace(new RegExp(a,`g`),o):a3(r,`${G6} 'replacement'`):a3(r,`${G6} 'find'`):a3(r,`${G6} 'input'`)},K6=`$replaceOne`,Zbe=(e,t,n)=>{let r=n.failOnError,i=$(e,t,null,n),{input:a,find:o,replacement:s}=i;return Q(a)||Q(o)||Q(s)?null:p4(a)?p4(o)?p4(s)?i.input.replace(i.find,i.replacement):a3(r,`${K6} 'replacement'`):a3(r,`${K6} 'find'`):a3(r,`${K6} 'input'`)},Qbe=(e,t,n)=>U6(e,t,n,{left:!1,right:!0}),$be=(e,t,n)=>{Y(Z(t)&&t.length===2,`$split expects array(2)`);let r=$(e,t,null,n),i=n.failOnError;return Q(r[0])?null:r.every(p4)?r[0].split(r[1]):s3(i,`$split `,{size:2,type:`string`})},exe=(e,t,n)=>{Y(Z(t)&&t.length===2,`$strcasecmp expects array(2)`);let r=$(e,t,null,n),i=n.failOnError;if(r.every(Q))return 0;if(!r.every(p4))return s3(i,`$strcasecmp arguments`,{type:`string`});let[a,o]=r.map(e=>e.toLowerCase());return a4(a,o)},txe=(e,t,n)=>{let r=$(e,t,null,n);return p4(r)?~-encodeURI(r).split(/%..|./).length:a3(n.failOnError,`$strLenBytes`)},nxe=(e,t,n)=>{let r=$(e,t,null,n);return p4(r)?r.length:a3(n.failOnError,`$strLenCP`)},q6=`$substrBytes`,J6=(e,t,n)=>{Y(Z(t)&&t.length===3,`${q6} expects array(3)`);let[r,i,a]=$(e,t,null,n),o=n.failOnError,s=Q(r);if(!s&&!p4(r))return a3(o,`${q6} arg1 <string>`);if(!m4(i)||i<0)return o3(o,`${q6} arg2 <index>`,n3.index);if(!m4(a)||a<0)return o3(o,`${q6} arg3 <count>`,n3.index);if(s)return``;let c=0,l=null,u=null,d=`${q6} UTF-8 boundary falls inside a continuation byte`;for(let e=0;e<r.length;){let t=r.codePointAt(e),n=t<128?1:t<2048?2:t<65536?3:4,s=t>65535?2:1;if(l===null){if(i>c&&i<c+n)return r3(o,d);c===i&&(l=e)}let f=i+a;if(l!==null&&u===null){if(f>c&&f<c+n)return r3(o,d);if(c===f){u=e;break}}c+=n,e+=s}if(l===null)return i===c?``:r3(o,`${q6} byte index out of range`);if(u===null){if(i+a!==c)return r3(o,`${q6} count extends beyond UTF-8 length`);u=r.length}return r.slice(l,u)},rxe=J6,Y6=`$substrCP`,ixe=(e,t,n)=>{Y(Z(t)&&t.length===3,`${Y6} expects array(3)`);let[r,i,a]=$(e,t,null,n),o=Q(r),s=n.failOnError;return!o&&!p4(r)?a3(s,`${Y6} arg1 <string>`):m4(i)?m4(a)?o||i<0?``:a<0?r.substring(i):r.substring(i,i+a):o3(s,`${Y6} arg3 <count>`):o3(s,`${Y6} arg2 <index>`)},X6=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:p4(r)?!0:!!r},Z6=(e,t,n)=>{let r=$(e,t,null,n);if(_4(r))return r;if(Q(r))return null;let i=new Date(r);return Y(!isNaN(i.getTime()),`cannot convert '${r}' to date`),i},Q6=(e,t,n)=>{let r=$(e,t,null,n);if(Q(r))return null;if(_4(r))return r.getTime();if(r===!0)return 1;if(r===!1)return 0;let i=Number(r);return Y(X(i),`cannot convert '${r}' to double/decimal`),i},axe=2147483647,oxe=-2147483648,sxe=9007199254740991,cxe=-9007199254740991;function $6(e,t,n,r,i){let a=$(e,t,null,n);if(a===!0)return 1;if(a===!1)return 0;if(Q(a))return null;if(_4(a))return a.getTime();let o=Number(a);return Y(X(o)&&o>=r&&o<=i&&(!p4(a)||o.toString().indexOf(`.`)===-1),`cannot convert '${a}' to ${i==2147483647?`int`:`long`}`),Math.trunc(o)}var e8=(e,t,n)=>$6(e,t,n,oxe,axe),t8=(e,t,n)=>$6(e,t,n,cxe,sxe),n8=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:_4(r)?r.toISOString():t4(r)||v4(r)?String(r):r3(n.failOnError,`$toString cannot convert from object to string`)},lxe=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`to`),`$convert expects object { input, to, onError, onNull }`);let r=$(e,t.input,null,n);if(Q(r))return $(e,t.onNull,null,n)??null;let i=$(e,t.to,null,n);try{switch(i){case 2:case`string`:return n8(e,r,n);case 8:case`boolean`:case`bool`:return X6(e,r,n);case 9:case`date`:return Z6(e,r,n);case 1:case 19:case`double`:case`decimal`:case`number`:return Q6(e,r,n);case 16:case`int`:return e8(e,r,n);case 18:case`long`:return t8(e,r,n)}}catch{}return t.onError===void 0?r3(n.failOnError,`$convert cannot convert from object to ${t.to} with no onError value`):$(e,t.onError,null,n)},uxe=(e,t,n)=>X($(e,t,null,n)),dxe=Q6,fxe=(e,t,n)=>{let r=$(e,t,null,n);if(n.useStrictMode){if(r===void 0)return`missing`;if(r===!0||r===!1)return`bool`;if(X(r))return r%1==0?r>=-2147483648&&r<=2147483647?`int`:`long`:`double`;if(v4(r))return`regex`}return d4(r)},pxe=(e,t,n)=>{Z(t)&&t.length===1&&(t=t[0]);let r=n8(e,t,n);return r===null?r:r.toLowerCase()},mxe=(e,t,n)=>{Z(t)&&t.length===1&&(t=t[0]);let r=n8(e,t,n);return r===null?r:r.toUpperCase()},hxe=(e,t,n)=>U6(e,t,n,{left:!0,right:!0}),gxe=(e,t,n)=>Q2($(e,t,null,n));function r8(e,t,n,r,i){let a={undefined:null,null:null,NaN:NaN,Infinity:Error(),"-Infinity":Error(),...i},o=n.failOnError,s=r.name,c=$(e,t,null,n);if(c in a){let e=a[c];return e instanceof Error?o3(o,`$${s} invalid input '${c}'`):e}return X(c)?r(c):o3(o,`$${s}`)}var _xe=(e,t,n)=>r8(e,t,n,Math.acos,{Infinity:1/0,0:Error()}),vxe=(e,t,n)=>r8(e,t,n,Math.acosh,{Infinity:1/0,0:Error()}),yxe=(e,t,n)=>r8(e,t,n,Math.asin),bxe=(e,t,n)=>r8(e,t,n,Math.asinh,{Infinity:1/0,"-Infinity":-1/0}),xxe=(e,t,n)=>r8(e,t,n,Math.atan),Sxe=(e,t,n)=>{let[r,i]=$(e,t,null,n);return isNaN(r)||Q(r)?r:isNaN(i)||Q(i)?i:Math.atan2(r,i)},Cxe=(e,t,n)=>r8(e,t,n,Math.atanh,{1:1/0,"-1":-1/0}),wxe=(e,t,n)=>r8(e,t,n,Math.cos),Txe=(e,t,n)=>r8(e,t,n,Math.cosh,{"-Infinity":1/0,Infinity:1/0}),Exe=e=>Math.PI/180*e,Dxe=(e,t,n)=>r8(e,t,n,Exe,{Infinity:1/0,"-Infinity":1/0}),Oxe=e=>180/Math.PI*e,kxe=(e,t,n)=>r8(e,t,n,Oxe,{Infinity:1/0,"-Infinity":1/0}),Axe=(e,t,n)=>r8(e,t,n,Math.sin),jxe=(e,t,n)=>r8(e,t,n,Math.sinh,{"-Infinity":-1/0,Infinity:1/0}),Mxe=(e,t,n)=>r8(e,t,n,Math.tan),Nxe=(e,t,n)=>r8(e,t,n,Math.tanh,{Infinity:1,"-Infinity":-1}),Pxe=(e,t,n)=>{let r={};for(let[i,a]of Object.entries(t.vars))r[i]=$(e,a,null,n);return $(e,t.in,null,V4.init(n).update({variables:r}))},Fxe=e({$abs:()=>Hve,$acos:()=>_xe,$acosh:()=>vxe,$add:()=>Uve,$allElementsTrue:()=>Ibe,$and:()=>kye,$anyElementTrue:()=>Lbe,$arrayElemAt:()=>aye,$arrayToObject:()=>oye,$asin:()=>yxe,$asinh:()=>bxe,$atan:()=>xxe,$atan2:()=>Sxe,$atanh:()=>Cxe,$bitAnd:()=>Tye,$bitNot:()=>Eye,$bitOr:()=>Dye,$bitXor:()=>Oye,$ceil:()=>Wve,$cmp:()=>Mye,$concat:()=>Ube,$concatArrays:()=>sye,$cond:()=>ebe,$convert:()=>lxe,$cos:()=>wxe,$cosh:()=>Txe,$dateAdd:()=>x6,$dateDiff:()=>dbe,$dateFromParts:()=>mbe,$dateFromString:()=>ybe,$dateSubtract:()=>bbe,$dateToParts:()=>xbe,$dateToString:()=>Cbe,$dateTrunc:()=>Ebe,$dayOfMonth:()=>S6,$dayOfWeek:()=>C6,$dayOfYear:()=>w6,$degreesToRadians:()=>Dxe,$divide:()=>Gve,$eq:()=>Jye,$exp:()=>Kve,$filter:()=>cye,$first:()=>lye,$firstN:()=>uye,$floor:()=>qve,$function:()=>Y3,$getField:()=>Abe,$gt:()=>Yye,$gte:()=>Xye,$hour:()=>T6,$ifNull:()=>J3,$in:()=>dye,$indexOfArray:()=>fye,$indexOfBytes:()=>Wbe,$isArray:()=>pye,$isNumber:()=>uxe,$isoDayOfWeek:()=>E6,$isoWeek:()=>D6,$isoWeekYear:()=>Dbe,$last:()=>mye,$lastN:()=>hye,$let:()=>Pxe,$literal:()=>Obe,$ln:()=>Jve,$log:()=>Yve,$log10:()=>Xve,$lt:()=>Zye,$lte:()=>Qye,$ltrim:()=>Kbe,$map:()=>gye,$maxN:()=>_ye,$median:()=>kbe,$mergeObjects:()=>I6,$millisecond:()=>O6,$minN:()=>vye,$minute:()=>k6,$mod:()=>Zve,$month:()=>A6,$multiply:()=>Qve,$ne:()=>$ye,$not:()=>Aye,$objectToArray:()=>Nbe,$or:()=>jye,$percentile:()=>Fbe,$pow:()=>$ve,$radiansToDegrees:()=>kxe,$rand:()=>jbe,$range:()=>yye,$reduce:()=>bye,$regexFind:()=>qbe,$regexFindAll:()=>Jbe,$regexMatch:()=>Ybe,$replaceAll:()=>Xbe,$replaceOne:()=>Zbe,$reverseArray:()=>xye,$round:()=>eye,$rtrim:()=>Qbe,$sampleRate:()=>Mbe,$second:()=>j6,$setDifference:()=>Rbe,$setEquals:()=>zbe,$setField:()=>R6,$setIntersection:()=>Bbe,$setIsSubset:()=>Vbe,$setUnion:()=>Hbe,$sigmoid:()=>tye,$sin:()=>Axe,$sinh:()=>jxe,$size:()=>Sye,$slice:()=>C3,$sortArray:()=>Cye,$split:()=>$be,$sqrt:()=>nye,$strLenBytes:()=>txe,$strLenCP:()=>nxe,$strcasecmp:()=>exe,$substr:()=>rxe,$substrBytes:()=>J6,$substrCP:()=>ixe,$subtract:()=>rye,$switch:()=>tbe,$tan:()=>Mxe,$tanh:()=>Nxe,$toBool:()=>X6,$toDate:()=>Z6,$toDecimal:()=>dxe,$toDouble:()=>Q6,$toHashedIndexKey:()=>gxe,$toInt:()=>e8,$toLong:()=>t8,$toLower:()=>pxe,$toString:()=>n8,$toUpper:()=>mxe,$trim:()=>hxe,$trunc:()=>iye,$type:()=>fxe,$unsetField:()=>Pbe,$week:()=>M6,$year:()=>N6,$zip:()=>wye}),i8=(e,t,n)=>{let r=Object.keys(t);return r.length===0?e:e.map((e=>{let i={...e};for(let a of r){let r=$(e,t[a],null,n);r===void 0?I4(i,a):F4(i,a,r)}return i}))},Ixe=(e,t,n)=>{let r=t.boundaries.slice(),i=t.default,a=r[0],o=r[r.length-1],s=t.output||{count:{$sum:1}};Y(r.length>1,`$bucket: must specify at least two boundaries.`),Y(r.every((e,t)=>t===0||d4(e)===d4(r[t-1])&&s4(e,r[t-1])>0),`$bucket: bounds must be of same type and in ascending order`),Y(Q(i)||d4(i)!==d4(a)||s4(i,o)>=0||s4(i,a)<0,`$bucket: 'default' expression must be out of boundaries range`);let c=()=>{let c=new Map;for(let e=0;e<r.length-1;e++)c.set(r[e],[]);return Q(i)||c.set(i,[]),e.each(e=>{let s=$(e,t.groupBy,null,n);if(Q(s)||s4(s,a)<0||s4(s,o)>=0)Y(!Q(i),`$bucket require a default for out of range values`),c.get(i).push(e);else{Y(s4(s,a)>=0&&s4(s,o)<0,`$bucket 'groupBy' expression must resolve to a value in range of boundaries`);let t=z4(r,s),n=r[Math.max(0,t-1)];c.get(n).push(e)}}),r.pop(),Q(i)||(c.get(i).length?r.push(i):c.delete(i)),Y(c.size===r.length,`bounds and groups must be of equal size.`),K4(r).map(e=>({...$(c.get(e),s,null,n),_id:e}))},l;return K4(()=>(l||=c(),l.next()))},Lxe=(e,t,n)=>{let{buckets:r,groupBy:i,output:a,granularity:o}=t,s=a??{count:{$sum:1}};Y(r>0,`$bucketAuto: 'buckets' field must be greater than 0, but found: ${r}`),o&&Y(/^(POWERSOF2|1-2-5|E(6|12|24|48|96|192)|R(5|10|20|40|80))$/.test(o),`$bucketAuto: invalid granularity '${o}'.`);let c=new Map,l=o?(e,t)=>{}:(e,t)=>c.set(e,t),u=e.map(e=>{let t=$(e,i,null,n)??null;return Y(!o||X(t),`$bucketAuto: groupBy values must be numeric when granularity is specified.`),l(e,t??null),[t??null,e]}).collect();u.sort((e,t)=>Q(e[0])?-1:Q(t[0])?1:s4(e[0],t[0]));let d;d=o?o==`POWERSOF2`?zxe(u,r):Vxe(u,r,o):Rxe(u,r,c);let f=!1;return K4(()=>{if(f)return{done:!0};let{min:e,max:t,bucket:r,done:i}=d();f=i;let a=$(r,s,null,n);for(let[e,t]of Object.entries(a))Z(t)&&(a[e]=t.filter(e=>!Q(e)));return{done:!1,value:{...a,_id:{min:e,max:t}}}})};function Rxe(e,t,n){let r=e.length,i=Math.max(1,Math.round(e.length/t)),a=0,o=0;return()=>{let s=++o==t,c=[];for(;a<r&&(s||c.length<i||a>0&&l4(e[a-1][0],e[a][0]));)c.push(e[a++][1]);let l=n.get(c[0]),u;return u=a<r?e[a][0]:n.get(c[c.length-1]),Y(Q(u)||Q(l)||l<=u,`error: $bucketAuto boundary must be in order.`),{min:l,max:u,bucket:c,done:a>=r}}}function zxe(e,t){let n=e.length,r=Math.max(1,Math.round(e.length/t)),i=e=>e===0?0:2**(Math.floor(Math.log2(e))+1),a=0,o=0,s=0;return()=>{let t=[],c=i(s);for(o=a>0?s:0;t.length<r&&a<n&&(s===0||e[a][0]<c);)t.push(e[a++][1]);for(s=s==0?i(e[a-1][0]):c;a<n&&e[a][0]<s;)t.push(e[a++][1]);return{min:o,max:s,bucket:t,done:a>=n}}}var Bxe={R5:[10,16,25,40,63],R10:[100,125,160,200,250,315,400,500,630,800],R20:[100,112,125,140,160,180,200,224,250,280,315,355,400,450,500,560,630,710,800,900],R40:[100,106,112,118,125,132,140,150,160,170,180,190,200,212,224,236,250,265,280,300,315,355,375,400,425,450,475,500,530,560,600,630,670,710,750,800,850,900,950],R80:[103,109,115,122,128,136,145,155,165,175,185,195,206,218,230,243,258,272,290,307,325,345,365,387,412,437,462,487,515,545,575,615,650,690,730,775,825,875,925,975],"1-2-5":[10,20,50],E6:[10,15,22,33,47,68],E12:[10,12,15,18,22,27,33,39,47,56,68,82],E24:[10,11,12,13,15,16,18,20,22,24,27,30,33,36,39,43,47,51,56,62,68,75,82,91],E48:[100,105,110,115,121,127,133,140,147,154,162,169,178,187,196,205,215,226,237,249,261,274,287,301,316,332,348,365,383,402,422,442,464,487,511,536,562,590,619,649,681,715,750,787,825,866,909,953],E96:[100,102,105,107,110,113,115,118,121,124,127,130,133,137,140,143,147,150,154,158,162,165,169,174,178,182,187,191,196,200,205,210,215,221,226,232,237,243,249,255,261,267,274,280,287,294,301,309,316,324,332,340,348,357,365,374,383,392,402,412,422,432,442,453,464,475,487,499,511,523,536,549,562,576,590,604,619,634,649,665,681,698,715,732,750,768,787,806,825,845,866,887,909,931,953,976],E192:[100,101,102,104,105,106,107,109,110,111,113,114,115,117,118,120,121,123,124,126,127,129,130,132,133,135,137,138,140,142,143,145,147,149,150,152,154,156,158,160,162,164,165,167,169,172,174,176,178,180,182,184,187,189,191,193,196,198,200,203,205,208,210,213,215,218,221,223,226,229,232,234,237,240,243,246,249,252,255,258,261,264,267,271,274,277,280,284,287,291,294,298,301,305,309,312,316,320,324,328,332,336,340,344,348,352,357,361,365,370,374,379,383,388,392,397,402,407,412,417,422,427,432,437,442,448,453,459,464,470,475,481,487,493,499,505,511,517,523,530,536,542,549,556,562,569,576,583,590,597,604,612,619,626,634,642,649,657,665,673,681,690,698,706,715,723,732,741,750,759,768,777,787,796,806,816,825,835,845,856,866,876,887,898,909,920,931,942,953,965,976,988]},a8=(e,t)=>{if(e==0)return 0;let n=Bxe[t],r=n[0],i=n[n.length-1],a=1;for(;e>=i*a;)a*=10;let o=0;for(;e<r*a;)if(o=r*a,a/=10,e>=i*a)return o;Y(e>=r*a&&e<i*a,`$bucketAuto: number out of range of series.`);let s=z4(n,e,(e,t)=>(t*=a,e<t?-1:e>t?1:0)),c=n[s]*a;return e==c?n[s+1]*a:c};function Vxe(e,t,n){let r=e.length,i=Math.max(1,Math.round(e.length/t)),a=0,o=0,s=0,c=0;return()=>{let l=++o==t,u=[];for(s=a>0?c:0;a<r&&(l||u.length<i);)u.push(e[a++][1]);c=a8(e[a-1][0],n);let d=u.length;for(;a<r&&(l||e[a][0]<c);)u.push(e[a++][1]);return d!=u.length&&(c=a8(e[a-1][0],n)),Y(s<c,`$bucketAuto: ${s} < ${c}.`),{min:s,max:c,bucket:u,done:a>=r}}}var Hxe=(e,t,n)=>(Y(p4(t)&&!b4(t)&&t.indexOf(`.`)===-1&&t.trim()[0]!==`$`,`Invalid expression value for $count`),K4([{[t]:e.size()}])),Uxe=(e,t,n)=>{let{step:r,bounds:i,unit:a}=t.range;a?(Y(X3.includes(a),``),Y(Number.isInteger(r)&&r>0,`The step parameter in a range statement must be a whole number when densifying a date range.`)):Y(X(r)&&r>0,`The step parameter in a range statement must be a strictly positive numeric value.`),Z(i)&&(Y(!!i&&i.length===2,`A bounding array in a range statement must have exactly two elements.`),Y((i.every(X)||i.every(_4))&&i[0]<i[1],`A bounding array must be an ascending array of either two dates or two numbers.`),Y(a&&!i.some(X),`Numeric bounds may not have unit parameter.`)),t.partitionByFields&&Y(Z(t.partitionByFields),"$densify: `partitionByFields` must be an array of strings"),e=Z4(e,{[t.field]:1},n);let o=e=>X(e)?e+r:x6(null,{startDate:e,unit:a,amount:r},n),s=!!a&&X3.includes(a),c=e=>{let n=A4(e,t.field);return Y(Q(n)||_4(n)&&s||X(n)&&!s,`$densify: Densify field type must be numeric with 'unit' unspecified, or a date with 'unit' specified.`),n},l=[],u=K4(()=>{let t=e.next();return Q(c(t.value))?t:(l.push(t),{done:!0})}),d=u4.init(),[f,p]=Z(i)?i:[i,i],m,h=e=>{m=m===void 0||m<e?e:m},g=[],_=K4(()=>{let n=l.length>0?l.pop():e.next();if(n.done)return n;let r=g;Z(t.partitionByFields)&&(r=t.partitionByFields.map(e=>A4(n.value,e)),Y(r.every(p4),`$densify: Partition fields must evaluate to string values.`)),Y(h4(n.value),`$densify: collection must contain documents`);let i=c(n.value);d.has(r)||(f==`full`?(d.has(g)||d.set(g,i),d.set(r,d.get(g))):f==`partition`?d.set(r,i):d.set(r,f));let a=d.get(r);if(i<=a||p!=`full`&&p!=`partition`&&a>=p)return a<=i&&d.set(r,o(a)),h(i),n;d.set(r,o(a)),h(a);let s={[t.field]:a};return r&&r.forEach((e,n)=>{s[t.partitionByFields[n]]=e}),l.push(n),{done:!1,value:s}});if(f!==`full`)return q4(u,_);let v=-1,y;return q4(u,_,K4(()=>{if(v===-1){let e=d.get(g);d.delete(g),y=Array.from(d.keys()),y.length===0&&(y.push(g),d.set(g,e)),v++}do{let e=y[v],n=d.get(e);if(n<m){d.set(e,o(n));let r={[t.field]:n};return e.forEach((e,n)=>{r[t.partitionByFields[n]]=e}),{done:!1,value:r}}v++}while(v<y.length);return{done:!0}}))},Wxe=(e,t,n)=>(n.processingMode&B4.CLONE_INPUT||(n={...V4.init(n).options,processingMode:B4.CLONE_INPUT}),e.transform((e=>{let r={};for(let[i,a]of Object.entries(t))r[i]=new Y4(a,n).run(e);return[r]}))),o8=new WeakMap;function s8(e,t,n,r){o8.has(e)||o8.set(e,{});let i=o8.get(e);t.field in i||(i[t.field]=n());let a=!1;try{let e=r(i[t.field]);return a=!0,e}finally{a?t.documentNumber===e.length&&(delete i[t.field],Object.keys(i).length===0&&o8.delete(e)):o8.delete(e)}}function c8(e,t,n,r,i){return s8(t,n,()=>{let e=X4(t,`$`+Object.keys(n.parentExpr.sortBy)[0],r),i=O4(e,((t,n)=>e[n])),a=0,o=0;for(let e of i.keys()){let t=i.get(e).length;i.set(e,[a++,o]),o+=t}return{values:e,groups:i}},({values:e,groups:r})=>{if(r.size==t.length)return n.documentNumber;let a=e[n.documentNumber-1],[o,s]=r.get(a);return(i?o:s)+1})}var Gxe=(e,t,n,r,i)=>t+(i-e)*((r-t)/(n-e)),l8=(e,t,n,r)=>s8(t,n,()=>{let e=X4(t,[`$`+Object.keys(n.parentExpr.sortBy)[0],n.inputExpr],r).filter((([e,t])=>X(+e)));if(e.length!==t.length)return null;let i=-1,a=0;for(;a<e.length;){for(;i+1<e.length&&X(e[i+1][1]);)i++,a=i;for(;a+1<e.length&&!X(e[a+1][1]);)a++;if(a+1>=e.length)break;for(a++;i+1<a;)e[i+1][1]=Gxe(e[i][0],e[i][1],e[a][0],e[a][1],e[i+1][0]),i++;i=a}return e.map(([e,t])=>t)},e=>e[n.documentNumber-1]),u8=(e,t,n,r)=>s8(t,n,()=>{let e=X4(t,n.inputExpr,r);for(let t=1;t<e.length;t++)Q(e[t])&&(e[t]=e[t-1]);return e},e=>e[n.documentNumber-1]),d8=`_id`,f8=(e,t,n)=>{Y(S4(t,d8),`$group specification must include an '_id'`);let r=t[d8],i=V4.init(n),a=Object.keys(t).filter(e=>e!=d8);return e.transform((e=>{let o=O4(e,e=>$(e,r,null,n)),s=-1,c=Array.from(o.keys());return()=>{if(++s===o.size)return{done:!0};let e=c[s],n={};e!==void 0&&(n[d8]=e);for(let r of a)n[r]=$(o.get(e),t[r],null,i.update({root:null,groupId:e}));return{value:n,done:!1}}}))},p8=new Set([`$denseRank`,`$documentNumber`,`$first`,`$last`,`$linearFill`,`$rank`,`$shift`]),Kxe=new Set([`$denseRank`,`$expMovingAvg`,`$linearFill`,`$locf`,`$rank`,`$shift`]),qxe=e=>{let t=e?.documents||e?.range;return!t||t[0]===`unbounded`&&t[1]===`unbounded`},m8=(e,t,n)=>{n=V4.init(n),n.context.addExpressionOps({$function:Y3});for(let e of Object.values(t.output)){let t=Object.keys(e),r=t.find(L4),i=n.context;if(Y(!!i.getOperator(H4.WINDOW,r)||!!i.getOperator(H4.ACCUMULATOR,r),`'${r}' is not a valid window operator`),Y(t.length>0&&t.length<=2&&(t.length==1||t.includes(`window`)),`'output' option should have a single window operator.`),e?.window){let{documents:t,range:n}=e.window;Y((!!t^+!!n)==1,`'window' option supports only one of 'documents' or 'range'.`)}}return t.sortBy&&(e=Z4(e,t.sortBy,n)),e=f8(e,{_id:t.partitionBy,items:{$push:`$$CURRENT`}},n),e.transform((e=>{let r=[],i=[];for(let[e,r]of Object.entries(t.output)){let a=Object.keys(r).find(L4),o={operatorName:a,func:{left:n.context.getOperator(H4.ACCUMULATOR,a),right:n.context.getOperator(H4.WINDOW,a)},args:r[a],field:e,window:r.window};Y(!!t.sortBy||!(p8.has(a)||!o.window),`${p8.has(a)?`'${a}'`:`bounded window operation`} requires a sortBy.`),Y(!o.window||!Kxe.has(a),`${a} does not accept a 'window' field.`),i.push(o)}return e.forEach((e=>{let a=e.items,o=K4(a),s={};for(let e of i){let{func:r,args:i,field:c,window:l}=e,u=e=>{let a=-1;return o=>{if(++a,r.left)return r.left(e(o,a),i,n);if(r.right)return r.right(o,e(o,a),{parentExpr:t,inputExpr:i,documentNumber:a+1,field:c},n)}};if(l){let{documents:e,range:r,unit:i}=l,o=e||r;if(!qxe(l)){let[r,l]=o,d=e=>r==`current`?e:r==`unbounded`?0:Math.max(r+e,0),f=e=>l==`current`?e+1:l==`unbounded`?a.length:l+e+1;s[c]=u((s,c)=>{if(e||o.every(p4))return a.slice(d(c),f(c));let u=Object.keys(t.sortBy)[0],p,m;if(i){let e=e=>x6(s,{startDate:new Date(s[u]),unit:i,amount:e},n).getTime();p=X(r)?e(r):-1/0,m=X(l)?e(l):1/0}else{let e=s[u];p=X(r)?e+r:-1/0,m=X(l)?e+l:1/0}let h=r==`current`?c:0,g=l==`current`?c+1:a.length,_=[];for(;h<g;){let e=a[h++],t=+e[u];t>=p&&t<=m&&_.push(e)}return _})}}s[c]||(s[c]=u(e=>a)),o=i8(o,{[c]:{$function:{body:e=>s[c](e),args:[`$$CURRENT`]}}},n)}r.push(o)})),q4(...r)}))},Jxe={locf:`$locf`,linear:`$linearFill`},Yxe=(e,t,n)=>{Y(!t.sortBy||h4(t.sortBy),`sortBy must be an object.`),Y(!!t.sortBy||Object.values(t.output).every(e=>S4(e,`value`)),`sortBy required if any output field specifies a 'method'.`),Y(!(t.partitionBy&&t.partitionByFields),`specify either partitionBy or partitionByFields.`),Y(!t.partitionByFields||t?.partitionByFields?.every(e=>e[0]!==`$`),`fields in partitionByFields cannot begin with '$'.`),n.context.addExpressionOps({$ifNull:J3}),n.context.addWindowOps({$locf:u8,$linearFill:l8});let r=t.partitionBy||t?.partitionByFields?.map(e=>`$`+e),i={},a={};for(let[e,n]of Object.entries(t.output))if(S4(n,`value`))i[e]={$ifNull:[`$$CURRENT.${e}`,n.value]};else{let t=Jxe[n.method];Y(!!t,`invalid fill method '${n.method}'.`),a[e]={[t]:`$`+e}}return Object.keys(a).length>0&&(e=m8(e,{sortBy:t.sortBy||{},partitionBy:r,output:a},n)),Object.keys(i).length>0&&(e=i8(e,i,n)),e},h8=(e,t,n)=>{let r=p4(t.from)?n?.collectionResolver(t.from):t.from,{let:i,foreignField:a,localField:o}=t,s=e=>[!0,[]],{documents:c,pipeline:l}=D3(t.pipeline??[],n);if(Y(!r!=!c,"$lookup: must specify single join input with `expr.from` or `expr.pipeline`."),r??=c,Y(Z(r),`$lookup: join collection must resolve to an array.`),a&&o){let n=u4.init();for(let e of r)x4(A4(e,a)??null).forEach(t=>{let r=n.get(t),i=r??[];i.push(e),i!==r&&n.set(t,i)});if(s=e=>{let t=A4(e,o)??null;if(Z(t)){if(l.length)return[t.some(e=>n.has(e)),null];let e=Array.from(new Set(E4(t.map(e=>n.get(e)))));return[e.length>0,e]}let r=n.get(t)??null;return[r!==null,r??[]]},l.length===0)return e.map(e=>({...e,[t.as]:s(e).pop()}))}let u=new Y4(l,n),d=V4.init(n);return e.map(e=>{let a=$(e,i,null,n);d.update({root:null,variables:a});let[o,c]=s(e);return{...e,[t.as]:o?u.run(r,d):c}})},Xxe=(e,t,n)=>{let r=p4(t.from)?n?.collectionResolver(t.from):t.from,{connectFromField:i,connectToField:a,as:o,maxDepth:s,depthField:c,restrictSearchWithMatch:l}=t,u=l?{pipeline:[{$match:l}]}:{};return e.map(e=>{let l={};F4(l,i,$(e,t.startWith,null,n));let d=[l],f=-1,p=u4.init();do{f++,d=E4(h8(K4(d),{from:r,localField:i,foreignField:a,as:o,...u},n).map(e=>e[o]).collect());let e=p.size;if(d.forEach(e=>p.set(e,p.get(e)??f)),e==p.size)break}while(Q(s)||f<s);let m=Array(p.size),h=0;return p.forEach((e,t)=>{m[h++]=Object.assign(c?{[c]:e}:{},t)}),{...e,[o]:m}})},Zxe=(e,t,n)=>{let r=new N3(t,n);return e.filter(e=>r.test(e))},Qxe=(e,t,n)=>{let r=p4(t.into)?n?.collectionResolver(t.into):t.into;Y(Z(r),`$merge: option 'into' must resolve to an array`);let i=t.on||n.idKey,a=p4(i)?e=>Q2(A4(e,i)):e=>Q2(i.map(t=>A4(e,t))),o=u4.init();for(let e=0;e<r.length;e++){let t=r[e],n=a(t);Y(!o.has(n),`$merge: 'into' collection must have unique entries for the 'on' field.`),o.set(n,[t,e])}let s=V4.init(n);return e.map(e=>{let n=a(e);if(o.has(n)){let[i,a]=o.get(n),c=$(i,t.let||{new:`$$ROOT`},null,s.update({root:e}));if(Z(t.whenMatched))r[a]=new Y4(t.whenMatched,s.update({root:null,variables:c})).run([i])[0];else switch(t.whenMatched){case`replace`:r[a]=e;break;case`fail`:throw new $2(`$merge: failed due to matching as specified by 'whenMatched' option.`);case`keepExisting`:break;default:r[a]=I6(i,[i,e],s.update({root:e,variables:c}));break}}else switch(t.whenNotMatched){case`discard`:break;case`fail`:throw new $2(`$merge: failed due to matching as specified by 'whenMatched' option.`);default:r.push(e);break}return e})},$xe=(e,t,n)=>{let r=p4(t)?n?.collectionResolver(t):t;return Y(Z(r),`expression must resolve to an array`),e.map(e=>(r.push(w4(e)),e))},eSe=(e,t,n)=>{let r=V4.init(n);return e.map(e=>g8(e,t,r.update({root:e})))};function g8(e,t,n){let r=$(e,t,null,n);switch(r){case`$$KEEP`:return e;case`$$PRUNE`:return;case`$$DESCEND`:{if(!S4(t,`$cond`))return e;let r={};for(let[i,a]of Object.entries(e))if(Z(a)){let e=[];for(let r of a)h4(r)&&(r=g8(r,t,n.update({root:r}))),Q(r)||e.push(r);r[i]=e}else if(h4(a)){let e=g8(a,t,n.update({root:a}));Q(e)||(r[i]=e)}else r[i]=a;return r}default:return r}}var tSe=(e,t,n)=>e.map(e=>(e=$(e,t.newRoot,null,n),Y(h4(e),`$replaceRoot expression must return an object`),e)),nSe=(e,t,n)=>e.map(e=>(e=$(e,t,null,n),Y(h4(e),`$replaceWith expression must return an object`),e)),rSe=(e,t,n)=>e.transform(e=>{let n=e.length,r=-1;return()=>++r===t.size?{done:!0}:{value:e[Math.floor(Math.random()*n)],done:!1}}),iSe=i8,aSe=(e,t,n)=>Z4(f8(e,{_id:t,count:{$sum:1}},n),{count:-1},n),oSe=(e,t,n)=>{let{coll:r,pipeline:i}=p4(t)||Z(t)?{coll:t}:t,a=p4(r)?n.collectionResolver(r):r,{documents:o,pipeline:s}=D3(i??[],n);Y(!a!=!o,"$unionWith: must specify single collection input with `expr.coll` or `expr.pipeline`.");let c=a??o;return q4(e,s?new Y4(s,n).stream(c):K4(c))},sSe=(e,t,n)=>{t=x4(t);let r={};for(let e of t)r[e]=0;return k3(e,r,n)},cSe=(e,t,n)=>{p4(t)&&(t={path:t});let r=t.path.substring(1),i=t?.includeArrayIndex||!1,a=t.preserveNullAndEmptyArrays||!1,o=(e,t)=>(i!==!1&&(e[i]=t),e),s;return K4(()=>{for(;;){if(s instanceof J4){let e=s.next();if(!e.done)return e}let t=e.next();if(t.done)return t;let n=t.value;if(s=A4(n,r),Z(s)){if(s.length===0&&a===!0)return s=null,I4(n,r),{value:o(n,null),done:!1};s=K4(s).map(((e,t)=>{let i=j4(n,r,{preserveKeys:!0});return F4(i,r,e),o(i,t)}))}else if(!b4(s)||a===!0)return{value:o(n,null),done:!1}}})},lSe=e({$addFields:()=>i8,$bucket:()=>Ixe,$bucketAuto:()=>Lxe,$count:()=>Hxe,$densify:()=>Uxe,$documents:()=>E3,$facet:()=>Wxe,$fill:()=>Yxe,$graphLookup:()=>Xxe,$group:()=>f8,$limit:()=>T3,$lookup:()=>h8,$match:()=>Zxe,$merge:()=>Qxe,$out:()=>$xe,$project:()=>k3,$redact:()=>eSe,$replaceRoot:()=>tSe,$replaceWith:()=>nSe,$sample:()=>rSe,$set:()=>iSe,$setWindowFields:()=>m8,$skip:()=>M3,$sort:()=>Z4,$sortByCount:()=>aSe,$unionWith:()=>oSe,$unset:()=>sSe,$unwind:()=>cSe}),uSe=(e,t,n,r)=>{let i=A4(e,n),a=new N3(t,r);if(!Z(i))return;let o=[];for(let e=0;e<i.length;e++)if(a.test(i[e])){if(r.useStrictMode)return[i[e]];o.push(i[e])}return o.length>0?o:void 0},dSe=(e,t,n,r)=>{let i=A4(e,n);return Z(i)?C3(e,Z(t)?[i,...t]:[i,t],r):i},fSe=e({$elemMatch:()=>uSe,$slice:()=>dSe}),pSe=(e,t,n)=>P3(e,t,n,Uye),mSe=(e,t,n)=>P3(e,t,n,U3),hSe=(e,t,n)=>P3(e,t,n,Wye),_8=(e,t,n)=>P3(e,t,null,(e,t)=>{let r=0;if(Z(t))for(let e of t)r|=1<<e;else r=t;return n(e&r,r)}),gSe=(e,t,n)=>_8(e,t,(e,t)=>e==0),_Se=(e,t,n)=>_8(e,t,(e,t)=>e==t),vSe=(e,t,n)=>_8(e,t,(e,t)=>e<t),ySe=(e,t,n)=>_8(e,t,(e,t)=>e>0),bSe=(e,t,n)=>P3(e,t,n,I3),xSe=(e,t,n)=>P3(e,t,n,V3),SSe=(e,t,n)=>P3(e,t,n,H3),CSe=(e,t,n)=>P3(e,t,n,R3),wSe=(e,t,n)=>P3(e,t,n,z3),TSe=(e,t,n)=>P3(e,t,n,B3),ESe=(e,t,n)=>P3(e,t,n,L3),DSe=(e,t,n)=>P3(e,t,n,Bye),OSe=(e,t,n)=>{let r=e.includes(`.`),i=!!t;return!r||e.match(/\.\d+$/)?t=>A4(t,e)!==void 0===i:t=>{let n=A4(j4(t,e,{preserveIndex:!0}),e.substring(0,e.lastIndexOf(`.`)));return Z(n)?n.some(e=>e!==void 0)===i:n!==void 0===i}},kSe=(e,t,n)=>P3(e,t,n,qye);function ASe(e,t,n){return e=>y4($(e,t,null,n),n.useStrictMode)}function jSe(e,t,n){Y(!!n?.jsonSchemaValidator,`$jsonSchema: must configure 'jsonSchemaValidator' option to this operator.`);let r=n?.jsonSchemaValidator(t);return e=>r(e)}var MSe=(e,t,n)=>P3(e,t,n,Vye),NSe=(e,t,n)=>P3(e,t,n,Hye);function PSe(e,t,n){Y(n.scriptEnabled,`$where requires 'scriptEnabled' option to be true`);let r=t;return Y(yve(r),`$where only accepts a Function objects`),e=>y4(r.call(e),n?.useStrictMode)}var FSe=(e,t,n)=>{Y(Z(t),`Invalid expression: $and expects value to be an Array.`);let r=t.map(e=>new N3(e,n));return e=>r.every(t=>t.test(e))},v8=(e,t,n)=>{Y(Z(t),`Invalid expression. $or expects value to be an Array`);let r=t.map(e=>new N3(e,n));return e=>r.some(t=>t.test(e))},ISe=(e,t,n)=>{Y(Z(t),`Invalid expression. $nor expects value to be an array.`);let r=v8(`$or`,t,n);return e=>!r(e)},LSe=(e,t,n)=>{let r={};r[e]=R4(t);let i=new N3(r,n);return e=>!i.test(e)},RSe=e({$all:()=>pSe,$and:()=>FSe,$bitsAllClear:()=>gSe,$bitsAllSet:()=>_Se,$bitsAnyClear:()=>vSe,$bitsAnySet:()=>ySe,$elemMatch:()=>mSe,$eq:()=>bSe,$exists:()=>OSe,$expr:()=>ASe,$gt:()=>xSe,$gte:()=>SSe,$in:()=>CSe,$jsonSchema:()=>jSe,$lt:()=>wSe,$lte:()=>TSe,$mod:()=>MSe,$ne:()=>ESe,$nin:()=>DSe,$nor:()=>ISe,$not:()=>LSe,$or:()=>v8,$regex:()=>NSe,$size:()=>hSe,$type:()=>kSe,$where:()=>PSe}),zSe=(e,t,n,r)=>c8(e,t,n,r,!0),BSe=(e,t,n,r)=>{if(t.length<2)return null;let{input:i,unit:a}=n.inputExpr,o=`$`+Object.keys(n.parentExpr.sortBy)[0],s=X4([t[0],t[t.length-1]],[o,i],r).filter((([e,t])=>X(+e)&&X(+t)));if(s.length!==2)return null;let[[c,l],[u,d]]=s,f=(u-c)/Math.max(i6[a],1);return(d-l)/f},VSe=(e,t,n,r)=>n.documentNumber,HSe=(e,t,n,r)=>{let{input:i,N:a,alpha:o}=n.inputExpr;return Y(!(a&&o),`$expMovingAvg: must provide either 'N' or 'alpha' field.`),Y(!a||X(a)&&a>0,`$expMovingAvg: 'N' must be greater than zero. Got ${a}.`),Y(!o||X(o)&&o>0&&o<1,`$expMovingAvg: 'alpha' must be between 0 and 1 (exclusive), found alpha: ${o}`),s8(t,n,()=>{let e=a==null?o:2/(a+1),n=X4(t,i,r);for(let t=0;t<n.length;t++){if(t===0){X(n[t])||(n[t]=null);continue}if(!X(n[t])){n[t]=n[t-1];continue}X(n[t-1])&&(n[t]=n[t]*e+n[t-1]*(1-e))}return n},e=>e[n.documentNumber-1])},USe=(e,t,n,r)=>{let{input:i,unit:a}=n.inputExpr,o=X4(t,[`$`+Object.keys(n.parentExpr.sortBy)[0],i],r).filter((([e,t])=>X(+e)&&X(+t)));if(o.length!==t.length)return null;let s=0,c=t.length;for(let e=1;e<c;e++){let[t,n]=o[e-1],[r,i]=o[e],c=(r-t)/Math.max(i6[a],1);s+=.5*(n+i)*c}return s},WSe=(e,t,n,r)=>s8(t,n,()=>{let e=n.inputExpr,i=e.min||0,a=e.max||1,o=X4(t,e.input||n.inputExpr,r);Y(Z(o)&&o.length>0&&o.every(X),`$minMaxScaler: input must be a numeric array`);let s=o[0],c=o[0];for(let e of o)e<s?s=e:e>c&&(c=e);let l=a-i,u=c-s;return Y(u!==0,`$minMaxScaler: input range must not be zero`),{min:i,scale:l,rmin:s,range:u,nums:o}},e=>{let{min:t,rmin:r,scale:i,range:a,nums:o}=e;return(o[n.documentNumber-1]-r)/a*i+t}),GSe=(e,t,n,r)=>c8(e,t,n,r,!1),KSe=(e,t,n,r)=>{let i=n.inputExpr,a=n.documentNumber-1+i.by;return a<0||a>t.length-1?i.default?$(e,i.default,null,r):null:$(t[a],i.output,null,r)},qSe=e({$denseRank:()=>zSe,$derivative:()=>BSe,$documentNumber:()=>VSe,$expMovingAvg:()=>HSe,$integral:()=>USe,$linearFill:()=>l8,$locf:()=>u8,$minMaxScaler:()=>WSe,$rank:()=>GSe,$shift:()=>KSe}),y8=U4.init({accumulator:Vve,expression:Fxe,pipeline:lSe,projection:fSe,query:RSe,window:qSe}),b8=e=>Object.assign({...e,context:e?.context?U4.from(y8,e?.context):y8}),x8=class extends N3{constructor(e,t){super(e,b8(t))}},JSe=class extends Y4{constructor(e,t){super(e,b8(t))}},YSe=Object.defineProperty,XSe=Object.getOwnPropertyNames,S8=(e,t)=>function(){return e&&(t=(0,e[XSe(e)[0]])(e=0)),t},C8=(e,t)=>{for(var n in t)YSe(e,n,{get:t[n],enumerable:!0})},w8={};C8(w8,{LocalStoragePersistenceAdapter:()=>E8});var T8,E8,D8=S8({"src/persistence/local-storage-adapter.ts"(){T8=class e{constructor(e){this.storageKey=e?.key||`objectstack:memory-db`}async load(){try{let e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):null}catch{return null}}async save(t){let n=JSON.stringify(t);n.length>e.SIZE_WARNING_BYTES&&console.warn(`[ObjectStack] localStorage persistence data size (${(n.length/1024/1024).toFixed(2)}MB) is approaching the ~5MB limit. Consider using a different persistence strategy.`);try{localStorage.setItem(this.storageKey,n)}catch(e){console.error(`[ObjectStack] Failed to persist data to localStorage:`,e?.message||e)}}async flush(){}},T8.SIZE_WARNING_BYTES=4.5*1024*1024,E8=T8}}),O8={};C8(O8,{FileSystemPersistenceAdapter:()=>k8});var k8,A8=S8({"src/persistence/file-adapter.ts"(){k8=class{constructor(e){this.dirty=!1,this.timer=null,this.currentDb=null,this.filePath=e?.path||Ud(`.objectstack`,`data`,`memory-driver.json`),this.autoSaveInterval=e?.autoSaveInterval??2e3}async load(){try{if(!Hd(this.filePath))return null;let e=Vd(this.filePath,`utf-8`);return JSON.parse(e)}catch{return null}}async save(e){this.currentDb=e,this.dirty=!0}async flush(){!this.dirty||!this.currentDb||(await this.writeToDisk(this.currentDb),this.dirty=!1)}startAutoSave(){this.timer||(this.timer=setInterval(async()=>{this.dirty&&this.currentDb&&(await this.writeToDisk(this.currentDb),this.dirty=!1)},this.autoSaveInterval),this.timer&&this.timer.unref())}async stopAutoSave(){this.timer&&=(clearInterval(this.timer),null),await this.flush()}async writeToDisk(e){this.filePath;let t=this.filePath+`.tmp`;JSON.stringify(e,null,2),(void 0)(t,this.filePath)}}}});function j8(e,t){return t.includes(`.`)?t.split(`.`).reduce((e,t)=>e?e[t]:void 0,e):e[t]}var M8=class e{constructor(e){this.name=`com.objectstack.driver.memory`,this.type=`driver`,this.version=`1.0.0`,this.idCounters=new Map,this.transactions=new Map,this.persistenceAdapter=null,this.supports={create:!0,read:!0,update:!0,delete:!0,bulkCreate:!0,bulkUpdate:!0,bulkDelete:!0,transactions:!0,savepoints:!1,queryFilters:!0,queryAggregations:!0,querySorting:!0,queryPagination:!0,queryWindowFunctions:!1,querySubqueries:!1,queryCTE:!1,joins:!1,fullTextSearch:!1,jsonQuery:!1,geospatialQuery:!1,streaming:!0,jsonFields:!0,arrayFields:!0,vectorSearch:!1,schemaSync:!0,batchSchemaSync:!1,migrations:!1,indexes:!1,connectionPooling:!1,preparedStatements:!1,queryCache:!1},this.db={},this.config=e||{},this.logger=e?.logger||nf({level:`info`,format:`pretty`}),this.logger.debug(`InMemory driver instance created`)}install(e){this.logger.debug(`Installing InMemory driver via plugin hook`),e.engine&&e.engine.ql&&typeof e.engine.ql.registerDriver==`function`?(e.engine.ql.registerDriver(this),this.logger.info(`InMemory driver registered with ObjectQL engine`)):this.logger.warn(`Could not register driver - ObjectQL engine not found in context`)}async connect(){if(await this.initPersistence(),this.persistenceAdapter){let e=await this.persistenceAdapter.load();if(e){for(let[t,n]of Object.entries(e)){this.db[t]=n;for(let e of n)if(e.id&&typeof e.id==`string`){let n=e.id.split(`-`),r=n[n.length-1],i=parseInt(r,10);isNaN(i)||i>(this.idCounters.get(t)||0)&&this.idCounters.set(t,i)}}this.logger.info(`InMemory Database restored from persistence`,{tables:Object.keys(e).length})}}if(this.config.initialData){for(let[e,t]of Object.entries(this.config.initialData)){let n=this.getTable(e);for(let r of t){let t=r.id||this.generateId(e);n.push({...r,id:t})}}this.logger.info(`InMemory Database Connected with initial data`,{tables:Object.keys(this.config.initialData).length})}else this.logger.info(`InMemory Database Connected (Virtual)`);this.persistenceAdapter?.startAutoSave&&this.persistenceAdapter.startAutoSave()}async disconnect(){this.persistenceAdapter&&(this.persistenceAdapter.stopAutoSave&&await this.persistenceAdapter.stopAutoSave(),await this.persistenceAdapter.flush());let e=Object.keys(this.db).length,t=Object.values(this.db).reduce((e,t)=>e+t.length,0);this.db={},this.logger.info(`InMemory Database Disconnected & Cleared`,{tableCount:e,recordCount:t})}async checkHealth(){return this.logger.debug(`Health check performed`,{tableCount:Object.keys(this.db).length,status:`healthy`}),!0}async execute(e,t){return this.logger.warn(`Raw execution not supported in InMemory driver`,{command:e}),null}async find(e,t,n){this.logger.debug(`Find operation`,{object:e,query:t});let r=[...this.getTable(e)];if(t.where){let e=this.convertToMongoQuery(t.where);e&&Object.keys(e).length>0&&(r=new x8(e).find(r).all())}if((t.groupBy||t.aggregations&&t.aggregations.length>0)&&(r=this.performAggregation(r,t)),t.orderBy){let e=Array.isArray(t.orderBy)?t.orderBy:[t.orderBy];r=this.applySort(r,e)}return t.offset&&(r=r.slice(t.offset)),t.limit&&(r=r.slice(0,t.limit)),t.fields&&Array.isArray(t.fields)&&t.fields.length>0&&(r=r.map(e=>this.projectFields(e,t.fields))),this.logger.debug(`Find completed`,{object:e,resultCount:r.length}),r}async*findStream(e,t,n){this.logger.debug(`FindStream operation`,{object:e});let r=await this.find(e,t,n);for(let e of r)yield e}async findOne(e,t,n){this.logger.debug(`FindOne operation`,{object:e,query:t});let r=(await this.find(e,{...t,limit:1},n))[0]||null;return this.logger.debug(`FindOne completed`,{object:e,found:!!r}),r}async create(e,t,n){this.logger.debug(`Create operation`,{object:e,hasData:!!t});let r=this.getTable(e),i={id:t.id||this.generateId(e),...t,created_at:t.created_at||new Date().toISOString(),updated_at:t.updated_at||new Date().toISOString()};return r.push(i),this.markDirty(),this.logger.debug(`Record created`,{object:e,id:i.id,tableSize:r.length}),{...i}}async update(e,t,n,r){this.logger.debug(`Update operation`,{object:e,id:t});let i=this.getTable(e),a=i.findIndex(e=>e.id==t);if(a===-1){if(this.config.strictMode)throw this.logger.warn(`Record not found for update`,{object:e,id:t}),Error(`Record with ID ${t} not found in ${e}`);return null}let o={...i[a],...n,id:i[a].id,created_at:i[a].created_at,updated_at:new Date().toISOString()};return i[a]=o,this.markDirty(),this.logger.debug(`Record updated`,{object:e,id:t}),{...o}}async upsert(e,t,n,r){this.logger.debug(`Upsert operation`,{object:e,conflictKeys:n});let i=this.getTable(e),a=null;return t.id?a=i.find(e=>e.id===t.id):n&&n.length>0&&(a=i.find(e=>n.every(n=>e[n]===t[n]))),a?(this.logger.debug(`Record exists, updating`,{object:e,id:a.id}),this.update(e,a.id,t,r)):(this.logger.debug(`Record does not exist, creating`,{object:e}),this.create(e,t,r))}async delete(e,t,n){this.logger.debug(`Delete operation`,{object:e,id:t});let r=this.getTable(e),i=r.findIndex(e=>e.id==t);if(i===-1){if(this.config.strictMode)throw Error(`Record with ID ${t} not found in ${e}`);return this.logger.warn(`Record not found for deletion`,{object:e,id:t}),!1}return r.splice(i,1),this.markDirty(),this.logger.debug(`Record deleted`,{object:e,id:t,tableSize:r.length}),!0}async count(e,t,n){let r=this.getTable(e);if(t?.where){let e=this.convertToMongoQuery(t.where);e&&Object.keys(e).length>0&&(r=new x8(e).find(r).all())}let i=r.length;return this.logger.debug(`Count operation`,{object:e,count:i}),i}async bulkCreate(e,t,n){this.logger.debug(`BulkCreate operation`,{object:e,count:t.length});let r=await Promise.all(t.map(t=>this.create(e,t,n)));return this.logger.debug(`BulkCreate completed`,{object:e,count:r.length}),r}async updateMany(e,t,n,r){this.logger.debug(`UpdateMany operation`,{object:e,query:t});let i=this.getTable(e),a=i;if(t&&t.where){let e=this.convertToMongoQuery(t.where);e&&Object.keys(e).length>0&&(a=new x8(e).find(a).all())}let o=a.length;for(let e of a){let t=i.findIndex(t=>t.id===e.id);t!==-1&&(i[t]={...i[t],...n,updated_at:new Date().toISOString()})}return o>0&&this.markDirty(),this.logger.debug(`UpdateMany completed`,{object:e,count:o}),o}async deleteMany(e,t,n){this.logger.debug(`DeleteMany operation`,{object:e,query:t});let r=this.getTable(e),i=r.length;if(t&&t.where){let n=this.convertToMongoQuery(t.where);if(n&&Object.keys(n).length>0){let t=new x8(n).find(r).all(),i=new Set(t.map(e=>e.id));this.db[e]=r.filter(e=>!i.has(e.id))}else this.db[e]=[]}else this.db[e]=[];let a=i-this.db[e].length;return a>0&&this.markDirty(),this.logger.debug(`DeleteMany completed`,{object:e,count:a}),a}async bulkUpdate(e,t,n){this.logger.debug(`BulkUpdate operation`,{object:e,count:t.length});let r=await Promise.all(t.map(t=>this.update(e,t.id,t.data,n)));return this.logger.debug(`BulkUpdate completed`,{object:e,count:r.length}),r}async bulkDelete(e,t,n){this.logger.debug(`BulkDelete operation`,{object:e,count:t.length}),await Promise.all(t.map(t=>this.delete(e,t,n))),this.logger.debug(`BulkDelete completed`,{object:e,count:t.length})}async beginTransaction(){let e=`tx_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,t={};for(let[e,n]of Object.entries(this.db))t[e]=n.map(e=>({...e}));let n={id:e,snapshot:t};return this.transactions.set(e,n),this.logger.debug(`Transaction started`,{txId:e}),{id:e}}async commit(e){let t=e?.id;if(!t||!this.transactions.has(t)){this.logger.warn(`Commit called with unknown transaction`);return}this.transactions.delete(t),this.logger.debug(`Transaction committed`,{txId:t})}async rollback(e){let t=e?.id;if(!t||!this.transactions.has(t)){this.logger.warn(`Rollback called with unknown transaction`);return}this.db=this.transactions.get(t).snapshot,this.transactions.delete(t),this.markDirty(),this.logger.debug(`Transaction rolled back`,{txId:t})}async clear(){this.db={},this.idCounters.clear(),this.markDirty(),this.logger.debug(`All data cleared`)}getSize(){return Object.values(this.db).reduce((e,t)=>e+t.length,0)}async distinct(e,t,n){let r=this.getTable(e);if(n?.where){let e=this.convertToMongoQuery(n.where);e&&Object.keys(e).length>0&&(r=new x8(e).find(r).all())}let i=new Set;for(let e of r){let n=j8(e,t);n!=null&&i.add(n)}return Array.from(i)}async aggregate(e,t,n){this.logger.debug(`Aggregate operation`,{object:e,stageCount:t.length});let r=this.getTable(e).map(e=>({...e})),i=new JSe(t).run(r);return this.logger.debug(`Aggregate completed`,{object:e,resultCount:i.length}),i}convertToMongoQuery(e){if(!e)return{};if(!Array.isArray(e)&&typeof e==`object`){if(e.type===`comparison`)return this.convertConditionToMongo(e.field,e.operator,e.value)||{};if(e.type===`logical`){let t=e.conditions?.map(e=>this.convertToMongoQuery(e))||[];return t.length===0?{}:t.length===1?t[0]:{[e.operator===`or`?`$or`:`$and`]:t}}return this.normalizeFilterCondition(e)}if(!Array.isArray(e)||e.length===0)return{};let t=[{logic:`and`,conditions:[]}],n=`and`;for(let r of e)if(typeof r==`string`){let e=r.toLowerCase();e!==n&&(n=e,t.push({logic:n,conditions:[]}))}else if(Array.isArray(r)){let[e,n,i]=r,a=this.convertConditionToMongo(e,n,i);a&&t[t.length-1].conditions.push(a)}let r=[];for(let e of t)if(e.conditions.length!==0)if(e.conditions.length===1)r.push(e.conditions[0]);else{let t=e.logic===`or`?`$or`:`$and`;r.push({[t]:e.conditions})}return r.length===0?{}:r.length===1?r[0]:{$and:r}}convertConditionToMongo(e,t,n){switch(t){case`=`:case`==`:return{[e]:n};case`!=`:case`<>`:return{[e]:{$ne:n}};case`>`:return{[e]:{$gt:n}};case`>=`:return{[e]:{$gte:n}};case`<`:return{[e]:{$lt:n}};case`<=`:return{[e]:{$lte:n}};case`in`:return{[e]:{$in:n}};case`nin`:case`not in`:return{[e]:{$nin:n}};case`contains`:case`like`:return{[e]:{$regex:new RegExp(this.escapeRegex(n),`i`)}};case`notcontains`:case`not_contains`:return{[e]:{$not:{$regex:new RegExp(this.escapeRegex(n),`i`)}}};case`startswith`:case`starts_with`:return{[e]:{$regex:RegExp(`^${this.escapeRegex(n)}`,`i`)}};case`endswith`:case`ends_with`:return{[e]:{$regex:RegExp(`${this.escapeRegex(n)}$`,`i`)}};case`between`:return Array.isArray(n)&&n.length===2?{[e]:{$gte:n[0],$lte:n[1]}}:null;default:return null}}normalizeFilterCondition(e){let t={},n=[];for(let r of Object.keys(e)){let i=e[r];if(r===`$and`||r===`$or`){t[r]=Array.isArray(i)?i.map(e=>this.normalizeFilterCondition(e)):i;continue}if(r===`$not`){t[r]=i&&typeof i==`object`?this.normalizeFilterCondition(i):i;continue}if(r.startsWith(`$`)){t[r]=i;continue}if(i&&typeof i==`object`&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp)){let e=this.normalizeFieldOperators(i);if(e._multiRegex){let t=e._multiRegex;delete e._multiRegex;for(let i of t)n.push({[r]:{...e,...i}})}else t[r]=e}else t[r]=i}if(n.length>0){let e=t.$and,r=Array.isArray(e)?e:[];if(Object.keys(t).filter(e=>e!==`$and`).length>0){let e={...t};delete e.$and,r.push(e)}return r.push(...n),{$and:r}}return t}normalizeFieldOperators(e){let t={},n=[];for(let r of Object.keys(e)){let i=e[r];switch(r){case`$contains`:n.push({$regex:new RegExp(this.escapeRegex(i),`i`)});break;case`$notContains`:t.$not={$regex:new RegExp(this.escapeRegex(i),`i`)};break;case`$startsWith`:n.push({$regex:RegExp(`^${this.escapeRegex(i)}`,`i`)});break;case`$endsWith`:n.push({$regex:RegExp(`${this.escapeRegex(i)}$`,`i`)});break;case`$between`:Array.isArray(i)&&i.length===2&&(t.$gte=i[0],t.$lte=i[1]);break;case`$null`:i===!0?t.$eq=null:t.$ne=null;break;default:t[r]=i;break}}return n.length===1?Object.assign(t,n[0]):n.length>1&&(t._multiRegex=n),t}escapeRegex(e){return String(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}performAggregation(e,t){let{groupBy:n,aggregations:r}=t,i=new Map;if(n&&n.length>0)for(let t of e){let e=n.map(e=>{let n=j8(t,e);return n==null?`null`:String(n)}),r=JSON.stringify(e);i.has(r)||i.set(r,[]),i.get(r).push(t)}else i.set(`all`,e);let a=[];for(let[e,t]of i.entries()){let e={};if(n&&n.length>0&&t.length>0){let r=t[0];for(let t of n)this.setValueByPath(e,t,j8(r,t))}if(r)for(let n of r){let r=this.computeAggregate(t,n);e[n.alias]=r}a.push(e)}return a}computeAggregate(e,t){let{function:n,field:r}=t,i=r?e.map(e=>j8(e,r)):[];switch(n){case`count`:return!r||r===`*`?e.length:i.filter(e=>e!=null).length;case`sum`:case`avg`:{let e=i.filter(e=>typeof e==`number`),t=e.reduce((e,t)=>e+t,0);return n===`sum`?t:e.length>0?t/e.length:null}case`min`:{let e=i.filter(e=>e!=null);return e.length===0?null:e.reduce((e,t)=>t<e?t:e,e[0])}case`max`:{let e=i.filter(e=>e!=null);return e.length===0?null:e.reduce((e,t)=>t>e?t:e,e[0])}default:return null}}setValueByPath(e,t,n){let r=t.split(`.`),i=e;for(let e=0;e<r.length-1;e++){let t=r[e];i[t]||(i[t]={}),i=i[t]}i[r[r.length-1]]=n}async syncSchema(e,t,n){this.db[e]||(this.db[e]=[],this.logger.info(`Created in-memory table`,{object:e}))}async dropTable(e,t){if(this.db[e]){let t=this.db[e].length;delete this.db[e],this.logger.info(`Dropped in-memory table`,{object:e,recordCount:t})}}applySort(e,t){let n=[...e];for(let e=t.length-1;e>=0;e--){let r=t[e],i,a;if(typeof r==`object`&&!Array.isArray(r))i=r.field,a=r.order||r.direction||`asc`;else if(Array.isArray(r))[i,a]=r;else continue;n.sort((e,t)=>{let n=j8(e,i),r=j8(t,i);return n==null&&r==null?0:n==null?1:r==null?-1:n<r?a===`desc`?1:-1:n>r?a===`desc`?-1:1:0})}return n}projectFields(e,t){let n={};for(let r of t){let t=j8(e,r);t!==void 0&&(n[r]=t)}return!t.includes(`id`)&&e.id!==void 0&&(n.id=e.id),n}getTable(e){return this.db[e]||(this.db[e]=[]),this.db[e]}generateId(e){let t=e||`_global`,n=(this.idCounters.get(t)||0)+1;return this.idCounters.set(t,n),`${t}-${Date.now()}-${n}`}markDirty(){this.persistenceAdapter&&this.persistenceAdapter.save(this.db)}async flush(){this.persistenceAdapter&&await this.persistenceAdapter.flush()}isBrowserEnvironment(){return globalThis.localStorage!==void 0}isServerlessEnvironment(){if(globalThis.process===void 0)return!1;let e={};return!!(e.VERCEL||e.VERCEL_ENV||e.AWS_LAMBDA_FUNCTION_NAME||e.NETLIFY||e.FUNCTIONS_WORKER_RUNTIME||e.K_SERVICE||e.FUNCTION_TARGET||e.DENO_DEPLOYMENT_ID)}async initPersistence(){let t=this.config.persistence===void 0?`auto`:this.config.persistence;if(t!==!1){if(typeof t==`string`)if(t===`auto`)if(this.isBrowserEnvironment()){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(D8(),w8));this.persistenceAdapter=new e,this.logger.debug(`Auto-detected browser environment, using localStorage persistence`)}else if(this.isServerlessEnvironment())this.logger.warn(e.SERVERLESS_PERSISTENCE_WARNING);else{let{FileSystemPersistenceAdapter:e}=await Promise.resolve().then(()=>(A8(),O8));this.persistenceAdapter=new e,this.logger.debug(`Auto-detected Node.js environment, using file persistence`)}else if(t===`file`){let{FileSystemPersistenceAdapter:e}=await Promise.resolve().then(()=>(A8(),O8));this.persistenceAdapter=new e}else if(t===`local`){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(D8(),w8));this.persistenceAdapter=new e}else throw Error(`Unknown persistence type: "${t}". Use 'file', 'local', or 'auto'.`);else if(`adapter`in t&&t.adapter)this.persistenceAdapter=t.adapter;else if(`type`in t){if(t.type===`auto`)if(this.isBrowserEnvironment()){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(D8(),w8));this.persistenceAdapter=new e({key:t.key}),this.logger.debug(`Auto-detected browser environment, using localStorage persistence`)}else if(this.isServerlessEnvironment())this.logger.warn(e.SERVERLESS_PERSISTENCE_WARNING);else{let{FileSystemPersistenceAdapter:e}=await Promise.resolve().then(()=>(A8(),O8));this.persistenceAdapter=new e({path:t.path,autoSaveInterval:t.autoSaveInterval}),this.logger.debug(`Auto-detected Node.js environment, using file persistence`)}else if(t.type===`file`){let{FileSystemPersistenceAdapter:e}=await Promise.resolve().then(()=>(A8(),O8));this.persistenceAdapter=new e({path:t.path,autoSaveInterval:t.autoSaveInterval})}else if(t.type===`local`){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(D8(),w8));this.persistenceAdapter=new e({key:t.key})}}this.persistenceAdapter&&this.logger.debug(`Persistence adapter initialized`)}}};M8.SERVERLESS_PERSISTENCE_WARNING=`Serverless environment detected — file-system persistence is disabled in auto mode. Data will NOT be persisted across function invocations. Set persistence: false to silence this warning, or provide a custom adapter (e.g. Upstash Redis, Vercel KV) via persistence: { adapter: yourAdapter }.`;var ZSe=M8;A8(),D8();var QSe=/(%?)(%([sdijo]))/g;function $Se(e,t){switch(t){case`s`:return e;case`d`:case`i`:return Number(e);case`j`:return JSON.stringify(e);case`o`:{if(typeof e==`string`)return e;let t=JSON.stringify(e);return t===`{}`||t===`[]`||/^\[object .+?\]$/.test(t)?e:t}}}function N8(e,...t){if(t.length===0)return e;let n=0,r=e.replace(QSe,(e,r,i,a)=>{let o=t[n],s=$Se(o,a);return r?e:(n++,s)});return n<t.length&&(r+=` ${t.slice(n).join(` `)}`),r=r.replace(/%{2,2}/g,`%`),r}var eCe=2;function tCe(e){if(!e.stack)return;let t=e.stack.split(`
|
|
100
|
+
`)}`)}return w0(i.data)}l({objectConflict:x([`error`,`override`,`merge`]).default(`error`),manifest:c([x([`first`,`last`]),A().int().min(0)]).default(`last`),namespace:o().optional()});var Xpe=l({queryFilters:v().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:v().default(!0).describe(`Supports GROUP BY and aggregation functions`),querySorting:v().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:v().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:v().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:v().default(!1).describe(`Supports subqueries`),queryDistinct:v().default(!0).describe(`Supports SELECT DISTINCT`),queryHaving:v().default(!1).describe(`Supports HAVING clause for aggregations`),queryJoins:v().default(!1).describe(`Supports SQL-style joins`),fullTextSearch:v().default(!1).describe(`Supports full-text search`),vectorSearch:v().default(!1).describe(`Supports vector embeddings and similarity search for AI/RAG`),geoSpatial:v().default(!1).describe(`Supports geospatial queries and location fields`),jsonFields:v().default(!0).describe(`Supports JSON field types`),arrayFields:v().default(!1).describe(`Supports array field types`),validationRules:v().default(!0).describe(`Supports validation rules`),workflows:v().default(!0).describe(`Supports workflow automation`),triggers:v().default(!0).describe(`Supports database triggers`),formulas:v().default(!0).describe(`Supports formula fields`),transactions:v().default(!0).describe(`Supports database transactions`),bulkOperations:v().default(!0).describe(`Supports bulk create/update/delete`),supportedDrivers:S(o()).optional().describe(`Available database drivers (e.g., postgresql, mongodb, excel)`)}),Zpe=l({listView:v().default(!0).describe(`Supports list/grid views`),formView:v().default(!0).describe(`Supports form views`),kanbanView:v().default(!1).describe(`Supports kanban board views`),calendarView:v().default(!1).describe(`Supports calendar views`),ganttView:v().default(!1).describe(`Supports Gantt chart views`),dashboards:v().default(!0).describe(`Supports dashboard creation`),reports:v().default(!0).describe(`Supports report generation`),charts:v().default(!0).describe(`Supports chart widgets`),customPages:v().default(!0).describe(`Supports custom page creation`),customThemes:v().default(!1).describe(`Supports custom theme creation`),customComponents:v().default(!1).describe(`Supports custom UI components/widgets`),customActions:v().default(!0).describe(`Supports custom button actions`),screenFlows:v().default(!1).describe(`Supports interactive screen flows`),mobileOptimized:v().default(!1).describe(`UI optimized for mobile devices`),accessibility:v().default(!1).describe(`WCAG accessibility support`)}),Qpe=l({version:o().describe(`ObjectOS Kernel Version`),environment:x([`development`,`test`,`staging`,`production`]),restApi:v().default(!0).describe(`REST API available`),graphqlApi:v().default(!1).describe(`GraphQL API available`),odataApi:v().default(!1).describe(`OData API available`),websockets:v().default(!1).describe(`WebSocket support for real-time updates`),serverSentEvents:v().default(!1).describe(`Server-Sent Events support`),eventBus:v().default(!1).describe(`Internal event bus for pub/sub`),webhooks:v().default(!0).describe(`Outbound webhook support`),apiContracts:v().default(!1).describe(`API contract definitions`),authentication:v().default(!0).describe(`Authentication system`),rbac:v().default(!0).describe(`Role-Based Access Control`),fieldLevelSecurity:v().default(!1).describe(`Field-level permissions`),rowLevelSecurity:v().default(!1).describe(`Row-level security/sharing rules`),multiTenant:v().default(!1).describe(`Multi-tenant architecture support`),backgroundJobs:v().default(!1).describe(`Background job scheduling`),auditLogging:v().default(!1).describe(`Audit trail logging`),fileStorage:v().default(!0).describe(`File upload and storage`),i18n:v().default(!0).describe(`Internationalization support`),pluginSystem:v().default(!1).describe(`Plugin/extension system`),features:S(zR).optional().describe(`Active Feature Flags`),apis:S(yW).optional().describe(`Available System & Business APIs`),network:l({graphql:v().default(!1),search:v().default(!1),websockets:v().default(!1),files:v().default(!0),analytics:v().default(!1).describe(`Is the Analytics/BI engine enabled?`),ai:v().default(!1).describe(`Is the AI engine enabled?`),workflow:v().default(!1).describe(`Is the Workflow engine enabled?`),notifications:v().default(!1).describe(`Is the Notification service enabled?`),i18n:v().default(!1).describe(`Is the i18n service enabled?`)}).optional().describe(`Network Capabilities (GraphQL, WS, etc.)`),systemObjects:S(o()).optional().describe(`List of globally available System Objects`),limits:l({maxObjects:A().optional(),maxFieldsPerObject:A().optional(),maxRecordsPerQuery:A().optional(),apiRateLimit:A().optional(),fileUploadSizeLimit:A().optional().describe(`Max file size in bytes`)}).optional()});l({data:Xpe.describe(`Data Layer capabilities`),ui:Zpe.describe(`UI Layer capabilities`),system:Qpe.describe(`System/Runtime Layer capabilities`)});var $pe=Ype({name:`task_app`,label:`Task Management`,description:`MSW + React CRUD Example with ObjectStack`,version:`1.0.0`,icon:`check-square`,branding:{primaryColor:`#3b82f6`,logo:`/assets/logo.png`},objects:[{name:`task`,label:`Task`,description:`Task management object`,icon:`check-square`,titleFormat:`{subject}`,enable:{apiEnabled:!0,trackHistory:!1,feeds:!1,activities:!1,mru:!0},fields:{id:{name:`id`,label:`ID`,type:`text`,required:!0},subject:{name:`subject`,label:`Subject`,type:`text`,required:!0},status:{name:`status`,label:`Status`,type:`select`,options:[{label:`Not Started`,value:`not_started`},{label:`In Progress`,value:`in_progress`},{label:`Waiting`,value:`waiting`},{label:`Completed`,value:`completed`}]},priority:{name:`priority`,label:`Priority`,type:`select`,options:[{label:`Low`,value:`low`},{label:`Normal`,value:`normal`},{label:`High`,value:`high`},{label:`Urgent`,value:`urgent`}]},category:{name:`category`,label:`Category`,type:`text`},due_date:{name:`due_date`,label:`Due Date`,type:`date`},is_completed:{name:`is_completed`,label:`Completed`,type:`boolean`,defaultValue:!1},created_at:{name:`created_at`,label:`Created At`,type:`datetime`}}}],data:[{object:`task`,mode:`upsert`,externalId:`subject`,records:[{subject:`Learn ObjectStack`,status:`completed`,priority:`high`,category:`Work`},{subject:`Build a cool app`,status:`in_progress`,priority:`normal`,category:`Work`},{subject:`Review PR #102`,status:`completed`,priority:`high`,category:`Work`},{subject:`Write Documentation`,status:`not_started`,priority:`normal`,category:`Work`},{subject:`Fix Server bug`,status:`waiting`,priority:`urgent`,category:`Work`},{subject:`Buy groceries`,status:`not_started`,priority:`low`,category:`Shopping`},{subject:`Schedule dentist appointment`,status:`not_started`,priority:`normal`,category:`Health`},{subject:`Pay utility bills`,status:`not_started`,priority:`high`,category:`Finance`}]}],navigation:[{id:`group_tasks`,type:`group`,label:`Tasks`,children:[{id:`nav_tasks`,type:`object`,objectName:`task`,label:`My Tasks`}]}]}),eme=class{constructor(e,t){this.type=`driver`,this.version=`1.0.0`,this.init=async e=>{let t=`driver.${this.driver.name||`unknown`}`;e.registerService(t,this.driver),e.logger.info(`Driver service registered`,{serviceName:t,driverName:this.driver.name,driverVersion:this.driver.version})},this.start=async e=>{this.name.startsWith(`com.objectstack.driver.`);try{let t=e.getService(`metadata`);t&&t.addDatasource&&((t.getDatasources?t.getDatasources():[]).some(e=>e.name===`default`)||(e.logger.info(`[DriverPlugin] No 'default' datasource found. Auto-configuring '${this.driver.name}' as default.`),await t.addDatasource({name:`default`,driver:this.driver.name})))}catch(t){e.logger.debug(`[DriverPlugin] Failed to auto-configure default datasource (Metadata service missing?)`,{error:t})}e.logger.debug(`Driver plugin started`,{driverName:this.driver.name||`unknown`})},this.driver=e,this.name=`com.objectstack.driver.${t||e.name||`unknown`}`}},tme=`name`,nme=class{constructor(e,t,n){this.engine=e,this.metadata=t,this.logger=n}async load(e){let t=Date.now(),n=e.config,r=[],i=[],a=this.filterByEnv(e.datasets,n.env);if(a.length===0)return this.buildEmptyResult(n,Date.now()-t);let o=a.map(e=>e.object),s=await this.buildDependencyGraph(o);this.logger.info(`[SeedLoader] Dependency graph built`,{objects:o.length,insertOrder:s.insertOrder,circularDeps:s.circularDependencies.length});let c=this.orderDatasets(a,s.insertOrder),l=this.buildReferenceMap(s),u=new Map,d=[];for(let e of c){let t=await this.loadDataset(e,n,l,u,d,r);if(i.push(t),n.haltOnError&&t.errored>0){this.logger.warn(`[SeedLoader] Halting on first error`,{object:e.object});break}}n.multiPass&&d.length>0&&!n.dryRun&&(this.logger.info(`[SeedLoader] Pass 2: resolving deferred references`,{count:d.length}),await this.resolveDeferredUpdates(d,u,i,r));let f=Date.now()-t;return this.buildResult(n,s,i,r,f)}async buildDependencyGraph(e){let t=[],n=new Set(e);for(let r of e){let e=await this.metadata.getObject(r),i=[],a=[];if(e&&e.fields){let t=e.fields;for(let[e,r]of Object.entries(t))if((r.type===`lookup`||r.type===`master_detail`)&&r.reference){let t=r.reference;n.has(t)&&!i.includes(t)&&i.push(t),a.push({field:e,targetObject:t,targetField:tme,fieldType:r.type})}}t.push({object:r,dependsOn:i,references:a})}let{insertOrder:r,circularDependencies:i}=this.topologicalSort(t);return{nodes:t,insertOrder:r,circularDependencies:i}}async validate(e,t){let n=E.parse({...t,dryRun:!0});return this.load({datasets:e,config:n})}async loadDataset(e,t,n,r,i,a){let o=e.object,s=e.mode||t.defaultMode,c=e.externalId||`name`,l=0,u=0,d=0,f=0,p=0,m=0,h=[];r.has(o)||r.set(o,new Map);let g;(s===`upsert`||s===`update`||s===`ignore`)&&!t.dryRun&&(g=await this.loadExistingRecords(o,c));let _=n.get(o)||[];for(let n=0;n<e.records.length;n++){let v={...e.records[n]};for(let e of _){let s=v[e.field];if(s==null||typeof s!=`string`||this.looksLikeInternalId(s))continue;let l=r.get(e.targetObject)?.get(String(s));if(l)v[e.field]=l,p++;else if(!t.dryRun){let r=await this.resolveFromDatabase(e.targetObject,e.targetField,s);if(r)v[e.field]=r,p++;else if(t.multiPass)v[e.field]=null,i.push({objectName:o,recordExternalId:String(v[c]??``),field:e.field,targetObject:e.targetObject,targetField:e.targetField,attemptedValue:s,recordIndex:n}),m++;else{let t={sourceObject:o,field:e.field,targetObject:e.targetObject,targetField:e.targetField,attemptedValue:s,recordIndex:n,message:`Cannot resolve reference: ${o}.${e.field} = '${s}' \u2192 ${e.targetObject}.${e.targetField} not found`};h.push(t),a.push(t)}}else if(!r.get(e.targetObject)?.has(String(s))){let t={sourceObject:o,field:e.field,targetObject:e.targetObject,targetField:e.targetField,attemptedValue:s,recordIndex:n,message:`[dry-run] Reference may not resolve: ${o}.${e.field} = '${s}' \u2192 ${e.targetObject}.${e.targetField}`};h.push(t),a.push(t)}}if(t.dryRun){let e=String(v[c]??``);e&&r.get(o).set(e,`dry-run-id-${n}`),l++}else try{let e=await this.writeRecord(o,v,s,c,g);e.action===`inserted`?l++:e.action===`updated`?u++:e.action===`skipped`&&d++;let t=String(v[c]??``),n=e.id;t&&n&&r.get(o).set(t,String(n))}catch(e){f++,this.logger.warn(`[SeedLoader] Failed to write ${o} record`,{error:e.message,recordIndex:n})}}return{object:o,mode:s,inserted:l,updated:u,skipped:d,errored:f,total:e.records.length,referencesResolved:p,referencesDeferred:m,errors:h}}async resolveFromDatabase(e,t,n){try{let r=await this.engine.find(e,{where:{[t]:n},fields:[`id`],limit:1});if(r&&r.length>0)return String(r[0].id||r[0]._id)}catch{}return null}async resolveDeferredUpdates(e,t,n,r){for(let i of e){let e=t.get(i.targetObject)?.get(String(i.attemptedValue));if(e||=await this.resolveFromDatabase(i.targetObject,i.targetField,i.attemptedValue)??void 0,e){let r=t.get(i.objectName)?.get(i.recordExternalId);if(r)try{await this.engine.update(i.objectName,{id:r,[i.field]:e});let t=n.find(e=>e.object===i.objectName);t&&(t.referencesResolved++,t.referencesDeferred--)}catch(e){this.logger.warn(`[SeedLoader] Failed to resolve deferred reference`,{object:i.objectName,field:i.field,error:e.message})}}else{let e={sourceObject:i.objectName,field:i.field,targetObject:i.targetObject,targetField:i.targetField,attemptedValue:i.attemptedValue,recordIndex:i.recordIndex,message:`Deferred reference unresolved after pass 2: ${i.objectName}.${i.field} = '${i.attemptedValue}' \u2192 ${i.targetObject}.${i.targetField} not found`},t=n.find(e=>e.object===i.objectName);t&&t.errors.push(e),r.push(e)}}}async writeRecord(e,t,n,r,i){let a=t[r],o=i?.get(String(a??``));switch(n){case`insert`:{let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}case`update`:{if(!o)return{action:`skipped`};let n=this.extractId(o);return await this.engine.update(e,{...t,id:n}),{action:`updated`,id:n}}case`upsert`:if(o){let n=this.extractId(o);return await this.engine.update(e,{...t,id:n}),{action:`updated`,id:n}}else{let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}case`ignore`:{if(o)return{action:`skipped`,id:this.extractId(o)};let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}case`replace`:{let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}default:{let n=await this.engine.insert(e,t);return{action:`inserted`,id:this.extractId(n)}}}}topologicalSort(e){let t=new Map,n=new Map,r=new Set(e.map(e=>e.object));for(let r of e)t.set(r.object,0),n.set(r.object,[]);for(let i of e)for(let e of i.dependsOn)r.has(e)&&e!==i.object&&(n.get(e).push(i.object),t.set(i.object,(t.get(i.object)||0)+1));let i=[];for(let[e,n]of t)n===0&&i.push(e);let a=[];for(;i.length>0;){let e=i.shift();a.push(e);for(let r of n.get(e)||[]){let e=(t.get(r)||0)-1;t.set(r,e),e===0&&i.push(r)}}let o=[],s=e.filter(e=>!a.includes(e.object));if(s.length>0){let e=this.findCycles(s);o.push(...e);for(let e of s)a.includes(e.object)||a.push(e.object)}return{insertOrder:a,circularDependencies:o}}findCycles(e){let t=[],n=new Map(e.map(e=>[e.object,e])),r=new Set,i=new Set,a=(e,o)=>{if(i.has(e)){let n=o.indexOf(e);n!==-1&&t.push([...o.slice(n),e]);return}if(r.has(e))return;r.add(e),i.add(e),o.push(e);let s=n.get(e);if(s)for(let e of s.dependsOn)n.has(e)&&a(e,[...o]);i.delete(e)};for(let t of e)r.has(t.object)||a(t.object,[]);return t}filterByEnv(e,t){return t?e.filter(e=>e.env.includes(t)):e}orderDatasets(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.object)??2**53-1)-(n.get(t.object)??2**53-1))}buildReferenceMap(e){let t=new Map;for(let n of e.nodes)n.references.length>0&&t.set(n.object,n.references);return t}async loadExistingRecords(e,t){let n=new Map;try{let r=await this.engine.find(e,{fields:[`id`,t]});for(let e of r||[]){let r=String(e[t]??``);r&&n.set(r,e)}}catch{}return n}looksLikeInternalId(e){return!!(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{24}$/i.test(e))}extractId(e){if(e)return String(e.id||e._id||``)}buildEmptyResult(e,t){return{success:!0,dryRun:e.dryRun,dependencyGraph:{nodes:[],insertOrder:[],circularDependencies:[]},results:[],errors:[],summary:{objectsProcessed:0,totalRecords:0,totalInserted:0,totalUpdated:0,totalSkipped:0,totalErrored:0,totalReferencesResolved:0,totalReferencesDeferred:0,circularDependencyCount:0,durationMs:t}}}buildResult(e,t,n,r,i){let a={objectsProcessed:n.length,totalRecords:n.reduce((e,t)=>e+t.total,0),totalInserted:n.reduce((e,t)=>e+t.inserted,0),totalUpdated:n.reduce((e,t)=>e+t.updated,0),totalSkipped:n.reduce((e,t)=>e+t.skipped,0),totalErrored:n.reduce((e,t)=>e+t.errored,0),totalReferencesResolved:n.reduce((e,t)=>e+t.referencesResolved,0),totalReferencesDeferred:n.reduce((e,t)=>e+t.referencesDeferred,0),circularDependencyCount:t.circularDependencies.length,durationMs:i};return{success:!(r.length>0||a.totalErrored>0),dryRun:e.dryRun,dependencyGraph:t,results:n,errors:r,summary:a}}},T0=class{constructor(e){this.type=`app`,this.init=async e=>{let t=this.bundle.manifest||this.bundle,n=t.id||t.name;e.logger.info(`Registering App Service`,{appId:n,pluginName:this.name,version:this.version});let r=`app.${n}`,i=this.bundle.manifest?{...this.bundle.manifest,...this.bundle}:this.bundle;e.registerService(r,i)},this.start=async e=>{let t=this.bundle.manifest||this.bundle,n=t.id||t.name,r;try{r=e.getService(`objectql`)}catch{}if(!r){e.logger.warn(`ObjectQL engine service not found`,{appName:this.name,appId:n});return}e.logger.debug(`Retrieved ObjectQL engine service`,{appId:n});let i=this.bundle.default||this.bundle;if(i&&typeof i.onEnable==`function`){e.logger.info(`Executing runtime.onEnable`,{appName:this.name,appId:n});let t={...e,ql:r,logger:e.logger,drivers:{register:t=>{e.logger.debug(`Registering driver via app runtime`,{driverName:t.name,appId:n}),r.registerDriver(t)}}};await i.onEnable(t),e.logger.debug(`Runtime.onEnable completed`,{appId:n})}else e.logger.debug(`No runtime.onEnable function found`,{appId:n});this.loadTranslations(e,n);let a=[];Array.isArray(this.bundle.data)&&a.push(...this.bundle.data);let o=this.bundle.manifest||this.bundle;o&&Array.isArray(o.data)&&a.push(...o.data);let s=(this.bundle.manifest||this.bundle)?.namespace,c=new Set([`base`,`system`]),l=e=>e.includes(`__`)||!s||c.has(s)?e:`${s}__${e}`;if(a.length>0){e.logger.info(`[AppPlugin] Found ${a.length} seed datasets for ${n}`);let t=a.filter(e=>e.object&&Array.isArray(e.records)).map(e=>({...e,object:l(e.object)}));try{let n=e.getService(`metadata`);if(n){let i=new nme(r,n,e.logger),{SeedLoaderRequestSchema:a}=await Jd(async()=>{let{SeedLoaderRequestSchema:e}=await import(`./data-CesT9QEt.js`).then(e=>e.i);return{SeedLoaderRequestSchema:e}},__vite__mapDeps([2,1]),import.meta.url),o=a.parse({datasets:t,config:{defaultMode:`upsert`,multiPass:!0}}),s=await i.load(o);e.logger.info(`[Seeder] Seed loading complete`,{inserted:s.summary.totalInserted,updated:s.summary.totalUpdated,errors:s.errors.length})}else{e.logger.debug(`[Seeder] No metadata service; using basic insert fallback`);for(let n of t){e.logger.info(`[Seeder] Seeding ${n.records.length} records for ${n.object}`);for(let t of n.records)try{await r.insert(n.object,t)}catch(t){e.logger.warn(`[Seeder] Failed to insert ${n.object} record:`,{error:t.message})}}e.logger.info(`[Seeder] Data seeding complete.`)}}catch(n){e.logger.warn(`[Seeder] SeedLoaderService failed, falling back to basic insert`,{error:n.message});for(let n of t)for(let t of n.records)try{await r.insert(n.object,t)}catch(t){e.logger.warn(`[Seeder] Failed to insert ${n.object} record:`,{error:t.message})}e.logger.info(`[Seeder] Data seeding complete (fallback).`)}}},this.bundle=e;let t=e.manifest||e;this.name=`plugin.app.${t.id||t.name||`unnamed-app`}`,this.version=t.version}loadTranslations(e,t){let n;try{n=e.getService(`i18n`)}catch{}let r=[];Array.isArray(this.bundle.translations)&&r.push(...this.bundle.translations);let i=this.bundle.manifest||this.bundle;if(i&&Array.isArray(i.translations)&&i.translations!==this.bundle.translations&&r.push(...i.translations),!n){r.length>0?e.logger.warn(`[i18n] App "${t}" has ${r.length} translation bundle(s) but no i18n service is registered. Translations will not be served via REST API. Register I18nServicePlugin from @objectstack/service-i18n, or use DevPlugin which auto-detects translations and registers the i18n service automatically.`):e.logger.debug(`[i18n] No i18n service registered; skipping translation loading`,{appId:t});return}let a=this.bundle.i18n||(this.bundle.manifest||this.bundle)?.i18n;if(a?.defaultLocale&&typeof n.setDefaultLocale==`function`&&(n.setDefaultLocale(a.defaultLocale),e.logger.debug(`[i18n] Set default locale`,{appId:t,locale:a.defaultLocale})),r.length===0)return;let o=0;for(let i of r)for(let[r,a]of Object.entries(i))if(a&&typeof a==`object`)try{n.loadTranslations(r,a),o++}catch(n){e.logger.warn(`[i18n] Failed to load translations`,{appId:t,locale:r,error:n.message})}let s=n;s._fallback||s._dev?e.logger.info(`[i18n] Loaded ${o} locale(s) into in-memory i18n fallback for "${t}". For production, consider registering I18nServicePlugin from @objectstack/service-i18n.`):e.logger.info(`[i18n] Loaded translation bundles`,{appId:t,bundles:r.length,locales:o})}};function E0(){return globalThis.crypto&&typeof globalThis.crypto.randomUUID==`function`?globalThis.crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var rme=class{constructor(e){this.kernel=e}success(e,t){return{status:200,body:{success:!0,data:e,meta:t}}}error(e,t=500,n){return{status:t,body:{success:!1,error:{message:e,code:t,details:n}}}}ensureBroker(){if(!this.kernel.broker)throw{statusCode:500,message:`Kernel Broker not available`};return this.kernel.broker}async getDiscoveryInfo(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=await Promise.all([this.resolveService(xi.enum.auth),this.resolveService(xi.enum.graphql),this.resolveService(xi.enum.search),this.resolveService(xi.enum.realtime),this.resolveService(xi.enum[`file-storage`]),this.resolveService(xi.enum.analytics),this.resolveService(xi.enum.workflow),this.resolveService(xi.enum.ai),this.resolveService(xi.enum.notification),this.resolveService(xi.enum.i18n),this.resolveService(xi.enum.ui),this.resolveService(xi.enum.automation),this.resolveService(xi.enum.cache),this.resolveService(xi.enum.queue),this.resolveService(xi.enum.job)]),g=!!t,_=!!(n||this.kernel.graphql),v=!!r,y=!!i,b=!!a,x=!!o,S=!!s,C=!!c,w=!!l,T=!!u,E=!!d,ee=!!f,D=!!p,O=!!m,te=!!h,k={data:`${e}/data`,metadata:`${e}/meta`,packages:`${e}/packages`,auth:g?`${e}/auth`:void 0,ui:E?`${e}/ui`:void 0,graphql:_?`${e}/graphql`:void 0,storage:b?`${e}/storage`:void 0,analytics:x?`${e}/analytics`:void 0,automation:ee?`${e}/automation`:void 0,workflow:S?`${e}/workflow`:void 0,realtime:y?`${e}/realtime`:void 0,notifications:w?`${e}/notifications`:void 0,ai:C?`${e}/ai`:void 0,i18n:T?`${e}/i18n`:void 0},A=(e,t)=>({enabled:!0,status:`available`,route:e,provider:t}),j=e=>({enabled:!1,status:`unavailable`,message:`Install a ${e} plugin to enable`}),M={default:`en`,supported:[`en`],timezone:`UTC`};if(T&&u){let e=typeof u.getDefaultLocale==`function`?u.getDefaultLocale():`en`,t=typeof u.getLocales==`function`?u.getLocales():[];M={default:e,supported:t.length>0?t:[e],timezone:`UTC`}}return{name:`ObjectOS`,version:`1.0.0`,environment:Qd(`NODE_ENV`,`development`),routes:k,endpoints:k,features:{graphql:_,search:v,websockets:y,files:b,analytics:x,ai:C,workflow:S,notifications:w,i18n:T},services:{metadata:{enabled:!0,status:`degraded`,route:k.metadata,provider:`kernel`,message:`In-memory registry; DB persistence pending`},data:A(k.data,`kernel`),auth:g?A(k.auth):j(`auth`),automation:ee?A(k.automation):j(`automation`),analytics:x?A(k.analytics):j(`analytics`),cache:D?A():j(`cache`),queue:O?A():j(`queue`),job:te?A():j(`job`),ui:E?A(k.ui):j(`ui`),workflow:S?A(k.workflow):j(`workflow`),realtime:y?A(k.realtime):j(`realtime`),notification:w?A(k.notifications):j(`notification`),ai:C?A(k.ai):j(`ai`),i18n:T?A(k.i18n):j(`i18n`),graphql:_?A(k.graphql):j(`graphql`),"file-storage":b?A(k.storage):j(`file-storage`),search:v?A():j(`search`)},locale:M}}async handleGraphQL(e,t){if(!e||!e.query)throw{statusCode:400,message:`Missing query in request body`};if(typeof this.kernel.graphql!=`function`)throw{statusCode:501,message:`GraphQL service not available`};return this.kernel.graphql(e.query,e.variables,{request:t.request})}async handleAuth(e,t,n,r){let i=await this.getService(xi.enum.auth);if(i&&typeof i.handler==`function`)return{handled:!0,result:await i.handler(r.request,r.response)};let a=e.replace(/^\/+/,``);if(a===`login`&&t.toUpperCase()===`POST`)try{return{handled:!0,response:{status:200,body:await this.ensureBroker().call(`auth.login`,n,{request:r.request})}}}catch(e){if((e?.statusCode??e?.status)!==500||!e?.message?.includes(`Broker not available`))throw e}return this.mockAuthFallback(a,t,n)}mockAuthFallback(e,t,n){let r=t.toUpperCase(),i=864e5;if((e===`sign-up/email`||e===`register`)&&r===`POST`){let e=`mock_${E0()}`;return{handled:!0,response:{status:200,body:{user:{id:e,name:n?.name||`Mock User`,email:n?.email||`mock@test.local`,emailVerified:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},session:{id:`session_${e}`,userId:e,token:`mock_token_${e}`,expiresAt:new Date(Date.now()+i).toISOString()}}}}}if((e===`sign-in/email`||e===`login`)&&r===`POST`){let e=`mock_${E0()}`;return{handled:!0,response:{status:200,body:{user:{id:e,name:`Mock User`,email:n?.email||`mock@test.local`,emailVerified:!0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},session:{id:`session_${e}`,userId:e,token:`mock_token_${e}`,expiresAt:new Date(Date.now()+i).toISOString()}}}}}return e===`get-session`&&r===`GET`?{handled:!0,response:{status:200,body:{session:null,user:null}}}:e===`sign-out`&&r===`POST`?{handled:!0,response:{status:200,body:{success:!0}}}:{handled:!1}}async handleMetadata(e,t,n,r,i){let a=this.kernel.broker??null,o=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(o[0]===`types`){let e=await this.resolveService(`protocol`);if(e&&typeof e.getMetaTypes==`function`){let t=await e.getMetaTypes({});return{handled:!0,response:this.success(t)}}if(a)try{let e=await a.call(`metadata.types`,{},{request:t.request});return{handled:!0,response:this.success(e)}}catch{}return{handled:!0,response:this.success({types:[`object`,`app`,`plugin`]})}}if(o.length===3&&o[2]===`published`&&(!n||n===`GET`)){let[e,n]=o,r=await this.getService(xi.enum.metadata);if(r&&typeof r.getPublished==`function`){let t=await r.getPublished(e,n);return t===void 0?{handled:!0,response:this.error(`Not found`,404)}:{handled:!0,response:this.success(t)}}if(a)try{let r=await a.call(`metadata.getPublished`,{type:e,name:n},{request:t.request});return{handled:!0,response:this.success(r)}}catch(e){return{handled:!0,response:this.error(e.message,404)}}return{handled:!0,response:this.error(`Not found`,404)}}if(o.length===2){let[e,i]=o;if(n===`PUT`&&r){let n=await this.resolveService(`protocol`);if(n&&typeof n.saveMetaItem==`function`)try{let t=await n.saveMetaItem({type:e,name:i,item:r});return{handled:!0,response:this.success(t)}}catch(e){return{handled:!0,response:this.error(e.message,400)}}if(a)try{let n=await a.call(`metadata.saveItem`,{type:e,name:i,item:r},{request:t.request});return{handled:!0,response:this.success(n)}}catch(e){return{handled:!0,response:this.error(e.message||`Save not supported`,501)}}return{handled:!0,response:this.error(`Save not supported`,501)}}try{if(e===`objects`||e===`object`){if(a){let e=await a.call(`metadata.getObject`,{objectName:i},{request:t.request});return{handled:!0,response:this.success(e)}}let e=await this.getObjectQLService();if(e?.registry){let t=e.registry.getObject(i);if(t)return{handled:!0,response:this.success(t)}}return{handled:!0,response:this.error(`Not found`,404)}}let n=e.endsWith(`s`)?e.slice(0,-1):e,r=await this.resolveService(`protocol`);if(r&&typeof r.getMetaItem==`function`)try{let e=await r.getMetaItem({type:n,name:i});return{handled:!0,response:this.success(e)}}catch{}if(a){let e=`metadata.get${this.capitalize(n)}`,r=await a.call(e,{name:i},{request:t.request});return{handled:!0,response:this.success(r)}}return{handled:!0,response:this.error(`Not found`,404)}}catch(e){return{handled:!0,response:this.error(e.message,404)}}}if(o.length===1){let e=o[0],n=i?.package||void 0,r=await this.resolveService(`protocol`);if(r&&typeof r.getMetaItems==`function`)try{let t=await r.getMetaItems({type:e,packageId:n});if(t&&(t.items!==void 0||Array.isArray(t)))return{handled:!0,response:this.success(t)}}catch{}if(a){try{if(e===`objects`){let e=await a.call(`metadata.objects`,{packageId:n},{request:t.request});return{handled:!0,response:this.success(e)}}let r=await a.call(`metadata.${e}`,{packageId:n},{request:t.request});if(r!=null)return{handled:!0,response:this.success(r)}}catch{}try{let n=await a.call(`metadata.getObject`,{objectName:e},{request:t.request});return{handled:!0,response:this.success(n)}}catch(e){return{handled:!0,response:this.error(e.message,404)}}}let s=await this.getObjectQLService();if(s?.registry){if(e===`objects`){let e=s.registry.getAllObjects(n);return{handled:!0,response:this.success({type:`object`,items:e})}}let t=s.registry.listItems?.(e,n);if(t&&t.length>0)return{handled:!0,response:this.success({type:e,items:t})};let r=s.registry.getObject(e);if(r)return{handled:!0,response:this.success(r)}}return{handled:!0,response:this.error(`Not found`,404)}}if(o.length===0){let e=await this.resolveService(`protocol`);if(e&&typeof e.getMetaTypes==`function`){let t=await e.getMetaTypes({});return{handled:!0,response:this.success(t)}}if(a)try{let e=await a.call(`metadata.types`,{},{request:t.request});return{handled:!0,response:this.success(e)}}catch{}return{handled:!0,response:this.success({types:[`object`,`app`,`plugin`]})}}return{handled:!1}}async handleData(e,t,n,r,i){let a=this.ensureBroker(),o=e.replace(/^\/+/,``).split(`/`),s=o[0];if(!s)return{handled:!0,response:this.error(`Object name required`,400)};let c=t.toUpperCase();if(o.length>1){let e=o[1];if(e===`query`&&c===`POST`){let e=await a.call(`data.query`,{object:s,...n},{request:i.request});return{handled:!0,response:this.success(e)}}if(e===`batch`&&c===`POST`){let e=await a.call(`data.batch`,{object:s,...n},{request:i.request});return{handled:!0,response:this.success(e)}}if(o.length===2&&c===`GET`){let e=o[1],{select:t,expand:n}=r||{},c={};t!=null&&(c.select=t),n!=null&&(c.expand=n);let l=await a.call(`data.get`,{object:s,id:e,...c},{request:i.request});return{handled:!0,response:this.success(l)}}if(o.length===2&&c===`PATCH`){let e=o[1],t=await a.call(`data.update`,{object:s,id:e,data:n},{request:i.request});return{handled:!0,response:this.success(t)}}if(o.length===2&&c===`DELETE`){let e=o[1],t=await a.call(`data.delete`,{object:s,id:e},{request:i.request});return{handled:!0,response:this.success(t)}}}else{if(c===`GET`){let e={...r};(e.filter!=null||e.filters!=null)&&(e.where=e.where??e.filter??e.filters,delete e.filter,delete e.filters),e.select!=null&&e.fields==null&&(e.fields=e.select,delete e.select),e.sort!=null&&e.orderBy==null&&(e.orderBy=e.sort,delete e.sort),e.top!=null&&e.limit==null&&(e.limit=e.top,delete e.top),e.skip!=null&&e.offset==null&&(e.offset=e.skip,delete e.skip);let t=await a.call(`data.query`,{object:s,query:e},{request:i.request});return{handled:!0,response:this.success(t)}}if(c===`POST`){let e=await a.call(`data.create`,{object:s,data:n},{request:i.request}),t=this.success(e);return t.status=201,{handled:!0,response:t}}}return{handled:!1}}async handleAnalytics(e,t,n,r){let i=await this.getService(xi.enum.analytics);if(!i)return{handled:!1};let a=t.toUpperCase(),o=e.replace(/^\/+/,``);if(o===`query`&&a===`POST`){let e=await i.query(n);return{handled:!0,response:this.success(e)}}if(o===`meta`&&a===`GET`){let e=await i.getMeta();return{handled:!0,response:this.success(e)}}if(o===`sql`&&a===`POST`){let e=await i.generateSql(n);return{handled:!0,response:this.success(e)}}return{handled:!1}}async handleI18n(e,t,n,r){let i=await this.getService(xi.enum.i18n);if(!i)return{handled:!0,response:this.error(`i18n service not available`,501)};let a=t.toUpperCase(),o=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(a!==`GET`)return{handled:!1};if(o[0]===`locales`&&o.length===1){let e=i.getLocales();return{handled:!0,response:this.success({locales:e})}}if(o[0]===`translations`){let e=o[1]?decodeURIComponent(o[1]):n?.locale;if(!e)return{handled:!0,response:this.error(`Missing locale parameter`,400)};let t=i.getTranslations(e);if(Object.keys(t).length===0){let n=lf(e,typeof i.getLocales==`function`?i.getLocales():[]);if(n&&n!==e)return t=i.getTranslations(n),{handled:!0,response:this.success({locale:n,requestedLocale:e,translations:t})}}return{handled:!0,response:this.success({locale:e,translations:t})}}if(o[0]===`labels`&&o.length>=2){let e=decodeURIComponent(o[1]),t=o[2]?decodeURIComponent(o[2]):n?.locale;if(!t)return{handled:!0,response:this.error(`Missing locale parameter`,400)};let r=typeof i.getLocales==`function`?i.getLocales():[],a=lf(t,r);if(a&&(t=a),typeof i.getFieldLabels==`function`){let n=i.getFieldLabels(e,t);return{handled:!0,response:this.success({object:e,locale:t,labels:n})}}let s=i.getTranslations(t),c=`o.${e}.fields.`,l={};for(let[e,t]of Object.entries(s))e.startsWith(c)&&(l[e.substring(c.length)]=t);return{handled:!0,response:this.success({object:e,locale:t,labels:l})}}return{handled:!1}}async handlePackages(e,t,n,r,i){let a=t.toUpperCase(),o=e.replace(/^\/+/,``).split(`/`).filter(Boolean),s=(await this.getObjectQLService())?.registry;if(!s)return this.kernel.broker?this.handlePackagesViaBroker(o,a,n,r,i):{handled:!0,response:this.error(`Package service not available`,503)};try{if(o.length===0&&a===`GET`){let e=s.getAllPackages();return r?.status&&(e=e.filter(e=>e.status===r.status)),r?.type&&(e=e.filter(e=>e.manifest?.type===r.type)),{handled:!0,response:this.success({packages:e,total:e.length})}}if(o.length===0&&a===`POST`){let e=s.installPackage(n.manifest||n,n.settings),t=this.success(e);return t.status=201,{handled:!0,response:t}}if(o.length===2&&o[1]===`enable`&&a===`PATCH`){let e=decodeURIComponent(o[0]),t=s.enablePackage(e);return t?{handled:!0,response:this.success(t)}:{handled:!0,response:this.error(`Package '${e}' not found`,404)}}if(o.length===2&&o[1]===`disable`&&a===`PATCH`){let e=decodeURIComponent(o[0]),t=s.disablePackage(e);return t?{handled:!0,response:this.success(t)}:{handled:!0,response:this.error(`Package '${e}' not found`,404)}}if(o.length===2&&o[1]===`publish`&&a===`POST`){let e=decodeURIComponent(o[0]),t=await this.getService(xi.enum.metadata);if(t&&typeof t.publishPackage==`function`){let r=await t.publishPackage(e,n||{});return{handled:!0,response:this.success(r)}}if(this.kernel.broker){let t=await this.kernel.broker.call(`metadata.publishPackage`,{packageId:e,...n},{request:i.request});return{handled:!0,response:this.success(t)}}return{handled:!0,response:this.error(`Metadata service not available`,503)}}if(o.length===2&&o[1]===`revert`&&a===`POST`){let e=decodeURIComponent(o[0]),t=await this.getService(xi.enum.metadata);return t&&typeof t.revertPackage==`function`?(await t.revertPackage(e),{handled:!0,response:this.success({success:!0})}):this.kernel.broker?(await this.kernel.broker.call(`metadata.revertPackage`,{packageId:e},{request:i.request}),{handled:!0,response:this.success({success:!0})}):{handled:!0,response:this.error(`Metadata service not available`,503)}}if(o.length===1&&a===`GET`){let e=decodeURIComponent(o[0]),t=s.getPackage(e);return t?{handled:!0,response:this.success(t)}:{handled:!0,response:this.error(`Package '${e}' not found`,404)}}if(o.length===1&&a===`DELETE`){let e=decodeURIComponent(o[0]);return s.uninstallPackage(e)?{handled:!0,response:this.success({success:!0})}:{handled:!0,response:this.error(`Package '${e}' not found`,404)}}}catch(e){return{handled:!0,response:this.error(e.message,e.statusCode||500)}}return{handled:!1}}async handlePackagesViaBroker(e,t,n,r,i){let a=this.kernel.broker;try{if(e.length===0&&t===`GET`){let e=await a.call(`package.list`,r||{},{request:i.request});return{handled:!0,response:this.success(e)}}if(e.length===0&&t===`POST`){let e=await a.call(`package.install`,n,{request:i.request}),t=this.success(e);return t.status=201,{handled:!0,response:t}}if(e.length===2&&e[1]===`enable`&&t===`PATCH`){let t=decodeURIComponent(e[0]),n=await a.call(`package.enable`,{id:t},{request:i.request});return{handled:!0,response:this.success(n)}}if(e.length===2&&e[1]===`disable`&&t===`PATCH`){let t=decodeURIComponent(e[0]),n=await a.call(`package.disable`,{id:t},{request:i.request});return{handled:!0,response:this.success(n)}}if(e.length===1&&t===`GET`){let t=decodeURIComponent(e[0]),n=await a.call(`package.get`,{id:t},{request:i.request});return{handled:!0,response:this.success(n)}}if(e.length===1&&t===`DELETE`){let t=decodeURIComponent(e[0]),n=await a.call(`package.uninstall`,{id:t},{request:i.request});return{handled:!0,response:this.success(n)}}}catch(e){return{handled:!0,response:this.error(e.message,e.statusCode||500)}}return{handled:!1}}async handleStorage(e,t,n,r){let i=await this.getService(xi.enum[`file-storage`])||this.kernel.services?.[`file-storage`];if(!i)return{handled:!0,response:this.error(`File storage not configured`,501)};let a=t.toUpperCase(),o=e.replace(/^\/+/,``).split(`/`);if(o[0]===`upload`&&a===`POST`){if(!n)return{handled:!0,response:this.error(`No file provided`,400)};let e=await i.upload(n,{request:r.request});return{handled:!0,response:this.success(e)}}if(o[0]===`file`&&o[1]&&a===`GET`){let e=o[1],t=await i.download(e,{request:r.request});return t.url&&t.redirect?{handled:!0,result:{type:`redirect`,url:t.url}}:t.stream?{handled:!0,result:{type:`stream`,stream:t.stream,headers:{"Content-Type":t.mimeType||`application/octet-stream`,"Content-Length":t.size}}}:{handled:!0,response:this.success(t)}}return{handled:!1}}async handleUi(e,t,n){let r=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(r[0]===`view`&&r[1]){let e=r[1],n=r[2]||t?.type||`list`,i=await this.resolveService(`protocol`);if(i&&typeof i.getUiView==`function`)try{let t=await i.getUiView({object:e,type:n});return{handled:!0,response:this.success(t)}}catch(e){return{handled:!0,response:this.error(e.message,500)}}else return{handled:!0,response:this.error(`Protocol service not available`,503)}}return{handled:!1}}async handleAutomation(e,t,n,r,i){let a=await this.getService(xi.enum.automation);if(!a)return{handled:!1};let o=t.toUpperCase(),s=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(s[0]===`trigger`&&s[1]&&o===`POST`){let e=s[1];if(typeof a.trigger==`function`){let t=await a.trigger(e,n,{request:r.request});return{handled:!0,response:this.success(t)}}if(typeof a.execute==`function`){let t=await a.execute(e,n);return{handled:!0,response:this.success(t)}}}if(s.length===0&&o===`GET`&&typeof a.listFlows==`function`){let e=await a.listFlows();return{handled:!0,response:this.success({flows:e,total:e.length,hasMore:!1})}}if(s.length===0&&o===`POST`&&typeof a.registerFlow==`function`)return a.registerFlow(n?.name,n),{handled:!0,response:this.success(n)};if(s.length>=1){let e=s[0];if(s[1]===`trigger`&&o===`POST`&&typeof a.execute==`function`){let t=await a.execute(e,n);return{handled:!0,response:this.success(t)}}if(s[1]===`toggle`&&o===`POST`&&typeof a.toggleFlow==`function`)return await a.toggleFlow(e,n?.enabled??!0),{handled:!0,response:this.success({name:e,enabled:n?.enabled??!0})};if(s[1]===`runs`&&s[2]&&o===`GET`&&typeof a.getRun==`function`){let e=await a.getRun(s[2]);return e?{handled:!0,response:this.success(e)}:{handled:!0,response:this.error(`Execution not found`,404)}}if(s[1]===`runs`&&!s[2]&&o===`GET`&&typeof a.listRuns==`function`){let t=i?{limit:i.limit?Number(i.limit):void 0,cursor:i.cursor}:void 0,n=await a.listRuns(e,t);return{handled:!0,response:this.success({runs:n,hasMore:!1})}}if(s.length===1&&o===`GET`&&typeof a.getFlow==`function`){let t=await a.getFlow(e);return t?{handled:!0,response:this.success(t)}:{handled:!0,response:this.error(`Flow not found`,404)}}if(s.length===1&&o===`PUT`&&typeof a.registerFlow==`function`)return a.registerFlow(e,n?.definition??n),{handled:!0,response:this.success(n?.definition??n)};if(s.length===1&&o===`DELETE`&&typeof a.unregisterFlow==`function`)return a.unregisterFlow(e),{handled:!0,response:this.success({name:e,deleted:!0})}}return{handled:!1}}getServicesMap(){return this.kernel.services instanceof Map?Object.fromEntries(this.kernel.services):this.kernel.services||{}}async getService(e){return this.resolveService(e)}async resolveService(e){if(typeof this.kernel.getServiceAsync==`function`)try{let t=await this.kernel.getServiceAsync(e);if(t!=null)return t}catch{}if(typeof this.kernel.getService==`function`)try{let t=await this.kernel.getService(e);if(t!=null)return t}catch{}if(this.kernel?.context?.getService)try{let t=await this.kernel.context.getService(e);if(t!=null)return t}catch{}return this.getServicesMap()[e]}async getObjectQLService(){try{let e=await this.resolveService(`objectql`);if(e?.registry)return e}catch{}return null}capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}async dispatch(e,t,n,r,i){let a=t.replace(/\/$/,``);if((a===`/discovery`||a===``)&&e===`GET`){let e=await this.getDiscoveryInfo(``);return{handled:!0,response:this.success(e)}}if(a.startsWith(`/auth`))return this.handleAuth(a.substring(5),e,n,i);if(a.startsWith(`/meta`))return this.handleMetadata(a.substring(5),i,e,n,r);if(a.startsWith(`/data`))return this.handleData(a.substring(5),e,n,r,i);if(a.startsWith(`/graphql`)&&e===`POST`)return this.handleGraphQL(n,i);if(a.startsWith(`/storage`))return this.handleStorage(a.substring(8),e,n,i);if(a.startsWith(`/ui`))return this.handleUi(a.substring(3),r,i);if(a.startsWith(`/automation`))return this.handleAutomation(a.substring(11),e,n,i,r);if(a.startsWith(`/analytics`))return this.handleAnalytics(a.substring(10),e,n,i);if(a.startsWith(`/packages`))return this.handlePackages(a.substring(9),e,n,r,i);if(a.startsWith(`/i18n`))return this.handleI18n(a.substring(5),e,r,i);if(a===`/openapi.json`&&e===`GET`){let e=this.ensureBroker();try{let t=await e.call(`metadata.generateOpenApi`,{},{request:i.request});return{handled:!0,response:this.success(t)}}catch{}}let o=await this.handleApiEndpoint(a,e,n,r,i);return o.handled?o:{handled:!1}}async handleApiEndpoint(e,t,n,r,i){let a=this.ensureBroker();try{let o=await a.call(`metadata.matchEndpoint`,{path:e,method:t});if(o){if(o.type===`flow`){let e=await a.call(`automation.runFlow`,{flowId:o.target,inputs:{...r,...n,_request:i.request}});return{handled:!0,response:this.success(e)}}if(o.type===`script`){let e=await a.call(`automation.runScript`,{scriptName:o.target,context:{...r,...n,request:i.request}},{request:i.request});return{handled:!0,response:this.success(e)}}if(o.type===`object_operation`&&o.objectParams){let{object:e,operation:t}=o.objectParams;if(t===`find`){let t=await a.call(`data.query`,{object:e,query:r},{request:i.request});return{handled:!0,response:this.success(t.records,{total:t.total})}}if(t===`get`&&r.id){let t=await a.call(`data.get`,{object:e,id:r.id},{request:i.request});return{handled:!0,response:this.success(t)}}if(t===`create`){let t=await a.call(`data.create`,{object:e,data:n},{request:i.request});return{handled:!0,response:this.success(t)}}}if(o.type===`proxy`)return{handled:!0,response:{status:200,body:{proxy:!0,target:o.target,note:`Proxy execution requires http-client service`}}}}}catch{}return{handled:!1}}};l({name:o().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:o().optional().describe(`Command description for help text`),module:o().optional().describe(`Module path exporting oclif Command classes`)}),l({commands:l({strategy:x([`pattern`,`explicit`,`single`]).optional().describe(`Command discovery strategy`),target:o().optional().describe(`Target directory for command files`),glob:o().optional().describe(`Glob pattern for command file matching`)}).optional().describe(`Command discovery configuration`),topicSeparator:o().optional().describe(`Character separating topic and command names`)}).describe(`oclif plugin configuration section`);var D0=x([`objects`,`views`,`pages`,`flows`,`dashboards`,`permissions`,`agents`,`reports`,`actions`,`translations`,`themes`,`datasets`,`apis`,`triggers`,`workflows`]).describe(`Metadata category within the artifact`),ime=l({path:o().describe(`Relative file path within the artifact`),size:A().int().nonnegative().describe(`File size in bytes`),category:D0.optional().describe(`Metadata category this file belongs to`)}).describe(`A single file entry within the artifact`),O0=l({algorithm:x([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm used for checksums`),files:u(o(),o().regex(/^[a-f0-9]+$/)).describe(`File path to hash value mapping`)}).describe(`Checksum manifest for artifact integrity verification`),k0=l({algorithm:x([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).default(`RSA-SHA256`).describe(`Signing algorithm used`),publicKeyRef:o().describe(`Public key reference (URL or fingerprint) for signature verification`),signature:o().describe(`Base64-encoded digital signature`),signedAt:o().datetime().optional().describe(`ISO 8601 timestamp of when the artifact was signed`),signedBy:o().optional().describe(`Identity of the signer (publisher ID or email)`)}).describe(`Digital signature for artifact authenticity verification`),A0=l({formatVersion:o().regex(/^\d+\.\d+$/).default(`1.0`).describe(`Artifact format version (e.g. "1.0")`),packageId:o().describe(`Package identifier from manifest`),version:o().describe(`Package version from manifest`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Archive format of the artifact`),size:A().int().positive().optional().describe(`Total artifact file size in bytes`),builtAt:o().datetime().describe(`ISO 8601 timestamp of when the artifact was built`),builtWith:o().optional().describe(`Build tool identifier (e.g. "os-cli@3.2.0")`),files:S(ime).optional().describe(`List of files contained in the artifact`),metadataCategories:S(D0).optional().describe(`Metadata categories included in this artifact`),checksums:O0.optional().describe(`SHA256 checksums for artifact integrity verification`),signature:k0.optional().describe(`Digital signature for artifact authenticity verification`)}).describe(`Package artifact structure and metadata`);l({directory:o().optional().describe(`Project root directory (defaults to current working directory)`),outDir:o().optional().describe(`Output directory for the built artifact (defaults to ./dist)`),format:x([`tgz`,`zip`]).default(`tgz`).describe(`Archive format for the artifact`),sign:v().default(!1).describe(`Whether to digitally sign the artifact`),privateKeyPath:o().optional().describe(`Path to RSA/ECDSA private key file for signing`),signAlgorithm:x([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).optional().describe(`Signing algorithm to use`),checksumAlgorithm:x([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm for file checksums`),includeData:v().default(!0).describe(`Whether to include seed data in the artifact`),includeLocales:v().default(!0).describe(`Whether to include locale/translation files`)}).describe(`Options for the os plugin build command`),l({success:v().describe(`Whether the build succeeded`),artifactPath:o().optional().describe(`Absolute path to the generated artifact file`),artifact:A0.optional().describe(`Artifact metadata`),fileCount:A().int().min(0).optional().describe(`Total number of files in the artifact`),size:A().int().min(0).optional().describe(`Total artifact size in bytes`),durationMs:A().optional().describe(`Build duration in milliseconds`),errorMessage:o().optional().describe(`Error message if build failed`),warnings:S(o()).optional().describe(`Warnings emitted during build`)}).describe(`Result of the os plugin build command`);var ame=l({severity:x([`error`,`warning`,`info`]).describe(`Validation issue severity`).describe(`Issue severity level`),rule:o().describe(`Validation rule identifier`),message:o().describe(`Human-readable finding description`),path:o().optional().describe(`Relative file path within the artifact`)}).describe(`A single validation finding`);l({artifactPath:o().describe(`Path to the artifact file to validate`),verifySignature:v().default(!0).describe(`Whether to verify the digital signature`),publicKeyPath:o().optional().describe(`Path to the public key for signature verification`),verifyChecksums:v().default(!0).describe(`Whether to verify checksums of all files`),validateMetadata:v().default(!0).describe(`Whether to validate metadata against schemas`),platformVersion:o().optional().describe(`Platform version for compatibility verification`)}).describe(`Options for the os plugin validate command`),l({valid:v().describe(`Whether the artifact passed validation`),artifact:A0.optional().describe(`Extracted artifact metadata`),checksumVerification:l({passed:v().describe(`Whether all checksums match`),checksums:O0.optional().describe(`Verified checksums`),mismatches:S(o()).optional().describe(`Files with checksum mismatches`)}).optional().describe(`Checksum verification result`),signatureVerification:l({passed:v().describe(`Whether the signature is valid`),signature:k0.optional().describe(`Signature details`),failureReason:o().optional().describe(`Signature verification failure reason`)}).optional().describe(`Signature verification result`),platformCompatibility:l({compatible:v().describe(`Whether artifact is compatible`),requiredRange:o().optional().describe(`Required platform version range`),targetVersion:o().optional().describe(`Target platform version`)}).optional().describe(`Platform compatibility check result`),findings:S(ame).describe(`All validation findings`),summary:l({errors:A().int().min(0).describe(`Error count`),warnings:A().int().min(0).describe(`Warning count`),infos:A().int().min(0).describe(`Info count`)}).optional().describe(`Finding counts by severity`)}).describe(`Result of the os plugin validate command`),l({artifactPath:o().describe(`Path to the artifact file to publish`),registryUrl:o().url().optional().describe(`Marketplace API base URL`),token:o().optional().describe(`Authentication token for marketplace API`),releaseNotes:o().optional().describe(`Release notes for this version`),preRelease:v().default(!1).describe(`Whether this is a pre-release version`),skipValidation:v().default(!1).describe(`Whether to skip local validation before publish`),access:x([`public`,`restricted`]).default(`public`).describe(`Package access level on the marketplace`),tags:S(o()).optional().describe(`Tags for marketplace categorization`)}).describe(`Options for the os plugin publish command`),l({success:v().describe(`Whether the publish succeeded`),packageId:o().optional().describe(`Published package identifier`),version:o().optional().describe(`Published version string`),artifactUrl:o().url().optional().describe(`URL of the published artifact in the marketplace`),sha256:o().optional().describe(`SHA256 checksum of the uploaded artifact`),submissionId:o().optional().describe(`Marketplace submission ID for review tracking`),errorMessage:o().optional().describe(`Error message if publish failed`),message:o().optional().describe(`Human-readable status message`)}).describe(`Result of the os plugin publish command`);var ome=x([`shared_schema`,`isolated_schema`,`isolated_db`]),sme=x([`turso`,`postgres`,`memory`]).describe(`Database provider for tenant data`),cme=l({url:o().min(1).describe(`Database connection URL`),authToken:o().optional().describe(`Database auth token (encrypted at rest)`),group:o().optional().describe(`Turso database group name`)}).describe(`Tenant database connection configuration`),j0=l({maxUsers:A().int().positive().optional().describe(`Maximum number of users`),maxStorage:A().int().positive().optional().describe(`Maximum storage in bytes`),apiRateLimit:A().int().positive().optional().describe(`API requests per minute`),maxObjects:A().int().positive().optional().describe(`Maximum number of custom objects`),maxRecordsPerObject:A().int().positive().optional().describe(`Maximum records per object`),maxDeploymentsPerDay:A().int().positive().optional().describe(`Maximum deployments per day`),maxStorageBytes:A().int().positive().optional().describe(`Maximum storage in bytes`)});l({currentObjectCount:A().int().min(0).default(0).describe(`Current number of custom objects`),currentRecordCount:A().int().min(0).default(0).describe(`Total records across all objects`),currentStorageBytes:A().int().min(0).default(0).describe(`Current storage usage in bytes`),deploymentsToday:A().int().min(0).default(0).describe(`Deployments executed today`),currentUsers:A().int().min(0).default(0).describe(`Current number of active users`),apiRequestsThisMinute:A().int().min(0).default(0).describe(`API requests in the current minute`),lastUpdatedAt:o().datetime().optional().describe(`Last usage update time`)}).describe(`Current tenant resource usage`),l({allowed:v().describe(`Whether the operation is within quota`),exceededQuota:o().optional().describe(`Name of the exceeded quota`),currentUsage:A().optional().describe(`Current usage value`),limit:A().optional().describe(`Quota limit`),message:o().optional().describe(`Human-readable quota message`)}).describe(`Quota enforcement check result`),l({id:o().describe(`Unique tenant identifier`),name:o().describe(`Tenant display name`),isolationLevel:ome,databaseProvider:sme.optional().describe(`Database provider`),connectionConfig:cme.optional().describe(`Database connection config`),provisioningStatus:x([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).optional().describe(`Current provisioning lifecycle status`),plan:x([`free`,`pro`,`enterprise`]).optional().describe(`Subscription plan`),customizations:u(o(),b()).optional().describe(`Custom configuration values`),quotas:j0.optional()}),d(`strategy`,[l({strategy:p(`shared_schema`).describe(`Row-level isolation strategy`),database:l({enableRLS:v().default(!0).describe(`Enable PostgreSQL Row-Level Security`),contextMethod:x([`session_variable`,`search_path`,`application_name`]).default(`session_variable`).describe(`How to set tenant context`),contextVariable:o().default(`app.current_tenant`).describe(`Session variable name`),applicationValidation:v().default(!0).describe(`Application-level tenant validation`)}).optional().describe(`Database configuration`),performance:l({usePartialIndexes:v().default(!0).describe(`Use partial indexes per tenant`),usePartitioning:v().default(!1).describe(`Use table partitioning by tenant_id`),poolSizePerTenant:A().int().positive().optional().describe(`Connection pool size per tenant`)}).optional().describe(`Performance settings`)}),l({strategy:p(`isolated_schema`).describe(`Schema-level isolation strategy`),schema:l({namingPattern:o().default(`tenant_{tenant_id}`).describe(`Schema naming pattern`),includePublicSchema:v().default(!0).describe(`Include public schema`),sharedSchema:o().default(`public`).describe(`Schema for shared resources`),autoCreateSchema:v().default(!0).describe(`Auto-create schema`)}).optional().describe(`Schema configuration`),migrations:l({strategy:x([`parallel`,`sequential`,`on_demand`]).default(`parallel`).describe(`Migration strategy`),maxConcurrent:A().int().positive().default(10).describe(`Max concurrent migrations`),rollbackOnError:v().default(!0).describe(`Rollback on error`)}).optional().describe(`Migration configuration`),performance:l({poolPerSchema:v().default(!1).describe(`Separate pool per schema`),schemaCacheTTL:A().int().positive().default(3600).describe(`Schema cache TTL`)}).optional().describe(`Performance settings`)}),l({strategy:p(`isolated_db`).describe(`Database-level isolation strategy`),database:l({namingPattern:o().default(`tenant_{tenant_id}`).describe(`Database naming pattern`),serverStrategy:x([`shared`,`sharded`,`dedicated`]).default(`shared`).describe(`Server assignment strategy`),separateCredentials:v().default(!0).describe(`Separate credentials per tenant`),autoCreateDatabase:v().default(!0).describe(`Auto-create database`)}).optional().describe(`Database configuration`),connectionPool:l({poolSize:A().int().positive().default(10).describe(`Connection pool size`),maxActivePools:A().int().positive().default(100).describe(`Max active pools`),idleTimeout:A().int().positive().default(300).describe(`Idle pool timeout`),usePooler:v().default(!0).describe(`Use connection pooler`)}).optional().describe(`Connection pool configuration`),backup:l({strategy:x([`individual`,`consolidated`,`on_demand`]).default(`individual`).describe(`Backup strategy`),frequencyHours:A().int().positive().default(24).describe(`Backup frequency`),retentionDays:A().int().positive().default(30).describe(`Backup retention days`)}).optional().describe(`Backup configuration`),encryption:l({perTenantKeys:v().default(!1).describe(`Per-tenant encryption keys`),algorithm:o().default(`AES-256-GCM`).describe(`Encryption algorithm`),keyManagement:x([`aws_kms`,`azure_key_vault`,`gcp_kms`,`hashicorp_vault`,`custom`]).optional().describe(`Key management service`)}).optional().describe(`Encryption configuration`)})]),l({encryption:l({atRest:v().default(!0).describe(`Require encryption at rest`),inTransit:v().default(!0).describe(`Require encryption in transit`),fieldLevel:v().default(!1).describe(`Require field-level encryption`)}).optional().describe(`Encryption requirements`),accessControl:l({requireMFA:v().default(!1).describe(`Require MFA`),requireSSO:v().default(!1).describe(`Require SSO`),ipWhitelist:S(o()).optional().describe(`Allowed IP addresses`),sessionTimeout:A().int().positive().default(3600).describe(`Session timeout`)}).optional().describe(`Access control requirements`),compliance:l({standards:S(x([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),requireAuditLog:v().default(!0).describe(`Require audit logging`),auditRetentionDays:A().int().positive().default(365).describe(`Audit retention days`),dataResidency:l({region:o().optional().describe(`Required region (e.g., US, EU, APAC)`),excludeRegions:S(o()).optional().describe(`Prohibited regions`)}).optional().describe(`Data residency requirements`)}).optional().describe(`Compliance requirements`)});var lme=x([`development`,`production`,`test`,`provisioning`,`preview`]).describe(`Kernel operating mode`),ume=l({autoLogin:v().default(!0).describe(`Auto-login as simulated user, skipping login/registration pages`),simulatedRole:x([`admin`,`user`,`viewer`]).default(`admin`).describe(`Permission role for the simulated preview user`),simulatedUserName:o().default(`Preview User`).describe(`Display name for the simulated preview user`),readOnly:v().default(!1).describe(`Restrict the preview session to read-only operations`),expiresInSeconds:A().int().min(0).default(0).describe(`Preview session duration in seconds (0 = no expiration)`),bannerMessage:o().optional().describe(`Banner message displayed in the UI during preview mode`)});l({instanceId:o().uuid().describe(`Unique UUID for this running kernel process`),mode:lme.default(`production`),version:o().describe(`Kernel version`),appName:o().optional().describe(`Host application name`),cwd:o().describe(`Current working directory`),workspaceRoot:o().optional().describe(`Workspace root if different from cwd`),startTime:A().int().describe(`Boot timestamp (ms)`),features:u(o(),v()).default({}).describe(`Global feature toggles`),previewMode:ume.optional().describe(`Preview/demo mode configuration (used when mode is "preview")`)}).extend({tenantId:o().min(1).describe(`Resolved tenant identifier`),tenantPlan:x([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),tenantRegion:o().optional().describe(`Tenant deployment region`),tenantDbUrl:o().min(1).describe(`Tenant database connection URL`),tenantQuotas:j0.optional().describe(`Tenant resource quotas`)}).describe(`Tenant-aware kernel runtime context`);var dme=x([`satisfied`,`needs_install`,`needs_upgrade`,`conflict`]).describe(`Resolution status for a dependency`),fme=l({packageId:o().describe(`Dependency package identifier`),requiredRange:o().describe(`SemVer range required (e.g. "^2.0.0")`),resolvedVersion:o().optional().describe(`Actual version resolved from registry`),installedVersion:o().optional().describe(`Currently installed version`),status:dme.describe(`Resolution status`),conflictReason:o().optional().describe(`Explanation of the conflict`)}).describe(`Resolution result for a single dependency`),pme=l({type:x([`install`,`upgrade`,`confirm_conflict`]).describe(`Type of action required`),packageId:o().describe(`Target package identifier`),description:o().describe(`Human-readable action description`)}).describe(`Action required before installation can proceed`),mme=l({dependencies:S(fme).describe(`Resolution result for each dependency`),canProceed:v().describe(`Whether installation can proceed`),requiredActions:S(pme).describe(`Actions required before proceeding`),installOrder:S(o()).describe(`Topologically sorted package IDs for installation`),circularDependencies:S(S(o())).optional().describe(`Circular dependency chains detected (e.g. [["A", "B", "A"]])`)}).describe(`Complete dependency resolution result`),hme=l({service:o().min(1).describe(`Target service identifier`),enabled:v().default(!0).describe(`Enable or disable this service`),strategy:x([`mock`,`memory`,`stub`,`passthrough`]).default(`memory`).describe(`Implementation strategy for development`),config:u(o(),b()).optional().describe(`Strategy-specific configuration for this service override`)}),gme=l({enabled:v().default(!0).describe(`Load fixture data on startup`),paths:S(o()).optional().describe(`Glob patterns for fixture files`),resetBeforeLoad:v().default(!0).describe(`Clear existing data before loading fixtures`),envFilter:S(o()).optional().describe(`Only load fixtures matching these environment tags`)}),_me=l({hotReload:v().default(!0).describe(`Enable HMR / live-reload`),requestInspector:v().default(!1).describe(`Enable request inspector`),dbExplorer:v().default(!1).describe(`Enable database explorer UI`),verboseLogging:v().default(!0).describe(`Enable verbose logging`),apiDocs:v().default(!0).describe(`Serve OpenAPI docs at /_dev/docs`),mailCatcher:v().default(!1).describe(`Capture outbound emails in dev`)});l({preset:x([`minimal`,`standard`,`full`]).describe(`Predefined dev configuration profile`).default(`standard`).describe(`Base configuration preset`),services:u(o().min(1),hme.omit({service:!0})).optional().describe(`Per-service dev overrides keyed by service name`),fixtures:gme.optional().describe(`Fixture data loading configuration`),tools:_me.optional().describe(`Developer tooling settings`),port:A().int().min(1).max(65535).default(4400).describe(`Port for the dev-tools dashboard`),open:v().default(!1).describe(`Auto-open dev dashboard in browser`),seedAdminUser:v().default(!0).describe(`Create a default admin user for development`),simulatedLatency:A().int().min(0).default(0).describe(`Artificial latency (ms) added to service calls`)}),o().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`);var vme=o().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`),M0=o().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`),yme=x([`critical`,`high`,`normal`,`low`,`background`]),bme=l({source:o().describe(`Event source (e.g., plugin name, system component)`),timestamp:o().datetime().describe(`ISO 8601 datetime when event was created`),userId:o().optional().describe(`User who triggered the event`),tenantId:o().optional().describe(`Tenant identifier for multi-tenant systems`),correlationId:o().optional().describe(`Correlation ID for event tracing`),causationId:o().optional().describe(`ID of the event that caused this event`),priority:yme.optional().default(`normal`).describe(`Event priority`)}),xme=l({name:M0.describe(`Event type name (lowercase with dots)`),version:o().default(`1.0.0`).describe(`Event schema version`),schema:b().optional().describe(`JSON Schema for event payload validation`),description:o().optional().describe(`Event type description`),deprecated:v().optional().default(!1).describe(`Whether this event type is deprecated`),tags:S(o()).optional().describe(`Event type tags`)}),N0=l({id:o().optional().describe(`Unique event identifier`),name:M0.describe(`Event name (lowercase with dots, e.g., user.created, order.paid)`),payload:b().describe(`Event payload schema`),metadata:bme.describe(`Event metadata`)}),Sme=l({id:o().optional().describe(`Unique handler identifier`),eventName:o().describe(`Name of event to handle (supports wildcards like user.*)`),handler:b().describe(`Handler function`),priority:A().int().default(0).describe(`Execution priority (lower numbers execute first)`),async:v().default(!0).describe(`Execute in background (true) or block (false)`),retry:l({maxRetries:A().int().min(0).default(3).describe(`Maximum retry attempts`),backoffMs:A().int().positive().default(1e3).describe(`Initial backoff delay`),backoffMultiplier:A().positive().default(2).describe(`Backoff multiplier`)}).optional().describe(`Retry policy for failed handlers`),timeoutMs:A().int().positive().optional().describe(`Handler timeout in milliseconds`),filter:b().optional().describe(`Optional filter to determine if handler should execute`)});l({from:o().describe(`Source event pattern (supports wildcards, e.g., user.* or *.created)`),to:S(o()).describe(`Target event names to route to`),transform:b().optional().describe(`Optional function to transform payload`)});var Cme=l({enabled:v().default(!1).describe(`Enable event persistence`),retention:A().int().positive().describe(`Days to retain persisted events`),filter:b().optional().describe(`Optional filter function to select which events to persist`),storage:x([`database`,`file`,`s3`,`custom`]).default(`database`).describe(`Storage backend for persisted events`)}),wme=l({name:o().default(`events`).describe(`Event queue name`),concurrency:A().int().min(1).default(10).describe(`Max concurrent event handlers`),retryPolicy:l({maxRetries:A().int().min(0).default(3).describe(`Max retries for failed events`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:A().int().positive().default(6e4).describe(`Maximum retry delay`)}).optional().describe(`Default retry policy for events`),deadLetterQueue:o().optional().describe(`Dead letter queue name for failed events`),priorityEnabled:v().default(!0).describe(`Process events based on priority`)});l({fromTimestamp:o().datetime().describe(`Start timestamp for replay (ISO 8601)`),toTimestamp:o().datetime().optional().describe(`End timestamp for replay (ISO 8601)`),eventTypes:S(o()).optional().describe(`Event types to replay (empty = all)`),filters:u(o(),b()).optional().describe(`Additional filters for event selection`),speed:A().positive().default(1).describe(`Replay speed multiplier (1 = real-time)`),targetHandlers:S(o()).optional().describe(`Handler IDs to execute (empty = all)`)});var Tme=l({enabled:v().default(!1).describe(`Enable event sourcing`),snapshotInterval:A().int().positive().default(100).describe(`Create snapshot every N events`),snapshotRetention:A().int().positive().default(10).describe(`Number of snapshots to retain`),retention:A().int().positive().default(365).describe(`Days to retain events`),aggregateTypes:S(o()).optional().describe(`Aggregate types to enable event sourcing for`),storage:l({type:x([`database`,`file`,`s3`,`eventstore`]).default(`database`).describe(`Storage backend`),options:u(o(),b()).optional().describe(`Storage-specific options`)}).optional().describe(`Event store configuration`)});l({id:o().describe(`Unique entry identifier`),event:N0.describe(`Original event`),error:l({message:o().describe(`Error message`),stack:o().optional().describe(`Error stack trace`),code:o().optional().describe(`Error code`)}).describe(`Failure details`),retries:A().int().min(0).describe(`Number of retry attempts`),firstFailedAt:o().datetime().describe(`When event first failed`),lastFailedAt:o().datetime().describe(`When event last failed`),failedHandler:o().optional().describe(`Handler ID that failed`)}),l({id:o().describe(`Unique log entry identifier`),event:N0.describe(`The event`),status:x([`pending`,`processing`,`completed`,`failed`]).describe(`Processing status`),handlersExecuted:S(l({handlerId:o().describe(`Handler identifier`),status:x([`success`,`failed`,`timeout`]).describe(`Handler execution status`),durationMs:A().int().optional().describe(`Execution duration`),error:o().optional().describe(`Error message if failed`)})).optional().describe(`Handlers that processed this event`),receivedAt:o().datetime().describe(`When event was received`),processedAt:o().datetime().optional().describe(`When event was processed`),totalDurationMs:A().int().optional().describe(`Total processing time`)});var Eme=l({id:o().optional().describe(`Unique webhook identifier`),eventPattern:o().describe(`Event name pattern (supports wildcards)`),url:o().url().describe(`Webhook endpoint URL`),method:x([`GET`,`POST`,`PUT`,`PATCH`]).default(`POST`).describe(`HTTP method`),headers:u(o(),o()).optional().describe(`HTTP headers`),authentication:l({type:x([`none`,`bearer`,`basic`,`api-key`]).describe(`Auth type`),credentials:u(o(),o()).optional().describe(`Auth credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:l({maxRetries:A().int().min(0).default(3).describe(`Max retry attempts`),backoffStrategy:x([`fixed`,`linear`,`exponential`]).default(`exponential`),initialDelayMs:A().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:A().int().positive().default(6e4).describe(`Max retry delay`)}).optional().describe(`Retry policy`),timeoutMs:A().int().positive().default(3e4).describe(`Request timeout in milliseconds`),transform:b().optional().describe(`Transform event before sending`),enabled:v().default(!0).describe(`Whether webhook is enabled`)}),Dme=l({provider:x([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Message queue provider`),topic:o().describe(`Topic or queue name`),eventPattern:o().default(`*`).describe(`Event name pattern to publish (supports wildcards)`),partitionKey:o().optional().describe(`JSON path for partition key (e.g., "metadata.tenantId")`),format:x([`json`,`avro`,`protobuf`]).default(`json`).describe(`Message serialization format`),includeMetadata:v().default(!0).describe(`Include event metadata in message`),compression:x([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression`),batchSize:A().int().min(1).default(1).describe(`Batch size for publishing`),flushIntervalMs:A().int().positive().default(1e3).describe(`Flush interval for batching`)}),Ome=l({enabled:v().default(!0).describe(`Enable real-time notifications`),protocol:x([`websocket`,`sse`,`long-polling`]).default(`websocket`).describe(`Real-time protocol`),eventPattern:o().default(`*`).describe(`Event pattern to broadcast`),userFilter:v().default(!0).describe(`Filter events by user`),tenantFilter:v().default(!0).describe(`Filter events by tenant`),channels:S(l({name:o().describe(`Channel name`),eventPattern:o().describe(`Event pattern for channel`),filter:b().optional().describe(`Additional filter function`)})).optional().describe(`Named channels for event broadcasting`),rateLimit:l({maxEventsPerSecond:A().int().positive().describe(`Max events per second per client`),windowMs:A().int().positive().default(1e3).describe(`Rate limit window`)}).optional().describe(`Rate limiting configuration`)});l({persistence:Cme.optional().describe(`Event persistence configuration`),queue:wme.optional().describe(`Event queue configuration`),eventSourcing:Tme.optional().describe(`Event sourcing configuration`),replay:l({enabled:v().default(!0).describe(`Enable event replay capability`)}).optional().describe(`Event replay configuration`),webhooks:S(Eme).optional().describe(`Webhook configurations`),messageQueue:Dme.optional().describe(`Message queue integration`),realtime:Ome.optional().describe(`Real-time notification configuration`),eventTypes:S(xme).optional().describe(`Event type definitions`),handlers:S(Sme).optional().describe(`Global event handlers`)});var kme=x([`boolean`,`percentage`,`user_list`,`group`,`custom`]),Ame=l({name:vme.describe(`Feature key (snake_case)`),label:o().optional().describe(`Display label`),description:o().optional(),enabled:v().default(!1).describe(`Is globally enabled`),strategy:kme.default(`boolean`),conditions:l({percentage:A().min(0).max(100).optional(),users:S(o()).optional(),groups:S(o()).optional(),expression:o().optional().describe(`Custom formula expression`)}).optional(),environment:x([`dev`,`staging`,`prod`,`all`]).default(`all`).describe(`Environment validity`),expiresAt:o().datetime().optional().describe(`Feature flag expiration date`)});Object.assign(Ame,{create:e=>e});var jme=x([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),P0=l({major:A().int().min(0),minor:A().int().min(0),patch:A().int().min(0)}).describe(`Semantic version of the protocol`),Mme=l({id:o().regex(/^([a-z][a-z0-9]*\.)+protocol\.[a-z][a-z0-9._]*\.v\d+$/).describe(`Unique protocol identifier (e.g., com.objectstack.protocol.storage.v1)`),label:o(),version:P0,specification:o().optional().describe(`URL or path to protocol specification`),description:o().optional()}),Nme=l({name:o().describe(`Feature identifier within the protocol`),enabled:v().default(!0),description:o().optional(),sinceVersion:o().optional().describe(`Version when this feature was added`),deprecatedSince:o().optional().describe(`Version when deprecated`)}),Pme=l({protocol:Mme,conformance:jme.default(`full`),implementedFeatures:S(o()).optional().describe(`List of implemented feature names`),features:S(Nme).optional(),metadata:u(o(),b()).optional(),certified:v().default(!1).describe(`Has passed official conformance tests`),certificationDate:o().datetime().optional()}),Fme=l({id:o().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:o(),description:o().optional(),version:P0,methods:S(l({name:o().describe(`Method name`),description:o().optional(),parameters:S(l({name:o(),type:o().describe(`Type notation (e.g., string, number, User)`),required:v().default(!0),description:o().optional()})).optional(),returnType:o().optional().describe(`Return value type`),async:v().default(!1).describe(`Whether method returns a Promise`)})),events:S(l({name:o().describe(`Event name`),description:o().optional(),payload:o().optional().describe(`Event payload type`)})).optional(),stability:x([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),Ime=l({pluginId:o().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:o().describe(`Semantic version constraint`),optional:v().default(!1),reason:o().optional(),requiredCapabilities:S(o()).optional().describe(`Protocol IDs the dependency must support`)}),Lme=l({id:o().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:o(),description:o().optional(),type:x([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:l({input:o().optional().describe(`Input type/schema`),output:o().optional().describe(`Output type/schema`),signature:o().optional().describe(`Function signature if applicable`)}).optional(),cardinality:x([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),F0=l({implements:S(Pme).optional().describe(`List of protocols this plugin conforms to`),provides:S(Fme).optional().describe(`Services/APIs this plugin offers to others`),requires:S(Ime).optional().describe(`Required plugins and their capabilities`),extensionPoints:S(Lme).optional().describe(`Points where other plugins can extend this plugin`),extensions:S(l({targetPluginId:o().describe(`Plugin ID being extended`),extensionPointId:o().describe(`Extension point identifier`),implementation:o().describe(`Path to implementation module`),priority:A().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),Rme=x([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),zme=l({enabled:v().default(!1),priority:A().int().min(0).default(100),resources:S(x([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:l({routes:S(o()).optional(),roles:S(o()).optional(),deviceType:S(x([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:x([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),Bme=l({enabled:v().default(!0),strategy:x([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:x([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:A().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:l({enabled:v().default(!0),minChunks:A().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),Vme=l({enabled:v().default(!0),mode:x([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:v().default(!1).describe(`Prefetch module in idle time`),preload:v().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:o().optional().describe(`Custom chunk name for webpack`),timeout:A().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:l({enabled:v().default(!0),maxAttempts:A().int().min(1).max(10).default(3),backoffMs:A().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),Hme=l({mode:x([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:A().int().min(100).default(3e4),priority:A().int().min(0).default(100),critical:v().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:l({enabled:v().default(!1),maxAttempts:A().int().min(1).max(5).default(3),backoffMs:A().int().min(0).default(1e3)}).optional(),healthCheckInterval:A().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),Ume=l({strategy:x([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:l({resolve:v().default(!0),onMissing:x([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:x([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:l({load:v().default(!0),onFailure:x([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:x([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:x([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),Wme=l({enabled:v().default(!1),environment:x([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:x([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:S(o()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:S(o()).optional().describe(`Glob patterns for files to ignore`),debounceMs:A().int().min(0).default(300),preserveState:v().default(!1),stateSerialization:l({enabled:v().default(!1),handler:o().optional()}).optional(),hooks:l({beforeReload:o().optional().describe(`Function to call before reload`),afterReload:o().optional().describe(`Function to call after reload`),onError:o().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:l({healthValidation:v().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:v().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:A().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:v().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:A().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:A().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:A().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),Gme=l({enabled:v().default(!0),storage:x([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:x([`version`,`hash`,`timestamp`]).default(`version`),ttl:A().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:A().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:S(x([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:l({enabled:v().default(!1),algorithm:x([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),Kme=l({enabled:v().default(!1),scope:x([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:x([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:S(o()).optional().describe(`List of allowed capability IDs`),resourceQuotas:l({maxMemoryMB:A().int().min(1).optional(),maxCpuTimeMs:A().int().min(100).optional(),maxFileDescriptors:A().int().min(1).optional(),maxNetworkKBps:A().int().min(1).optional()}).optional(),permissions:l({allowedAPIs:S(o()).optional(),allowedPaths:S(o()).optional(),allowedEndpoints:S(o()).optional(),allowedEnvVars:S(o()).optional()}).optional(),ipc:l({enabled:v().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:x([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:A().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:A().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:S(o()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),qme=l({enabled:v().default(!1),metrics:S(x([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:A().min(0).max(1).default(1),reportingInterval:A().int().min(1).default(60),budgets:l({maxLoadTimeMs:A().int().min(0).optional(),maxInitTimeMs:A().int().min(0).optional(),maxMemoryMB:A().int().min(0).optional()}).optional(),onBudgetViolation:x([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),Jme=l({strategy:Rme.default(`lazy`),preload:zme.optional(),codeSplitting:Bme.optional(),dynamicImport:Vme.optional(),initialization:Hme.optional(),dependencyResolution:Ume.optional(),hotReload:Wme.optional(),caching:Gme.optional(),sandboxing:Kme.optional(),monitoring:qme.optional()}).describe(`Complete plugin loading configuration`);l({type:x([`load-started`,`load-completed`,`load-failed`,`init-started`,`init-completed`,`init-failed`,`preload-started`,`preload-completed`,`cache-hit`,`cache-miss`,`hot-reload`,`dynamic-load`,`dynamic-unload`,`dynamic-discover`]),pluginId:o(),timestamp:A().int().min(0),durationMs:A().int().min(0).optional(),metadata:u(o(),b()).optional(),error:l({message:o(),code:o().optional(),stack:o().optional()}).optional()}).describe(`Plugin loading lifecycle event`),l({pluginId:o(),state:x([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:A().min(0).max(100).default(0),startedAt:A().int().min(0).optional(),completedAt:A().int().min(0).optional(),lastError:o().optional(),retryCount:A().int().min(0).default(0)}).describe(`Plugin loading state`),l({ql:l({object:O().describe(`Get object handle for method chaining`),query:O().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:l({getCurrentUser:O().describe(`Get the current authenticated user`),getConfig:O().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:l({debug:O().describe(`Log debug message`),info:O().describe(`Log info message`),warn:O().describe(`Log warning message`),error:O().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:l({get:O().describe(`Get a value from storage`),set:O().describe(`Set a value in storage`),delete:O().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:l({t:O().describe(`Translate a key`),getLocale:O().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:u(o(),b()),events:u(o(),b()),app:l({router:l({get:O().describe(`Register GET route handler`),post:O().describe(`Register POST route handler`),use:O().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:l({register:O().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),l({previousVersion:o().describe(`Version before upgrade`),newVersion:o().describe(`Version after upgrade`),isMajorUpgrade:v().describe(`Whether this is a major version bump`),previousMetadata:u(o(),b()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`);var Yme=l({onInstall:O().optional().describe(`Called when plugin is installed`),onEnable:O().optional().describe(`Called when plugin is enabled`),onDisable:O().optional().describe(`Called when plugin is disabled`),onUninstall:O().optional().describe(`Called when plugin is uninstalled`),onUpgrade:O().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),I0=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`];Yme.extend({id:o().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:x([`standard`,...I0]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:o().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:o().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:v().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:o().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:o().optional(),author:o().optional(),homepage:o().url().optional()});var Xme=x([`insert`,`update`,`upsert`,`replace`,`ignore`]),Zme=l({object:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:o().default(`name`).describe(`Field match for uniqueness check`),mode:Xme.default(`upsert`).describe(`Conflict resolution strategy`),env:S(x([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:S(u(o(),b())).describe(`Data records`)}),L0=l({id:o().describe(`Unique package identifier (reverse domain style)`),namespace:o().regex(/^[a-z][a-z0-9_]{1,19}$/,`Namespace must be 2-20 chars, lowercase alphanumeric + underscore`).optional().describe(`Short namespace identifier for metadata scoping (e.g. "crm", "todo")`),version:o().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:x([`plugin`,...I0,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:o().describe(`Human-readable package name`),description:o().optional().describe(`Package description`),permissions:S(o()).optional().describe(`Array of required permission strings`),objects:S(o()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:S(o()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:u(o(),o()).optional().describe(`Package dependencies`),configuration:l({title:o().optional(),properties:u(o(),l({type:x([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:b().optional().describe(`Default value`),description:o().optional().describe(`Tooltip description`),required:v().optional().describe(`Is this setting required?`),secret:v().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:S(o()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:l({kinds:S(l({id:o().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:S(o()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:o().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:S(o()).optional().describe(`Events this plugin listens to`),menus:u(o(),S(l({id:o(),label:o(),command:o().optional()}))).optional().describe(`UI Menu contributions`),themes:S(l({id:o(),label:o(),path:o()})).optional().describe(`Theme contributions`),translations:S(l({locale:o(),path:o()})).optional().describe(`Translation resources`),actions:S(l({name:o().describe(`Unique action name`),label:o().optional(),description:o().optional(),input:b().optional().describe(`Input validation schema`),output:b().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:S(l({id:o().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:o().describe(`Human readable name`),description:o().optional()})).optional().describe(`Driver contributions`),fieldTypes:S(l({name:o().describe(`Unique field type name (e.g. "vector")`),label:o().describe(`Display label`),description:o().optional()})).optional().describe(`Field Type contributions`),functions:S(l({name:o().describe(`Function name (e.g. "distance")`),description:o().optional(),args:S(o()).optional().describe(`Argument types`),returnType:o().optional()})).optional().describe(`Query Function contributions`),routes:S(l({prefix:o().regex(/^\//).describe(`API path prefix`),service:o().describe(`Service name this plugin provides`),methods:S(o()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:S(l({name:o().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:o().optional().describe(`Command description for help text`),module:o().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:S(Zme).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:F0.optional().describe(`Plugin capability declarations for interoperability`),extensions:u(o(),b()).optional().describe(`Extension points and contributions`),loading:Jme.optional().describe(`Plugin loading and runtime behavior configuration`),engine:l({objectstack:o().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)});x([`package`,`admin`,`user`,`migration`,`api`]);var Qme=l({path:o().describe(`JSON path to the changed field`),originalValue:b().optional().describe(`Original value from the package`),currentValue:b().describe(`Current customized value`),changedBy:o().optional().describe(`User or admin who made this change`),changedAt:o().datetime().optional().describe(`Timestamp of the change`)});l({id:o().describe(`Overlay record ID (UUID)`),baseType:o().describe(`Metadata type being customized`),baseName:o().describe(`Metadata name being customized`),packageId:o().optional().describe(`Package ID that delivered the base metadata`),packageVersion:o().optional().describe(`Package version when overlay was created`),scope:x([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:o().optional().describe(`Tenant identifier`),owner:o().optional().describe(`Owner user ID for user-scope overlays`),patch:u(o(),b()).describe(`JSON Merge Patch payload (changed fields only)`),changes:S(Qme).optional().describe(`Field-level change tracking for conflict detection`),active:v().default(!0).describe(`Whether this overlay is active`),createdAt:o().datetime().optional(),createdBy:o().optional(),updatedAt:o().datetime().optional(),updatedBy:o().optional()});var $me=l({path:o().describe(`JSON path to the conflicting field`),baseValue:b().describe(`Value in the old package version`),incomingValue:b().describe(`Value in the new package version`),customValue:b().describe(`Customer customized value`),suggestedResolution:x([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:o().optional().describe(`Explanation for the suggested resolution`)}),ehe=l({defaultStrategy:x([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:S(o()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:S(o()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:v().default(!0).describe(`Auto-resolve changes that do not conflict`)});l({success:v().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:u(o(),b()).optional().describe(`Merged metadata result`),updatedOverlay:u(o(),b()).optional().describe(`Updated overlay after merge`),conflicts:S($me).optional().describe(`Unresolved merge conflicts`),autoResolved:S(l({path:o(),resolution:o(),description:o().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:l({totalFields:A().int().min(0).describe(`Total fields evaluated`),unchanged:A().int().min(0).describe(`Fields with no changes`),autoResolved:A().int().min(0).describe(`Fields auto-resolved`),conflicts:A().int().min(0).describe(`Fields with conflicts`)}).optional()});var the=l({metadataType:o().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:v().default(!0),lockedFields:S(o()).optional().describe(`Field paths that cannot be customized`),customizableFields:S(o()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:v().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:v().default(!1).describe(`Whether admins can delete package-delivered fields`)}),R0=x([`json`,`yaml`,`typescript`,`javascript`]),nhe=l({size:A().int().min(0).describe(`File size in bytes`),modifiedAt:o().datetime().describe(`Last modified date`),etag:o().describe(`Entity tag for cache validation`),format:R0.describe(`Serialization format`),path:o().optional().describe(`File system path`),metadata:u(o(),b()).optional().describe(`Provider-specific metadata`)});l({patterns:S(o()).optional().describe(`File glob patterns`),ifNoneMatch:o().optional().describe(`ETag for conditional request`),ifModifiedSince:o().datetime().optional().describe(`Only load if modified after this date`),validate:v().default(!0).describe(`Validate against schema`),useCache:v().default(!0).describe(`Enable caching`),filter:o().optional().describe(`Filter predicate as string`),limit:A().int().min(1).optional().describe(`Maximum items to load`),recursive:v().default(!0).describe(`Search subdirectories`)}),l({format:R0.default(`typescript`).describe(`Output format`),prettify:v().default(!0).describe(`Format with indentation`),indent:A().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:v().default(!1).describe(`Sort object keys`),includeDefaults:v().default(!1).describe(`Include default values`),backup:v().default(!1).describe(`Create backup file`),overwrite:v().default(!0).describe(`Overwrite existing file`),atomic:v().default(!0).describe(`Use atomic write operation`),path:o().optional().describe(`Custom output path`)}),l({output:o().describe(`Output file path`),format:R0.default(`json`).describe(`Export format`),filter:o().optional().describe(`Filter items to export`),includeStats:v().default(!1).describe(`Include metadata statistics`),compress:v().default(!1).describe(`Compress output (gzip)`),prettify:v().default(!0).describe(`Pretty print output`)}),l({conflictResolution:x([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:v().default(!0).describe(`Validate before import`),dryRun:v().default(!1).describe(`Simulate import without saving`),continueOnError:v().default(!1).describe(`Continue if validation fails`),transform:o().optional().describe(`Transform items before import`)}),l({data:b().nullable().describe(`Loaded metadata`),fromCache:v().default(!1).describe(`Loaded from cache`),notModified:v().default(!1).describe(`Not modified since last request`),etag:o().optional().describe(`Entity tag`),stats:nhe.optional().describe(`Metadata statistics`),loadTime:A().min(0).optional().describe(`Load duration in ms`)}),l({success:v().describe(`Save successful`),path:o().describe(`Output path`),etag:o().optional().describe(`Generated entity tag`),size:A().int().min(0).optional().describe(`File size`),saveTime:A().min(0).optional().describe(`Save duration in ms`),backupPath:o().optional().describe(`Backup file path`)}),l({type:x([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:o().describe(`Type of metadata`),name:o().describe(`Item identifier`),path:o().describe(`File path`),data:b().optional().describe(`Item data`),timestamp:o().datetime().describe(`Event timestamp`)}),l({type:o().describe(`Collection type`),count:A().int().min(0).describe(`Number of items`),formats:S(R0).describe(`Formats in collection`),totalSize:A().int().min(0).optional().describe(`Total size in bytes`),lastModified:o().datetime().optional().describe(`Last modification date`),location:o().optional().describe(`Collection location`)}),l({name:o().describe(`Loader identifier`),protocol:x([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:l({read:v().default(!0),write:v().default(!1),watch:v().default(!1),list:v().default(!0)}).describe(`Loader capabilities`),supportedFormats:S(R0).describe(`Supported formats`),supportsWatch:v().default(!1).describe(`Supports file watching`),supportsWrite:v().default(!0).describe(`Supports write operations`),supportsCache:v().default(!0).describe(`Supports caching`)});var rhe=x([`filesystem`,`memory`,`none`]),ihe=l({datasource:o().optional().describe(`Datasource name reference for database persistence`),tableName:o().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:rhe.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:o().optional().describe(`Root directory path`),formats:S(R0).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:l({enabled:v().default(!0).describe(`Enable caching`),ttl:A().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:A().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:v().default(!1).describe(`Enable file watching`),watchOptions:l({ignored:S(o()).optional().describe(`Patterns to ignore`),persistent:v().default(!0).describe(`Keep process running`),ignoreInitial:v().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:l({strict:v().default(!0).describe(`Strict validation`),throwOnError:v().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:u(o(),b()).optional().describe(`Loader-specific configuration`)}),z0=x([`object`,`field`,`trigger`,`validation`,`hook`,`view`,`page`,`dashboard`,`app`,`action`,`report`,`flow`,`workflow`,`approval`,`datasource`,`translation`,`router`,`function`,`service`,`permission`,`profile`,`role`,`agent`,`tool`,`skill`]),ahe=l({type:z0.describe(`Metadata type identifier`),label:o().describe(`Display label for the metadata type`),description:o().optional().describe(`Description of the metadata type`),filePatterns:S(o()).describe(`Glob patterns to discover files of this type`),supportsOverlay:v().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:v().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:v().default(!1).describe(`Whether version history is tracked`),loadOrder:A().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:x([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)});l({types:S(z0).optional().describe(`Filter by metadata types`),namespaces:S(o()).optional().describe(`Filter by namespaces`),packageId:o().optional().describe(`Filter by owning package`),search:o().optional().describe(`Full-text search query`),scope:x([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:x([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:S(o()).optional().describe(`Filter by tags`),sortBy:x([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:x([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:A().int().min(1).default(1).describe(`Page number`),pageSize:A().int().min(1).max(500).default(50).describe(`Items per page`)}),l({items:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),namespace:o().optional().describe(`Namespace`),label:o().optional().describe(`Display label`),scope:x([`system`,`platform`,`user`]).optional(),state:x([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:o().optional(),updatedAt:o().datetime().optional()})).describe(`Matched metadata items`),total:A().int().min(0).describe(`Total matching items`),page:A().int().min(1).describe(`Current page`),pageSize:A().int().min(1).describe(`Page size`)}),l({event:x([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:z0.describe(`Metadata type`),name:o().describe(`Metadata item name`),namespace:o().optional().describe(`Namespace`),packageId:o().optional().describe(`Owning package ID`),timestamp:o().datetime().describe(`Event timestamp`),actor:o().optional().describe(`User or system that triggered the event`),payload:u(o(),b()).optional().describe(`Event-specific payload`)}),l({valid:v().describe(`Whether the metadata is valid`),errors:S(l({path:o().describe(`JSON path to the invalid field`),message:o().describe(`Error description`),code:o().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:S(l({path:o().describe(`JSON path to the field`),message:o().describe(`Warning description`)})).optional().describe(`Validation warnings`)});var ohe=l({storage:ihe.describe(`Storage backend configuration`),customizationPolicies:S(the).optional().describe(`Default customization policies per type`),mergeStrategy:ehe.optional().describe(`Merge strategy for package upgrades`),additionalTypes:S(ahe.omit({type:!0}).extend({type:o().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:v().default(!0).describe(`Emit metadata change events`),validateOnWrite:v().default(!0).describe(`Validate metadata on write`),enableVersioning:v().default(!1).describe(`Track metadata version history`),cacheMaxItems:A().int().min(0).default(1e4).describe(`Max items in memory cache`)});l({id:p(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:p(`ObjectStack Metadata Service`).describe(`Plugin name`),version:o().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:p(`standard`).describe(`Plugin type`),description:o().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:l({crud:v().default(!0).describe(`Supports metadata CRUD`),query:v().default(!0).describe(`Supports metadata query`),overlay:v().default(!0).describe(`Supports customization overlays`),watch:v().default(!1).describe(`Supports file watching`),importExport:v().default(!0).describe(`Supports import/export`),validation:v().default(!0).describe(`Supports schema validation`),versioning:v().default(!1).describe(`Supports version history`),events:v().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:ohe.optional().describe(`Plugin configuration`)}),l({items:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),data:u(o(),b()).describe(`Metadata payload`),namespace:o().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:v().default(!1).describe(`Continue if individual item fails`),validate:v().default(!0).describe(`Validate before register`)}),l({total:A().int().min(0).describe(`Total items processed`),succeeded:A().int().min(0).describe(`Successfully processed`),failed:A().int().min(0).describe(`Failed items`),errors:S(l({type:o().describe(`Metadata type`),name:o().describe(`Item name`),error:o().describe(`Error message`)})).optional().describe(`Per-item errors`)}),l({sourceType:o().describe(`Dependent metadata type`),sourceName:o().describe(`Dependent metadata name`),targetType:o().describe(`Referenced metadata type`),targetName:o().describe(`Referenced metadata name`),kind:x([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)});var B0=x([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),V0=l({manifest:L0.describe(`Full package manifest`),status:B0.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:v().default(!0).describe(`Whether the package is currently enabled`),installedAt:o().datetime().optional().describe(`Installation timestamp`),updatedAt:o().datetime().optional().describe(`Last update timestamp`),installedVersion:o().optional().describe(`Currently installed version for quick access`),previousVersion:o().optional().describe(`Version before the last upgrade`),statusChangedAt:o().datetime().optional().describe(`Status change timestamp`),errorMessage:o().optional().describe(`Error message when status is error`),settings:u(o(),b()).optional().describe(`User-provided configuration settings`),upgradeHistory:S(l({fromVersion:o().describe(`Version before upgrade`),toVersion:o().describe(`Version after upgrade`),upgradedAt:o().datetime().describe(`Upgrade timestamp`),status:x([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:S(o()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:S(o()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`);l({namespace:o().describe(`Namespace prefix`),packageId:o().describe(`Owning package ID`),registeredAt:o().datetime().describe(`Registration timestamp`),status:x([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),l({type:p(`namespace_conflict`).describe(`Error type`),requestedNamespace:o().describe(`Requested namespace`),conflictingPackageId:o().describe(`Conflicting package ID`),conflictingPackageName:o().describe(`Conflicting package display name`),suggestion:o().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),l({status:B0.optional().describe(`Filter by package status`),type:L0.shape.type.optional().describe(`Filter by package type`),enabled:v().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),l({packages:S(V0).describe(`List of installed packages`),total:A().describe(`Total package count`)}).describe(`List packages response`),l({id:o().describe(`Package identifier`)}).describe(`Get package request`),l({package:V0.describe(`Package details`)}).describe(`Get package response`),l({manifest:L0.describe(`Package manifest to install`),settings:u(o(),b()).optional().describe(`User-provided settings at install time`),enableOnInstall:v().default(!0).describe(`Whether to enable immediately after install`),platformVersion:o().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),l({package:V0.describe(`Installed package details`),message:o().optional().describe(`Installation status message`),dependencyResolution:mme.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),l({id:o().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),l({id:o().describe(`Uninstalled package ID`),success:v().describe(`Whether uninstall succeeded`),message:o().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),l({id:o().describe(`Package ID to enable`)}).describe(`Enable package request`),l({package:V0.describe(`Enabled package details`),message:o().optional().describe(`Enable status message`)}).describe(`Enable package response`),l({id:o().describe(`Package ID to disable`)}).describe(`Disable package request`),l({package:V0.describe(`Disabled package details`),message:o().optional().describe(`Disable status message`)}).describe(`Disable package response`);var she=x([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),che=l({type:o().describe(`Metadata type`),name:o().describe(`Metadata name`),changeType:she.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:v().default(!1).describe(`Whether this change may conflict with customizations`),summary:o().optional().describe(`Human-readable change summary`),previousName:o().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),lhe=x([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),uhe=l({packageId:o().describe(`Package identifier`),fromVersion:o().describe(`Currently installed version`),toVersion:o().describe(`Target upgrade version`),impactLevel:lhe.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:S(che).describe(`All metadata changes`),affectedCustomizations:A().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:v().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:S(o()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:S(l({packageId:o(),fromVersion:o(),toVersion:o()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:A().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:o().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`);l({id:o().describe(`Snapshot identifier`),packageId:o().describe(`Package identifier`),fromVersion:o().describe(`Version before upgrade`),toVersion:o().describe(`Target upgrade version`),tenantId:o().optional().describe(`Tenant identifier`),previousManifest:L0.describe(`Complete manifest of the previous package version`),metadataSnapshot:S(l({type:o(),name:o(),metadata:u(o(),b())})).describe(`Snapshot of all package metadata`),customizationSnapshot:S(u(o(),b())).optional().describe(`Snapshot of customer customizations`),createdAt:o().datetime().describe(`Snapshot creation timestamp`),expiresAt:o().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),l({packageId:o().describe(`Package ID to upgrade`),targetVersion:o().optional().describe(`Target version (defaults to latest)`),manifest:L0.optional().describe(`New manifest (if installing from local)`),createSnapshot:v().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:x([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:v().default(!1).describe(`Preview upgrade without making changes`),skipValidation:v().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`);var dhe=x([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`);l({success:v().describe(`Whether the upgrade succeeded`),phase:dhe.describe(`Current upgrade phase`),plan:uhe.optional().describe(`Upgrade plan`),snapshotId:o().optional().describe(`Snapshot ID for rollback`),conflicts:S(l({path:o(),baseValue:b(),incomingValue:b(),customValue:b()})).optional().describe(`Unresolved merge conflicts`),errorMessage:o().optional().describe(`Error message if upgrade failed`),message:o().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),l({packageId:o().describe(`Package ID to rollback`),snapshotId:o().describe(`Snapshot ID to restore from`),rollbackCustomizations:v().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),l({success:v().describe(`Whether the rollback succeeded`),restoredVersion:o().optional().describe(`Version restored to`),message:o().optional().describe(`Rollback status message`)}).describe(`Rollback package response`);var H0=x([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),fhe=l({interval:A().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:A().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:A().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:A().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:o().optional().describe(`Method name to call for health check`),autoRestart:v().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:A().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:x([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)});l({status:H0,timestamp:o().datetime(),message:o().optional(),metrics:l({uptime:A().describe(`Plugin uptime in milliseconds`),memoryUsage:A().optional().describe(`Memory usage in bytes`),cpuUsage:A().optional().describe(`CPU usage percentage`),activeConnections:A().optional().describe(`Number of active connections`),errorRate:A().optional().describe(`Error rate (errors per minute)`),responseTime:A().optional().describe(`Average response time in ms`)}).partial().optional(),checks:S(l({name:o().describe(`Check name`),status:x([`passed`,`failed`,`warning`]),message:o().optional(),data:u(o(),b()).optional()})).optional(),dependencies:S(l({pluginId:o(),status:H0,message:o().optional()})).optional()});var phe=l({provider:x([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:S(o()).optional().describe(`Backend connection endpoints`),keyPrefix:o().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:A().int().min(0).optional().describe(`State expiration time in seconds`),auth:l({username:o().optional(),password:o().optional(),token:o().optional(),certificate:o().optional()}).optional(),replication:l({enabled:v().default(!0),minReplicas:A().int().min(1).default(1)}).optional(),customConfig:u(o(),b()).optional().describe(`Provider-specific configuration`)}),mhe=l({enabled:v().default(!1),watchPatterns:S(o()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:A().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:v().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:x([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:phe.optional().describe(`Configuration for distributed state management`),shutdownTimeout:A().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:S(o()).optional().describe(`Hook names to call before reload`),afterReload:S(o()).optional().describe(`Hook names to call after reload`)}),hhe=l({enabled:v().default(!0),fallbackMode:x([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:S(o()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:S(o()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:S(l({feature:o().describe(`Feature name`),enabled:v().describe(`Whether feature is available in degraded mode`),reason:o().optional()})).optional(),autoRecovery:l({enabled:v().default(!0),retryInterval:A().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:A().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),ghe=l({mode:x([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:l({major:v().default(!1).describe(`Allow major version updates`),minor:v().default(!0).describe(`Allow minor version updates`),patch:v().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:l({cron:o().optional(),timezone:o().default(`UTC`),maintenanceWindow:A().int().min(1).default(60)}).optional(),rollback:l({enabled:v().default(!0),automatic:v().default(!0),keepVersions:A().int().min(1).default(3),timeout:A().int().min(1e3).default(3e4)}).optional(),validation:l({checkCompatibility:v().default(!0),runTests:v().default(!1),testSuite:o().optional()}).optional()});l({pluginId:o(),version:o(),timestamp:o().datetime(),state:u(o(),b()),metadata:l({checksum:o().optional().describe(`State checksum for verification`),compressed:v().default(!1),encryption:o().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),l({health:fhe.optional(),hotReload:mhe.optional(),degradation:hhe.optional(),updates:ghe.optional(),resources:l({maxMemory:A().int().optional().describe(`Maximum memory in bytes`),maxCpu:A().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:A().int().optional().describe(`Maximum concurrent connections`),timeout:A().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:l({enableMetrics:v().default(!0),enableTracing:v().default(!0),enableProfiling:v().default(!1),metricsInterval:A().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()});var U0=x([`init`,`start`,`destroy`]).describe(`Plugin lifecycle phase`),W0=l({pluginName:o().describe(`Name of the plugin`),timestamp:A().int().describe(`Unix timestamp in milliseconds when event occurred`)});W0.extend({version:o().optional().describe(`Plugin version`)}),W0.extend({duration:A().min(0).optional().describe(`Duration of the lifecycle phase in milliseconds`),phase:U0.optional().describe(`Lifecycle phase`)}),W0.extend({error:l({name:o().describe(`Error class name`),message:o().describe(`Error message`),stack:o().optional().describe(`Stack trace`),code:o().optional().describe(`Error code`)}).describe(`Serializable error representation`),phase:U0.describe(`Lifecycle phase where error occurred`),errorMessage:o().optional().describe(`Error message`),errorStack:o().optional().describe(`Error stack trace`)}),l({serviceName:o().describe(`Name of the registered service`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),serviceType:o().optional().describe(`Type or interface name of the service`)}),l({serviceName:o().describe(`Name of the unregistered service`),timestamp:A().int().describe(`Unix timestamp in milliseconds`)}),l({hookName:o().describe(`Name of the hook`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),handlerCount:A().int().min(0).describe(`Number of handlers registered for this hook`)}),l({hookName:o().describe(`Name of the hook`),timestamp:A().int().describe(`Unix timestamp in milliseconds`),args:S(b()).describe(`Arguments passed to the hook handlers`),handlerCount:A().int().min(0).optional().describe(`Number of handlers that will handle this event`)});var G0=l({timestamp:A().int().describe(`Unix timestamp in milliseconds`)});G0.extend({duration:A().min(0).optional().describe(`Total initialization duration in milliseconds`),pluginCount:A().int().min(0).optional().describe(`Number of plugins initialized`)}),G0.extend({reason:o().optional().describe(`Reason for kernel shutdown`)}),x([`kernel:ready`,`kernel:shutdown`,`kernel:before-init`,`kernel:after-init`,`plugin:registered`,`plugin:before-init`,`plugin:init`,`plugin:after-init`,`plugin:before-start`,`plugin:started`,`plugin:after-start`,`plugin:before-destroy`,`plugin:destroyed`,`plugin:after-destroy`,`plugin:error`,`service:registered`,`service:unregistered`,`hook:registered`,`hook:triggered`]).describe(`Plugin lifecycle event type`);var _he=x([`load`,`unload`,`reload`,`enable`,`disable`]).describe(`Runtime plugin operation type`),vhe=l({type:x([`npm`,`local`,`url`,`registry`,`git`]).describe(`Plugin source type`),location:o().describe(`Package name, file path, URL, or git repository`),version:o().optional().describe(`Semver version range (e.g., "^1.0.0")`),integrity:o().optional().describe(`Subresource Integrity hash (e.g., "sha384-...")`)}).describe(`Plugin source location for dynamic resolution`),yhe=l({type:x([`onCommand`,`onRoute`,`onObject`,`onEvent`,`onService`,`onSchedule`,`onStartup`]).describe(`Trigger type for lazy activation`),pattern:o().describe(`Match pattern for the activation trigger`)}).describe(`Lazy activation trigger for a dynamic plugin`);l({pluginId:o().describe(`Unique plugin identifier`),source:vhe,activationEvents:S(yhe).optional().describe(`Lazy activation triggers; if omitted plugin starts immediately`),config:u(o(),b()).optional().describe(`Runtime configuration overrides`),priority:A().int().min(0).default(100).describe(`Loading priority (lower is higher)`),sandbox:v().default(!1).describe(`Run in an isolated sandbox`),timeout:A().int().min(1e3).default(6e4).describe(`Maximum time to complete loading in ms`)}).describe(`Request to dynamically load a plugin at runtime`),l({pluginId:o().describe(`Plugin to unload`),strategy:x([`graceful`,`forceful`,`drain`]).default(`graceful`).describe(`How to handle in-flight work during unload`),timeout:A().int().min(1e3).default(3e4).describe(`Maximum time to complete unloading in ms`),cleanupCache:v().default(!1).describe(`Remove cached code and assets after unload`),dependentAction:x([`cascade`,`warn`,`block`]).default(`block`).describe(`How to handle plugins that depend on this one`)}).describe(`Request to dynamically unload a plugin at runtime`),l({success:v(),operation:_he,pluginId:o(),durationMs:A().int().min(0).optional(),version:o().optional(),error:l({code:o().describe(`Machine-readable error code`),message:o().describe(`Human-readable error message`),details:u(o(),b()).optional()}).optional(),warnings:S(o()).optional()}).describe(`Result of a dynamic plugin operation`);var bhe=l({type:x([`registry`,`npm`,`directory`,`url`]).describe(`Discovery source type`),endpoint:o().describe(`Registry URL, directory path, or manifest URL`),pollInterval:A().int().min(0).default(0).describe(`How often to re-scan for new plugins (0 = manual)`),filter:l({tags:S(o()).optional(),vendors:S(o()).optional(),minTrustLevel:x([`verified`,`trusted`,`community`,`untrusted`]).optional()}).optional()}).describe(`Source for runtime plugin discovery`),xhe=l({enabled:v().default(!1),sources:S(bhe).default([]),autoLoad:v().default(!1).describe(`Automatically load newly discovered plugins`),requireApproval:v().default(!0).describe(`Require admin approval before loading discovered plugins`)}).describe(`Runtime plugin discovery configuration`);l({enabled:v().default(!1).describe(`Enable runtime load/unload of plugins`),maxDynamicPlugins:A().int().min(1).default(50).describe(`Upper limit on runtime-loaded plugins`),discovery:xhe.optional(),defaultSandbox:v().default(!0).describe(`Sandbox dynamically loaded plugins by default`),allowedSources:S(x([`npm`,`local`,`url`,`registry`,`git`])).optional().describe(`Restrict which source types are permitted`),requireIntegrity:v().default(!0).describe(`Require integrity hash verification for remote sources`),operationTimeout:A().int().min(1e3).default(6e4).describe(`Default timeout for load/unload operations in ms`)}).describe(`Dynamic plugin loading subsystem configuration`);var She=x([`global`,`tenant`,`user`,`resource`,`plugin`]).describe(`Scope of permission application`),Che=x([`create`,`read`,`update`,`delete`,`execute`,`manage`,`configure`,`share`,`export`,`import`,`admin`]).describe(`Type of action being permitted`),whe=x([`data.object`,`data.record`,`data.field`,`ui.view`,`ui.dashboard`,`ui.report`,`system.config`,`system.plugin`,`system.api`,`system.service`,`storage.file`,`storage.database`,`network.http`,`network.websocket`,`process.spawn`,`process.env`]).describe(`Type of resource being accessed`),The=l({permissions:S(l({id:o().describe(`Unique permission identifier`),resource:whe,actions:S(Che),scope:She.default(`plugin`),filter:l({resourceIds:S(o()).optional(),condition:o().optional().describe(`Filter expression (e.g., owner = currentUser)`),fields:S(o()).optional().describe(`Allowed fields for data resources`)}).optional(),description:o(),required:v().default(!0),justification:o().optional().describe(`Why this permission is needed`)})),groups:S(l({name:o().describe(`Group name`),description:o(),permissions:S(o()).describe(`Permission IDs in this group`)})).optional(),defaultGrant:x([`prompt`,`allow`,`deny`,`inherit`]).default(`prompt`)}),Ehe=l({engine:x([`v8-isolate`,`wasm`,`container`,`process`]).default(`v8-isolate`).describe(`Execution environment engine`),engineConfig:l({wasm:l({maxMemoryPages:A().int().min(1).max(65536).optional().describe(`Maximum WASM memory pages (64KB each)`),instructionLimit:A().int().min(1).optional().describe(`Maximum instructions before timeout`),enableSimd:v().default(!1).describe(`Enable WebAssembly SIMD support`),enableThreads:v().default(!1).describe(`Enable WebAssembly threads`),enableBulkMemory:v().default(!0).describe(`Enable bulk memory operations`)}).optional(),container:l({image:o().optional().describe(`Container image to use`),runtime:x([`docker`,`podman`,`containerd`]).default(`docker`),resources:l({cpuLimit:o().optional().describe(`CPU limit (e.g., "0.5", "2")`),memoryLimit:o().optional().describe(`Memory limit (e.g., "512m", "1g")`)}).optional(),networkMode:x([`none`,`bridge`,`host`]).default(`bridge`)}).optional(),v8Isolate:l({heapSizeMb:A().int().min(1).optional(),enableSnapshot:v().default(!0)}).optional()}).optional(),resourceLimits:l({maxMemory:A().int().optional().describe(`Maximum memory allocation`),maxCpu:A().min(0).max(100).optional().describe(`Maximum CPU usage percentage`),timeout:A().int().min(0).optional().describe(`Maximum execution time`)}).optional()}),Dhe=l({enabled:v().default(!0),level:x([`none`,`minimal`,`standard`,`strict`,`paranoid`]).default(`standard`),runtime:Ehe.optional().describe(`Execution environment and isolation settings`),filesystem:l({mode:x([`none`,`readonly`,`restricted`,`full`]).default(`restricted`),allowedPaths:S(o()).optional().describe(`Whitelisted paths`),deniedPaths:S(o()).optional().describe(`Blacklisted paths`),maxFileSize:A().int().optional().describe(`Maximum file size in bytes`)}).optional(),network:l({mode:x([`none`,`local`,`restricted`,`full`]).default(`restricted`),allowedHosts:S(o()).optional().describe(`Whitelisted hosts`),deniedHosts:S(o()).optional().describe(`Blacklisted hosts`),allowedPorts:S(A()).optional().describe(`Allowed port numbers`),maxConnections:A().int().optional()}).optional(),process:l({allowSpawn:v().default(!1).describe(`Allow spawning child processes`),allowedCommands:S(o()).optional().describe(`Whitelisted commands`),timeout:A().int().optional().describe(`Process timeout in ms`)}).optional(),memory:l({maxHeap:A().int().optional().describe(`Maximum heap size in bytes`),maxStack:A().int().optional().describe(`Maximum stack size in bytes`)}).optional(),cpu:l({maxCpuPercent:A().min(0).max(100).optional(),maxThreads:A().int().optional()}).optional(),environment:l({mode:x([`none`,`readonly`,`restricted`,`full`]).default(`readonly`),allowedVars:S(o()).optional(),deniedVars:S(o()).optional()}).optional()}),K0=l({cve:o().optional(),id:o(),severity:x([`critical`,`high`,`medium`,`low`,`info`]),category:o().optional(),title:o(),location:o().optional(),remediation:o().optional(),description:o(),affectedVersions:S(o()),fixedIn:S(o()).optional(),cvssScore:A().min(0).max(10).optional(),exploitAvailable:v().default(!1),patchAvailable:v().default(!1),workaround:o().optional(),references:S(o()).optional(),discoveredDate:o().datetime().optional(),publishedDate:o().datetime().optional()}),Ohe=l({timestamp:o().datetime(),scanner:l({name:o(),version:o()}),status:x([`passed`,`failed`,`warning`]),vulnerabilities:S(K0).optional(),codeIssues:S(l({severity:x([`error`,`warning`,`info`]),type:o().describe(`Issue type (e.g., sql-injection, xss)`),file:o(),line:A().int().optional(),message:o(),suggestion:o().optional()})).optional(),dependencyVulnerabilities:S(l({package:o(),version:o(),vulnerability:K0})).optional(),licenseCompliance:l({status:x([`compliant`,`non-compliant`,`unknown`]),issues:S(l({package:o(),license:o(),reason:o()})).optional()}).optional(),summary:l({totalVulnerabilities:A().int(),criticalCount:A().int(),highCount:A().int(),mediumCount:A().int(),lowCount:A().int(),infoCount:A().int()})}),khe=l({csp:l({directives:u(o(),S(o())).optional(),reportOnly:v().default(!1)}).optional(),cors:l({allowedOrigins:S(o()),allowedMethods:S(o()),allowedHeaders:S(o()),allowCredentials:v().default(!1),maxAge:A().int().optional()}).optional(),rateLimit:l({enabled:v().default(!0),maxRequests:A().int(),windowMs:A().int().describe(`Time window in milliseconds`),strategy:x([`fixed`,`sliding`,`token-bucket`]).default(`sliding`)}).optional(),authentication:l({required:v().default(!0),methods:S(x([`jwt`,`oauth2`,`api-key`,`session`,`certificate`])),tokenExpiration:A().int().optional().describe(`Token expiration in seconds`)}).optional(),encryption:l({dataAtRest:v().default(!1).describe(`Encrypt data at rest`),dataInTransit:v().default(!0).describe(`Enforce HTTPS/TLS`),algorithm:o().optional().describe(`Encryption algorithm`),minKeyLength:A().int().optional().describe(`Minimum key length in bits`)}).optional(),auditLog:l({enabled:v().default(!0),events:S(o()).optional().describe(`Events to log`),retention:A().int().optional().describe(`Log retention in days`)}).optional()}),Ahe=x([`verified`,`trusted`,`community`,`untrusted`,`blocked`]).describe(`Trust level of the plugin`);l({pluginId:o(),trustLevel:Ahe,permissions:The,sandbox:Dhe,policy:khe.optional(),scanResults:S(Ohe).optional(),vulnerabilities:S(K0).optional(),codeSigning:l({signed:v(),signature:o().optional(),certificate:o().optional(),algorithm:o().optional(),timestamp:o().datetime().optional()}).optional(),certifications:S(l({name:o().describe(`Certification name (e.g., SOC 2, ISO 27001)`),issuer:o(),issuedDate:o().datetime(),expiryDate:o().datetime().optional(),certificateUrl:o().url().optional()})).optional(),securityContact:l({email:o().email().optional(),url:o().url().optional(),pgpKey:o().optional()}).optional(),vulnerabilityDisclosure:l({policyUrl:o().url().optional(),responseTime:A().int().optional().describe(`Expected response time in hours`),bugBounty:v().default(!1)}).optional()});var q0=/^[a-z][a-z0-9_]*$/,jhe=o().describe(`Validates a file path against OPS naming conventions`).superRefine((e,t)=>{if(!e.startsWith(`src/`))return;let n=e.split(`/`);if(n.length>2){let e=n[1];q0.test(e)||t.addIssue({code:le.custom,message:`Domain directory '${e}' must be lowercase snake_case`})}let r=n[n.length-1];r===`index.ts`||r===`main.ts`||q0.test(r.split(`.`)[0])||t.addIssue({code:le.custom,message:`Filename '${r}' base name must be lowercase snake_case`})});l({name:o().regex(q0).describe(`Module name (snake_case)`),files:S(o()).describe(`List of files in this module`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}).describe(`Scanned domain module representing a plugin folder`).superRefine((e,t)=>{e.files.includes(`index.ts`)||t.addIssue({code:le.custom,message:`Module '${e.name}' is missing an 'index.ts' entry point.`})}),l({root:o().describe(`Root directory path of the plugin project`),files:S(o()).describe(`List of all file paths relative to root`),metadata:u(o(),b()).optional().describe(`Custom metadata key-value pairs for extensibility`)}).describe(`Full plugin project layout validated against OPS conventions`).superRefine((e,t)=>{e.files.includes(`objectstack.config.ts`)||t.addIssue({code:le.custom,message:`Missing 'objectstack.config.ts' configuration file.`}),e.files.filter(e=>e.startsWith(`src/`)).forEach(e=>{let n=jhe.safeParse(e);n.success||n.error.issues.forEach(n=>{t.addIssue({...n,path:[e]})})})});var Mhe=l({field:o().describe(`Field name that failed validation`),message:o().describe(`Human-readable error message`),code:o().optional().describe(`Machine-readable error code`)}),Nhe=l({field:o().describe(`Field name with warning`),message:o().describe(`Human-readable warning message`),code:o().optional().describe(`Machine-readable warning code`)});l({valid:v().describe(`Whether the plugin passed validation`),errors:S(Mhe).optional().describe(`Validation errors`),warnings:S(Nhe).optional().describe(`Validation warnings`)}),l({name:o().min(1).describe(`Unique plugin identifier`),version:o().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic version (e.g., 1.0.0)`),dependencies:S(o()).optional().describe(`Array of plugin names this plugin depends on`),signature:o().optional().describe(`Cryptographic signature for plugin verification`)}).passthrough().describe(`Plugin metadata for validation`);var Phe=l({major:A().int().min(0).describe(`Major version (breaking changes)`),minor:A().int().min(0).describe(`Minor version (backward compatible features)`),patch:A().int().min(0).describe(`Patch version (backward compatible fixes)`),preRelease:o().optional().describe(`Pre-release identifier (alpha, beta, rc.1)`),build:o().optional().describe(`Build metadata`)}).describe(`Semantic version number`);c([o().regex(/^[\d.]+$/).describe("Exact version: `1.2.3`"),o().regex(/^\^[\d.]+$/).describe("Compatible with: `^1.2.3` (`>=1.2.3 <2.0.0`)"),o().regex(/^~[\d.]+$/).describe("Approximately: `~1.2.3` (`>=1.2.3 <1.3.0`)"),o().regex(/^>=[\d.]+$/).describe("Greater than or equal: `>=1.2.3`"),o().regex(/^>[\d.]+$/).describe("Greater than: `>1.2.3`"),o().regex(/^<=[\d.]+$/).describe("Less than or equal: `<=1.2.3`"),o().regex(/^<[\d.]+$/).describe("Less than: `<1.2.3`"),o().regex(/^[\d.]+ - [\d.]+$/).describe("Range: `1.2.3 - 2.3.4`"),p(`*`).describe(`Any version`),p(`latest`).describe(`Latest stable version`)]);var Fhe=x([`fully-compatible`,`backward-compatible`,`deprecated-compatible`,`breaking-changes`,`incompatible`]).describe(`Compatibility level between versions`),J0=l({introducedIn:o().describe(`Version that introduced this breaking change`),type:x([`api-removed`,`api-renamed`,`api-signature-changed`,`behavior-changed`,`dependency-changed`,`configuration-changed`,`protocol-changed`]),description:o(),migrationGuide:o().optional().describe(`How to migrate from old to new`),deprecatedIn:o().optional().describe(`Version where old API was deprecated`),removedIn:o().optional().describe(`Version where old API will be removed`),automatedMigration:v().default(!1).describe(`Whether automated migration tool is available`),severity:x([`critical`,`major`,`minor`]).describe(`Impact severity`)}),Ihe=l({feature:o().describe(`Deprecated feature identifier`),deprecatedIn:o(),removeIn:o().optional(),reason:o(),alternative:o().optional().describe(`What to use instead`),migrationPath:o().optional().describe(`How to migrate to alternative`)}),Y0=l({from:o().describe(`Version being upgraded from`),to:o().describe(`Version being upgraded to`),compatibility:Fhe,breakingChanges:S(J0).optional(),migrationRequired:v().default(!1),migrationComplexity:x([`trivial`,`simple`,`moderate`,`complex`,`major`]).optional(),estimatedMigrationTime:A().optional(),migrationScript:o().optional().describe(`Path to migration script`),testCoverage:A().min(0).max(100).optional().describe(`Percentage of migration covered by tests`)});l({pluginId:o(),currentVersion:o(),compatibilityMatrix:S(Y0),supportedVersions:S(l({version:o(),supported:v(),endOfLife:o().datetime().optional().describe(`End of support date`),securitySupport:v().default(!1).describe(`Still receives security updates`)})),minimumCompatibleVersion:o().optional().describe(`Oldest version that can be directly upgraded`)});var Lhe=l({type:x([`version-mismatch`,`missing-dependency`,`circular-dependency`,`incompatible-versions`,`conflicting-interfaces`]),plugins:S(l({pluginId:o(),version:o(),requirement:o().optional().describe(`What this plugin requires`)})),description:o(),resolutions:S(l({strategy:x([`upgrade`,`downgrade`,`replace`,`disable`,`manual`]),description:o(),automaticResolution:v().default(!1),riskLevel:x([`low`,`medium`,`high`])})).optional(),severity:x([`critical`,`error`,`warning`,`info`])});l({success:v(),resolved:S(l({pluginId:o(),version:o(),resolvedVersion:o()})).optional(),conflicts:S(Lhe).optional(),warnings:S(o()).optional(),installationOrder:S(o()).optional().describe(`Plugin IDs in order they should be installed`),dependencyGraph:u(o(),S(o())).optional().describe(`Map of plugin ID to its dependencies`)}),l({enabled:v().default(!1),maxConcurrentVersions:A().int().min(1).default(2).describe(`How many versions can run at the same time`),selectionStrategy:x([`latest`,`stable`,`compatible`,`pinned`,`canary`,`custom`]).default(`latest`),routing:S(l({condition:o().describe(`Routing condition (e.g., tenant, user, feature flag)`),version:o().describe(`Version to use when condition matches`),priority:A().int().default(100).describe(`Rule priority`)})).optional(),rollout:l({enabled:v().default(!1),strategy:x([`percentage`,`blue-green`,`canary`]),percentage:A().min(0).max(100).optional().describe(`Percentage of traffic to new version`),duration:A().int().optional().describe(`Rollout duration in milliseconds`)}).optional()}),l({pluginId:o(),version:Phe,versionString:o().describe(`Full version string (e.g., 1.2.3-beta.1+build.123)`),releaseDate:o().datetime(),releaseNotes:o().optional(),breakingChanges:S(J0).optional(),deprecations:S(Ihe).optional(),compatibilityMatrix:S(Y0).optional(),securityFixes:S(l({cve:o().optional().describe(`CVE identifier`),severity:x([`critical`,`high`,`medium`,`low`]),description:o(),fixedIn:o().describe(`Version where vulnerability was fixed`)})).optional(),statistics:l({downloads:A().int().min(0).optional(),installations:A().int().min(0).optional(),ratings:A().min(0).max(5).optional()}).optional(),support:l({status:x([`active`,`maintenance`,`deprecated`,`eol`]),endOfLife:o().datetime().optional(),securitySupport:v().default(!0)})});var X0=x([`singleton`,`transient`,`scoped`]).describe(`Service scope type`);l({name:o().min(1).describe(`Unique service name identifier`),scope:X0.optional().default(`singleton`).describe(`Service scope type`),type:o().optional().describe(`Service type or interface name`),registeredAt:A().int().optional().describe(`Unix timestamp in milliseconds when service was registered`),metadata:u(o(),b()).optional().describe(`Additional service-specific metadata`)}),l({strictMode:v().optional().default(!0).describe(`Throw errors on invalid operations (duplicate registration, service not found, etc.)`),allowOverwrite:v().optional().default(!1).describe(`Allow overwriting existing service registrations`),enableLogging:v().optional().default(!1).describe(`Enable logging for service registration and retrieval`),scopeTypes:S(o()).optional().describe(`Supported scope types`),maxServices:A().int().min(1).optional().describe(`Maximum number of services that can be registered`)}),l({name:o().min(1).describe(`Unique service name identifier`),scope:X0.optional().default(`singleton`).describe(`Service scope type`),factoryType:x([`sync`,`async`]).optional().default(`sync`).describe(`Whether factory is synchronous or asynchronous`),singleton:v().optional().default(!0).describe(`Whether to cache the factory result (singleton pattern)`)}),l({scopeType:o().describe(`Type of scope`),scopeId:o().optional().describe(`Unique scope identifier`),metadata:u(o(),b()).optional().describe(`Scope-specific context metadata`)}),l({scopeId:o().describe(`Unique scope identifier`),scopeType:o().describe(`Type of scope`),createdAt:A().int().describe(`Unix timestamp in milliseconds when scope was created`),serviceCount:A().int().min(0).optional().describe(`Number of services registered in this scope`),metadata:u(o(),b()).optional().describe(`Scope-specific context metadata`)}),l({timeout:A().int().min(0).optional().default(3e4).describe(`Maximum time in milliseconds to wait for each plugin to start`),rollbackOnFailure:v().optional().default(!0).describe(`Whether to rollback already-started plugins if any plugin fails`),healthCheck:v().optional().default(!1).describe(`Whether to run health checks after plugin startup`),parallel:v().optional().default(!1).describe(`Whether to start plugins in parallel when dependencies allow`),context:b().optional().describe(`Custom context object to pass to plugin lifecycle methods`)});var Rhe=l({healthy:v().describe(`Whether the plugin is healthy`),timestamp:A().int().describe(`Unix timestamp in milliseconds when health check was performed`),details:u(o(),b()).optional().describe(`Optional plugin-specific health details`),message:o().optional().describe(`Error message if plugin is unhealthy`)});l({results:S(l({plugin:l({name:o(),version:o().optional()}).passthrough().describe(`Plugin metadata`),success:v().describe(`Whether the plugin started successfully`),duration:A().min(0).describe(`Time taken to start the plugin in milliseconds`),error:l({name:o().describe(`Error class name`),message:o().describe(`Error message`),stack:o().optional().describe(`Stack trace`),code:o().optional().describe(`Error code`)}).optional().describe(`Serializable error representation if startup failed`),health:Rhe.optional().describe(`Health status after startup if health check was enabled`)})).describe(`Startup results for each plugin`),totalDuration:A().min(0).describe(`Total time taken for all plugins in milliseconds`),allSuccessful:v().describe(`Whether all plugins started successfully`),rolledBack:S(o()).optional().describe(`Names of plugins that were rolled back`)});var zhe=l({id:o().regex(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/).describe(`Vendor identifier (reverse domain)`),name:o(),website:o().url().optional(),email:o().email().optional(),verified:v().default(!1).describe(`Whether vendor is verified by ObjectStack`),trustLevel:x([`official`,`verified`,`community`,`unverified`]).default(`unverified`)}),Bhe=l({testCoverage:A().min(0).max(100).optional(),documentationScore:A().min(0).max(100).optional(),codeQuality:A().min(0).max(100).optional(),securityScan:l({lastScanDate:o().datetime().optional(),vulnerabilities:l({critical:A().int().min(0).default(0),high:A().int().min(0).default(0),medium:A().int().min(0).default(0),low:A().int().min(0).default(0)}).optional(),passed:v().default(!1)}).optional(),conformanceTests:S(l({protocolId:o().describe(`Protocol being tested`),passed:v(),totalTests:A().int().min(0),passedTests:A().int().min(0),lastRunDate:o().datetime().optional()})).optional()}),Vhe=l({downloads:A().int().min(0).default(0),downloadsLastMonth:A().int().min(0).default(0),activeInstallations:A().int().min(0).default(0),ratings:l({average:A().min(0).max(5).default(0),count:A().int().min(0).default(0),distribution:l({5:A().int().min(0).default(0),4:A().int().min(0).default(0),3:A().int().min(0).default(0),2:A().int().min(0).default(0),1:A().int().min(0).default(0)}).optional()}).optional(),stars:A().int().min(0).optional(),dependents:A().int().min(0).default(0)});l({id:o().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Plugin identifier (reverse domain notation)`),version:o().regex(/^\d+\.\d+\.\d+$/),name:o(),description:o().optional(),readme:o().optional(),category:x([`data`,`integration`,`ui`,`analytics`,`security`,`automation`,`ai`,`utility`,`driver`,`gateway`,`adapter`]).optional(),tags:S(o()).optional(),vendor:zhe,capabilities:F0.optional(),compatibility:l({minObjectStackVersion:o().optional(),maxObjectStackVersion:o().optional(),nodeVersion:o().optional(),platforms:S(x([`linux`,`darwin`,`win32`,`browser`])).optional()}).optional(),links:l({homepage:o().url().optional(),repository:o().url().optional(),documentation:o().url().optional(),bugs:o().url().optional(),changelog:o().url().optional()}).optional(),media:l({icon:o().url().optional(),logo:o().url().optional(),screenshots:S(o().url()).optional(),video:o().url().optional()}).optional(),quality:Bhe.optional(),statistics:Vhe.optional(),license:o().optional().describe(`SPDX license identifier`),pricing:l({model:x([`free`,`freemium`,`paid`,`enterprise`]),price:A().min(0).optional(),currency:o().default(`USD`).optional(),billingPeriod:x([`one-time`,`monthly`,`yearly`]).optional()}).optional(),publishedAt:o().datetime().optional(),updatedAt:o().datetime().optional(),deprecated:v().default(!1),deprecationMessage:o().optional(),replacedBy:o().optional().describe(`Plugin ID that replaces this one`),flags:l({experimental:v().default(!1),beta:v().default(!1),featured:v().default(!1),verified:v().default(!1)}).optional()}),l({query:o().optional(),category:S(o()).optional(),tags:S(o()).optional(),trustLevel:S(x([`official`,`verified`,`community`,`unverified`])).optional(),implementsProtocols:S(o()).optional(),pricingModel:S(x([`free`,`freemium`,`paid`,`enterprise`])).optional(),minRating:A().min(0).max(5).optional(),sortBy:x([`relevance`,`downloads`,`rating`,`updated`,`name`]).optional(),sortOrder:x([`asc`,`desc`]).default(`desc`).optional(),page:A().int().min(1).default(1).optional(),limit:A().int().min(1).max(100).default(20).optional()}),l({pluginId:o(),version:o().optional().describe(`Defaults to latest`),config:u(o(),b()).optional(),autoUpdate:v().default(!1).optional(),options:l({skipDependencies:v().default(!1).optional(),force:v().default(!1).optional(),target:x([`system`,`space`,`user`]).default(`space`).optional()}).optional()});var Hhe=x([`critical`,`high`,`medium`,`low`,`info`]).describe(`Severity level of a security vulnerability`),Uhe=l({cve:o().regex(/^CVE-\d{4}-\d+$/).optional().describe(`CVE identifier`),id:o().describe(`Vulnerability ID`),title:o().describe(`Short title summarizing the vulnerability`),description:o().describe(`Detailed description of the vulnerability`),severity:Hhe.describe(`Severity level of this vulnerability`),cvss:A().min(0).max(10).optional().describe(`CVSS score ranging from 0 to 10`),package:l({name:o().describe(`Name of the affected package`),version:o().describe(`Version of the affected package`),ecosystem:o().optional().describe(`Package ecosystem (e.g., npm, pip, maven)`)}).describe(`Affected package information`),vulnerableVersions:o().describe(`Semver range of vulnerable versions`),patchedVersions:o().optional().describe(`Semver range of patched versions`),references:S(l({type:x([`advisory`,`article`,`report`,`web`]).describe(`Type of reference source`),url:o().url().describe(`URL of the reference`)})).default([]).describe(`External references related to the vulnerability`),cwe:S(o()).default([]).describe(`CWE identifiers associated with this vulnerability`),publishedAt:o().datetime().optional().describe(`ISO 8601 date when the vulnerability was published`),mitigation:o().optional().describe(`Recommended steps to mitigate the vulnerability`)}).describe(`A known security vulnerability in a package dependency`);l({scanId:o().uuid().describe(`Unique identifier for this security scan`),plugin:l({id:o().describe(`Plugin identifier`),version:o().describe(`Plugin version that was scanned`)}).describe(`Plugin that was scanned`),scannedAt:o().datetime().describe(`ISO 8601 timestamp when the scan was performed`),scanner:l({name:o().describe(`Scanner name (e.g., snyk, osv, trivy)`),version:o().describe(`Version of the scanner tool`)}).describe(`Information about the scanner tool used`),status:x([`passed`,`failed`,`warning`]).describe(`Overall result status of the security scan`),vulnerabilities:S(Uhe).describe(`List of vulnerabilities discovered during the scan`),summary:l({critical:A().int().min(0).default(0).describe(`Count of critical severity vulnerabilities`),high:A().int().min(0).default(0).describe(`Count of high severity vulnerabilities`),medium:A().int().min(0).default(0).describe(`Count of medium severity vulnerabilities`),low:A().int().min(0).default(0).describe(`Count of low severity vulnerabilities`),info:A().int().min(0).default(0).describe(`Count of informational severity vulnerabilities`),total:A().int().min(0).default(0).describe(`Total count of all vulnerabilities`)}).describe(`Summary counts of vulnerabilities by severity`),licenseIssues:S(l({package:o().describe(`Name of the package with a license issue`),license:o().describe(`License identifier of the package`),reason:o().describe(`Reason the license is flagged`),severity:x([`error`,`warning`,`info`]).describe(`Severity of the license compliance issue`)})).default([]).describe(`License compliance issues found during the scan`),codeQuality:l({score:A().min(0).max(100).optional().describe(`Overall code quality score from 0 to 100`),issues:S(l({type:x([`security`,`quality`,`style`]).describe(`Category of the code quality issue`),severity:x([`error`,`warning`,`info`]).describe(`Severity of the code quality issue`),message:o().describe(`Description of the code quality issue`),file:o().optional().describe(`File path where the issue was found`),line:A().int().optional().describe(`Line number where the issue was found`)})).default([]).describe(`List of individual code quality issues`)}).optional().describe(`Code quality analysis results`),nextScanAt:o().datetime().optional().describe(`ISO 8601 timestamp for the next scheduled scan`)}).describe(`Result of a security scan performed on a plugin`),l({id:o().describe(`Unique identifier for the security policy`),name:o().describe(`Human-readable name of the security policy`),autoScan:l({enabled:v().default(!0).describe(`Whether automatic scanning is enabled`),frequency:x([`on-publish`,`daily`,`weekly`,`monthly`]).default(`daily`).describe(`How often automatic scans are performed`)}).describe(`Automatic security scanning configuration`),thresholds:l({maxCritical:A().int().min(0).default(0).describe(`Maximum allowed critical vulnerabilities before blocking`),maxHigh:A().int().min(0).default(0).describe(`Maximum allowed high vulnerabilities before blocking`),maxMedium:A().int().min(0).default(5).describe(`Maximum allowed medium vulnerabilities before warning`)}).describe(`Vulnerability count thresholds for policy enforcement`),allowedLicenses:S(o()).default([`MIT`,`Apache-2.0`,`BSD-3-Clause`,`BSD-2-Clause`,`ISC`]).describe(`List of SPDX license identifiers that are permitted`),prohibitedLicenses:S(o()).default([`GPL-3.0`,`AGPL-3.0`]).describe(`List of SPDX license identifiers that are prohibited`),codeSigning:l({required:v().default(!1).describe(`Whether code signing is required for plugins`),allowedSigners:S(o()).default([]).describe(`List of trusted signer identities`)}).optional().describe(`Code signing requirements for plugin artifacts`),sandbox:l({networkAccess:x([`none`,`localhost`,`allowlist`,`all`]).default(`all`).describe(`Level of network access granted to the plugin`),allowedDestinations:S(o()).default([]).describe(`Permitted network destinations when using allowlist mode`),filesystemAccess:x([`none`,`read-only`,`temp-only`,`full`]).default(`full`).describe(`Level of file system access granted to the plugin`),maxMemoryMB:A().int().positive().optional().describe(`Maximum memory allocation in megabytes`),maxCPUSeconds:A().int().positive().optional().describe(`Maximum CPU time allowed in seconds`)}).optional().describe(`Sandbox restrictions for plugin execution`)}).describe(`Security policy governing plugin scanning and enforcement`);var Whe=l({name:o().describe(`Package name or identifier`),versionConstraint:o().describe("Semver range (e.g., `^1.0.0`, `>=2.0.0 <3.0.0`)"),type:x([`required`,`optional`,`peer`,`dev`]).default(`required`).describe(`Category of the dependency relationship`),resolvedVersion:o().optional().describe(`Concrete version resolved during dependency resolution`)}).describe(`A package dependency with its version constraint`),Ghe=l({id:o().describe(`Unique identifier of the package`),version:o().describe(`Resolved version of the package`),dependencies:S(Whe).default([]).describe(`Dependencies required by this package`),depth:A().int().min(0).describe(`Depth level in the dependency tree (0 = root)`),isDirect:v().describe(`Whether this is a direct (top-level) dependency`),metadata:l({name:o().describe(`Display name of the package`),description:o().optional().describe(`Short description of the package`),license:o().optional().describe(`SPDX license identifier of the package`),homepage:o().url().optional().describe(`Homepage URL of the package`)}).optional().describe(`Additional metadata about the package`)}).describe(`A node in the dependency graph representing a resolved package`),Khe=l({root:l({id:o().describe(`Identifier of the root package`),version:o().describe(`Version of the root package`)}).describe(`Root package of the dependency graph`),nodes:S(Ghe).describe(`All resolved package nodes in the dependency graph`),edges:S(l({from:o().describe(`Package ID`),to:o().describe(`Package ID`),constraint:o().describe(`Version constraint`)})).describe(`Directed edges representing dependency relationships`),stats:l({totalDependencies:A().int().min(0).describe(`Total number of resolved dependencies`),directDependencies:A().int().min(0).describe(`Number of direct (top-level) dependencies`),maxDepth:A().int().min(0).describe(`Maximum depth of the dependency tree`)}).describe(`Summary statistics for the dependency graph`)}).describe(`Complete dependency graph for a package and its transitive dependencies`),qhe=l({package:o().describe(`Name of the package with conflicting version requirements`),conflicts:S(l({version:o().describe(`Conflicting version of the package`),requestedBy:S(o()).describe(`Packages that require this version`),constraint:o().describe(`Semver constraint that produced this version requirement`)})).describe(`List of conflicting version requirements`),resolution:l({strategy:x([`pick-highest`,`pick-lowest`,`manual`]).describe(`Strategy used to resolve the conflict`),version:o().optional().describe(`Resolved version selected by the strategy`),reason:o().optional().describe(`Explanation of why this resolution was chosen`)}).optional().describe(`Suggested resolution for the conflict`),severity:x([`error`,`warning`,`info`]).describe(`Severity level of the dependency conflict`)}).describe(`A detected conflict between dependency version requirements`);l({status:x([`success`,`conflict`,`error`]).describe(`Overall status of the dependency resolution`),graph:Khe.optional().describe(`Resolved dependency graph if resolution succeeded`),conflicts:S(qhe).default([]).describe(`List of dependency conflicts detected during resolution`),errors:S(l({package:o().describe(`Name of the package that caused the error`),error:o().describe(`Error message describing what went wrong`)})).default([]).describe(`Errors encountered during dependency resolution`),installOrder:S(o()).default([]).describe(`Topologically sorted list of package IDs for installation`),resolvedIn:A().int().min(0).optional().describe(`Time taken to resolve dependencies in milliseconds`)}).describe(`Result of a dependency resolution process`);var Jhe=l({name:o().describe(`Name of the software component`),version:o().describe(`Version of the software component`),purl:o().optional().describe(`Package URL identifier`),license:o().optional().describe(`SPDX license identifier of the component`),hashes:l({sha256:o().optional().describe(`SHA-256 hash of the component artifact`),sha512:o().optional().describe(`SHA-512 hash of the component artifact`)}).optional().describe(`Cryptographic hashes for integrity verification`),supplier:l({name:o().describe(`Name of the component supplier`),url:o().url().optional().describe(`URL of the component supplier`)}).optional().describe(`Supplier information for the component`),externalRefs:S(l({type:x([`website`,`repository`,`documentation`,`issue-tracker`]).describe(`Type of external reference`),url:o().url().describe(`URL of the external reference`)})).default([]).describe(`External references related to the component`)}).describe(`A single entry in a Software Bill of Materials`);l({format:x([`spdx`,`cyclonedx`]).default(`cyclonedx`).describe(`SBOM standard format used`),version:o().describe(`Version of the SBOM specification`),plugin:l({id:o().describe(`Plugin identifier`),version:o().describe(`Plugin version`),name:o().describe(`Human-readable plugin name`)}).describe(`Metadata about the plugin this SBOM describes`),components:S(Jhe).describe(`List of software components included in the plugin`),generatedAt:o().datetime().describe(`ISO 8601 timestamp when the SBOM was generated`),generator:l({name:o().describe(`Name of the SBOM generator tool`),version:o().describe(`Version of the SBOM generator tool`)}).optional().describe(`Tool used to generate this SBOM`)}).describe(`Software Bill of Materials for a plugin`),l({pluginId:o().describe(`Unique identifier of the plugin`),version:o().describe(`Version of the plugin artifact`),build:l({timestamp:o().datetime().describe(`ISO 8601 timestamp when the build was produced`),environment:l({os:o().describe(`Operating system used for the build`),arch:o().describe(`CPU architecture used for the build`),nodeVersion:o().describe(`Node.js version used for the build`)}).optional().describe(`Environment details where the build was executed`),source:l({repository:o().url().describe(`URL of the source repository`),commit:o().regex(/^[a-f0-9]{40}$/).describe(`Full SHA-1 commit hash of the source`),branch:o().optional().describe(`Branch name the build was produced from`),tag:o().optional().describe(`Git tag associated with the build`)}).optional().describe(`Source repository information for the build`),builder:l({name:o().describe(`Name of the person or system that produced the build`),email:o().email().optional().describe(`Email address of the builder`)}).optional().describe(`Identity of the builder who produced the artifact`)}).describe(`Build provenance information`),artifacts:S(l({filename:o().describe(`Name of the artifact file`),sha256:o().describe(`SHA-256 hash of the artifact`),size:A().int().positive().describe(`Size of the artifact in bytes`)})).describe(`List of build artifacts with integrity hashes`),signatures:S(l({algorithm:x([`rsa`,`ecdsa`,`ed25519`]).describe(`Cryptographic algorithm used for signing`),publicKey:o().describe(`Public key used to verify the signature`),signature:o().describe(`Digital signature value`),signedBy:o().describe(`Identity of the signer`),timestamp:o().datetime().describe(`ISO 8601 timestamp when the signature was created`)})).default([]).describe(`Cryptographic signatures for the plugin artifact`),attestations:S(l({type:x([`code-review`,`security-scan`,`test-results`,`ci-build`]).describe(`Type of attestation`),status:x([`passed`,`failed`]).describe(`Result status of the attestation`),url:o().url().optional().describe(`URL with details about the attestation`),timestamp:o().datetime().describe(`ISO 8601 timestamp when the attestation was issued`)})).default([]).describe(`Verification attestations for the plugin`)}).describe(`Verifiable provenance and chain of custody for a plugin artifact`),l({pluginId:o().describe(`Unique identifier of the plugin`),score:A().min(0).max(100).describe(`Overall trust score from 0 to 100`),components:l({vendorReputation:A().min(0).max(100).describe(`Vendor reputation score from 0 to 100`),securityScore:A().min(0).max(100).describe(`Security scan results score from 0 to 100`),codeQuality:A().min(0).max(100).describe(`Code quality score from 0 to 100`),communityScore:A().min(0).max(100).describe(`Community engagement score from 0 to 100`),maintenanceScore:A().min(0).max(100).describe(`Maintenance and update frequency score from 0 to 100`)}).describe(`Individual score components contributing to the overall trust score`),level:x([`verified`,`trusted`,`neutral`,`untrusted`,`blocked`]).describe(`Computed trust level based on the overall score`),badges:S(x([`official`,`verified-vendor`,`security-scanned`,`code-signed`,`open-source`,`popular`])).default([]).describe(`Verification badges earned by the plugin`),updatedAt:o().datetime().describe(`ISO 8601 timestamp when the trust score was last updated`)}).describe(`Trust score and verification status for a plugin`);var Yhe=l({userId:o().optional(),tenantId:o().optional(),roles:S(o()).default([]),permissions:S(o()).default([]),isSystem:v().default(!1),accessToken:o().optional(),transaction:b().optional(),traceId:o().optional()}),Xhe=l({key:o().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:o().optional().describe(`Fallback value when translation key is not found`),params:u(o(),c([o(),A(),v()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}),q=c([o(),Xhe]).describe(`Display label: plain string or i18n translation object`),Z0=l({ariaLabel:q.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:o().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:o().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);l({key:o().describe(`Translation key`),zero:o().optional().describe(`Zero form (e.g., "No items")`),one:o().optional().describe(`Singular form (e.g., "{count} item")`),two:o().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:o().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:o().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:o().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var Zhe=l({style:x([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:o().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:o().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:A().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:A().optional().describe(`Maximum number of fraction digits`),useGrouping:v().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),Qhe=l({dateStyle:x([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:x([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:o().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:v().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);l({code:o().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:S(o()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:x([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:Zhe.optional().describe(`Default number formatting rules`),dateFormat:Qhe.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var Q0=x(`bar.horizontal-bar.column.grouped-bar.stacked-bar.bi-polar-bar.line.area.stacked-area.step-line.spline.pie.donut.funnel.pyramid.scatter.bubble.treemap.sunburst.sankey.word-cloud.gauge.solid-gauge.metric.kpi.bullet.choropleth.bubble-map.gl-map.heatmap.radar.waterfall.box-plot.violin.candlestick.stock.table.pivot`.split(`.`)),$0=l({field:o().describe(`Data field key`),title:q.optional().describe(`Axis display title`),format:o().optional().describe(`Value format string (e.g., "$0,0.00")`),min:A().optional().describe(`Minimum value`),max:A().optional().describe(`Maximum value`),stepSize:A().optional().describe(`Step size for ticks`),showGridLines:v().default(!0),position:x([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:v().default(!1)}),$he=l({name:o().describe(`Field name or series identifier`),label:q.optional().describe(`Series display label`),type:Q0.optional().describe(`Override chart type for this series`),color:o().optional().describe(`Series color (hex/rgb/token)`),stack:o().optional().describe(`Stack identifier to group series`),yAxis:x([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`)}),ege=l({type:x([`line`,`region`]).default(`line`),axis:x([`x`,`y`]).default(`y`),value:c([A(),o()]).describe(`Start value`),endValue:c([A(),o()]).optional().describe(`End value for regions`),color:o().optional(),label:q.optional(),style:x([`solid`,`dashed`,`dotted`]).default(`dashed`)}),tge=l({tooltips:v().default(!0),zoom:v().default(!1),brush:v().default(!1),clickAction:o().optional().describe(`Action ID to trigger on click`)}),e2=l({type:Q0,title:q.optional().describe(`Chart title`),subtitle:q.optional().describe(`Chart subtitle`),description:q.optional().describe(`Accessibility description`),xAxis:$0.optional().describe(`X-Axis configuration`),yAxis:S($0).optional().describe(`Y-Axis configuration (support dual axis)`),series:S($he).optional().describe(`Defined series configuration`),colors:S(o()).optional().describe(`Color palette`),height:A().optional().describe(`Fixed height in pixels`),showLegend:v().default(!0).describe(`Display legend`),showDataLabels:v().default(!1).describe(`Display data labels`),annotations:S(ege).optional(),interaction:tge.optional(),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),t2=x([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),nge=l({xs:A().min(1).max(12).optional(),sm:A().min(1).max(12).optional(),md:A().min(1).max(12).optional(),lg:A().min(1).max(12).optional(),xl:A().min(1).max(12).optional(),"2xl":A().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),rge=l({xs:A().optional(),sm:A().optional(),md:A().optional(),lg:A().optional(),xl:A().optional(),"2xl":A().optional()}).describe(`Display order per breakpoint`),n2=l({breakpoint:t2.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:S(t2).optional().describe(`Hide on these breakpoints`),columns:nge.optional().describe(`Grid columns per breakpoint`),order:rge.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),r2=l({lazyLoad:v().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:l({enabled:v().default(!1).describe(`Enable virtual scrolling`),itemHeight:A().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:A().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:x([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:v().optional().describe(`Prefetch data before component is visible`),pageSize:A().optional().describe(`Number of items per page for pagination`),debounceMs:A().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),ige=o().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`),i2=o().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`);o().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`);var a2=l({enabled:v().default(!1).describe(`Enable public sharing`),publicLink:o().optional().describe(`Generated public share URL`),password:o().optional().describe(`Password required to access shared link`),allowedDomains:S(o()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:o().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:v().optional().default(!1).describe(`Allow access without authentication`)}),age=l({enabled:v().default(!1).describe(`Enable iframe embedding`),allowedOrigins:S(o()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:o().optional().default(`100%`).describe(`Embed width (CSS value)`),height:o().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:v().optional().default(!0).describe(`Show interface header in embed`),showNavigation:v().optional().default(!1).describe(`Show navigation in embed`),responsive:v().optional().default(!0).describe(`Enable responsive resizing`)}),o2=l({id:i2.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:q.describe(`Display proper label`),icon:o().optional().describe(`Icon name`),order:A().optional().describe(`Sort order within the same level (lower = first)`),badge:c([o(),A()]).optional().describe(`Badge text or count displayed on the item`),visible:o().optional().describe(`Visibility formula condition`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this item`)}),oge=o2.extend({type:p(`object`),objectName:o().describe(`Target object name`),viewName:o().optional().describe(`Default list view to open. Defaults to "all"`)}),sge=o2.extend({type:p(`dashboard`),dashboardName:o().describe(`Target dashboard name`)}),cge=o2.extend({type:p(`page`),pageName:o().describe(`Target custom page component name`),params:u(o(),b()).optional().describe(`Parameters passed to the page context`)}),lge=o2.extend({type:p(`url`),url:o().describe(`Target external URL`),target:x([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),uge=o2.extend({type:p(`report`),reportName:o().describe(`Target report name`)}),dge=o2.extend({type:p(`action`),actionDef:l({actionName:o().describe(`Action machine name to execute`),params:u(o(),b()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),fge=o2.extend({type:p(`group`),expanded:v().default(!1).describe(`Default expansion state in sidebar`)}),s2=j(()=>c([oge.extend({children:S(s2).optional().describe(`Child navigation items (e.g. specific views)`)}),sge,cge,lge,uge,dge,fge.extend({children:S(s2).describe(`Child navigation items`)})])),pge=l({primaryColor:o().optional().describe(`Primary theme color hex code`),logo:o().optional().describe(`Custom logo URL for this app`),favicon:o().optional().describe(`Custom favicon URL for this app`)}),mge=l({id:i2.describe(`Unique area identifier (lowercase snake_case)`),label:q.describe(`Area display label`),icon:o().optional().describe(`Area icon name`),order:A().optional().describe(`Sort order among areas (lower = first)`),description:q.optional().describe(`Area description`),visible:o().optional().describe(`Visibility formula condition for this area`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this area`),navigation:S(s2).describe(`Navigation items within this area`)}),hge=l({name:i2.describe(`App unique machine name (lowercase snake_case)`),label:q.describe(`App display label`),version:o().optional().describe(`App version`),description:q.optional().describe(`App description`),icon:o().optional().describe(`App icon used in the App Launcher`),branding:pge.optional().describe(`App-specific branding`),active:v().optional().default(!0).describe(`Whether the app is enabled`),isDefault:v().optional().default(!1).describe(`Is default app`),navigation:S(s2).optional().describe(`Full navigation tree for the app sidebar`),areas:S(mge).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:o().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:S(o()).optional().describe(`Permissions required to access this app`),objects:S(b()).optional().describe(`Objects belonging to this app`),apis:S(b()).optional().describe(`Custom APIs belonging to this app`),sharing:a2.optional().describe(`Public sharing configuration`),embed:age.optional().describe(`Iframe embedding configuration`),mobileNavigation:l({mode:x([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:S(o()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes for the application`)}),gge=x([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),_ge=x([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),c2=l({url:o().describe(`API endpoint URL`),method:_ge.optional().default(`GET`).describe(`HTTP method`),headers:u(o(),o()).optional().describe(`Custom HTTP headers`),params:u(o(),b()).optional().describe(`Query parameters`),body:b().optional().describe(`Request body for POST/PUT/PATCH`)});l({enabled:v().default(!0).describe(`Enable CORS`),origins:c([o(),S(o())]).default(`*`).describe(`Allowed origins (* for all)`),methods:S(gge).optional().describe(`Allowed HTTP methods`),credentials:v().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:A().int().optional().describe(`Preflight cache duration in seconds`)}),l({enabled:v().default(!1).describe(`Enable rate limiting`),windowMs:A().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:A().int().default(100).describe(`Max requests per window`)}),l({path:o().describe(`URL path to serve from`),directory:o().describe(`Physical directory to serve`),cacheControl:o().optional().describe(`Cache-Control header value`)});var l2=d(`provider`,[l({provider:p(`object`),object:o().describe(`Target object name`)}),l({provider:p(`api`),read:c2.optional().describe(`Configuration for fetching data`),write:c2.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),l({provider:p(`value`),items:S(b()).describe(`Static data array`)})]),u2=l({field:o().describe(`Field name to filter on`),operator:o().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:c([o(),A(),v(),h(),S(c([o(),A()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),vge=x([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),yge=l({field:o().describe(`Field name (snake_case)`),label:q.optional().describe(`Display label override`),width:A().positive().optional().describe(`Column width in pixels`),align:x([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:v().optional().describe(`Hide column by default`),sortable:v().optional().describe(`Allow sorting by this column`),resizable:v().optional().describe(`Allow resizing this column`),wrap:v().optional().describe(`Allow text wrapping`),type:o().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:x([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:vge.optional().describe(`Footer aggregation function for this column`),link:v().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:o().optional().describe(`Registered Action ID to execute when clicked`)}),bge=l({type:x([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),xge=l({pageSize:A().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:S(A().int().positive()).optional().describe(`Available page size options`)}),Sge=x([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),Cge=l({fields:S(l({field:o().describe(`Field name to group by`),order:x([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:v().default(!1).describe(`Collapse groups by default`)})).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),wge=l({coverField:o().optional().describe(`Attachment/image field to display as card cover`),coverFit:x([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:x([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:o().optional().describe(`Field to display as card title`),visibleFields:S(o()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),Tge=l({startDateField:o().describe(`Field for timeline item start date`),endDateField:o().optional().describe(`Field for timeline item end date`),titleField:o().describe(`Field to display as timeline item title`),groupByField:o().optional().describe(`Field to group timeline rows`),colorField:o().optional().describe(`Field to determine item color`),scale:x([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),Ege=l({type:x([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:o().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),Dge=l({field:o().describe(`Field to derive color from (typically a select/status field)`),colors:u(o(),o()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),Oge=x([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),d2=l({sort:v().default(!0).describe(`Allow users to sort records`),search:v().default(!0).describe(`Allow users to search records`),filter:v().default(!0).describe(`Allow users to filter records`),rowHeight:v().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:v().default(!1).describe(`Add records through a form instead of inline`),buttons:S(o()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),f2=l({showDescription:v().default(!0).describe(`Show the view description text`),allowedVisualizations:S(Oge).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),p2=l({name:i2.describe(`Tab identifier (snake_case)`),label:q.optional().describe(`Display label`),icon:o().optional().describe(`Tab icon name`),view:o().optional().describe(`Referenced list view name from listViews`),filter:S(u2).optional().describe(`Tab-specific filter criteria`),order:A().int().min(0).optional().describe(`Tab display order`),pinned:v().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:v().default(!1).describe(`Set as the default active tab`),visible:v().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),m2=l({enabled:v().default(!0).describe(`Show the add record entry point`),position:x([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:x([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:o().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),kge=l({groupByField:o().describe(`Field to group columns by (usually status/select)`),summarizeField:o().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:S(o()).describe(`Fields to show on cards`)}),Age=l({startDateField:o(),endDateField:o().optional(),titleField:o(),colorField:o().optional()}),jge=l({startDateField:o(),endDateField:o(),titleField:o(),progressField:o().optional(),dependenciesField:o().optional()}),Mge=l({mode:x([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]).default(`page`),view:o().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:v().default(!1).describe(`Disable standard navigation entirely`),openNewTab:v().default(!1).describe(`Force open in new tab (applies to page mode)`),width:c([o(),A()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),h2=l({name:i2.optional().describe(`Internal view name (lowercase snake_case)`),label:q.optional(),type:x([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:l2.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:c([S(o()),S(yge)]).describe(`Fields to display as columns`),filter:S(u2).optional().describe(`Filter criteria (JSON Rules)`),sort:c([o(),S(l({field:o(),order:x([`asc`,`desc`])}))]).optional(),searchableFields:S(o()).optional().describe(`Fields enabled for search`),filterableFields:S(o()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:S(l({field:o().describe(`Field name to filter by`),label:o().optional().describe(`Display label for the chip`),operator:x([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:c([o(),A(),v(),h(),S(c([o(),A()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:v().optional().describe(`Enable column resizing`),striped:v().optional().describe(`Striped row styling`),bordered:v().optional().describe(`Show borders`),selection:bge.optional().describe(`Row selection configuration`),navigation:Mge.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:xge.optional().describe(`Pagination configuration`),kanban:kge.optional(),calendar:Age.optional(),gantt:jge.optional(),gallery:wge.optional(),timeline:Tge.optional(),description:q.optional().describe(`View description for documentation/tooltips`),sharing:Ege.optional().describe(`View sharing and access configuration`),rowHeight:Sge.optional().describe(`Row height / density setting`),grouping:Cge.optional().describe(`Group records by one or more fields`),rowColor:Dge.optional().describe(`Color rows based on field value`),hiddenFields:S(o()).optional().describe(`Fields to hide in this specific view`),fieldOrder:S(o()).optional().describe(`Explicit field display order for this view`),rowActions:S(o()).optional().describe(`Actions available for individual row items`),bulkActions:S(o()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:v().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:S(l({condition:o().describe(`Condition expression to evaluate`),style:u(o(),o()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:v().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:S(x([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:d2.optional().describe(`User action toggles for the view toolbar`),appearance:f2.optional().describe(`Appearance and visualization configuration`),tabs:S(p2).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:m2.optional().describe(`Add record entry point configuration`),showRecordCount:v().optional().describe(`Show record count at the bottom of the list`),allowPrinting:v().optional().describe(`Allow users to print the view`),emptyState:l({title:q.optional(),message:q.optional(),icon:o().optional()}).optional().describe(`Empty state configuration when no records found`),aria:Z0.optional().describe(`ARIA accessibility attributes for the list view`),responsive:n2.optional().describe(`Responsive layout configuration`),performance:r2.optional().describe(`Performance optimization settings`)}),Nge=l({field:o().describe(`Field name (snake_case)`),label:q.optional().describe(`Display label override`),placeholder:q.optional().describe(`Placeholder text`),helpText:q.optional().describe(`Help/hint text`),readonly:v().optional().describe(`Read-only override`),required:v().optional().describe(`Required override`),hidden:v().optional().describe(`Hidden override`),colSpan:A().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:o().optional().describe(`Custom widget/component name`),dependsOn:o().optional().describe(`Parent field name for cascading`),visibleOn:o().optional().describe(`Visibility condition expression`)}),g2=l({label:q.optional(),collapsible:v().default(!1),collapsed:v().default(!1),columns:x([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:S(c([o(),Nge]))}),_2=l({type:x([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:l2.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:S(g2).optional(),groups:S(g2).optional(),defaultSort:S(l({field:o().describe(`Field name to sort by`),order:x([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:a2.optional().describe(`Public sharing configuration for this form`),aria:Z0.optional().describe(`ARIA accessibility attributes for the form view`)});l({list:h2.optional(),form:_2.optional(),listViews:u(o(),h2).optional().describe(`Additional named list views`),formViews:u(o(),_2).optional().describe(`Additional named form views`)});var v2=l({$field:o().describe(`Field Reference/Column Name`)});l({$eq:T().optional(),$ne:T().optional()}),l({$gt:c([A(),_(),v2]).optional(),$gte:c([A(),_(),v2]).optional(),$lt:c([A(),_(),v2]).optional(),$lte:c([A(),_(),v2]).optional()}),l({$in:S(T()).optional(),$nin:S(T()).optional()}),l({$between:a([c([A(),_(),v2]),c([A(),_(),v2])]).optional()}),l({$contains:o().optional(),$notContains:o().optional(),$startsWith:o().optional(),$endsWith:o().optional()}),l({$null:v().optional(),$exists:v().optional()});var y2=l({$eq:T().optional(),$ne:T().optional(),$gt:c([A(),_(),v2]).optional(),$gte:c([A(),_(),v2]).optional(),$lt:c([A(),_(),v2]).optional(),$lte:c([A(),_(),v2]).optional(),$in:S(T()).optional(),$nin:S(T()).optional(),$between:a([c([A(),_(),v2]),c([A(),_(),v2])]).optional(),$contains:o().optional(),$notContains:o().optional(),$startsWith:o().optional(),$endsWith:o().optional(),$null:v().optional(),$exists:v().optional()}),b2=j(()=>u(o(),b()).and(l({$and:S(b2).optional(),$or:S(b2).optional(),$not:b2.optional()})));l({where:b2.optional()});var x2=j(()=>l({$and:S(c([u(o(),y2),x2])).optional(),$or:S(c([u(o(),y2),x2])).optional(),$not:c([u(o(),y2),x2]).optional()})),Pge=x([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`),S2=x([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`),Fge=l({label:q.describe(`Action button label`),actionUrl:o().describe(`URL or target for the action`),actionType:S2.optional().describe(`Type of action`),icon:o().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`),Ige=l({showTitle:v().default(!0).describe(`Show dashboard title in header`),showDescription:v().default(!0).describe(`Show dashboard description in header`),actions:S(Fge).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`),Lge=l({valueField:o().describe(`Field to aggregate`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:q.optional().describe(`Measure display label`),format:o().optional().describe(`Number format string`)}).describe(`Widget measure definition`),Rge=l({id:i2.describe(`Unique widget identifier (snake_case)`),title:q.optional().describe(`Widget title`),description:q.optional().describe(`Widget description text below the header`),type:Q0.default(`metric`).describe(`Visualization type`),chartConfig:e2.optional().describe(`Chart visualization configuration`),colorVariant:Pge.optional().describe(`Widget color variant for theming`),actionUrl:o().optional().describe(`URL or target for the widget action button`),actionType:S2.optional().describe(`Type of action for the widget action button`),actionIcon:o().optional().describe(`Icon identifier for the widget action button`),object:o().optional().describe(`Data source object name`),filter:b2.optional().describe(`Data filter criteria`),categoryField:o().optional().describe(`Field for grouping (X-Axis)`),valueField:o().optional().describe(`Field for values (Y-Axis)`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:S(Lge).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:l({x:A(),y:A(),w:A(),h:A()}).describe(`Grid layout position`),options:b().optional().describe(`Widget specific configuration`),responsive:n2.optional().describe(`Responsive layout configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),zge=l({object:o().describe(`Source object name`),valueField:o().describe(`Field to use as option value`),labelField:o().describe(`Field to use as option label`),filter:b2.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`),Bge=l({field:o().describe(`Field name to filter on`),label:q.optional().describe(`Display label for the filter`),type:x([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:S(l({value:c([o(),A(),v()]).describe(`Option value`),label:q})).optional().describe(`Static filter options`),optionsFrom:zge.optional().describe(`Dynamic filter options from object`),defaultValue:c([o(),A(),v()]).optional().describe(`Default filter value`),scope:x([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:S(o()).optional().describe(`Widget IDs to apply this filter to`)});l({name:i2.describe(`Dashboard unique name`),label:q.describe(`Dashboard label`),description:q.optional().describe(`Dashboard description`),header:Ige.optional().describe(`Dashboard header configuration`),widgets:S(Rge).describe(`Widgets to display`),refreshInterval:A().optional().describe(`Auto-refresh interval in seconds`),dateRange:l({field:o().optional().describe(`Default date field name for time-based filtering`),defaultRange:x([`today`,`yesterday`,`this_week`,`last_week`,`this_month`,`last_month`,`this_quarter`,`last_quarter`,`this_year`,`last_year`,`last_7_days`,`last_30_days`,`last_90_days`,`custom`]).default(`this_month`).describe(`Default date range preset`),allowCustomRange:v().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:S(Bge).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:Z0.optional().describe(`ARIA accessibility attributes`),performance:r2.optional().describe(`Performance optimization settings`)});var Vge=x([`tabular`,`summary`,`matrix`,`joined`]),Hge=l({field:o().describe(`Field name`),label:q.optional().describe(`Override label`),aggregate:x([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:n2.optional().describe(`Responsive visibility for this column`)}),C2=l({field:o().describe(`Field to group by`),sortOrder:x([`asc`,`desc`]).default(`asc`),dateGranularity:x([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)}),Uge=e2.extend({xAxis:o().describe(`Grouping field for X-Axis`),yAxis:o().describe(`Summary field for Y-Axis`),groupBy:o().optional().describe(`Additional grouping field`)});l({name:i2.describe(`Report unique name`),label:q.describe(`Report label`),description:q.optional(),objectName:o().describe(`Primary object`),type:Vge.default(`tabular`).describe(`Report format type`),columns:S(Hge).describe(`Columns to display`),groupingsDown:S(C2).optional().describe(`Row groupings`),groupingsAcross:S(C2).optional().describe(`Column groupings (Matrix only)`),filter:b2.optional().describe(`Filter criteria`),chart:Uge.optional().describe(`Embedded chart configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes`),performance:r2.optional().describe(`Performance optimization settings`)});var Wge=x([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),Gge=x([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),Kge=l({enabled:v().default(!1).describe(`Enable automatic key rotation`),frequencyDays:A().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:A().default(3).describe(`Number of old key versions to retain`),autoRotate:v().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),w2=l({enabled:v().default(!1).describe(`Enable field-level encryption`),algorithm:Wge.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:l({provider:Gge.describe(`Key management service provider`),keyId:o().optional().describe(`Key identifier in the provider`),rotationPolicy:Kge.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:x([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:v().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:v().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);l({fieldName:o().describe(`Name of the field to encrypt`),encryptionConfig:w2.describe(`Encryption settings for this field`),indexable:v().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var qge=x([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),T2=l({field:o().describe(`Field name to apply masking to`),strategy:qge.describe(`Masking strategy to use`),pattern:o().optional().describe(`Regex pattern for partial masking`),preserveFormat:v().default(!0).describe(`Keep the original data format after masking`),preserveLength:v().default(!0).describe(`Keep the original data length after masking`),roles:S(o()).optional().describe(`Roles that see masked data`),exemptRoles:S(o()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);l({enabled:v().default(!1).describe(`Enable data masking`),rules:S(T2).describe(`List of field-level masking rules`),auditUnmasking:v().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var E2=x(`text.textarea.email.url.phone.password.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),Jge=l({label:o().describe(`Display label (human-readable, any case allowed)`),value:ige.describe(`Stored value (lowercase machine identifier)`),color:o().optional().describe(`Color code for badges/charts`),default:v().optional().describe(`Is default option`)});l({latitude:A().min(-90).max(90).describe(`Latitude coordinate`),longitude:A().min(-180).max(180).describe(`Longitude coordinate`),altitude:A().optional().describe(`Altitude in meters`),accuracy:A().optional().describe(`Accuracy in meters`)});var Yge=l({precision:A().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:x([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:o().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});l({value:A().describe(`Monetary amount`),currency:o().length(3).describe(`Currency code (ISO 4217)`)}),l({street:o().optional().describe(`Street address`),city:o().optional().describe(`City name`),state:o().optional().describe(`State/Province`),postalCode:o().optional().describe(`Postal/ZIP code`),country:o().optional().describe(`Country name or code`),countryCode:o().optional().describe(`ISO country code (e.g., US, GB)`),formatted:o().optional().describe(`Formatted address string`)});var Xge=l({dimensions:A().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:x([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:v().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:v().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:x([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),Zge=l({minSize:A().min(0).optional().describe(`Minimum file size in bytes`),maxSize:A().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:S(o()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:S(o()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:S(o()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:S(o()).optional().describe(`Blocked MIME types`),virusScan:v().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:x([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:v().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:v().default(!0).describe(`Quarantine files if threat detected`),storageProvider:o().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:o().optional().describe(`Target bucket name`),storagePrefix:o().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:l({minWidth:A().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:A().min(1).optional().describe(`Maximum image width in pixels`),minHeight:A().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:A().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:o().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:v().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:S(l({name:o().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:A().min(1).describe(`Thumbnail width in pixels`),height:A().min(1).describe(`Thumbnail height in pixels`),crop:v().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:v().default(!1).describe(`Preserve EXIF metadata`),autoRotate:v().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:v().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:v().default(!0).describe(`Allow replacing existing files`),allowDelete:v().default(!0).describe(`Allow deleting uploaded files`),requireUpload:v().default(!1).describe(`Require at least one file when field is required`),extractMetadata:v().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:v().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:v().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:A().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:v().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:A().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`}),Qge=l({uniqueness:v().default(!1).describe(`Enforce unique values across all records`),completeness:A().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:l({source:o().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:A().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),$ge=l({enabled:v().describe(`Enable caching for computed field results`),ttl:A().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:S(o()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),e_e=l({name:o().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:o().optional().describe(`Human readable label`),type:E2.describe(`Field Data Type`),description:o().optional().describe(`Tooltip/Help text`),format:o().optional().describe(`Format string (e.g. email, phone)`),columnName:o().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:v().default(!1).describe(`Is required`),searchable:v().default(!1).describe(`Is searchable`),multiple:v().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:v().default(!1).describe(`Is unique constraint`),defaultValue:b().optional().describe(`Default value`),maxLength:A().optional().describe(`Max character length`),minLength:A().optional().describe(`Min character length`),precision:A().optional().describe(`Total digits`),scale:A().optional().describe(`Decimal places`),min:A().optional().describe(`Minimum value`),max:A().optional().describe(`Maximum value`),options:S(Jge).optional().describe(`Static options for select/multiselect`),reference:o().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:S(o()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:v().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:x([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:o().optional().describe(`Formula expression`),summaryOperations:l({object:o().describe(`Source child object name for roll-up`),field:o().describe(`Field on child object to aggregate`),function:x([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:o().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:o().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:v().optional().describe(`Show line numbers in code editor`),maxRating:A().optional().describe(`Maximum rating value (default: 5)`),allowHalf:v().optional().describe(`Allow half-star ratings`),displayMap:v().optional().describe(`Display map widget for location field`),allowGeocoding:v().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:x([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:x([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:v().optional().describe(`Allow transparency/alpha channel`),presetColors:S(o()).optional().describe(`Preset color options`),step:A().optional().describe(`Step increment for slider (default: 1)`),showValue:v().optional().describe(`Display current value on slider`),marks:u(o(),o()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:x([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:x([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:v().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:v().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:Yge.optional().describe(`Configuration for currency field type`),vectorConfig:Xge.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:Zge.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:w2.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:T2.optional().describe(`Data masking rules for PII protection`),auditTrail:v().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:S(o()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:$ge.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Qge.optional().describe(`Data quality validation and monitoring rules`),group:o().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:o().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:v().default(!1).describe(`Hidden from default UI`),readonly:v().default(!1).describe(`Read-only in UI`),sortable:v().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:o().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:v().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:v().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:o().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:v().default(!1).describe(`Create standard database index`),externalId:v().default(!1).describe(`Is external ID for upsert operations`)}),t_e=l({name:o(),label:q,type:E2,required:v().default(!1),options:S(l({label:q,value:o()})).optional()}),D2=x([`script`,`url`,`modal`,`flow`,`api`]),n_e=new Set(D2.options.filter(e=>e!==`script`));l({name:i2.describe(`Machine name (lowercase snake_case)`),label:q.describe(`Display label`),objectName:o().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:o().optional().describe(`Icon name`),locations:S(x([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:x([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:D2.default(`script`).describe(`Action functionality type`),target:o().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:o().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:S(t_e).optional().describe(`Input parameters required from user`),variant:x([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:q.optional().describe(`Confirmation message before execution`),successMessage:q.optional().describe(`Success message to show after execution`),refreshAfter:v().default(!1).describe(`Refresh view after execution`),visible:o().optional().describe(`Formula returning boolean`),disabled:c([v(),o()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:o().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:v().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:A().optional().describe(`Maximum execution time in milliseconds for the action`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(n_e.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),x([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var r_e=x([`asc`,`desc`]).describe(`Sort order direction`),O2=l({field:o().describe(`Field name to sort by`),order:r_e.describe(`Sort direction`)}).describe(`Sort field and direction pair`);x([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),x([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),x([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var i_e=l({name:o().describe(`Region name (e.g. "sidebar", "main", "header")`),width:x([`small`,`medium`,`large`,`full`]).optional(),components:S(j(()=>s_e)).describe(`Components in this region`)}),a_e=x(`page:header.page:footer.page:sidebar.page:tabs.page:accordion.page:card.page:section.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.ai:chat_window.ai:suggestion.element:text.element:number.element:image.element:divider.element:button.element:filter.element:form.element:record_picker`.split(`.`)),o_e=l({object:o().describe(`Object to query`),view:o().optional().describe(`Named view to apply`),filter:b2.optional().describe(`Additional filter criteria`),sort:S(O2).optional().describe(`Sort order`),limit:A().int().positive().optional().describe(`Max records to display`)}),s_e=l({type:c([a_e,o()]).describe(`Component Type (Standard enum or custom string)`),id:o().optional().describe(`Unique instance ID`),label:q.optional(),properties:u(o(),b()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:u(o(),o()).optional().describe(`Event handlers map`),style:u(o(),o()).optional().describe(`Inline styles or utility classes`),className:o().optional().describe(`CSS class names`),visibility:o().optional().describe(`Visibility filter/formula`),dataSource:o_e.optional().describe(`Per-element data binding for multi-object pages`),responsive:n2.optional().describe(`Responsive layout configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),c_e=l({name:o().describe(`Variable name`),type:x([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:b().optional(),source:o().optional().describe(`Component ID that writes to this variable`)}),l_e=l({componentId:o().describe(`Reference to a PageComponent.id in the page`),x:A().int().min(0).describe(`Grid column position (0-based)`),y:A().int().min(0).describe(`Grid row position (0-based)`),width:A().int().min(1).describe(`Width in grid columns`),height:A().int().min(1).describe(`Height in grid rows`)}),u_e=l({columns:A().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:A().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:A().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:S(l_e).describe(`Positioned components on the canvas`)}),d_e=x([`record`,`home`,`app`,`utility`,`dashboard`,`grid`,`list`,`gallery`,`kanban`,`calendar`,`timeline`,`form`,`record_detail`,`record_review`,`overview`,`blank`]).describe(`Page type — platform or interface page types`),f_e=l({object:o().describe(`Target object for review`),filter:b2.optional().describe(`Filter criteria for review queue`),sort:S(O2).optional().describe(`Sort order for review queue`),displayFields:S(o()).optional().describe(`Fields to display on the review page`),actions:S(l({label:o().describe(`Action button label`),type:x([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:o().optional().describe(`Field to update on action`),value:c([o(),A(),v()]).optional().describe(`Value to set on action`),nextRecord:v().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:x([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:v().optional().default(!0).describe(`Show review progress indicator`)}),p_e=l({source:o().optional().describe(`Source object name for the page`),levels:A().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:S(u2).optional().describe(`Page-level filter criteria`),appearance:f2.optional().describe(`Appearance and visualization configuration`),userFilters:l({elements:S(x([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:S(p2).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:d2.optional().describe(`User action toggles`),addRecord:m2.optional().describe(`Add record entry point configuration`),showRecordCount:v().optional().describe(`Show record count at page bottom`),allowPrinting:v().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`);l({name:i2.describe(`Page unique name (lowercase snake_case)`),label:q,description:q.optional(),icon:o().optional().describe(`Page icon name`),type:d_e.default(`record`).describe(`Page type`),variables:S(c_e).optional().describe(`Local page state variables`),object:o().optional().describe(`Bound object (for Record pages)`),recordReview:f_e.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:u_e.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:o().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:S(i_e).describe(`Defined regions with components`),isDefault:v().default(!1),assignedProfiles:S(o()).optional(),interfaceConfig:p_e.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:le.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:le.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`})});var m_e=l({onMount:o().optional().describe(`Initialization code when widget mounts`),onUpdate:o().optional().describe(`Code to run when props change`),onUnmount:o().optional().describe(`Cleanup code when widget unmounts`),onValidate:o().optional().describe(`Custom validation logic`),onFocus:o().optional().describe(`Code to run on focus`),onBlur:o().optional().describe(`Code to run on blur`),onError:o().optional().describe(`Error handling code`)}),h_e=l({name:o().describe(`Event name`),label:q.optional().describe(`Human-readable event label`),description:q.optional().describe(`Event description and usage`),bubbles:v().default(!1).describe(`Whether event bubbles`),cancelable:v().default(!1).describe(`Whether event is cancelable`),payload:u(o(),b()).optional().describe(`Event payload schema`)}),g_e=l({name:o().describe(`Property name (camelCase)`),label:q.optional().describe(`Human-readable label`),type:x([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:v().default(!1).describe(`Whether property is required`),default:b().optional().describe(`Default value`),description:q.optional().describe(`Property description`),validation:u(o(),b()).optional().describe(`Validation rules`),category:o().optional().describe(`Property category`)}),__e=d(`type`,[l({type:p(`npm`),packageName:o().describe(`NPM package name`),version:o().default(`latest`),exportName:o().optional().describe(`Named export (default: default)`)}),l({type:p(`remote`),url:o().url().describe(`Remote entry URL (.js)`),moduleName:o().describe(`Exposed module name`),scope:o().describe(`Remote scope name`)}),l({type:p(`inline`),code:o().describe(`JavaScript code body`)})]);l({name:i2.describe(`Widget identifier (snake_case)`),label:q.describe(`Widget display name`),description:q.optional().describe(`Widget description`),version:o().optional().describe(`Widget version (semver)`),author:o().optional().describe(`Widget author`),icon:o().optional().describe(`Widget icon`),fieldTypes:S(o()).optional().describe(`Supported field types`),category:x([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:m_e.optional().describe(`Lifecycle hooks`),events:S(h_e).optional().describe(`Custom events`),properties:S(g_e).optional().describe(`Configuration properties`),implementation:__e.optional().describe(`Widget implementation source`),dependencies:S(l({name:o(),version:o().optional(),url:o().url().optional()})).optional().describe(`Widget dependencies`),screenshots:S(o().url()).optional().describe(`Screenshot URLs`),documentation:o().url().optional().describe(`Documentation URL`),license:o().optional().describe(`License (SPDX identifier)`),tags:S(o()).optional().describe(`Tags for categorization`),aria:Z0.optional().describe(`ARIA accessibility attributes`),performance:r2.optional().describe(`Performance optimization settings`)}),l({value:b().describe(`Current field value`),onChange:O().input(a([b()])).output(g()).describe(`Callback to update field value`),readonly:v().default(!1).describe(`Read-only mode flag`),required:v().default(!1).describe(`Required field flag`),error:o().optional().describe(`Validation error message`),field:e_e.describe(`Field schema definition`),record:u(o(),b()).optional().describe(`Complete record data`),options:u(o(),b()).optional().describe(`Custom widget options`)});var k2=x([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),v_e=l({type:x([`user`,`team`,`record`]).describe(`Mention target type`),id:o().describe(`Target ID`),name:o().describe(`Display name for rendering`),offset:A().int().min(0).describe(`Character offset in body text`),length:A().int().min(1).describe(`Length of mention token in body text`)}),y_e=l({field:o().describe(`Field machine name`),fieldLabel:o().optional().describe(`Field display label`),oldValue:b().optional().describe(`Previous value`),newValue:b().optional().describe(`New value`),oldDisplayValue:o().optional().describe(`Human-readable old value`),newDisplayValue:o().optional().describe(`Human-readable new value`)}),b_e=l({emoji:o().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:S(o()).describe(`Users who reacted`),count:A().int().min(1).describe(`Total reaction count`)}),x_e=l({type:x([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:o().describe(`Actor ID`),name:o().optional().describe(`Actor display name`),avatarUrl:o().url().optional().describe(`Actor avatar URL`),source:o().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),S_e=x([`public`,`internal`,`private`]);l({id:o().describe(`Feed item ID`),type:k2.describe(`Activity type`),object:o().describe(`Object name (e.g., "account")`),recordId:o().describe(`Record ID this feed item belongs to`),actor:x_e.describe(`Who performed this action`),body:o().optional().describe(`Rich text body (Markdown supported)`),mentions:S(v_e).optional().describe(`Mentioned users/teams/records`),changes:S(y_e).optional().describe(`Field-level changes`),reactions:S(b_e).optional().describe(`Emoji reactions on this item`),parentId:o().optional().describe(`Parent feed item ID for threaded replies`),replyCount:A().int().min(0).default(0).describe(`Number of replies`),pinned:v().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:o().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:o().optional().describe(`User ID who pinned the item`),starred:v().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:o().datetime().optional().describe(`Timestamp when the item was starred`),visibility:S_e.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:o().datetime().describe(`Creation timestamp`),updatedAt:o().datetime().optional().describe(`Last update timestamp`),editedAt:o().datetime().optional().describe(`When comment was last edited`),isEdited:v().default(!1).describe(`Whether comment has been edited`)});var C_e=x([`all`,`comments_only`,`changes_only`,`tasks_only`]);l({}),l({title:q.describe(`Page title`),subtitle:q.optional().describe(`Page subtitle`),icon:o().optional().describe(`Icon name`),breadcrumb:v().default(!0).describe(`Show breadcrumb`),actions:S(o()).optional().describe(`Action IDs to show in header`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({type:x([`line`,`card`,`pill`]).default(`line`),position:x([`top`,`left`]).default(`top`),items:S(l({label:q,icon:o().optional(),children:S(b()).describe(`Child components`)})),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({title:q.optional(),bordered:v().default(!0),actions:S(o()).optional(),body:S(b()).optional().describe(`Card content components (slot)`),footer:S(b()).optional().describe(`Card footer components (slot)`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({columns:x([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:x([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:S(o()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:S(o()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({objectName:o().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:o().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:S(o()).describe(`Fields to display in the related list`),sort:c([o(),S(l({field:o(),order:x([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:A().int().positive().default(5).describe(`Number of records to display initially`),filter:S(u2).optional().describe(`Additional filter criteria for related records`),title:q.optional().describe(`Custom title for the related list`),showViewAll:v().default(!0).describe(`Show "View All" link to see all related records`),actions:S(o()).optional().describe(`Action IDs available for related records`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({fields:S(o()).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards)`),layout:x([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:Z0.optional().describe(`ARIA accessibility attributes`)});var w_e=l({types:S(k2).optional().describe(`Feed item types to show (default: all)`),filterMode:C_e.default(`all`).describe(`Default activity filter`),showFilterToggle:v().default(!0).describe(`Show filter dropdown in panel header`),limit:A().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:v().default(!1).describe(`Include completed activities`),unifiedTimeline:v().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:v().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:v().default(!0).describe(`Enable @mentions in comments`),enableReactions:v().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:v().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:v().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:Z0.optional().describe(`ARIA accessibility attributes`)});l({position:x([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:c([o(),A()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:v().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:v().default(!1).describe(`Whether the panel starts collapsed`),feed:w_e.optional().describe(`Embedded activity feed configuration`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({statusField:o().describe(`Field name representing the current status/stage`),stages:S(l({value:o(),label:q})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({items:S(l({label:q,icon:o().optional(),collapsed:v().default(!1),children:S(b()).describe(`Child components`)})),allowMultiple:v().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({mode:x([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:o().optional().describe(`Specific AI agent to use`),context:u(o(),b()).optional().describe(`Contextual data to pass to the AI`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({content:o().describe(`Text or Markdown content`),variant:x([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:x([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({object:o().describe(`Source object`),field:o().optional().describe(`Field to aggregate`),aggregate:x([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:b2.optional().describe(`Filter criteria`),format:x([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:o().optional().describe(`Prefix text (e.g. "$")`),suffix:o().optional().describe(`Suffix text (e.g. "%")`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({src:o().describe(`Image URL or attachment field`),alt:o().optional().describe(`Alt text for accessibility`),fit:x([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:A().optional().describe(`Fixed height in pixels`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({label:q.describe(`Button display label`),variant:x([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:x([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:o().optional().describe(`Icon name (Lucide icon)`),iconPosition:x([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:v().optional().default(!1).describe(`Disable the button`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({object:o().describe(`Object to filter`),fields:S(o()).describe(`Filterable field names`),targetVariable:o().optional().describe(`Page variable to store filter state`),layout:x([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:v().optional().default(!0).describe(`Show search input`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({object:o().describe(`Object for the form`),fields:S(o()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:x([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:q.optional().describe(`Submit button label`),onSubmit:o().optional().describe(`Action expression on form submit`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({object:o().describe(`Object to pick records from`),displayField:o().describe(`Field to display as the record label`),searchFields:S(o()).optional().describe(`Fields to search against`),filter:b2.optional().describe(`Filter criteria for available records`),multiple:v().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:o().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:q.optional().describe(`Placeholder text`),aria:Z0.optional().describe(`ARIA accessibility attributes`)}),l({context:o().optional()});var A2=l({minWidth:A().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:A().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:A().optional().describe(`Additional padding around touch target in pixels`),hitSlop:l({top:A().optional().describe(`Extra hit area above the element`),right:A().optional().describe(`Extra hit area to the right of the element`),bottom:A().optional().describe(`Extra hit area below the element`),left:A().optional().describe(`Extra hit area to the left of the element`)}).optional().describe(`Invisible hit area extension beyond the visible bounds`)}).describe(`Touch target sizing configuration (WCAG accessible)`),T_e=x([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`),E_e=l({direction:S(x([`up`,`down`,`left`,`right`])).describe(`Allowed swipe directions`),threshold:A().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:A().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`),D_e=l({minScale:A().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:A().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`),O_e=l({duration:A().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:A().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`);l({gestures:S(l({type:T_e.describe(`Gesture type to configure`),label:q.optional().describe(`Descriptive label for the gesture action`),enabled:v().default(!0).describe(`Whether this gesture is active`),swipe:E_e.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:D_e.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:O_e.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`)).optional().describe(`Configured gesture recognizers`),touchTarget:A2.optional().describe(`Touch target sizing and hit area`),hapticFeedback:v().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(Z0.partial()).describe(`Touch and gesture interaction configuration`);var k_e=l({enabled:v().default(!1).describe(`Enable focus trapping within this container`),initialFocus:o().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:v().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:v().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`),A_e=l({key:o().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:o().describe(`Action identifier to invoke when shortcut is triggered`),description:q.optional().describe(`Human-readable description of what the shortcut does`),scope:x([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`),j2=l({tabOrder:x([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:v().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:v().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:k_e.optional().describe(`Focus trap settings`),arrowNavigation:v().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`);l({shortcuts:S(A_e).optional().describe(`Registered keyboard shortcuts`),focusManagement:j2.optional().describe(`Focus and tab order management`),rovingTabindex:v().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(Z0.partial()).describe(`Keyboard navigation and shortcut configuration`);var j_e=l({primary:o().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:o().optional().describe(`Secondary brand color`),accent:o().optional().describe(`Accent color for highlights`),success:o().optional().describe(`Success state color (default: green)`),warning:o().optional().describe(`Warning state color (default: yellow)`),error:o().optional().describe(`Error state color (default: red)`),info:o().optional().describe(`Info state color (default: blue)`),background:o().optional().describe(`Background color`),surface:o().optional().describe(`Surface/card background color`),text:o().optional().describe(`Primary text color`),textSecondary:o().optional().describe(`Secondary text color`),border:o().optional().describe(`Border color`),disabled:o().optional().describe(`Disabled state color`),primaryLight:o().optional().describe(`Lighter shade of primary`),primaryDark:o().optional().describe(`Darker shade of primary`),secondaryLight:o().optional().describe(`Lighter shade of secondary`),secondaryDark:o().optional().describe(`Darker shade of secondary`)}),M_e=l({fontFamily:l({base:o().optional().describe(`Base font family (default: system fonts)`),heading:o().optional().describe(`Heading font family`),mono:o().optional().describe(`Monospace font family for code`)}).optional(),fontSize:l({xs:o().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:o().optional().describe(`Small font size (e.g., 0.875rem)`),base:o().optional().describe(`Base font size (e.g., 1rem)`),lg:o().optional().describe(`Large font size (e.g., 1.125rem)`),xl:o().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":o().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":o().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":o().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:l({light:A().optional().describe(`Light weight (default: 300)`),normal:A().optional().describe(`Normal weight (default: 400)`),medium:A().optional().describe(`Medium weight (default: 500)`),semibold:A().optional().describe(`Semibold weight (default: 600)`),bold:A().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:l({tight:o().optional().describe(`Tight line height (e.g., 1.25)`),normal:o().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:o().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:o().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:l({tighter:o().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:o().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:o().optional().describe(`Normal letter spacing (e.g., 0)`),wide:o().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:o().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()}),N_e=l({0:o().optional().describe(`0 spacing (0)`),1:o().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:o().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:o().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:o().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:o().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:o().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:o().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:o().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:o().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:o().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:o().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:o().optional().describe(`Spacing unit 24 (e.g., 6rem)`)}),P_e=l({none:o().optional().describe(`No border radius (0)`),sm:o().optional().describe(`Small border radius (e.g., 0.125rem)`),base:o().optional().describe(`Base border radius (e.g., 0.25rem)`),md:o().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:o().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:o().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":o().optional().describe(`2X large border radius (e.g., 1rem)`),full:o().optional().describe(`Full border radius (50%)`)}),F_e=l({none:o().optional().describe(`No shadow`),sm:o().optional().describe(`Small shadow`),base:o().optional().describe(`Base shadow`),md:o().optional().describe(`Medium shadow`),lg:o().optional().describe(`Large shadow`),xl:o().optional().describe(`Extra large shadow`),"2xl":o().optional().describe(`2X large shadow`),inner:o().optional().describe(`Inner shadow (inset)`)}),I_e=l({xs:o().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:o().optional().describe(`Small breakpoint (e.g., 640px)`),md:o().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:o().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:o().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":o().optional().describe(`2X large breakpoint (e.g., 1536px)`)}),L_e=l({duration:l({fast:o().optional().describe(`Fast animation (e.g., 150ms)`),base:o().optional().describe(`Base animation (e.g., 300ms)`),slow:o().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:l({linear:o().optional().describe(`Linear timing function`),ease:o().optional().describe(`Ease timing function`),ease_in:o().optional().describe(`Ease-in timing function`),ease_out:o().optional().describe(`Ease-out timing function`),ease_in_out:o().optional().describe(`Ease-in-out timing function`)}).optional()}),R_e=l({base:A().optional().describe(`Base z-index (e.g., 0)`),dropdown:A().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:A().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:A().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:A().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:A().optional().describe(`Modal z-index (e.g., 1050)`),popover:A().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:A().optional().describe(`Tooltip z-index (e.g., 1070)`)}),z_e=x([`light`,`dark`,`auto`]),B_e=x([`compact`,`regular`,`spacious`]),V_e=x([`AA`,`AAA`]);l({name:i2.describe(`Unique theme identifier (snake_case)`),label:o().describe(`Human-readable theme name`),description:o().optional().describe(`Theme description`),mode:z_e.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:j_e.describe(`Color palette configuration`),typography:M_e.optional().describe(`Typography settings`),spacing:N_e.optional().describe(`Spacing scale`),borderRadius:P_e.optional().describe(`Border radius scale`),shadows:F_e.optional().describe(`Box shadow effects`),breakpoints:I_e.optional().describe(`Responsive breakpoints`),animation:L_e.optional().describe(`Animation settings`),zIndex:R_e.optional().describe(`Z-index scale for layering`),customVars:u(o(),o()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:l({light:o().optional().describe(`Logo URL for light mode`),dark:o().optional().describe(`Logo URL for dark mode`),favicon:o().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:o().optional().describe(`Base theme to extend from`),density:B_e.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:V_e.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:v().optional().describe(`Enable right-to-left layout direction`),touchTarget:A2.optional().describe(`Touch target sizing defaults`),keyboardNavigation:j2.optional().describe(`Keyboard focus management settings`)});var M2=x([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`),H_e=x([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`),U_e=l({strategy:M2.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:H_e.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:A().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:A().optional().describe(`Maximum number of sync retry attempts`),batchSize:A().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`),W_e=x([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`),G_e=x([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`),K_e=l({maxSize:A().optional().describe(`Maximum cache size in bytes`),ttl:A().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:W_e.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:G_e.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`);l({enabled:v().default(!1).describe(`Enable offline support`),strategy:M2.default(`network_first`).describe(`Default offline fetch strategy`),cache:K_e.optional().describe(`Cache settings for offline data`),sync:U_e.optional().describe(`Sync settings for offline mutations`),offlineIndicator:v().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:q.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:A().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`);var N2=x([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`),P2=x([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`),F2=l({preset:N2.optional().describe(`Transition preset to apply`),duration:A().optional().describe(`Transition duration in milliseconds`),easing:P2.optional().describe(`Easing function for the transition`),delay:A().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:o().optional().describe(`CSS @keyframes name for custom animations`),themeToken:o().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`),q_e=x([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`),J_e=l({label:q.optional().describe(`Descriptive label for this animation configuration`),enter:F2.optional().describe(`Enter/mount animation`),exit:F2.optional().describe(`Exit/unmount animation`),hover:F2.optional().describe(`Hover state animation`),trigger:q_e.optional().describe(`When to trigger the animation`),reducedMotion:x([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(Z0.partial()).describe(`Component-level animation configuration`),Y_e=l({type:N2.default(`fade`).describe(`Page transition type`),duration:A().default(300).describe(`Transition duration in milliseconds`),easing:P2.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:v().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`);l({label:q.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:F2.optional().describe(`Default transition applied to all animations`),pageTransitions:Y_e.optional().describe(`Page navigation transition settings`),componentAnimations:u(o(),J_e).optional().describe(`Component name to animation configuration mapping`),reducedMotion:v().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:v().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`);var X_e=x([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`),Z_e=x([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`),I2=x([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`),Q_e=l({label:q.describe(`Action button label`),action:o().describe(`Action identifier to execute`),variant:x([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`);l({type:X_e.default(`toast`).describe(`Notification presentation style`),severity:Z_e.default(`info`).describe(`Notification severity level`),title:q.optional().describe(`Notification title`),message:q.describe(`Notification message body`),icon:o().optional().describe(`Icon name override`),duration:A().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:v().default(!0).describe(`Allow user to dismiss the notification`),actions:S(Q_e).optional().describe(`Action buttons`),position:I2.optional().describe(`Override default position`)}).merge(Z0.partial()).describe(`Notification instance definition`),l({defaultPosition:I2.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:A().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:A().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:x([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:v().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`);var $_e=x([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`),eve=x([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`),tve=l({axis:x([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:x([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:a([A(),A()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`),nve=l({label:q.optional().describe(`Accessible label for the drop zone`),accept:S(o()).describe(`Accepted drag item types`),maxItems:A().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:v().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:eve.default(`move`).describe(`Visual effect on drop`)}).merge(Z0.partial()).describe(`Drop zone configuration`),rve=l({type:o().describe(`Drag item type identifier for matching with drop zones`),label:q.optional().describe(`Accessible label describing the draggable item`),handle:$_e.default(`element`).describe(`How to initiate drag`),constraint:tve.optional().describe(`Drag movement constraints`),preview:x([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:v().default(!1).describe(`Disable dragging`)}).merge(Z0.partial()).describe(`Draggable item configuration`);l({enabled:v().default(!1).describe(`Enable drag and drop`),dragItem:rve.optional().describe(`Configuration for draggable item`),dropZone:nve.optional().describe(`Configuration for drop target`),sortable:v().default(!1).describe(`Enable sortable list behavior`),autoScroll:v().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:A().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`);var ive=e({DEFAULT_EXTENDER_PRIORITY:()=>200,DEFAULT_OWNER_PRIORITY:()=>100,MetadataFacade:()=>K2,ObjectQL:()=>U2,ObjectQLPlugin:()=>q2,ObjectRepository:()=>W2,ObjectStackProtocolImplementation:()=>V2,RESERVED_NAMESPACES:()=>L2,SchemaRegistry:()=>J,ScopedContext:()=>G2,computeFQN:()=>R2,parseFQN:()=>z2}),L2=new Set([`base`,`system`]);function R2(e,t){return!e||L2.has(e)?t:`${e}__${t}`}function z2(e){let t=e.indexOf(`__`);return t===-1?{namespace:void 0,shortName:e}:{namespace:e.slice(0,t),shortName:e.slice(t+2)}}function ave(e,t){let n={...e};return t.fields&&(n.fields={...e.fields,...t.fields}),t.validations&&(n.validations=[...e.validations||[],...t.validations]),t.indexes&&(n.indexes=[...e.indexes||[],...t.indexes]),t.label!==void 0&&(n.label=t.label),t.pluralLabel!==void 0&&(n.pluralLabel=t.pluralLabel),t.description!==void 0&&(n.description=t.description),n}var J=class{static get logLevel(){return this._logLevel}static set logLevel(e){this._logLevel=e}static log(e){this._logLevel===`silent`||this._logLevel===`error`||this._logLevel===`warn`||console.log(e)}static registerNamespace(e,t){if(!e)return;let n=this.namespaceRegistry.get(e);if(n&&n!==t)throw Error(`Namespace "${e}" is already registered to package "${n}". Package "${t}" cannot use the same namespace.`);this.namespaceRegistry.set(e,t),this.log(`[Registry] Registered namespace: ${e} \u2192 ${t}`)}static unregisterNamespace(e,t){this.namespaceRegistry.get(e)===t&&(this.namespaceRegistry.delete(e),this.log(`[Registry] Unregistered namespace: ${e}`))}static getNamespaceOwner(e){return this.namespaceRegistry.get(e)}static registerObject(e,t,n,r=`own`,i=r===`own`?100:200){let a=e.name,o=R2(n,a);n&&this.registerNamespace(n,t);let s=this.objectContributors.get(o);if(s||(s=[],this.objectContributors.set(o,s)),r===`own`){let e=s.find(e=>e.ownership===`own`);if(e&&e.packageId!==t)throw Error(`Object "${o}" is already owned by package "${e.packageId}". Package "${t}" cannot claim ownership. Use 'extend' to add fields.`);let n=s.findIndex(e=>e.packageId===t&&e.ownership===`own`);n!==-1&&(s.splice(n,1),console.warn(`[Registry] Re-registering owned object: ${o} from ${t}`))}else{let e=s.findIndex(e=>e.packageId===t&&e.ownership===`extend`);e!==-1&&s.splice(e,1)}let c={packageId:t,namespace:n||``,ownership:r,priority:i,definition:{...e,name:o}};return s.push(c),s.sort((e,t)=>e.priority-t.priority),this.mergedObjectCache.delete(o),this.log(`[Registry] Registered object: ${o} (${r}, priority=${i}) from ${t}`),o}static resolveObject(e){let t=this.mergedObjectCache.get(e);if(t)return t;let n=this.objectContributors.get(e);if(!n||n.length===0)return;let r=n.find(e=>e.ownership===`own`);if(!r){console.warn(`[Registry] Object "${e}" has extenders but no owner. Skipping.`);return}let i={...r.definition};for(let e of n)e.ownership===`extend`&&(i=ave(i,e.definition));return this.mergedObjectCache.set(e,i),i}static getObject(e){let t=this.resolveObject(e);if(t)return t;for(let t of this.objectContributors.keys()){let{shortName:n}=z2(t);if(n===e)return this.resolveObject(t)}for(let t of this.objectContributors.keys()){let n=this.resolveObject(t);if(n?.tableName===e)return n}}static getAllObjects(e){let t=[];for(let n of this.objectContributors.keys()){if(e&&!this.objectContributors.get(n)?.some(t=>t.packageId===e))continue;let r=this.resolveObject(n);r&&(r._packageId=this.getObjectOwner(n)?.packageId,t.push(r))}return t}static getObjectContributors(e){return this.objectContributors.get(e)||[]}static getObjectOwner(e){return this.objectContributors.get(e)?.find(e=>e.ownership===`own`)}static unregisterObjectsByPackage(e,t=!1){for(let[n,r]of this.objectContributors.entries()){let i=r.filter(t=>t.packageId===e);for(let a of i){if(a.ownership===`own`&&!t){let t=r.filter(t=>t.packageId!==e&&t.ownership===`extend`);if(t.length>0)throw Error(`Cannot uninstall package "${e}": object "${n}" is extended by ${t.map(e=>e.packageId).join(`, `)}. Uninstall extenders first.`)}let i=r.indexOf(a);i!==-1&&(r.splice(i,1),this.log(`[Registry] Removed ${a.ownership} contribution to ${n} from ${e}`))}r.length===0&&this.objectContributors.delete(n),this.mergedObjectCache.delete(n)}}static registerItem(e,t,n=`name`,r){this.metadata.has(e)||this.metadata.set(e,new Map);let i=this.metadata.get(e),a=String(t[n]);r&&(t._packageId=r);try{this.validate(e,t)}catch(t){console.error(`[Registry] Validation failed for ${e} ${a}: ${t.message}`)}let o=r?`${r}:${a}`:a;i.has(o)&&console.warn(`[Registry] Overwriting ${e}: ${o}`),i.set(o,t),this.log(`[Registry] Registered ${e}: ${o}`)}static validate(e,t){return e===`object`?C.parse(t):e===`apps`?hge.parse(t):e===`package`?V0.parse(t):e===`plugin`?L0.parse(t):!0}static unregisterItem(e,t){let n=this.metadata.get(e);if(!n){console.warn(`[Registry] Attempted to unregister non-existent ${e}: ${t}`);return}if(n.has(t)){n.delete(t),this.log(`[Registry] Unregistered ${e}: ${t}`);return}for(let r of n.keys())if(r.endsWith(`:${t}`)){n.delete(r),this.log(`[Registry] Unregistered ${e}: ${r}`);return}console.warn(`[Registry] Attempted to unregister non-existent ${e}: ${t}`)}static getItem(e,t){if(e===`object`||e===`objects`)return this.getObject(t);let n=this.metadata.get(e);if(!n)return;let r=n.get(t);if(r)return r;for(let[e,r]of n)if(e.endsWith(`:${t}`))return r}static listItems(e,t){if(e===`object`||e===`objects`)return this.getAllObjects(t);let n=Array.from(this.metadata.get(e)?.values()||[]);return t?n.filter(e=>e._packageId===t):n}static getRegisteredTypes(){let e=Array.from(this.metadata.keys());return!e.includes(`object`)&&this.objectContributors.size>0&&e.push(`object`),e}static installPackage(e,t){let n=new Date().toISOString(),r={manifest:e,status:`installed`,enabled:!0,installedAt:n,updatedAt:n,settings:t};e.namespace&&this.registerNamespace(e.namespace,e.id),this.metadata.has(`package`)||this.metadata.set(`package`,new Map);let i=this.metadata.get(`package`);return i.has(e.id)&&console.warn(`[Registry] Overwriting package: ${e.id}`),i.set(e.id,r),this.log(`[Registry] Installed package: ${e.id} (${e.name})`),r}static uninstallPackage(e){let t=this.getPackage(e);if(!t)return console.warn(`[Registry] Package not found for uninstall: ${e}`),!1;t.manifest.namespace&&this.unregisterNamespace(t.manifest.namespace,e),this.unregisterObjectsByPackage(e);let n=this.metadata.get(`package`);return n?(n.delete(e),this.log(`[Registry] Uninstalled package: ${e}`),!0):!1}static getPackage(e){return this.metadata.get(`package`)?.get(e)}static getAllPackages(){return this.listItems(`package`)}static enablePackage(e){let t=this.getPackage(e);return t&&(t.enabled=!0,t.status=`installed`,t.statusChangedAt=new Date().toISOString(),t.updatedAt=new Date().toISOString(),this.log(`[Registry] Enabled package: ${e}`)),t}static disablePackage(e){let t=this.getPackage(e);return t&&(t.enabled=!1,t.status=`disabled`,t.statusChangedAt=new Date().toISOString(),t.updatedAt=new Date().toISOString(),this.log(`[Registry] Disabled package: ${e}`)),t}static registerApp(e,t){this.registerItem(`apps`,e,`name`,t)}static getApp(e){return this.getItem(`apps`,e)}static getAllApps(){return this.listItems(`apps`)}static registerPlugin(e){this.registerItem(`plugin`,e,`id`)}static getAllPlugins(){return this.listItems(`plugin`)}static registerKind(e){this.registerItem(`kind`,e,`id`)}static getAllKinds(){return this.listItems(`kind`)}static reset(){this.objectContributors.clear(),this.mergedObjectCache.clear(),this.namespaceRegistry.clear(),this.metadata.clear(),this.log(`[Registry] Reset complete`)}};J._logLevel=`info`,J.objectContributors=new Map,J.mergedObjectCache=new Map,J.namespaceRegistry=new Map,J.metadata=new Map;function ove(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}var B2={auth:{route:`/api/v1/auth`,plugin:`plugin-auth`},automation:{route:`/api/v1/automation`,plugin:`plugin-automation`},cache:{route:`/api/v1/cache`,plugin:`plugin-redis`},queue:{route:`/api/v1/queue`,plugin:`plugin-bullmq`},job:{route:`/api/v1/jobs`,plugin:`job-scheduler`},ui:{route:`/api/v1/ui`,plugin:`ui-plugin`},workflow:{route:`/api/v1/workflow`,plugin:`plugin-workflow`},realtime:{route:`/api/v1/realtime`,plugin:`plugin-realtime`},notification:{route:`/api/v1/notifications`,plugin:`plugin-notifications`},ai:{route:`/api/v1/ai`,plugin:`plugin-ai`},i18n:{route:`/api/v1/i18n`,plugin:`service-i18n`},graphql:{route:`/graphql`,plugin:`plugin-graphql`},"file-storage":{route:`/api/v1/storage`,plugin:`plugin-storage`},search:{route:`/api/v1/search`,plugin:`plugin-search`}},V2=class{constructor(e,t,n){this.engine=e,this.getServicesRegistry=t,this.getFeedService=n}requireFeedService(){let e=this.getFeedService?.();if(!e)throw Error(`Feed service not available. Install and register service-feed to enable feed operations.`);return e}async getDiscovery(){let e=this.getServicesRegistry?this.getServicesRegistry():new Map,t={metadata:{enabled:!0,status:`available`,route:`/api/v1/meta`,provider:`objectql`},data:{enabled:!0,status:`available`,route:`/api/v1/data`,provider:`objectql`},analytics:{enabled:!0,status:`available`,route:`/api/v1/analytics`,provider:`objectql`}};for(let[n,r]of Object.entries(B2))e.has(n)?t[n]={enabled:!0,status:`available`,route:r.route,provider:r.plugin}:t[n]={enabled:!1,status:`unavailable`,message:`Install ${r.plugin} to enable`};let n={auth:`auth`,automation:`automation`,ui:`ui`,workflow:`workflow`,realtime:`realtime`,notification:`notifications`,ai:`ai`,i18n:`i18n`,graphql:`graphql`,"file-storage":`storage`},r={analytics:`/api/v1/analytics`};for(let[t,i]of Object.entries(B2))if(e.has(t)){let e=n[t];e&&(r[e]=i.route)}e.has(`feed`)?t.feed={enabled:!0,status:`available`,route:`/api/v1/data`,provider:`service-feed`}:t.feed={enabled:!1,status:`unavailable`,message:`Install service-feed to enable`};let i={data:`/api/v1/data`,metadata:`/api/v1/meta`,...r},a={feed:e.has(`feed`),comments:e.has(`feed`),automation:e.has(`automation`),cron:e.has(`job`),search:e.has(`search`),export:e.has(`automation`)||e.has(`queue`),chunkedUpload:e.has(`file-storage`)},o={};for(let[e,t]of Object.entries(a))o[e]={enabled:t};return{version:`1.0`,apiName:`ObjectStack API`,routes:i,services:t,capabilities:o}}async getMetaTypes(){return{types:J.getRegisteredTypes()}}async getMetaItems(e){let t=J.listItems(e.type);if(t.length===0){let n=e.type.endsWith(`s`)?e.type.slice(0,-1):e.type+`s`;t=J.listItems(n)}if(t.length===0)try{let n=await this.engine.find(`sys_metadata`,{where:{type:e.type,state:`active`}});if(n&&n.length>0)t=n.map(t=>{let n=typeof t.metadata==`string`?JSON.parse(t.metadata):t.metadata;return J.registerItem(e.type,n,`name`),n});else{let n=e.type.endsWith(`s`)?e.type.slice(0,-1):e.type+`s`,r=await this.engine.find(`sys_metadata`,{where:{type:n,state:`active`}});r&&r.length>0&&(t=r.map(t=>{let n=typeof t.metadata==`string`?JSON.parse(t.metadata):t.metadata;return J.registerItem(e.type,n,`name`),n}))}}catch{}return{type:e.type,items:t}}async getMetaItem(e){let t=J.getItem(e.type,e.name);if(t===void 0){let n=e.type.endsWith(`s`)?e.type.slice(0,-1):e.type+`s`;t=J.getItem(n,e.name)}if(t===void 0)try{let n=await this.engine.findOne(`sys_metadata`,{where:{type:e.type,name:e.name,state:`active`}});if(n)t=typeof n.metadata==`string`?JSON.parse(n.metadata):n.metadata,J.registerItem(e.type,t,`name`);else{let n=e.type.endsWith(`s`)?e.type.slice(0,-1):e.type+`s`,r=await this.engine.findOne(`sys_metadata`,{where:{type:n,name:e.name,state:`active`}});r&&(t=typeof r.metadata==`string`?JSON.parse(r.metadata):r.metadata,J.registerItem(e.type,t,`name`))}}catch{}return{type:e.type,name:e.name,item:t}}async getUiView(e){let t=J.getObject(e.object);if(!t)throw Error(`Object ${e.object} not found`);let n=t.fields||{},r=Object.keys(n);if(e.type===`list`){let i=[`name`,`title`,`label`,`subject`,`email`,`status`,`type`,`category`,`created_at`],a=r.filter(e=>i.includes(e));if(a.length<5){let e=r.filter(e=>!a.includes(e)&&e!==`id`&&!n[e].hidden);a=[...a,...e.slice(0,5-a.length)]}return{list:{type:`grid`,object:e.object,label:t.label||t.name,columns:a.map(e=>({field:e,label:n[e]?.label||e,sortable:!0})),sort:n.created_at?[{field:`created_at`,order:`desc`}]:void 0,searchableFields:a.slice(0,3)}}}else{let i=r.filter(e=>e!==`id`&&e!==`created_at`&&e!==`updated_at`&&!n[e].hidden).map(e=>({field:e,label:n[e]?.label,required:n[e]?.required,readonly:n[e]?.readonly,type:n[e]?.type,colSpan:n[e]?.type===`textarea`||n[e]?.type===`html`?2:1}));return{form:{type:`simple`,object:e.object,label:`Edit ${t.label||t.name}`,sections:[{label:`General Information`,columns:2,collapsible:!1,collapsed:!1,fields:i}]}}}}async findData(e){let t={...e.query};t.top!=null&&(t.limit=Number(t.top),delete t.top),t.skip!=null&&(t.offset=Number(t.skip),delete t.skip),t.limit!=null&&(t.limit=Number(t.limit)),t.offset!=null&&(t.offset=Number(t.offset)),typeof t.select==`string`?t.fields=t.select.split(`,`).map(e=>e.trim()).filter(Boolean):Array.isArray(t.select)&&(t.fields=t.select),t.select!==void 0&&delete t.select;let n=t.orderBy??t.sort;typeof n==`string`?t.orderBy=n.split(`,`).map(e=>{let t=e.trim();if(t.startsWith(`-`))return{field:t.slice(1),order:`desc`};let[n,r]=t.split(/\s+/);return{field:n,order:r?.toLowerCase()===`desc`?`desc`:`asc`}}).filter(e=>e.field):Array.isArray(n)&&(t.orderBy=n),delete t.sort;let r=t.filter??t.filters??t.$filter??t.where;if(delete t.filter,delete t.filters,delete t.$filter,r!==void 0){let e=r;if(typeof e==`string`)try{e=JSON.parse(e)}catch{}f(e)&&(e=w(e)),t.where=e}let i=t.populate,a=t.$expand??t.expand,o=[];if(typeof i==`string`?o.push(...i.split(`,`).map(e=>e.trim()).filter(Boolean)):Array.isArray(i)&&o.push(...i),!o.length&&a&&(typeof a==`string`?o.push(...a.split(`,`).map(e=>e.trim()).filter(Boolean)):Array.isArray(a)&&o.push(...a)),delete t.populate,delete t.$expand,(typeof t.expand!=`object`||t.expand===null)&&delete t.expand,o.length>0&&!t.expand){t.expand={};for(let e of o)t.expand[e]={object:e}}for(let e of[`distinct`,`count`])t[e]===`true`?t[e]=!0:t[e]===`false`&&(t[e]=!1);let s=new Set([`top`,`limit`,`offset`,`orderBy`,`fields`,`where`,`expand`,`distinct`,`count`,`aggregations`,`groupBy`,`search`,`context`,`cursor`]);if(!t.where){let e={};for(let n of Object.keys(t))s.has(n)||(e[n]=t[n],delete t[n]);Object.keys(e).length>0&&(t.where=e)}let c=await this.engine.find(e.object,t);return{object:e.object,value:c,records:c,total:c.length,hasMore:!1}}async getData(e){let t={where:{id:e.id}};if(e.select&&(t.fields=typeof e.select==`string`?e.select.split(`,`).map(e=>e.trim()).filter(Boolean):e.select),e.expand){let n=typeof e.expand==`string`?e.expand.split(`,`).map(e=>e.trim()).filter(Boolean):e.expand;t.expand={};for(let e of n)t.expand[e]={object:e}}let n=await this.engine.findOne(e.object,t);if(n)return{object:e.object,id:e.id,record:n};throw Error(`Record ${e.id} not found in ${e.object}`)}async createData(e){let t=await this.engine.insert(e.object,e.data);return{object:e.object,id:t.id,record:t}}async updateData(e){let t=await this.engine.update(e.object,e.data,{where:{id:e.id}});return{object:e.object,id:e.id,record:t}}async deleteData(e){return await this.engine.delete(e.object,{where:{id:e.id}}),{object:e.object,id:e.id,success:!0}}async getMetaItemCached(e){try{let t=J.getItem(e.type,e.name);if(!t)throw Error(`Metadata item ${e.type}/${e.name} not found`);let n=ove(JSON.stringify(t)),r={value:n,weak:!1};return e.cacheRequest?.ifNoneMatch&&e.cacheRequest.ifNoneMatch.replace(/^"(.*)"$/,`$1`).replace(/^W\/"(.*)"$/,`$1`)===n?{notModified:!0,etag:r}:{data:t,etag:r,lastModified:new Date().toISOString(),cacheControl:{directives:[`public`,`max-age`],maxAge:3600},notModified:!1}}catch(e){throw e}}async batchData(e){let{object:t,request:n}=e,{operation:r,records:i,options:a}=n,o=[],s=0,c=0;for(let e of i)try{switch(r){case`create`:{let n=await this.engine.insert(t,e.data||e);o.push({id:n.id,success:!0,record:n}),s++;break}case`update`:{if(!e.id)throw Error(`Record id is required for update`);let n=await this.engine.update(t,e.data||{},{where:{id:e.id}});o.push({id:e.id,success:!0,record:n}),s++;break}case`upsert`:if(e.id)try{if(await this.engine.findOne(t,{where:{id:e.id}})){let n=await this.engine.update(t,e.data||{},{where:{id:e.id}});o.push({id:e.id,success:!0,record:n})}else{let n=await this.engine.insert(t,{id:e.id,...e.data||{}});o.push({id:n.id,success:!0,record:n})}}catch{let n=await this.engine.insert(t,{id:e.id,...e.data||{}});o.push({id:n.id,success:!0,record:n})}else{let n=await this.engine.insert(t,e.data||e);o.push({id:n.id,success:!0,record:n})}s++;break;case`delete`:if(!e.id)throw Error(`Record id is required for delete`);await this.engine.delete(t,{where:{id:e.id}}),o.push({id:e.id,success:!0}),s++;break;default:o.push({id:e.id,success:!1,error:`Unknown operation: ${r}`}),c++}}catch(t){if(o.push({id:e.id,success:!1,error:t.message}),c++,a?.atomic||!a?.continueOnError)break}return{success:c===0,operation:r,total:i.length,succeeded:s,failed:c,results:a?.returnRecords===!1?o.map(e=>({id:e.id,success:e.success,error:e.error})):o}}async createManyData(e){let t=await this.engine.insert(e.object,e.records);return{object:e.object,records:t,count:t.length}}async updateManyData(e){let{object:t,records:n,options:r}=e,i=[],a=0,o=0;for(let e of n)try{let n=await this.engine.update(t,e.data,{where:{id:e.id}});i.push({id:e.id,success:!0,record:n}),a++}catch(t){if(i.push({id:e.id,success:!1,error:t.message}),o++,!r?.continueOnError)break}return{success:o===0,operation:`update`,total:n.length,succeeded:a,failed:o,results:i}}async analyticsQuery(e){let{query:t,cube:n}=e,r=n,i=t.dimensions||[],a=[];if(t.measures)for(let e of t.measures)if(e===`count`||e===`count_all`)a.push({field:`*`,method:`count`,alias:`count`});else if(e.includes(`.`)){let[t,n]=e.split(`.`);a.push({field:t,method:n,alias:`${t}_${n}`})}else a.push({field:e,method:`sum`,alias:e});let o;if(t.filters&&t.filters.length>0){let e=t.filters.map(e=>{let t=this.mapAnalyticsOperator(e.operator);return e.values&&e.values.length===1?{[e.member]:{[t]:e.values[0]}}:e.values&&e.values.length>1?{[e.member]:{$in:e.values}}:{[e.member]:{[t]:!0}}});o=e.length===1?e[0]:{$and:e}}return{success:!0,data:{rows:await this.engine.aggregate(r,{where:o,groupBy:i.length>0?i:void 0,aggregations:a.length>0?a.map(e=>({function:e.method,field:e.field,alias:e.alias})):[{function:`count`,alias:`count`}]}),fields:[...i.map(e=>({name:e,type:`string`})),...a.map(e=>({name:e.alias,type:`number`}))]}}}async getAnalyticsMeta(e){let t=J.listItems(`object`),n=e?.cube,r=[];for(let e of t){let t=e;if(n&&t.name!==n)continue;let i={},a={},o=t.fields||{};i.count={name:`count`,label:`Count`,type:`count`,sql:`*`};for(let[e,t]of Object.entries(o)){let n=t,r=n.type||`text`;[`number`,`currency`,`percent`].includes(r)?(i[`${e}_sum`]={name:`${e}_sum`,label:`${n.label||e} (Sum)`,type:`sum`,sql:e},i[`${e}_avg`]={name:`${e}_avg`,label:`${n.label||e} (Avg)`,type:`avg`,sql:e},a[e]={name:e,label:n.label||e,type:`number`,sql:e}):[`date`,`datetime`].includes(r)?a[e]={name:e,label:n.label||e,type:`time`,sql:e,granularities:[`day`,`week`,`month`,`quarter`,`year`]}:[`boolean`].includes(r)?a[e]={name:e,label:n.label||e,type:`boolean`,sql:e}:a[e]={name:e,label:n.label||e,type:`string`,sql:e}}r.push({name:t.name,title:t.label||t.name,description:t.description,sql:t.name,measures:i,dimensions:a,public:!0})}return{success:!0,data:{cubes:r}}}mapAnalyticsOperator(e){return{equals:`$eq`,notEquals:`$ne`,contains:`$contains`,notContains:`$notContains`,gt:`$gt`,gte:`$gte`,lt:`$lt`,lte:`$lte`,set:`$ne`,notSet:`$eq`}[e]||`$eq`}async triggerAutomation(e){throw Error(`triggerAutomation requires plugin-automation service. Install and register a plugin that provides the "automation" service.`)}async deleteManyData(e){return this.engine.delete(e.object,{where:{id:{$in:e.ids}},...e.options})}async saveMetaItem(e){if(!e.item)throw Error(`Item data is required`);J.registerItem(e.type,e.item,`name`);try{let t=new Date().toISOString(),n=await this.engine.findOne(`sys_metadata`,{where:{type:e.type,name:e.name}});if(n)await this.engine.update(`sys_metadata`,{metadata:JSON.stringify(e.item),updated_at:t,version:(n.version||0)+1},{where:{id:n.id}});else{let n=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`meta_${Date.now()}_${Math.random().toString(36).slice(2)}`;await this.engine.insert(`sys_metadata`,{id:n,name:e.name,type:e.type,scope:`platform`,metadata:JSON.stringify(e.item),state:`active`,version:1,created_at:t,updated_at:t})}return{success:!0,message:`Saved to database and registry`}}catch(t){return console.warn(`[Protocol] DB persistence failed for ${e.type}/${e.name}: ${t.message}`),{success:!0,message:`Saved to memory registry (DB persistence unavailable)`,warning:t.message}}}async loadMetaFromDb(){let e=0,t=0;try{let n=await this.engine.find(`sys_metadata`,{where:{state:`active`}});for(let r of n)try{let t=typeof r.metadata==`string`?JSON.parse(r.metadata):r.metadata;r.type===`object`?J.registerObject(t,r.packageId||`sys_metadata`):J.registerItem(r.type,t,`name`),e++}catch(e){t++,console.warn(`[Protocol] Failed to hydrate ${r.type}/${r.name}: ${e instanceof Error?e.message:String(e)}`)}}catch(e){console.warn(`[Protocol] DB hydration skipped: ${e.message}`)}return{loaded:e,errors:t}}async listFeed(e){return{success:!0,data:await this.requireFeedService().listFeed({object:e.object,recordId:e.recordId,filter:e.type,limit:e.limit,cursor:e.cursor})}}async createFeedItem(e){return{success:!0,data:await this.requireFeedService().createFeedItem({object:e.object,recordId:e.recordId,type:e.type,actor:{type:`user`,id:`current_user`},body:e.body,mentions:e.mentions,parentId:e.parentId,visibility:e.visibility})}}async updateFeedItem(e){return{success:!0,data:await this.requireFeedService().updateFeedItem(e.feedId,{body:e.body,mentions:e.mentions,visibility:e.visibility})}}async deleteFeedItem(e){return await this.requireFeedService().deleteFeedItem(e.feedId),{success:!0,data:{feedId:e.feedId}}}async addReaction(e){return{success:!0,data:{reactions:await this.requireFeedService().addReaction(e.feedId,e.emoji,`current_user`)}}}async removeReaction(e){return{success:!0,data:{reactions:await this.requireFeedService().removeReaction(e.feedId,e.emoji,`current_user`)}}}async pinFeedItem(e){let t=this.requireFeedService(),n=await t.getFeedItem(e.feedId);if(!n)throw Error(`Feed item ${e.feedId} not found`);return await t.updateFeedItem(e.feedId,{visibility:n.visibility}),{success:!0,data:{feedId:e.feedId,pinned:!0,pinnedAt:new Date().toISOString()}}}async unpinFeedItem(e){let t=this.requireFeedService(),n=await t.getFeedItem(e.feedId);if(!n)throw Error(`Feed item ${e.feedId} not found`);return await t.updateFeedItem(e.feedId,{visibility:n.visibility}),{success:!0,data:{feedId:e.feedId,pinned:!1}}}async starFeedItem(e){let t=this.requireFeedService(),n=await t.getFeedItem(e.feedId);if(!n)throw Error(`Feed item ${e.feedId} not found`);return await t.updateFeedItem(e.feedId,{visibility:n.visibility}),{success:!0,data:{feedId:e.feedId,starred:!0,starredAt:new Date().toISOString()}}}async unstarFeedItem(e){let t=this.requireFeedService(),n=await t.getFeedItem(e.feedId);if(!n)throw Error(`Feed item ${e.feedId} not found`);return await t.updateFeedItem(e.feedId,{visibility:n.visibility}),{success:!0,data:{feedId:e.feedId,starred:!1}}}async searchFeed(e){let t=await this.requireFeedService().listFeed({object:e.object,recordId:e.recordId,filter:e.type,limit:e.limit,cursor:e.cursor}),n=(e.query||``).toLowerCase(),r=t.items.filter(e=>e.body?.toLowerCase().includes(n));return{success:!0,data:{items:r,total:r.length,hasMore:!1}}}async getChangelog(e){let t=await this.requireFeedService().listFeed({object:e.object,recordId:e.recordId,filter:`changes_only`,limit:e.limit,cursor:e.cursor});return{success:!0,data:{entries:t.items.map(e=>({id:e.id,object:e.object,recordId:e.recordId,actor:e.actor,changes:e.changes||[],timestamp:e.createdAt,source:e.source})),total:t.total,nextCursor:t.nextCursor,hasMore:t.hasMore}}}async feedSubscribe(e){return{success:!0,data:await this.requireFeedService().subscribe({object:e.object,recordId:e.recordId,userId:`current_user`,events:e.events,channels:e.channels})}}async feedUnsubscribe(e){let t=await this.requireFeedService().unsubscribe(e.object,e.recordId,`current_user`);return{success:!0,data:{object:e.object,recordId:e.recordId,unsubscribed:t}}}},H2=class e{constructor(e={}){this.drivers=new Map,this.defaultDriver=null,this.hooks=new Map([[`beforeFind`,[]],[`afterFind`,[]],[`beforeInsert`,[]],[`afterInsert`,[]],[`beforeUpdate`,[]],[`afterUpdate`,[]],[`beforeDelete`,[]],[`afterDelete`,[]]]),this.middlewares=[],this.actions=new Map,this.hostContext={},this.hostContext=e,this.logger=e.logger||nf({level:`info`,format:`pretty`}),this.logger.info(`ObjectQL Engine Instance Created`)}getStatus(){return{name:xi.enum.data,status:`running`,version:`0.9.0`,features:[`crud`,`query`,`aggregate`,`transactions`,`metadata`]}}get registry(){return J}async use(e,t){if(this.logger.debug(`Loading plugin`,{hasManifest:!!e,hasRuntime:!!t}),e&&this.registerApp(e),t){let e=t.default||t;if(e.onEnable){this.logger.debug(`Executing plugin runtime onEnable`);let t={ql:this,logger:this.logger,drivers:{register:e=>this.registerDriver(e)},...this.hostContext};await e.onEnable(t),this.logger.debug(`Plugin runtime onEnable completed`)}}}registerHook(e,t,n){this.hooks.has(e)||this.hooks.set(e,[]);let r=this.hooks.get(e);r.push({handler:t,object:n?.object,priority:n?.priority??100,packageId:n?.packageId}),r.sort((e,t)=>e.priority-t.priority),this.logger.debug(`Registered hook`,{event:e,object:n?.object,priority:n?.priority??100,totalHandlers:r.length})}async triggerHooks(e,t){let n=this.hooks.get(e)||[];if(n.length===0){this.logger.debug(`No hooks registered for event`,{event:e});return}this.logger.debug(`Triggering hooks`,{event:e,count:n.length});for(let e of n){if(e.object){let n=Array.isArray(e.object)?e.object:[e.object];if(!n.includes(`*`)&&!n.includes(t.object))continue}await e.handler(t)}}registerAction(e,t,n,r){let i=`${e}:${t}`;this.actions.set(i,{handler:n,package:r}),this.logger.debug(`Registered action`,{objectName:e,actionName:t,package:r})}async executeAction(e,t,n){let r=this.actions.get(`${e}:${t}`);if(!r)throw Error(`Action '${t}' on object '${e}' not found`);return r.handler(n)}removeActionsByPackage(e){for(let[t,n]of this.actions.entries())n.package===e&&this.actions.delete(t)}registerMiddleware(e,t){this.middlewares.push({fn:e,object:t?.object}),this.logger.debug(`Registered middleware`,{object:t?.object,total:this.middlewares.length})}async executeWithMiddleware(e,t){let n=this.middlewares.filter(t=>!t.object||t.object===`*`||t.object===e.object),r=0,i=async()=>{r<n.length?await n[r++].fn(e,i):e.result=await t()};return await i(),e.result}buildSession(e){if(e)return{userId:e.userId,tenantId:e.tenantId,roles:e.roles,accessToken:e.accessToken}}registerApp(e){let t=e.id||e.name,n=e.namespace;if(this.logger.debug(`Registering package manifest`,{id:t,namespace:n}),J.installPackage(e),this.logger.debug(`Installed Package`,{id:e.id,name:e.name,namespace:n}),e.objects)if(Array.isArray(e.objects)){this.logger.debug(`Registering objects from manifest (Array)`,{id:t,objectCount:e.objects.length});for(let r of e.objects){let e=J.registerObject(r,t,n,`own`);this.logger.debug(`Registered Object`,{fqn:e,from:t})}}else{this.logger.debug(`Registering objects from manifest (Map)`,{id:t,objectCount:Object.keys(e.objects).length});for(let[r,i]of Object.entries(e.objects)){i.name=r;let e=J.registerObject(i,t,n,`own`);this.logger.debug(`Registered Object`,{fqn:e,from:t})}}if(Array.isArray(e.objectExtensions)&&e.objectExtensions.length>0){this.logger.debug(`Registering object extensions`,{id:t,count:e.objectExtensions.length});for(let n of e.objectExtensions){let e=n.extend,r=n.priority??200,i={name:e,fields:n.fields,label:n.label,pluralLabel:n.pluralLabel,description:n.description,validations:n.validations,indexes:n.indexes};J.registerObject(i,t,void 0,`extend`,r),this.logger.debug(`Registered Object Extension`,{target:e,priority:r,from:t})}}if(Array.isArray(e.apps)&&e.apps.length>0){this.logger.debug(`Registering apps from manifest`,{id:t,count:e.apps.length});for(let n of e.apps){let e=n.name||n.id;e&&(J.registerApp(n,t),this.logger.debug(`Registered App`,{app:e,from:t}))}}e.name&&e.navigation&&!e.apps?.length&&(J.registerApp(e,t),this.logger.debug(`Registered manifest-as-app`,{app:e.name,from:t}));for(let n of[`actions`,`views`,`pages`,`dashboards`,`reports`,`themes`,`flows`,`workflows`,`approvals`,`webhooks`,`roles`,`permissions`,`profiles`,`sharingRules`,`policies`,`agents`,`ragPipelines`,`apis`,`hooks`,`mappings`,`analyticsCubes`,`connectors`]){let r=e[n];if(Array.isArray(r)&&r.length>0){this.logger.debug(`Registering ${n} from manifest`,{id:t,count:r.length});for(let e of r)(e.name||e.id)&&J.registerItem(n,e,`name`,t)}}let r=e.data;if(Array.isArray(r)&&r.length>0){this.logger.debug(`Registering seed data datasets`,{id:t,count:r.length});for(let e of r)e.object&&J.registerItem(`data`,e,`object`,t)}if(e.contributes?.kinds){this.logger.debug(`Registering kinds from manifest`,{id:t,kindCount:e.contributes.kinds.length});for(let n of e.contributes.kinds)J.registerKind(n),this.logger.debug(`Registered Kind`,{kind:n.name||n.type,from:t})}if(Array.isArray(e.plugins)&&e.plugins.length>0){this.logger.debug(`Processing nested plugins`,{id:t,count:e.plugins.length});for(let r of e.plugins)if(r&&typeof r==`object`){let e=r.name||r.id||`unnamed-plugin`;this.logger.debug(`Registering nested plugin`,{pluginName:e,parentId:t}),this.registerPlugin(r,t,n)}}}registerPlugin(e,t,n){let r=e.name||e.id||`unnamed`,i=e.namespace||n,a=t;if(e.objects)try{if(Array.isArray(e.objects)){this.logger.debug(`Registering plugin objects (Array)`,{pluginName:r,count:e.objects.length});for(let t of e.objects){let e=J.registerObject(t,a,i,`own`);this.logger.debug(`Registered Object`,{fqn:e,from:r})}}else{let t=Object.entries(e.objects);this.logger.debug(`Registering plugin objects (Map)`,{pluginName:r,count:t.length});for(let[e,n]of t){n.name=e;let t=J.registerObject(n,a,i,`own`);this.logger.debug(`Registered Object`,{fqn:t,from:r})}}}catch(e){this.logger.warn(`Failed to register plugin objects`,{pluginName:r,error:e.message})}if(e.name&&e.navigation)try{J.registerApp(e,a),this.logger.debug(`Registered plugin-as-app`,{app:e.name,from:r})}catch(e){this.logger.warn(`Failed to register plugin as app`,{pluginName:r,error:e.message})}for(let t of[`actions`,`views`,`pages`,`dashboards`,`reports`,`themes`,`flows`,`workflows`,`approvals`,`webhooks`,`roles`,`permissions`,`profiles`,`sharingRules`,`policies`,`agents`,`ragPipelines`,`apis`,`hooks`,`mappings`,`analyticsCubes`,`connectors`]){let n=e[t];if(Array.isArray(n)&&n.length>0)for(let e of n)(e.name||e.id)&&J.registerItem(t,e,`name`,a)}}registerDriver(e,t=!1){if(this.drivers.has(e.name)){this.logger.warn(`Driver already registered, skipping`,{driverName:e.name});return}this.drivers.set(e.name,e),this.logger.info(`Registered driver`,{driverName:e.name,version:e.version}),(t||this.drivers.size===1)&&(this.defaultDriver=e.name,this.logger.info(`Set default driver`,{driverName:e.name}))}getSchema(e){return J.getObject(e)}resolveObjectName(e){let t=J.getObject(e);return t?t.tableName||t.name:e}getDriver(e){let t=J.getObject(e);if(t){let n=t.datasource||`default`;if(n===`default`){if(this.defaultDriver&&this.drivers.has(this.defaultDriver))return this.drivers.get(this.defaultDriver)}else{if(this.drivers.has(n))return this.drivers.get(n);throw Error(`[ObjectQL] Datasource '${n}' configured for object '${e}' is not registered.`)}}if(this.defaultDriver)return this.drivers.get(this.defaultDriver);throw Error(`[ObjectQL] No driver available for object '${e}'`)}async init(){this.logger.info(`Initializing ObjectQL engine`,{driverCount:this.drivers.size,drivers:Array.from(this.drivers.keys())});for(let[e,t]of this.drivers)try{await t.connect(),this.logger.info(`Driver connected successfully`,{driverName:e})}catch(t){this.logger.error(`Failed to connect driver`,t,{driverName:e})}this.logger.info(`ObjectQL engine initialization complete`)}async destroy(){this.logger.info(`Destroying ObjectQL engine`,{driverCount:this.drivers.size});for(let[e,t]of this.drivers.entries())try{await t.disconnect()}catch(t){this.logger.error(`Error disconnecting driver`,t,{driverName:e})}this.logger.info(`ObjectQL engine destroyed`)}async expandRelatedRecords(t,n,r,i=0){if(!n||n.length===0||i>=e.MAX_EXPAND_DEPTH)return n;let a=J.getObject(t);if(!a||!a.fields)return n;for(let[e,o]of Object.entries(r)){let r=a.fields[e];if(!r||!r.reference||r.type!==`lookup`&&r.type!==`master_detail`)continue;let s=r.reference,c=[];for(let t of n){let n=t[e];if(n!=null)if(Array.isArray(n))c.push(...n.filter(e=>e!=null));else if(typeof n==`object`)continue;else c.push(n)}let l=[...new Set(c)];if(l.length!==0)try{let t={object:s,where:{id:{$in:l}},...o.fields?{fields:o.fields}:{},...o.orderBy?{orderBy:o.orderBy}:{}},r=await this.getDriver(s).find(s,t)??[],a=new Map;for(let e of r){let t=e.id;t!=null&&a.set(String(t),e)}if(o.expand&&Object.keys(o.expand).length>0){let e=await this.expandRelatedRecords(s,r,o.expand,i+1);a.clear();for(let t of e){let e=t.id;e!=null&&a.set(String(e),t)}}for(let t of n){let n=t[e];n!=null&&(Array.isArray(n)?t[e]=n.map(e=>a.get(String(e))??e):typeof n!=`object`&&(t[e]=a.get(String(n))??n))}}catch(n){this.logger.warn(`Failed to expand relationship field; retaining foreign key IDs`,{object:t,field:e,reference:s,error:n.message})}}return n}async find(e,t){e=this.resolveObjectName(e),this.logger.debug(`Find operation starting`,{object:e,query:t});let n=this.getDriver(e),r={object:e,...t};delete r.context,r.top!=null&&r.limit==null&&(r.limit=r.top),delete r.top;let i={object:e,operation:`find`,ast:r,options:t,context:t?.context};return await this.executeWithMiddleware(i,async()=>{let t={object:e,event:`beforeFind`,input:{ast:i.ast,options:i.options},session:this.buildSession(i.context),transaction:i.context?.transaction,ql:this};await this.triggerHooks(`beforeFind`,t);try{let i=await n.find(e,t.input.ast,t.input.options);return r.expand&&Object.keys(r.expand).length>0&&Array.isArray(i)&&(i=await this.expandRelatedRecords(e,i,r.expand,0)),t.event=`afterFind`,t.result=i,await this.triggerHooks(`afterFind`,t),t.result}catch(t){throw this.logger.error(`Find operation failed`,t,{object:e}),t}}),i.result}async findOne(e,t){e=this.resolveObjectName(e),this.logger.debug(`FindOne operation`,{objectName:e});let n=this.getDriver(e),r={object:e,...t,limit:1};delete r.context,delete r.top;let i={object:e,operation:`findOne`,ast:r,options:t,context:t?.context};return await this.executeWithMiddleware(i,async()=>{let t=await n.findOne(e,i.ast);return r.expand&&Object.keys(r.expand).length>0&&t!=null&&(t=(await this.expandRelatedRecords(e,[t],r.expand,0))[0]),t}),i.result}async insert(e,t,n){e=this.resolveObjectName(e),this.logger.debug(`Insert operation starting`,{object:e,isBatch:Array.isArray(t)});let r=this.getDriver(e),i={object:e,operation:`insert`,data:t,options:n,context:n?.context};return await this.executeWithMiddleware(i,async()=>{let t={object:e,event:`beforeInsert`,input:{data:i.data,options:i.options},session:this.buildSession(i.context),transaction:i.context?.transaction,ql:this};await this.triggerHooks(`beforeInsert`,t);try{let n;return n=Array.isArray(t.input.data)?r.bulkCreate?await r.bulkCreate(e,t.input.data,t.input.options):await Promise.all(t.input.data.map(n=>r.create(e,n,t.input.options))):await r.create(e,t.input.data,t.input.options),t.event=`afterInsert`,t.result=n,await this.triggerHooks(`afterInsert`,t),t.result}catch(t){throw this.logger.error(`Insert operation failed`,t,{object:e}),t}}),i.result}async update(e,t,n){e=this.resolveObjectName(e),this.logger.debug(`Update operation starting`,{object:e});let r=this.getDriver(e),i=t.id;!i&&n?.where&&typeof n.where==`object`&&`id`in n.where&&(i=n.where.id);let a={object:e,operation:`update`,data:t,options:n,context:n?.context};return await this.executeWithMiddleware(a,async()=>{let t={object:e,event:`beforeUpdate`,input:{id:i,data:a.data,options:a.options},session:this.buildSession(a.context),transaction:a.context?.transaction,ql:this};await this.triggerHooks(`beforeUpdate`,t);try{let i;if(t.input.id)i=await r.update(e,t.input.id,t.input.data,t.input.options);else if(n?.multi&&r.updateMany){let a={object:e,where:n.where};i=await r.updateMany(e,a,t.input.data,t.input.options)}else throw Error(`Update requires an ID or options.multi=true`);return t.event=`afterUpdate`,t.result=i,await this.triggerHooks(`afterUpdate`,t),t.result}catch(t){throw this.logger.error(`Update operation failed`,t,{object:e}),t}}),a.result}async delete(e,t){e=this.resolveObjectName(e),this.logger.debug(`Delete operation starting`,{object:e});let n=this.getDriver(e),r;t?.where&&typeof t.where==`object`&&`id`in t.where&&(r=t.where.id);let i={object:e,operation:`delete`,options:t,context:t?.context};return await this.executeWithMiddleware(i,async()=>{let a={object:e,event:`beforeDelete`,input:{id:r,options:i.options},session:this.buildSession(i.context),transaction:i.context?.transaction,ql:this};await this.triggerHooks(`beforeDelete`,a);try{let r;if(a.input.id)r=await n.delete(e,a.input.id,a.input.options);else if(t?.multi&&n.deleteMany){let i={object:e,where:t.where};r=await n.deleteMany(e,i,a.input.options)}else throw Error(`Delete requires an ID or options.multi=true`);return a.event=`afterDelete`,a.result=r,await this.triggerHooks(`afterDelete`,a),a.result}catch(t){throw this.logger.error(`Delete operation failed`,t,{object:e}),t}}),i.result}async count(e,t){e=this.resolveObjectName(e);let n=this.getDriver(e),r={object:e,operation:`count`,options:t,context:t?.context};return await this.executeWithMiddleware(r,async()=>{if(n.count){let r={object:e,where:t?.where};return n.count(e,r)}return(await this.find(e,{where:t?.where,fields:[`id`]})).length}),r.result}async aggregate(e,t){e=this.resolveObjectName(e);let n=this.getDriver(e);this.logger.debug(`Aggregate on ${e} using ${n.name}`,t);let r={object:e,operation:`aggregate`,options:t,context:t?.context};return await this.executeWithMiddleware(r,async()=>{let r={object:e,where:t.where,groupBy:t.groupBy,aggregations:t.aggregations};return n.find(e,r)}),r.result}async execute(e,t){if(t?.object){let n=this.getDriver(t.object);if(n.execute)return n.execute(e,void 0,t)}throw Error(`Execute requires options.object to select driver`)}registerObject(e,t=`__runtime__`,n){if(e.fields)for(let[t,n]of Object.entries(e.fields))n&&typeof n==`object`&&!(`name`in n)&&(n.name=t);return J.registerObject(e,t,n)}unregisterObject(e,t){t?J.unregisterObjectsByPackage(t):J.unregisterItem(`object`,e)}getObject(e){return this.getSchema(e)}getConfigs(){let e={},t=J.getAllObjects();for(let n of t)n.name&&(e[n.name]=n);return e}getDriverByName(e){return this.drivers.get(e)}getDriverForObject(e){try{return this.getDriver(e)}catch{return}}datasource(e){let t=this.drivers.get(e);if(!t)throw Error(`[ObjectQL] Datasource '${e}' not found`);return t}on(e,t,n,r){this.registerHook(e,n,{object:t,packageId:r})}removePackage(e){for(let[t,n]of this.hooks.entries()){let r=n.filter(t=>t.packageId!==e);r.length!==n.length&&this.hooks.set(t,r)}this.removeActionsByPackage(e),J.unregisterObjectsByPackage(e,!0)}async close(){return this.destroy()}createContext(e){return new G2(Yhe.parse(e),this)}static async create(t){let n=new e;if(t.datasources)for(let[e,r]of Object.entries(t.datasources))r.name||=e,n.registerDriver(r,e===`default`);if(t.objects)for(let[e,r]of Object.entries(t.objects))n.registerObject(r);if(t.hooks)for(let e of t.hooks)n.on(e.event,e.object,e.handler);return await n.init(),n}};H2.MAX_EXPAND_DEPTH=3;var U2=H2,W2=class{constructor(e,t,n){this.objectName=e,this.context=t,this.engine=n}async find(e={}){return this.engine.find(this.objectName,{...e,context:this.context})}async findOne(e={}){return this.engine.findOne(this.objectName,{...e,context:this.context})}async insert(e){return this.engine.insert(this.objectName,e,{context:this.context})}async create(e){return this.insert(e)}async update(e,t={}){return this.engine.update(this.objectName,e,{...t,context:this.context})}async updateById(e,t){return this.engine.update(this.objectName,{...t,id:e},{where:{id:e},context:this.context})}async delete(e={}){return this.engine.delete(this.objectName,{...e,context:this.context})}async deleteById(e){return this.engine.delete(this.objectName,{where:{id:e},context:this.context})}async count(e={}){return this.engine.count(this.objectName,{...e,context:this.context})}async aggregate(e={}){return this.engine.aggregate(this.objectName,{...e,context:this.context})}async execute(e,t){if(this.engine.executeAction)return this.engine.executeAction(this.objectName,e,{...t,userId:this.context.userId,tenantId:this.context.tenantId,roles:this.context.roles});throw Error(`Actions not supported by engine`)}},G2=class e{constructor(e,t){this.executionContext=e,this.engine=t}object(e){return new W2(e,this.executionContext,this.engine)}sudo(){return new e({...this.executionContext,isSystem:!0},this.engine)}async transaction(t){let n=this.engine,r=n.defaultDriver?n.drivers?.get(n.defaultDriver):void 0;if(!r?.beginTransaction)return t(this);let i=await r.beginTransaction(),a=new e({...this.executionContext,transaction:i},this.engine);try{let e=await t(a);return r.commit?await r.commit(i):r.commitTransaction&&await r.commitTransaction(i),e}catch(e){throw r.rollback?await r.rollback(i):r.rollbackTransaction&&await r.rollbackTransaction(i),e}}get userId(){return this.executionContext.userId}get tenantId(){return this.executionContext.tenantId}get spaceId(){return this.executionContext.tenantId}get roles(){return this.executionContext.roles}get isSystem(){return this.executionContext.isSystem}get transactionHandle(){return this.executionContext.transaction}},K2=class{async register(e,t,n){let r=typeof n==`object`&&n?{...n,name:n.name??t}:n;e===`object`?J.registerItem(e,r,`name`):J.registerItem(e,r,r.id?`id`:`name`)}async get(e,t){let n=J.getItem(e,t);return n?.content??n}getEntry(e,t){return J.getItem(e,t)}async list(e){return J.listItems(e).map(e=>e?.content??e)}async unregister(e,t){J.unregisterItem(e,t)}async exists(e,t){return J.getItem(e,t)!=null}async listNames(e){return J.listItems(e).map(e=>e?.name??e?.content?.name??``).filter(Boolean)}async unregisterPackage(e){J.unregisterObjectsByPackage(e)}async getObject(e){return J.getObject(e)}async listObjects(){return J.getAllObjects()}},q2=class{constructor(e,t){this.name=`com.objectstack.engine.objectql`,this.type=`objectql`,this.version=`1.0.0`,this.init=async e=>{this.ql||=new U2({...this.hostContext,logger:e.logger}),e.registerService(`objectql`,this.ql);let t=!1,n=`objectql`;try{e.getService(`metadata`)&&(t=!0,n=`external`)}catch{}if(t)e.logger.info(`External metadata service detected`,{provider:n,mode:`will-sync-in-start-phase`});else try{let t=new K2;e.registerService(`metadata`,t),e.logger.info(`MetadataFacade registered as metadata service`,{mode:`in-memory`,features:[`registry`,`fast-lookup`]})}catch(e){if(!e.message?.includes(`already registered`))throw e}e.registerService(`data`,this.ql),e.logger.info(`ObjectQL engine registered`,{services:[`objectql`,`data`],metadataProvider:n});let r=new V2(this.ql,()=>e.getServices?e.getServices():new Map);e.registerService(`protocol`,r),e.logger.info(`Protocol service registered`)},this.start=async e=>{e.logger.info(`ObjectQL engine starting...`);try{let t=e.getService(`metadata`);t&&!(t instanceof K2)&&this.ql&&await this.loadMetadataFromService(t,e)}catch{e.logger.debug(`No external metadata service to sync from`)}if(e.getServices&&this.ql){let t=e.getServices();for(let[n,r]of t.entries())n.startsWith(`driver.`)&&(this.ql.registerDriver(r),e.logger.debug(`Discovered and registered driver service`,{serviceName:n})),n.startsWith(`app.`)&&(this.ql.registerApp(r),e.logger.debug(`Discovered and registered app service`,{serviceName:n}))}await this.ql?.init(),await this.syncRegisteredSchemas(e),this.registerAuditHooks(e),this.registerTenantMiddleware(e),e.logger.info(`ObjectQL engine started`,{driversRegistered:this.ql?.drivers?.size||0,objectsRegistered:this.ql?.registry?.getAllObjects?.()?.length||0})},e?this.ql=e:this.hostContext=t}registerAuditHooks(e){this.ql&&(this.ql.registerHook(`beforeInsert`,async e=>{if(e.session?.userId&&e.input?.data){let t=e.input.data;typeof t==`object`&&t&&(t.created_by=t.created_by??e.session.userId,t.updated_by=e.session.userId,t.created_at=t.created_at??new Date().toISOString(),t.updated_at=new Date().toISOString(),e.session.tenantId&&(t.tenant_id=t.tenant_id??e.session.tenantId))}},{object:`*`,priority:10}),this.ql.registerHook(`beforeUpdate`,async e=>{if(e.session?.userId&&e.input?.data){let t=e.input.data;typeof t==`object`&&t&&(t.updated_by=e.session.userId,t.updated_at=new Date().toISOString())}},{object:`*`,priority:10}),this.ql.registerHook(`beforeUpdate`,async e=>{if(e.input?.id&&!e.previous)try{let t=await this.ql.findOne(e.object,{where:{id:e.input.id}});t&&(e.previous=t)}catch{}},{object:`*`,priority:5}),this.ql.registerHook(`beforeDelete`,async e=>{if(e.input?.id&&!e.previous)try{let t=await this.ql.findOne(e.object,{where:{id:e.input.id}});t&&(e.previous=t)}catch{}},{object:`*`,priority:5}),e.logger.debug(`Audit hooks registered (created_by/updated_by, previousData)`))}registerTenantMiddleware(e){this.ql&&(this.ql.registerMiddleware(async(e,t)=>{if(!e.context?.tenantId||e.context?.isSystem)return t();if([`find`,`findOne`,`count`,`aggregate`].includes(e.operation)&&e.ast){let t={tenant_id:e.context.tenantId};e.ast.where?e.ast.where={$and:[e.ast.where,t]}:e.ast.where=t}await t()}),e.logger.debug(`Tenant isolation middleware registered`))}async syncRegisteredSchemas(e){if(!this.ql)return;let t=this.ql.registry?.getAllObjects?.()??[];if(t.length===0)return;let n=0,r=0,i=new Map;for(let n of t){let t=this.ql.getDriverForObject(n.name);if(!t){e.logger.debug(`No driver available for object, skipping schema sync`,{object:n.name}),r++;continue}if(typeof t.syncSchema!=`function`){e.logger.debug(`Driver does not support syncSchema, skipping`,{object:n.name,driver:t.name}),r++;continue}let a=n.tableName||n.name,o=i.get(t);o||(o=[],i.set(t,o)),o.push({obj:n,tableName:a})}for(let[t,r]of i)if(t.supports?.batchSchemaSync&&typeof t.syncSchemasBatch==`function`){let i=r.map(e=>({object:e.tableName,schema:e.obj}));try{await t.syncSchemasBatch(i),n+=r.length,e.logger.debug(`Batch schema sync succeeded`,{driver:t.name,count:r.length})}catch(i){e.logger.warn(`Batch schema sync failed, falling back to sequential`,{driver:t.name,error:i instanceof Error?i.message:String(i)});for(let{obj:i,tableName:a}of r)try{await t.syncSchema(a,i),n++}catch(n){e.logger.warn(`Failed to sync schema for object`,{object:i.name,tableName:a,driver:t.name,error:n instanceof Error?n.message:String(n)})}}}else for(let{obj:i,tableName:a}of r)try{await t.syncSchema(a,i),n++}catch(n){e.logger.warn(`Failed to sync schema for object`,{object:i.name,tableName:a,driver:t.name,error:n instanceof Error?n.message:String(n)})}(n>0||r>0)&&e.logger.info(`Schema sync complete`,{synced:n,skipped:r,total:t.length})}async loadMetadataFromService(e,t){t.logger.info(`Syncing metadata from external service into ObjectQL registry...`);let n=[`object`,`view`,`app`,`flow`,`workflow`,`function`],r=0;for(let i of n)try{if(typeof e.loadMany==`function`){let n=await e.loadMany(i);n&&n.length>0&&(n.forEach(e=>{let t=e.id?`id`:`name`;i===`object`&&this.ql||this.ql?.registry?.registerItem&&this.ql.registry.registerItem(i,e,t)}),r+=n.length,t.logger.info(`Synced ${n.length} ${i}(s) from metadata service`))}}catch(e){t.logger.debug(`No ${i} metadata found or error loading`,{error:e.message})}r>0&&t.logger.info(`Metadata sync complete: ${r} items loaded into ObjectQL registry`)}},sve=16777619;function J2(e,t){return e*sve^t>>>0}function Y2(e){if(Number.isNaN(e))return 2143289344;if(!Number.isFinite(e))return e>0?2139095040:4286578688;let t=Math.trunc(e),n=e-t,r=t|0;if(n!==0){let e=Math.floor(n*4294967296);r=J2(r,e|0)}return r>>>0}function X2(e){let t=0;for(let n=0;n<e.length;n++)t=J2(t,e.charCodeAt(n));return t>>>0}function cve(e){let t=0,n=e<0n,r=n?-e:e;if(r===0n)t=J2(t,0);else for(;r>0n;){let e=Number(r&255n);t=J2(t,e),r>>=8n}return J2(t,+n)>>>0}function lve(e){let t=X2((e.name||``)+e.toString());return t=J2(t,e.length),t>>>0}function uve(e){let t=0;for(let n=0;n<e.length;n++)t=J2(t,e[n]);return t>>>0}function dve(e){let t=X2(e.constructor.name),n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return t=J2(t,uve(n)),t>>>0}function fve(e,t){if(t.has(e))return 13;t.add(e);let n=1;for(let r=0;r<e.length;r++)n=J2(n,Z2(e[r],t));return t.delete(e),n>>>0}function pve(e,t){if(t.has(e))return 13;t.add(e);let n=Object.keys(e).sort(),r=X2(e?.constructor?.name);for(let i of n)r=J2(r,X2(i)),r=J2(r,Z2(e[i],t));return t.delete(e),r>>>0}var mve=[3735928559,305441741].map(e=>J2(3,e)),hve=J2(1,0),gve=J2(2,0);function Z2(e,t){if(e===null)return hve;switch(typeof e){case`undefined`:return gve;case`boolean`:return mve[+e];case`number`:return J2(4,Y2(e));case`string`:return J2(5,X2(e));case`bigint`:return J2(6,cve(e));case`function`:return J2(7,lve(e));default:return ArrayBuffer.isView(e)&&!(e instanceof DataView)?J2(12,dve(e)):e instanceof Date?J2(10,Y2(e.getTime())):e instanceof RegExp?J2(11,J2(X2(e.source),X2(e.flags))):Array.isArray(e)?J2(8,fve(e,t)):J2(9,pve(e,t))}}function Q2(e){return Z2(e,new WeakSet)>>>0}var $2=class extends Error{},e4=Symbol(`missing`),_ve=`mingo: cycle detected while processing object/array`,t4=e=>typeof e!=`object`&&typeof e!=`function`||e===null,n4=e=>t4(e)||_4(e)||v4(e),r4={undefined:1,null:2,number:3,string:4,symbol:5,object:6,array:7,arraybuffer:8,boolean:9,date:10,regexp:11,function:12},i4=Object.keys(r4).length*2,a4=(e,t)=>e<t?-1:e>t?1:0,vve=(e,t)=>{let n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=a4(n[e],r[e]);if(t!==0)return t}return a4(n.length,r.length)};function o4(e,t,n=!1){let r=0;if(e===e4&&(e=void 0),t===e4&&(t=void 0),e===t||Object.is(e,t))return 0;let i=C4(e)?`arraybuffer`:d4(e),a=C4(t)?`arraybuffer`:d4(t);if(i!==a){if(i==`undefined`)return-1;if(a==`undefined`)return 1;if(n&&i==`array`&&!e.length)return-1;if(n&&a==`array`&&!t.length)return 1;if(n){if(Z(e)){let n=e.slice().sort(o4);r=1;for(let e of n)if((r=Math.min(r,o4(e,t)))<0)return r;return r}else if(Z(t)){let n=t.slice().sort(o4);r=-1;for(let t of n)if((r=Math.max(r,o4(e,t)))>0)return r;return r}}let o=r4[i]??i4,s=r4[a]??i4;if(o!==s)return a4(o,s)}switch(i){case`number`:case`string`:return a4(e,t);case`boolean`:case`date`:return a4(+e,+t);case`regexp`:return(r=a4(e.source,t.source))||(r=a4(e.flags,t.flags))?r:0;case`arraybuffer`:return vve(e,t);case`array`:{let n=e.slice().sort(o4),i=t.slice().sort(o4),a=Math.min(n.length,i.length);for(let e=0;e<a;e++)if(r=o4(n[e],i[e]))return r;return a4(n.length,i.length)}default:{if(i!==`object`){if(e?.constructor===t?.constructor&&c4(e))return a4(e.toString(),t.toString());if(r=a4(e?.constructor?.name,t?.constructor?.name))return r}let n=Object.keys(e).sort();if(r=o4(n,Object.keys(t).sort()))return r;for(let i of n)if(r=o4(e[i],t[i]))return r;return 0}}}var s4=(e,t)=>o4(e,t,!0),c4=e=>e!=null&&e.toString!==Object.prototype.toString;function l4(e,t){if(e===t||Object.is(e,t))return!0;if(e===null||t===null||typeof e!=typeof t||typeof e!=`object`||e.constructor!==t.constructor)return!1;if(_4(e))return _4(t)&&+e==+t;if(v4(e))return v4(t)&&e.source===t.source&&e.flags===t.flags;if(Z(e)&&Z(t))return e.length===t.length&&e.every((e,n)=>l4(e,t[n]));if(e?.constructor!==Object&&c4(e))return e?.toString()===t?.toString();let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>S4(t,n)&&l4(e[n],t[n])):!1}var u4=class e extends Map{#e=new Map;#t=e=>{let t=Q2(e);return[(this.#e.get(t)||[]).find(t=>l4(t,e)),t]};constructor(){super()}static init(){return new e}clear(){super.clear(),this.#e.clear()}delete(e){if(t4(e))return super.delete(e);let[t,n]=this.#t(e);return super.delete(t)?(this.#e.set(n,this.#e.get(n).filter(e=>!l4(e,t))),!0):!1}get(e){if(t4(e))return super.get(e);let[t,n]=this.#t(e);return super.get(t)}has(e){if(t4(e))return super.has(e);let[t,n]=this.#t(e);return super.has(t)}set(e,t){if(t4(e))return super.set(e,t);let[n,r]=this.#t(e);if(super.has(n))super.set(n,t);else{super.set(e,t);let n=this.#e.get(r)||[];n.push(e),this.#e.set(r,n)}return this}get size(){return super.size}};function Y(e,t){if(!e)throw new $2(t)}function d4(e){if(e===null)return`null`;let t=typeof e;return t!==`object`&&r4[t]?t:Z(e)?`array`:_4(e)?`date`:v4(e)?`regexp`:e?.constructor?.name?.toLowerCase()??`object`}var f4=e=>typeof e==`boolean`,p4=e=>typeof e==`string`,X=e=>!Number.isNaN(e)&&typeof e==`number`,m4=Number.isInteger,Z=Array.isArray,h4=e=>d4(e)===`object`,g4=e=>!t4(e),_4=e=>e instanceof Date,v4=e=>e instanceof RegExp,yve=e=>typeof e==`function`,Q=e=>e==null,y4=(e,t=!0)=>!!e||t&&e===``,b4=e=>Q(e)||p4(e)&&!e||Z(e)&&e.length===0||h4(e)&&Object.keys(e).length===0,x4=e=>Z(e)?e:[e],S4=(e,...t)=>!!e&&t.every(t=>Object.prototype.hasOwnProperty.call(e,t)),C4=e=>typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e),w4=(e,t)=>{if(Q(e)||f4(e)||X(e)||p4(e))return e;if(_4(e))return new Date(e);if(v4(e))return new RegExp(e);if(C4(e)){let t=e.constructor;return new t(e)}if(t instanceof Set||(t=new Set),t.has(e))throw Error(_ve);t.add(e);try{if(Z(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=w4(e[r],t);return n}if(h4(e)){let n={};for(let r of Object.keys(e))n[r]=w4(e[r],t);return n}}finally{t.delete(e)}return e};function T4(e){if(e.length===0||e.some(e=>e.length===0))return[];if(e.length===1)return e[0].slice();let t=[u4.init(),u4.init()];e[e.length-1].forEach(e=>t[0].set(e,!0));for(let n=e.length-2;n>-1;n--){if(e[n].forEach(e=>{t[0].has(e)&&t[1].set(e,!0)}),t[1].size===0)return[];t.reverse(),t[1].clear()}return Array.from(t[0].keys())}function E4(e,t=1){let n=[];function r(e,t){for(let i=0,a=e.length;i<a;i++)Z(e[i])&&(t>0||t<0)?r(e[i],Math.max(-1,t-1)):n.push(e[i])}return r(e,t),n}function D4(e){let t=u4.init();return e.forEach(e=>t.set(e,!0)),Array.from(t.keys())}function O4(e,t){if(e.length<1)return new Map;let n=u4.init();for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r)??null,o=n.get(a);o?o.push(i):(o=[i],n.set(a,o))}return n}function k4(e,t){return g4(e)?e[t]:void 0}function bve(e,t){if(t<1)return e;for(;t--&&e.length===1&&Z(e[0]);)e=e[0];return e}function A4(e,t,n){let r=0;function i(e,t){let n=e;for(let e=0;e<t.length;e++){let a=t[e];if(/^\d+$/.exec(a)===null&&Z(n)){if(e===0&&r>0)break;r+=1;let a=t.slice(e);n=n.reduce((e,t)=>{let n=i(t,a);return n!==void 0&&e.push(n),e},[]);break}else n=k4(n,a);if(n===void 0)break}return n}let a=n4(e)?e:i(e,t.split(`.`));return Z(a)&&n?.unwrapArray?bve(a,r):a}function j4(e,t,n){let r=t.indexOf(`.`),i=r==-1?t:t.substring(0,r),a=t.substring(r+1),o=r!=-1;if(Z(e)){let r=/^\d+$/.test(i),s=r&&n?.preserveIndex?e.slice():[];if(r){let t=parseInt(i),r=k4(e,t);o&&(r=j4(r,a,n)),n?.preserveIndex?s[t]=r:s.push(r)}else for(let r of e){let e=j4(r,t,n);n?.preserveMissing?s.push(e??e4):(e!=null||n?.preserveIndex)&&s.push(e)}return s}let s=n?.preserveKeys?{...e}:{},c=k4(e,i);if(o&&(c=j4(c,a,n)),c!==void 0)return s[i]=c,s}function M4(e){if(Z(e))for(let t=e.length-1;t>=0;t--)e[t]===e4?e.splice(t,1):M4(e[t]);else if(h4(e))for(let t of Object.keys(e))S4(e,t)&&M4(e[t])}var N4=/^\d+$/;function P4(e,t,n,r){let i=t.split(`.`),a=i[0],o=i.slice(1).join(`.`);if(i.length===1)(h4(e)||Z(e)&&N4.test(a))&&n(e,a);else{r?.buildGraph&&Q(e[a])&&(e[a]={});let t=e[a];if(!t)return;let s=!!(i.length>1&&N4.test(i[1]));Z(t)&&r?.descendArray&&!s?t.forEach((e=>P4(e,o,n,r))):P4(t,o,n,r)}}function F4(e,t,n){P4(e,t,(e,t)=>e[t]=n,{buildGraph:!0})}function I4(e,t,n){P4(e,t,((e,t)=>{Z(e)?e.splice(parseInt(t),1):h4(e)&&delete e[t]}),n)}var L4=e=>e&&e[0]===`$`&&/^\$[a-zA-Z0-9_]+$/.test(e);function R4(e){if(n4(e))return v4(e)?{$regex:e}:{$eq:e};if(g4(e)){if(!Object.keys(e).some(L4))return{$eq:e};if(S4(e,`$regex`)){let t={...e};return t.$regex=new RegExp(e.$regex,e.$options),delete t.$options,t}}return e}function z4(e,t,n=s4){let r=0,i=e.length-1;for(;r<=i;){let a=Math.round(r+(i-r)/2);if(n(t,e[a])<0)i=a-1;else if(n(t,e[a])>0)r=a+1;else return a}return r}var xve=class{constructor(){this.root={children:new Map,isTerminal:!1}}add(e){let t=e.split(`.`),n=this.root;for(let e of t){if(n.isTerminal)return!1;n.children.has(e)||n.children.set(e,{children:new Map,isTerminal:!1}),n=n.children.get(e)}return n.isTerminal||n.children.size?!1:n.isTerminal=!0}},B4=(e=>(e[e.CLONE_OFF=0]=`CLONE_OFF`,e[e.CLONE_INPUT=1]=`CLONE_INPUT`,e[e.CLONE_OUTPUT=2]=`CLONE_OUTPUT`,e[e.CLONE_ALL=3]=`CLONE_ALL`,e))(B4||{}),V4=class e{constructor(e,t){this.options=e,this.#e=t?{...t}:{}}#e;static init(t){return t instanceof e?new e(t.options,t.#e):new e({idKey:`_id`,scriptEnabled:!0,useStrictMode:!0,failOnError:!0,processingMode:0,...t,context:t?.context?U4.from(t?.context):U4.init()})}update(e){return Object.assign(this.#e,e,{timestamp:this.#e.timestamp,variables:{...this.#e?.variables,...e?.variables}}),this}get local(){return this.#e}get now(){return this.#e?.timestamp||Object.assign(this.#e,{timestamp:Date.now()}),new Date(this.#e.timestamp)}get idKey(){return this.options.idKey}get collation(){return this.options?.collation}get processingMode(){return this.options?.processingMode}get useStrictMode(){return this.options?.useStrictMode}get scriptEnabled(){return this.options?.scriptEnabled}get failOnError(){return this.options?.failOnError}get collectionResolver(){return this.options?.collectionResolver}get jsonSchemaValidator(){return this.options?.jsonSchemaValidator}get variables(){return this.options?.variables}get context(){return this.options?.context}},H4=(e=>(e.ACCUMULATOR=`accumulator`,e.EXPRESSION=`expression`,e.PIPELINE=`pipeline`,e.PROJECTION=`projection`,e.QUERY=`query`,e.WINDOW=`window`,e))(H4||{}),U4=class e{#e=new Map(Object.values(H4).map(e=>[e,{}]));constructor(){}static init(t={}){let n=new e;for(let[e,r]of Object.entries(t))n.#e.has(e)&&r&&n.addOps(e,r);return n}static from(...t){let n=new e;for(let e of t)for(let t of Object.values(H4))n.addOps(t,e.#e.get(t));return n}addOps(e,t){return this.#e.set(e,Object.assign({},t,this.#e.get(e))),this}getOperator(e,t){return this.#e.get(e)[t]??null}addAccumulatorOps(e){return this.addOps(`accumulator`,e)}addExpressionOps(e){return this.addOps(`expression`,e)}addQueryOps(e){return this.addOps(`query`,e)}addPipelineOps(e){return this.addOps(`pipeline`,e)}addProjectionOps(e){return this.addOps(`projection`,e)}addWindowOps(e){return this.addOps(`window`,e)}};function $(e,t,n,r){let i=!(r instanceof V4)||Q(r.local.root)?V4.init(r).update({root:e}):r;return L4(n)?G4(e,t,n,i):W4(e,t,i)}var Sve=[`$$ROOT`,`$$CURRENT`,`$$REMOVE`,`$$NOW`];function W4(e,t,n){if(p4(t)&&t.length>0&&t[0]===`$`){if(t===`$$KEEP`||t===`$$PRUNE`||t===`$$DESCEND`)return t;let r=n.local.root,i=t.split(`.`);if(Sve.includes(i[0])){switch(i[0]){case`$$ROOT`:break;case`$$CURRENT`:r=e;break;case`$$REMOVE`:r=void 0;break;case`$$NOW`:r=new Date(n.now);break}t=t.slice(i[0].length+1)}else if(i[0].slice(0,2)===`$$`){r=Object.assign({},n.variables,{this:e},n?.local?.variables);let a=i[0].slice(2);Y(S4(r,a),`Use of undefined variable: ${a}`),t=t.slice(2)}else t=t.slice(1);return t===``?r:A4(r,t)}if(Z(t))return t.map(t=>W4(e,t,n));if(h4(t)){let r={},i=Object.entries(t);for(let[a,o]of i){if(L4(a))return Y(i.length===1,`Expression must contain a single operator. got [${Object.keys(t).join(`,`)}]`),G4(e,o,a,n);r[a]=W4(e,o,n)}return r}return t}function G4(e,t,n,r){let i=r.context,a=i.getOperator(`expression`,n);if(a)return a(e,t,r);let o=i.getOperator(`accumulator`,n);return Y(!!o,`accumulator '${n}' is not registered.`),Z(e)||(e=W4(e,t,r),t=null),Y(Z(e),`arguments must resolve to array for ${n}.`),o(e,t,r)}function K4(e){return e instanceof J4?e:new J4(e)}function q4(...e){let t=0;return K4(()=>{for(;t<e.length;){let n=e[t].next();if(!n.done)return n;t++}return{done:!0,value:void 0}})}function Cve(e){return!!e&&typeof e==`object`&&typeof e?.next==`function`}function wve(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e[Symbol.iterator]==`function`}var J4=class{#e=[];#t=[];#n;#r=!1;constructor(e){let t=wve(e)?e[Symbol.iterator]():Cve(e)?e:typeof e==`function`?{next:e}:null;Y(!!t,`Iterator must be initialized with an iterable or function.`);let n=-1,r={done:!1};this.#n=()=>{for(;!r.done&&(r=t.next(),!r.done);){let e=r.value;if(n++,this.#e.every(({op:t,fn:r})=>{let i=r(e,n);return t===`map`?!!(e=i)||!0:i}))return{value:e,done:!1}}return{done:!0}}}push(e,t){return this.#e.push({op:e,fn:t}),this}next(){return this.#n()}map(e){return this.push(`map`,e)}filter(e){return this.push(`filter`,e)}take(e){return Y(e>=0,`value must be a non‑negative integer`),this.filter(t=>e-- >0)}drop(e){return Y(e>=0,`value must be a non‑negative integer`),this.filter(t=>e--<=0)}transform(e){let t=this,n;return K4(()=>(n||=K4(e(t.collect())),n.next()))}collect(){for(;!this.#r;){let{done:e,value:t}=this.#n();e||this.#t.push(t),this.#r=e}return this.#t}each(e){for(let t=this.next();t.done!==!0;t=this.next())e(t.value)}reduce(e,t){let n=this.next();for(t===void 0&&!n.done&&(t=n.value,n=this.next());!n.done;)t=e(t,n.value),n=this.next();return t}size(){return this.collect().length}[Symbol.iterator](){return this}},Y4=class{#e;#t;constructor(e,t){this.#e=e,this.#t=V4.init(t)}stream(e,t){let n=K4(e),r=t??this.#t,i=r.processingMode;return i&B4.CLONE_INPUT&&n.map(e=>w4(e)),n=this.#e.map((e,t)=>{let n=Object.keys(e);Y(n.length===1,`aggregation stage must have single operator, got ${n.toString()}.`);let i=n[0];Y(i!==`$documents`||t==0,`$documents must be first stage in pipeline.`);let a=r.context.getOperator(H4.PIPELINE,i);return Y(!!a,`unregistered pipeline operator ${i}.`),[a,e[i]]}).reduce((e,[t,n])=>t(e,n,r),n),i&B4.CLONE_OUTPUT&&n.map(e=>w4(e)),n}run(e,t){return this.stream(e,t).collect()}},X4=(e,t,n)=>{if(Q(t))return e;let r=V4.init(n);return e.map(e=>$(e,t,null,r.update({root:e}))??null)},Tve=(e,t,n)=>{Y(n.scriptEnabled,`$accumulator requires 'scriptEnabled' option to be true`);let r=V4.init(n),i=$(r?.local?.groupId,t.initArgs||[],null,r.update({root:r?.local?.groupId})),a=X4(e,t.accumulateArgs,r);a.forEach(e=>e.forEach((t,n)=>e[n]=t??null));let o=t.init.apply(null,i),s=a.reduce((e,n)=>t.accumulate.apply(null,[e,...n]),o);return t.finalize?t.finalize.call(null,s):s},Eve=(e,t,n)=>D4(X4(e,t,n)),Dve=(e,t,n)=>{let r=X4(e,t,n).filter(X);return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length},Z4=(e,t,n)=>{if(b4(t)||!h4(t))return e;Y(h4(t)&&Object.keys(t).length>0,`$sort specification is invalid`);let r=s4,i=n.collation;return h4(i)&&p4(i.locale)&&(r=kve(i)),e.transform(e=>{let n=Object.keys(t);for(let i of n.reverse()){let n=O4(e,e=>A4(e,i)),a=Array.from(n.keys()),o=!1;if(r===s4){let e=!0,t=!0;o=a.every(n=>(e&&=p4(n))^+(t&&=X(n))),e?a.sort():t&&new Float64Array(a).sort().forEach((e,t)=>a[t]=e)}o||a.sort(r),t[i]===-1&&a.reverse();let s=0;for(let t of a)for(let r of n.get(t))e[s++]=r;Y(s==e.length,`bug: counter must match collection size.`)}return e})},Ove={1:`base`,2:`accent`,3:`variant`};function kve(e){let t={sensitivity:Ove[e.strength||3],caseFirst:e.caseFirst===`off`?`false`:e.caseFirst||`false`,numeric:e.numericOrdering||!1,ignorePunctuation:e.alternate===`shifted`};e.caseLevel===!0&&(t.sensitivity===`base`&&(t.sensitivity=`case`),t.sensitivity===`accent`&&(t.sensitivity=`variant`));let n=new Intl.Collator(e.locale,t);return(e,t)=>{if(!p4(e)||!p4(t))return s4(e,t);let r=n.compare(e,t);return r<0?-1:r>0?1:0}}var Q4=(e,t,n)=>{let r=n,i=$(r?.local?.groupId,t.n,null,r),a=Z4(K4(e),t.sortBy,n).collect(),o=a.length;return X4(o<=i?a:a.slice(o-i),t.output,r)},Ave=(e,t,n)=>Q4(e,{...t,n:1},n),jve=(e,t,n)=>e.length;function $4(e,t=!0){let n=e.reduce((e,t)=>e+t,0),r=Math.max(e.length,1),i=n/r;return Math.sqrt(e.reduce((e,t)=>e+(t-i)**2,0)/(r-Number(t)))}function e3(e,t=!0){if(e.length<2)return t?null:0;let n=0,r=0;for(let[t,i]of e)n+=t,r+=i;n/=e.length,r/=e.length;let i=0;for(let[t,a]of e)i+=(t-n)*(a-r);return i/(e.length-Number(t))}var Mve=(e,t,n)=>e3(X4(e,t,n),!1),Nve=(e,t,n)=>e3(X4(e,t,n),!0),t3=(e,t,n)=>{let r=e[0];return $(r,t,null,V4.init(n).update({root:r}))??null},n3={int:{int:!0},pos:{min:1,int:!0},index:{min:0,int:!0},nzero:{min:0,max:0,int:!0}},Pve={int:{type:`integers`},obj:{type:`objects`}};function r3(e,t){return Y(!e,t),null}function i3(e,t){let n=`${t} expression must resolve to object`;return Y(!e,n),null}function a3(e,t){let n=`${t} expression must resolve to string`;return Y(!e,n),null}function o3(e,t,n){let r=n?.int?`integer`:`number`,i=n?.min??-1/0,a=n?.max??1/0,o;return o=i===0&&a===0?`${t} expression must resolve to non-zero ${r}`:i===0&&a===1/0?`${t} expression must resolve to non-negative ${r}`:i!==-1/0&&a!==1/0?`${t} expression must resolve to ${r} in range [${i}, ${a}]`:i>0?`${t} expression must resolve to positive ${r}`:`${t} expression must resolve to ${r}`,Y(!e,o),null}function s3(e,t,n){let r=`array`;!Q(n?.size)&&n?.size>=0&&(r=n.size===0?`non-zero array`:`array(${n.size})`),n?.type&&(r=`array of ${n.type}`);let i=`${t} expression must resolve to ${r}`;return Y(!e,i),null}var c3=(e,t,n)=>{let r=n.failOnError,i=n,a=e.length,o=$(i?.local?.groupId,t.n,null,i);return!m4(o)||o<1?o3(r,`$firstN 'n'`,n3.pos):X4(a<=o?e:e.slice(0,o),t.input,n)},l3=(e,t,n)=>{let r=e[e.length-1];return $(r,t,null,V4.init(n).update({root:r}))??null},u3=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,null,r),o=n.failOnError;return!m4(a)||a<1?o3(o,`$lastN 'n'`,n3.pos):X4(i<=a?e:e.slice(i-a),t.input,n)},Fve=(e,t,n)=>{let r=X4(e,t,n).filter(e=>!Q(e));return r.length?r.reduce((e,t)=>s4(e,t)>=0?e:t):null},d3=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,null,r);if(!m4(a)||a<1)return o3(n.failOnError,`$maxN 'n'`,n3.pos);let o=X4(e,t.input,n).filter(e=>!Q(e));return o.sort((e,t)=>-1*s4(e,t)),i<=a?o:o.slice(0,a)},f3=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`p`)&&Z(t.p),`$percentile expects object { input, p }`);let r=X4(e,t.input,n).filter(X).sort(),i=X4(t.p,`$$CURRENT`,n),a=t.method||`approximate`;for(let e of i)if(!X(e)||e<0||e>1)return r3(n.failOnError,`$percentile 'p' must resolve to array of numbers between [0.0, 1.0]`);return i.map(e=>{let t=e*(r.length-1)+1,n=Math.floor(t),i=t===n?r[t-1]:r[n-1]+t%1*(r[n]-r[n-1]||0);switch(a){case`exact`:return i;case`approximate`:{let t=z4(r,i);return t/r.length>=e?r[Math.max(t-1,0)]:r[t]}}})},p3=(e,t,n)=>f3(e,{...t,p:[.5]},n).pop(),m3=(e,t,n)=>{let r={};for(let t of e)if(!Q(t))for(let e of Object.keys(t))t[e]!==void 0&&(r[e]=t[e]);return r},Ive=(e,t,n)=>{let r=X4(e,t,n).filter(e=>!Q(e));return r.length?r.reduce((e,t)=>s4(e,t)<=0?e:t):null},h3=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,null,r);if(!m4(a)||a<1)return o3(n.failOnError,`$minN 'n'`,n3.pos);let o=X4(e,t.input,n).filter(e=>!Q(e));return o.sort(s4),i<=a?o:o.slice(0,a)},Lve=(e,t,n)=>$4(X4(e,t,n).filter(X),!1),Rve=(e,t,n)=>$4(X4(e,t,n).filter(X),!0),zve=(e,t,n)=>X(t)?e.length*t:X4(e,t,n).filter(X).reduce((e,t)=>e+t,0),g3=(e,t,n)=>{let r=n,{n:i,sortBy:a}=$(r?.local?.groupId,t,null,r);return X4(Z4(K4(e),a,n).take(i).collect(),t.output,r)},Bve=(e,t,n)=>g3(e,{...t,n:1},n),Vve=e({$accumulator:()=>Tve,$addToSet:()=>Eve,$avg:()=>Dve,$bottom:()=>Ave,$bottomN:()=>Q4,$count:()=>jve,$covariancePop:()=>Mve,$covarianceSamp:()=>Nve,$first:()=>t3,$firstN:()=>c3,$last:()=>l3,$lastN:()=>u3,$max:()=>Fve,$maxN:()=>d3,$median:()=>p3,$mergeObjects:()=>m3,$min:()=>Ive,$minN:()=>h3,$percentile:()=>f3,$push:()=>X4,$stdDevPop:()=>Lve,$stdDevSamp:()=>Rve,$sum:()=>zve,$top:()=>Bve,$topN:()=>g3}),Hve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.abs(r):o3(n.failOnError,`$abs`)},_3=`$add expression must resolve to array of numbers.`,Uve=(e,t,n)=>{let r=$(e,t,null,n),i=n.failOnError,a=!1,o=0;if(!Z(r))return r3(i,_3);for(let e of r){if(Q(e))return null;if(typeof e==`number`)o+=e;else if(_4(e)){if(a)return r3(i,`$add must only have one date`);a=!0,o+=+e}else return r3(i,_3)}return a?new Date(o):o},Wve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.ceil(r):o3(n.failOnError,`$ceil`)},Gve=(e,t,n)=>{Y(Z(t),`$divide expects array(2)`);let r=$(e,t,null,n),i=n.failOnError;if(r.some(Q))return null;if(!r.every(X))return s3(i,`$divide`,{size:2,type:`number`});let[a,o]=r;return o===0?r3(i,`$divide cannot divide by zero`):a/o},Kve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.exp(r):o3(n.failOnError,`$exp`)},qve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.floor(r):o3(n.failOnError,`$floor`)},Jve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.log(r):o3(n.failOnError,`$ln`)},Yve=(e,t,n)=>{let r=$(e,t,null,n);if(Z(r)&&r.length==2){if(r.some(Q))return null;if(r.every(e=>typeof e==`number`))return Math.log10(r[0])/Math.log10(r[1])}return s3(n.failOnError,`$log`,{size:2,type:`number`})},Xve=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:typeof r==`number`?Math.log10(r):o3(n.failOnError,`$log10`)},Zve=(e,t,n)=>{let r=$(e,t,null,n),i=!Z(r)||r.length!=2;return i||=!r.every(e=>typeof e==`number`),i?s3(n.failOnError,`$mod`,{size:2,type:`number`}):r[0]%r[1]},Qve=(e,t,n)=>{Y(Z(t),`$multiply expects array`);let r=$(e,t,null,n),i=n.failOnError;if(r.some(Q))return null;let a=1;for(let e of r){if(!X(e))return s3(i,`$multiply`,{type:`number`});a*=e}return a},$ve=(e,t,n)=>{Y(Z(t)&&t.length===2,`$pow expects array(2)`);let r=$(e,t,null,n),i=n.failOnError;if(r.some(Q))return null;if(!r.every(X))return s3(i,`$pow`,{size:2,type:`number`});let[a,o]=r;return a===0&&o<0?r3(i,`$pow cannot raise 0 to a negative exponent`):a**+o};function v3(e,t,n){let{name:r,roundOff:i,failOnError:a}=n;if(Q(e))return null;if(Number.isNaN(e)||Math.abs(e)===1/0)return e;if(!X(e))return o3(a,`${r} arg1 <number>`);if(!m4(t)||t<-20||t>100)return o3(a,`${r} arg2 <precision>`,{min:-20,max:100,int:!0});let o=Math.abs(e)===e?1:-1;e=Math.abs(e);let s=Math.trunc(e),c=parseFloat((e-s).toFixed(Math.abs(t)+1));if(t===0){let e=Math.trunc(10*c);i&&((s&1)==1&&e>=5||e>5)&&s++}else if(t>0){let e=10**t,n=Math.trunc(c*e),r=Math.trunc(c*e*10)%10;i&&r>5&&(n+=1),s=(s*e+n)/e}else if(t<0){let e=10**(-1*t),n=s%e;if(s=Math.max(0,s-n),i&&o===-1){for(;n>10;)n-=n/10;s>0&&n>=5&&(s+=e)}}return s*o}var eye=(e,t,n)=>{Y(Z(t),`$round expects array(2)`);let[r,i]=$(e,t,null,n);return v3(r,i??0,{name:`$round`,roundOff:!0,failOnError:n.failOnError})},y3=1e10,tye=(e,t,n)=>{if(Q(t))return null;let r=$(e,t,null,n),{input:i,onNull:a}=h4(r)?r:{input:r};if(Q(i))return X(a)?a:null;if(X(i)){let e=1/(1+Math.exp(-i));return Math.round(e*y3)/y3}return o3(n.failOnError,`$sigmoid`)},nye=(e,t,n)=>{let r=$(e,t,null,n),i=!n.failOnError;return Q(r)?null:typeof r!=`number`||r<0?(Y(i,`$sqrt expression must resolve to non-negative number.`),null):Math.sqrt(r)},rye=(e,t,n)=>{Y(Z(t),`$subtract expects array(2)`);let r=$(e,t,null,n);if(r.some(Q))return null;let i=n.failOnError,[a,o]=r;return _4(a)&&X(o)?new Date(+a-Math.round(o)):_4(a)&&_4(o)?a-+o:r.every(e=>typeof e==`number`)?a-o:X(a)&&_4(o)?r3(i,`$subtract cannot subtract date from number`):s3(i,`$subtract`,{size:2,type:`number|date`})},iye=(e,t,n)=>{Y(Z(t),`$trunc expects array(2)`);let[r,i]=$(e,t,null,n);return v3(r,i??0,{name:`$trunc`,roundOff:!1,failOnError:n.failOnError})},b3=`$arrayElemAt`,aye=(e,t,n)=>{Y(Z(t)&&t.length===2,`${b3} expects array(2)`);let r=$(e,t,null,n);if(r.some(Q))return null;let i=n.failOnError,[a,o]=r;if(!Z(a))return s3(i,`${b3} arg1 <array>`);if(!m4(o))return o3(i,`${b3} arg2 <index>`,n3.int);if(o<0&&Math.abs(o)<=a.length)return a[(o+a.length)%a.length];if(o>=0&&o<a.length)return a[o]},x3={generic:{type:`key-value pairs`},array:{type:`[k,v]`},object:{type:`{k,v}`}},oye=(e,t,n)=>{let r=n.failOnError,i=$(e,t,null,n);if(Q(i))return null;if(!Z(i))return s3(r,`$arrayToObject`,x3.generic);let a=0,o={};for(let e of i)if(Z(e)){let t=E4(e);if(a||=1,a!==1)return s3(r,`$arrayToObject`,x3.object);let[n,i]=t;o[n]=i}else if(h4(e)&&S4(e,`k`)&&S4(e,`v`)){if(a||=2,a!==2)return s3(r,`$arrayToObject`,x3.array);let{k:t,v:n}=e;o[t]=n}else return s3(r,`$arrayToObject`,x3.generic);return o},sye=(e,t,n)=>{let r=$(e,t,null,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return s3(i,`$concatArrays`);let a=0;for(let e of r){if(Q(e))return null;if(!Z(e))return s3(i,`$concatArrays`);a+=e.length}let o=Array(a),s=0;for(let e of r)for(let t of e)o[s++]=t;return o},cye=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`cond`),`$filter expects object { input, as, cond, limit }`);let r=$(e,t.input,null,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return s3(i,`$filter 'input'`);let a=t.limit??Math.max(r.length,1);if(!m4(a)||a<1)return o3(i,`$filter 'limit'`,{min:1,int:!0});if(r.length===0)return[];let o=V4.init(n),s=t?.as||`this`,c={variables:{[s]:null}},l=[];for(let i=0,u=0;i<r.length&&u<a;i++)c.variables[s]=r[i],y4($(e,t.cond,null,o.update(c)),n.useStrictMode)&&(l.push(r[i]),u++);return l},lye=(e,t,n)=>{if(Z(e))return t3(e,t,n);let r=$(e,t,null,n);return Q(r)?null:Z(r)?E4(r)[0]:s3(n.failOnError,`$first`)},uye=(e,t,n)=>{if(Y(h4(t)&&S4(t,`input`,`n`),`$firstN expects object { input, n }`),Z(e))return c3(e,t,n);let{input:r,n:i}=$(e,t,null,n);return Q(r)?null:Z(r)?c3(r,{n:i,input:`$$this`},n):s3(n.failOnError,`$firstN 'input'`)},dye=(e,t,n)=>{Y(Z(t)&&t.length===2,`$in expects array(2)`);let[r,i]=$(e,t,null,n);return Z(i)?i.some(e=>l4(e,r)):r3(n.failOnError,`$in arg2 <array>`)},S3=`$indexOfArray`,fye=(e,t,n)=>{Y(Z(t)&&t.length>1&&t.length<5,`${S3} expects array(4)`);let r=$(e,t,null,n),i=n.failOnError,a=r[0];if(Q(a))return null;if(!Z(a))return s3(i,`${S3} arg1 <array>`);let o=r[1],s=r[2]??0,c=r[3]??a.length;return!m4(s)||s<0?o3(i,`${S3} arg3 <start>`,n3.pos):!m4(c)||c<0?o3(i,`${S3} arg4 <end>`,n3.pos):s>c?-1:(s>0||c<a.length?a.slice(s,c):a).findIndex(e=>l4(e,o))+s},pye=(e,t,n)=>{let r=t;return Z(t)&&(Y(t.length===1,`$isArray expects array(1)`),r=t[0]),Z($(e,r,null,n))},mye=(e,t,n)=>{if(Z(e))return l3(e,t,n);let r=$(e,t,null,n);return Q(r)?null:!Z(r)||r.length===0?s3(n.failOnError,`$last`,{size:0}):E4(r)[r.length-1]},hye=(e,t,n)=>{if(Y(h4(t)&&S4(t,`input`,`n`),`$lastN expects object { input, n }`),Z(e))return u3(e,t,n);let{input:r,n:i}=$(e,t,null,n);return Q(r)?null:Z(r)?u3(r,{n:i,input:`$$this`},n):s3(n.failOnError,`$lastN 'input'`)},gye=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`in`),`$map expects object { input, as, in }`);let r=$(e,t.input,null,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return s3(i,`$map 'input'`);if(!Q(t.as)&&!p4(t.as))return a3(i,`$map 'as'`);let a=V4.init(n),o=t.as||`this`,s={variables:{[o]:null}};return r.map(n=>(s.variables[o]=n,$(e,t.in,null,a.update(s))))},_ye=(e,t,n)=>{if(Y(h4(t)&&S4(t,`input`,`n`),`$maxN expects object { input, n }`),Z(e))return d3(e,t,n);let{input:r,n:i}=$(e,t,null,n);return Q(r)?null:Z(r)?d3(r,{n:i,input:`$$this`},n):s3(n.failOnError,`$maxN 'input'`)},vye=(e,t,n)=>{if(Y(h4(t)&&S4(t,`input`,`n`),`$minN expects object { input, n }`),Z(e))return h3(e,t,n);let{input:r,n:i}=$(e,t,null,n);return Q(r)?null:Z(r)?h3(r,{n:i,input:`$$this`},n):s3(n.failOnError,`$minN 'input'`)},yye=(e,t,n)=>{Y(Z(t)&&t.length>1&&t.length<4,`$range expects array(3)`);let[r,i,a]=$(e,t,null,n),o=n.failOnError,s=a??1;if(!m4(r))return o3(o,`$range arg1 <start>`,n3.int);if(!m4(i))return o3(o,`$range arg2 <end>`,n3.int);if(!m4(s)||s===0)return o3(o,`$range arg3 <step>`,n3.nzero);let c=[],l=r;for(;l<i&&s>0||l>i&&s<0;)c.push(l),l+=s;return c},bye=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`initialValue`,`in`),`$reduce expects object { input, initialValue, in }`);let r=$(e,t.input,null,n),i=$(e,t.initialValue,null,n),a=t.in;if(Q(r))return null;if(!Z(r))return s3(n.failOnError,`$reduce 'input'`);let o=V4.init(n),s={variables:{value:null}};return r.reduce((e,t)=>(s.variables.value=e,$(t,a,null,o.update(s))),i)},xye=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:Z(r)?r.slice().reverse():s3(n.failOnError,`$reverseArray`)},Sye=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:Z(r)?r.length:o3(n.failOnError,`$size`)},C3=(e,t,n)=>{Y(Z(t)&&t.length>1&&t.length<4,`$slice expects array(3)`);let r=n.failOnError,i=$(e,t,null,n),a=i[0],o=i[1],s=i[2];if(!Z(a))return s3(r,`$slice arg1 <array>`);if(!m4(o))return o3(r,`$slice arg2 <n>`,n3.int);if(!Q(s)&&!m4(s))return o3(r,`$slice arg3 <n>`,n3.int);if(Q(s))o<0?o=Math.max(0,a.length+o):(s=o,o=0);else{if(o<0&&(o=Math.max(0,a.length+o)),s<1)return o3(r,`$slice arg3 <n>`,n3.pos);s+=o}return a.slice(o,s)},Cye=(e,t,n)=>{Y(h4(t)&&`input`in t&&`sortBy`in t,`$sortArray expects object { input, sortBy }`);let{input:r,sortBy:i}=$(e,t,null,n);if(Q(r))return null;if(!Z(r))return s3(n.failOnError,`$sortArray 'input'`);if(h4(i))return Z4(K4(r),i,n).collect();let a=r.slice().sort(s4);return i===-1&&a.reverse(),a},wye=(e,t,n)=>{Y(h4(t)&&S4(t,`inputs`),`$zip received invalid arguments`);let r=$(e,t.inputs,null,n),i=$(e,t.defaults,null,n)??[],a=t.useLongestLength??!1,o=n.failOnError;if(Q(r))return null;if(!Z(r))return s3(o,`$zip 'inputs'`);let s=0;for(let e of r){if(Q(e))return null;Z(e)||s++}if(s)return s3(o,`$zip elements of 'inputs'`);f4(a)||r3(o,`$zip 'useLongestLength' must be boolean`),Z(i)&&i.length>0&&Y(a&&i.length===r.length,`$zip 'useLongestLength' must be set to true to use 'defaults'`);let c=0;for(let e of r)c=a?Math.max(c,e.length):Math.min(c||e.length,e.length);let l=[];for(let e=0;e<c;e++){let t=r.map((t,n)=>Q(t[e])?i[n]??null:t[e]);l.push(t)}return l};function w3(e,t,n,r,i){Y(Z(t),`${r} expects array as argument`);let a=$(e,t,null,n);return a.some(Q)?null:a.every(X)?i(a):r3(n.failOnError,`${r} array elements must resolve to integers`)}var Tye=(e,t,n)=>w3(e,t,n,`$bitAnd`,e=>e.reduce((e,t)=>e&t,-1)),Eye=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:m4(r)?~r:o3(n.failOnError,`$bitNot`,n3.int)},Dye=(e,t,n)=>w3(e,t,n,`$bitOr`,e=>e.reduce((e,t)=>e|t,0)),Oye=(e,t,n)=>w3(e,t,n,`$bitXor`,e=>e.reduce((e,t)=>e^t,0)),kye=(e,t,n)=>{Y(Z(t),`$and expects array`);let r=n.useStrictMode;return t.every(t=>y4($(e,t,null,n),r))},Aye=(e,t,n)=>{let r=x4(t);return r.length===0?!1:r.length>1?s3(n.failOnError,`$not`,{size:1}):!$(e,r[0],null,n)},jye=(e,t,n)=>{Y(Z(t),`$or expects array of expressions`);let r=n.useStrictMode;return t.some(t=>y4($(e,t,null,n),r))},Mye=(e,t,n)=>{Y(Z(t)&&t.length===2,`$cmp expects array(2)`);let[r,i]=$(e,t,null,n);return s4(r,i)},T3=(e,t,n)=>e.take(t),E3=(e,t,n)=>{let r=$(null,t,null,n);Y(Z(r),`$documents: expression must resolve to an array.`);let i=K4(r);return n.processingMode&B4.CLONE_ALL?i.map(e=>w4(e)):i};function D3(e,t){let n=!!e&&e[0]?.$documents;return n?{documents:E3(null,n,t).collect(),pipeline:e.slice(1)}:{pipeline:e}}function O3(e,t,n=!0){let r={exclusions:[],inclusions:[],positional:0},i=Object.keys(e);Y(i.length,`Invalid empty sub-projection`);let a=t?.idKey,o=!1;for(let s of i){if(s.startsWith(`$`))return Y(!n&&i.length===1,`FieldPath field names may not start with '$', given '${s}'.`),r;s.endsWith(`.$`)&&r.positional++;let c=e[s];if(c===!1||X(c)&&c===0)s===a?o=!0:r.exclusions.push(s);else if(!h4(c))r.inclusions.push(s);else{let e=O3(c,t,!1);!e.inclusions.length&&!e.exclusions.length?r.inclusions.includes(s)||r.inclusions.push(s):(e.inclusions.forEach(e=>r.inclusions.push(`${s}.${e}`)),e.exclusions.forEach(e=>r.exclusions.push(`${s}.${e}`))),r.positional+=e.positional}Y(!(r.exclusions.length&&r.inclusions.length),`Cannot do exclusion and inclusion in projection.`),Y(r.positional<=1,`Cannot specify more than one positional projection.`)}if(o&&r.exclusions.push(a),n){let e=new xve;r.exclusions.forEach(t=>Y(e.add(t),`Path collision at ${t}.`)),r.inclusions.forEach(t=>Y(e.add(t),`Path collision at ${t}.`)),r.exclusions.sort(),r.inclusions.sort()}return r}var k3=(e,t,n)=>{if(b4(t))return e;let r=O3(t,n),i=Nye(t,V4.init(n),r);return e.map(i)};function Nye(e,t,n){let r=t.idKey,{exclusions:i,inclusions:a}=n,o={},s={preserveMissing:!0};for(let e of i)o[e]=(t,n)=>{I4(t,e,{descendArray:!0})};for(let n of a){let r=A4(e,n)??e[n];if(n.endsWith(`.$`)&&r===1){let e=t?.local?.condition;Y(e,`positional operator '.$' couldn't find matching element in the array.`);let r=n.slice(0,-2);o[r]=Iye(r,e,t);continue}if(Z(r))o[n]=(e,i)=>{t.update({root:i}),F4(e,n,r.map(e=>$(i,e,null,t)??null))};else if(X(r)||r===!0)o[n]=(e,r)=>{t.update({root:r}),j3(e,j4(r,n,s))};else if(h4(r)==0)o[n]=(e,i)=>{t.update({root:i}),F4(e,n,$(i,r,null,t))};else{let e=Object.keys(r);Y(e.length===1&&L4(e[0]),`Not a valid operator`);let i=e[0],a=r[i],s=t.context.getOperator(H4.PROJECTION,i);!s||i===`$slice`&&!x4(a).every(X)?o[n]=(e,r)=>{t.update({root:r}),F4(e,n,$(r,a,i,t))}:o[n]=(e,r)=>{t.update({root:r}),F4(e,n,s(r,a,n,t))}}}let c=i.length===1&&i.includes(r),l=!i.includes(r),u=!a.length,d=u&&c||u&&i.length&&!c;return e=>{let t={};d&&Object.assign(t,e);for(let n in o)o[n](t,e);return u||M4(t),l&&!S4(t,r)&&S4(e,r)&&(t[r]=A4(e,r)),t}}var A3=(e,t,n,r)=>{let i=A4(e,t);Z(i)||(i=A4(i,n)),Y(Z(i),`must resolve to array`);let a=[];return i.forEach((e,t)=>r({[n]:[e]})&&a.push(t)),a},Pye=e=>t=>!e(t),Fye={$and:1,$or:1,$nor:1};function Iye(e,t,n){let r=Object.entries(t).slice(),i={$and:[],$or:[]};for(let t=0;t<r.length;t++){let[a,o,s]=r[t];if(a===e||a.startsWith(e+`.`)){let[e,t]=Object.entries(R4(o)).pop(),r=n.context.getOperator(H4.QUERY,e),c=a.substring(a.lastIndexOf(`.`)+1),l=r(c,t,n);!s||s===`$and`?i.$and.push([a,l,c]):s===`$nor`?i.$and.push([a,Pye(l),c]):s===`$or`&&i.$or.push([a,l,c])}else if(L4(a)){Y(Fye[a],`${a} is not allowed in this context`);for(let e of o)Object.entries(e).forEach(([e,t])=>r.push([e,t,a]))}}let a=e.lastIndexOf(`.`),o=e.substring(0,a)||e,s=e.substring(a+1);return(t,n)=>{let r=[];for(let[e,t,a]of i.$and)r.push(A3(n,e,a,t));if(i.$or.length){let e=[];for(let[t,r,a]of i.$or)e.push(...A3(n,t,a,r));r.push(D4(e))}let a=T4(r).sort()[0],c=A4(n,e)[a];o!=s&&!h4(c)&&(c={[s]:c}),F4(t,o,[c])}}function j3(e,t){if(e===e4||Q(e))return t;if(Q(t))return e;for(let n of Object.keys(t))e[n]=j3(e[n],t[n]);return e}var M3=(e,t,n)=>(Y(t>=0,`$skip value must be a non-negative integer`),e.drop(t)),Lye={$sort:Z4,$skip:M3,$limit:T3},Rye=class{#e;#t;#n;#r;#i={};#a=null;#o=[];constructor(e,t,n,r){this.#e=e,this.#t=t,this.#n=n,this.#r=r}fetch(){if(this.#a)return this.#a;this.#a=K4(this.#e).filter(this.#t);let e=this.#r.processingMode;e&B4.CLONE_INPUT&&this.#a.map(e=>w4(e));for(let e of[`$sort`,`$skip`,`$limit`])S4(this.#i,e)&&(this.#a=Lye[e](this.#a,this.#i[e],this.#r));return Object.keys(this.#n).length&&(this.#a=k3(this.#a,this.#n,this.#r)),e&B4.CLONE_OUTPUT&&this.#a.map(e=>w4(e)),this.#a}fetchAll(){let e=K4(Array.from(this.#o));return this.#o.length=0,q4(e,this.fetch())}all(){return this.fetchAll().collect()}skip(e){return this.#i.$skip=e,this}limit(e){return this.#i.$limit=e,this}sort(e){return this.#i.$sort=e,this}collation(e){return this.#r={...this.#r,collation:e},this}next(){if(this.#o.length>0)return this.#o.pop();let e=this.fetch().next();if(!e.done)return e.value}hasNext(){if(this.#o.length>0)return!0;let e=this.fetch().next();return e.done?!1:(this.#o.push(e.value),!0)}[Symbol.iterator](){return this.fetchAll()}},zye=/^\$(and|or|nor|expr|jsonSchema)$/,N3=class{#e;#t;#n;constructor(e,t){this.#t=w4(e),this.#n=V4.init(t).update({condition:e}),this.#e=[],this.compile()}compile(){Y(h4(this.#t),`query criteria must be an object: ${JSON.stringify(this.#t)}`);let e={},t=Object.entries(this.#t);for(let[n,r]of t){if(n===`$where`)Y(this.#n.scriptEnabled,`$where operator requires 'scriptEnabled' option to be true.`),Object.assign(e,{field:n,expr:r});else if(zye.test(n))this.processOperator(n,n,r);else{Y(!L4(n),`unknown top level operator: ${n}`);for(let[e,t]of Object.entries(R4(r)))this.processOperator(n,e,t)}e.field&&this.processOperator(e.field,e.field,e.expr)}}processOperator(e,t,n){let r=this.#n.context.getOperator(H4.QUERY,t);Y(!!r,`unknown query operator ${t}`),this.#e.push(r(e,n,this.#n))}test(e){return this.#e.every(t=>t(e))}find(e,t){return new Rye(e,e=>this.test(e),t||{},this.#n)}};function P3(e,t,n,r){let i={unwrapArray:!0},a=Math.max(1,e.split(`.`).length-1),o=V4.init(n).update({depth:a});return n=>r(A4(n,e,i),t,o)}function F3(e,t,n,r){Y(Z(t)&&t.length===2,`${r.name} expects array(2)`);let[i,a]=$(e,t,null,n);return r(i,a,n)}function I3(e,t,n){if(l4(e,t)||Q(e)&&Q(t))return!0;if(Z(e)){let r=n?.local?.depth??1;return e.some(e=>l4(e,t))||E4(e,r).some(e=>l4(e,t))}return!1}function L3(e,t,n){return!I3(e,t,n)}function R3(e,t,n){return Q(e)?t.some(e=>e===null):T4([x4(e),t]).length>0}function Bye(e,t,n){return!R3(e,t,n)}function z3(e,t,n){return K3(e,t,(e,t)=>s4(e,t)<0)}function B3(e,t,n){return K3(e,t,(e,t)=>s4(e,t)<=0)}function V3(e,t,n){return K3(e,t,(e,t)=>s4(e,t)>0)}function H3(e,t,n){return K3(e,t,(e,t)=>s4(e,t)>=0)}function Vye(e,t,n){return x4(e).some((e=>t.length===2&&e%t[0]===t[1]))}function Hye(e,t,n){let r=x4(e),i=e=>p4(e)&&y4(t.exec(e),n?.useStrictMode);return r.some(i)||E4(r,1).some(i)}function Uye(e,t,n){if(!Z(e)||!Z(t)||!e.length||!t.length)return!1;let r=!0;for(let i of t){if(!r)break;r=h4(i)&&Object.keys(i).includes(`$elemMatch`)?U3(e,i.$elemMatch,n):v4(i)?e.some(e=>typeof e==`string`&&i.test(e)):e.some(e=>l4(i,e))}return r}function Wye(e,t,n){return Array.isArray(e)&&e.length===t}function Gye(e){return L4(e)&&[`$and`,`$or`,`$nor`].indexOf(e)===-1}function U3(e,t,n){if(Z(e)&&!b4(e)){let r=e=>e,i=t;Object.keys(t).every(Gye)&&(i={temp:t},r=e=>({temp:e}));let a=new N3(i,n);for(let t=0,n=e.length;t<n;t++)if(a.test(r(e[t])))return!0}return!1}var W3=e=>e===null,Kye={array:Z,boolean:f4,bool:f4,date:_4,number:X,int:X,long:X,double:X,decimal:X,null:W3,object:h4,regexp:v4,regex:v4,string:p4,undefined:Q,1:X,2:p4,3:h4,4:Z,6:Q,8:f4,9:_4,10:W3,11:v4,16:X,18:X,19:X};function G3(e,t,n){let r=Kye[t];return r?r(e):!1}function qye(e,t,n){return Z(t)?t.findIndex(t=>G3(e,t,n))>=0:G3(e,t,n)}function K3(e,t,n){return x4(e).some(e=>d4(e)===d4(t)&&n(e,t))}var Jye=(e,t,n)=>F3(e,t,n,I3),Yye=(e,t,n)=>F3(e,t,n,V3),Xye=(e,t,n)=>F3(e,t,n,H3),Zye=(e,t,n)=>F3(e,t,n,z3),Qye=(e,t,n)=>F3(e,t,n,B3),$ye=(e,t,n)=>F3(e,t,n,L3),q3=`$cond expects array(3) or object with 'if-then-else' expressions`,ebe=(e,t,n)=>{let r,i,a;return Z(t)?(Y(t.length===3,q3),r=t[0],i=t[1],a=t[2]):(Y(h4(t),q3),r=t.if,i=t.then,a=t.else),$(e,y4($(e,r,null,n),n.useStrictMode)?i:a,null,n)},J3=(e,t,n)=>{Y(Z(t),`$ifNull expects an array`);let r;for(let i of t)if(r=$(e,i,null,n),!Q(r))return r;return r},tbe=(e,t,n)=>{Y(h4(t),`$switch received invalid arguments`);for(let{case:r,then:i}of t.branches)if(y4($(e,r,null,n),n.useStrictMode))return $(e,i,null,n);return $(e,t.default,null,n)},Y3=(e,t,n)=>{Y(n.scriptEnabled,`$function requires 'scriptEnabled' option to be true`);let r=$(e,t,null,n);return r.body.apply(null,r.args)},X3=[`year`,`quarter`,`month`,`week`,`day`,`hour`,`minute`,`second`,`millisecond`],nbe={mon:1,tue:2,wed:3,thu:4,fri:5,sat:6,sun:7},rbe=-1e9,Z3=e=>(e&3)==0&&(e%100!=0||e%400==0),ibe=[365,366],abe=[[0,31,59,90,120,151,181,212,243,273,304,334],[0,31,60,91,121,152,182,213,244,274,305,335]],Q3=e=>abe[+Z3(e.getUTCFullYear())][e.getUTCMonth()]+e.getUTCDate(),$3=(e,t)=>((e.getUTCDay()||7)-nbe[t.toLowerCase().substring(0,3)]+7)%7,e6=e=>(e+Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400))%7,t6=e=>52+Number(e6(e)==4||e6(e-1)==3);function n6(e){let t=e.getUTCDay()||7,n=Math.floor((10+Q3(e)-t)/7);return n<1?t6(e.getUTCFullYear()-1):n>t6(e.getUTCFullYear())?1:n}function r6(e){return e.getUTCFullYear()-Number(e.getUTCMonth()===0&&e.getUTCDate()==1&&e.getUTCDay()<1)}var i6={week:6048e5,day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},a6=[[`year`,0,9999],[`month`,1,12],[`day`,1,31],[`hour`,0,23],[`minute`,0,59],[`second`,0,59],[`millisecond`,0,999]],o6={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},s6={"%b":{name:`abbr_month`,padding:3,re:/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i},"%B":{name:`full_month`,padding:0,re:/(January|February|March|April|May|June|July|August|September|October|November|December)/i},"%Y":{name:`year`,padding:4,re:/([0-9]{4})/},"%G":{name:`year`,padding:4,re:/([0-9]{4})/},"%m":{name:`month`,padding:2,re:/(0[1-9]|1[012])/},"%d":{name:`day`,padding:2,re:/(0[1-9]|[12][0-9]|3[01])/},"%j":{name:`day_of_year`,padding:3,re:/(0[0-9][1-9]|[12][0-9]{2}|3[0-5][0-9]|36[0-6])/},"%H":{name:`hour`,padding:2,re:/([01][0-9]|2[0-3])/},"%M":{name:`minute`,padding:2,re:/([0-5][0-9])/},"%S":{name:`second`,padding:2,re:/([0-5][0-9]|60)/},"%L":{name:`millisecond`,padding:3,re:/([0-9]{3})/},"%w":{name:`day_of_week`,padding:1,re:/([0-6])/},"%u":{name:`day_of_week_iso`,padding:1,re:/([1-7])/},"%U":{name:`week_of_year`,padding:2,re:/([1-4][0-9]?|5[0-3]?)/},"%V":{name:`week_of_year_iso`,padding:2,re:/([1-4][0-9]?|5[0-3]?)/},"%z":{name:`timezone`,padding:2,re:/(([+-][01][0-9]|2[0-3]):?([0-5][0-9])?)/},"%Z":{name:`minute_offset`,padding:3,re:/([+-][0-9]{3})/},"%%":{name:`percent_literal`,padding:1,re:/%%/}},c6=/(%[bBYGmdjHMSLwuUVzZ%])/g,obe=/%[bBYGmdjHMSLwuUVzZ%]/,sbe=/^[a-zA-Z_]+\/[a-zA-Z_]+$/;function l6(e,t){if(Q(e))return 0;if(sbe.test(e)){let n=new Date(t.toLocaleString(`en-US`,{timeZone:`UTC`})),r=new Date(t.toLocaleString(`en-US`,{timeZone:e}));return Math.round((r.getTime()-n.getTime())/6e4)}let n=s6[`%z`].re.exec(e);Y(!!n,`timezone '${e}' is invalid or not supported.`);let r=parseInt(n[2])||0,i=parseInt(n[3])||0;return(Math.abs(r*60)+i)*(r<0?-1:1)}function cbe(e){return(e<0?`-`:`+`)+f6(Math.abs(Math.floor(e/60)),2)+f6(Math.abs(e)%60,2)}function u6(e,t){e.setUTCMinutes(e.getUTCMinutes()+t)}function d6(e,t,n){if(_4(e))return e;let r=$(e,t,null,n);if(_4(r))return new Date(r);if(X(r))return new Date(r*1e3);Y(!!r?.date,`cannot convert ${JSON.stringify(t)} to date`);let i=_4(r.date)?new Date(r.date):new Date(r.date*1e3);return r.timezone&&u6(i,l6(r.timezone,i)),i}function f6(e,t){return Array(Math.max(t-String(e).length+1,0)).join(`0`)+e.toString()}var p6=e=>{let t=e-rbe;return Math.trunc(t/4)-Math.trunc(t/100)+Math.trunc(t/400)};function lbe(e,t){return Math.trunc(p6(t-1)-p6(e-1)+(t-e)*ibe[0])}var m6=(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),h6=(e,t)=>t.getUTCMonth()-e.getUTCMonth()+m6(e,t)*12,g6=(e,t)=>{let n=Math.trunc(e.getUTCMonth()/3);return Math.trunc(t.getUTCMonth()/3)-n+m6(e,t)*4},_6=(e,t)=>Q3(t)-Q3(e)+lbe(e.getUTCFullYear(),t.getUTCFullYear()),v6=(e,t,n)=>{let r=(n||`sun`).substring(0,3);return Math.trunc((_6(e,t)+$3(e,r)-$3(t,r))/7)},ube=(e,t)=>t.getUTCHours()-e.getUTCHours()+_6(e,t)*24,y6=(e,t)=>{let n=e.getUTCMonth()+t,r=Math.floor(n/12);if(n<0){let t=n%12+12;e.setUTCFullYear(e.getUTCFullYear()+r,t,e.getUTCDate())}else e.setUTCFullYear(e.getUTCFullYear()+r,n%12,e.getUTCDate())},b6=(e,t,n,r)=>{let i=new Date(e);switch(t){case`year`:i.setUTCFullYear(i.getUTCFullYear()+n);break;case`quarter`:y6(i,3*n);break;case`month`:y6(i,n);break;default:i.setTime(i.getTime()+i6[t]*n)}return i},x6=(e,t,n)=>{let r=$(e,t,null,n);return b6(r.startDate,r.unit,r.amount,r.timezone)},dbe=(e,t,n)=>{let{startDate:r,endDate:i,unit:a,timezone:o,startOfWeek:s}=$(e,t,null,n),c=new Date(r),l=new Date(i);switch(u6(c,l6(o,c)),u6(l,l6(o,l)),a){case`year`:return m6(c,l);case`quarter`:return g6(c,l);case`month`:return h6(c,l);case`week`:return v6(c,l,s);case`day`:return _6(c,l);case`hour`:return ube(c,l);case`minute`:return c.setUTCSeconds(0),c.setUTCMilliseconds(0),l.setUTCSeconds(0),l.setUTCMilliseconds(0),Math.round((l.getTime()-c.getTime())/i6[a]);default:return Math.round((l.getTime()-c.getTime())/i6[a])}},fbe=[31,28,31,30,31,30,31,31,30,31,30,31],pbe=e=>e.month==2&&Z3(e.year)?29:fbe[e.month-1],mbe=(e,t,n)=>{let r=$(e,t,null,n),i=l6(r.timezone,new Date);for(let e=a6.length-1,t=0;e>=0;e--){let n=a6[e],a=n[0],o=n[1],s=n[2],c=(r[a]||0)+t;t=0;let l=s+1;if(a==`hour`&&(c+=Math.floor(i/60)*-1),a==`minute`&&(c+=i%60*-1),c<o){let e=o-c;t=-1*Math.ceil(e/l),c=l-e%l}else c>s&&(c+=o,t=Math.trunc(c/l),c%=l);r[a]=c}return r.day=Math.min(r.day,pbe(r)),new Date(Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond))};function hbe(e){return e===`Z`?0:e>=`A`&&e<`N`?e.charCodeAt(0)-64:77-e.charCodeAt(0)}var gbe=e=>e.replace(/^\//,``).replace(/\/$/,``).replace(/\/i/,``),_be=[`^`,`.`,`-`,`*`,`?`,`$`];function vbe(e){return _be.forEach(t=>{e=e.replace(t,`\\${t}`)}),e}var ybe=(e,t,n)=>{let r=$(e,t,null,n);r.format=r.format||`%Y-%m-%dT%H:%M:%S.%LZ`,r.onNull=r.onNull||null;let i=r.dateString;if(Q(i))return r.onNull;let a=r.format.split(obe);a.reverse();let o=r.format.match(c6),s={},c=``;for(let e=0,t=o.length;e<t;e++){let t=s6[o[e]];if(h4(t)){let e=t.re.exec(i),n=a.pop()||``;e===null?s[t.name]=null:(s[t.name]=/^\d+$/.exec(e[0])?parseInt(e[0]):e[0],i=i.substring(e.index+e[0].length+1),c+=vbe(n)+gbe(t.re.toString()))}}if(Q(s.month)){let e=(s.full_month?.slice(0,3)??s.abbr_month??``).toLowerCase();o6[e]&&(s.month=o6[e])}if(Q(s.year)||Q(s.month)||Q(s.day)||!RegExp(`^`+c+`[A-Z]?$`).test(r.dateString))return r.onError;let l=r.dateString.match(/([A-Z])$/);Y(!(l&&r.timezone),`$dateFromString: you cannot pass in a date/time string with time zone information ('${l&&l[0]}') together with a timezone argument`);let u=l?hbe(l[0])*60:l6(r.timezone,new Date),d=new Date(Date.UTC(s.year,s.month-1,s.day,0,0,0));return Q(s.hour)||d.setUTCHours(s.hour),Q(s.minute)||d.setUTCMinutes(s.minute),Q(s.second)||d.setUTCSeconds(s.second),Q(s.millisecond)||d.setUTCMilliseconds(s.millisecond),u6(d,-u),d},bbe=(e,t,n)=>{let r=$(e,t?.amount,null,n);return x6(e,{...t,amount:-1*r},n)},xbe=(e,t,n)=>{let r=$(e,t,null,n),i=new Date(r.date);u6(i,l6(r.timezone,i));let a={hour:i.getUTCHours(),minute:i.getUTCMinutes(),second:i.getUTCSeconds(),millisecond:i.getUTCMilliseconds()};return r.iso8601==1?Object.assign(a,{isoWeekYear:r6(i),isoWeek:n6(i),isoDayOfWeek:i.getUTCDay()||7}):Object.assign(a,{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate()})},S6=(e,t,n)=>d6(e,t,n).getUTCDate(),C6=(e,t,n)=>d6(e,t,n).getUTCDay()+1,w6=(e,t,n)=>Q3(d6(e,t,n)),T6=(e,t,n)=>d6(e,t,n).getUTCHours(),E6=(e,t,n)=>d6(e,t,n).getUTCDay()||7,D6=(e,t,n)=>n6(d6(e,t,n)),O6=(e,t,n)=>d6(e,t,n).getUTCMilliseconds(),k6=(e,t,n)=>d6(e,t,n).getUTCMinutes(),A6=(e,t,n)=>d6(e,t,n).getUTCMonth()+1,j6=(e,t,n)=>d6(e,t,n).getUTCSeconds(),M6=(e,t,n)=>{let r=d6(e,t,n),i=n6(r);return r.getUTCDay()>0&&r.getUTCDate()==1&&r.getUTCMonth()==0?0:r.getUTCDay()==0?i+1:i},N6=(e,t,n)=>d6(e,t,n).getUTCFullYear(),Sbe={"%Y":N6,"%G":N6,"%m":A6,"%d":S6,"%H":T6,"%M":k6,"%S":j6,"%L":O6,"%u":E6,"%U":M6,"%V":D6,"%j":w6,"%w":(e,t,n)=>C6(e,t,n)-1},Cbe=(e,t,n)=>{let r=$(e,t,null,n);if(Q(r.onNull)&&(r.onNull=null),Q(r.date))return r.onNull;let i=d6(e,r.date,n),a=r.format||`%Y-%m-%dT%H:%M:%S.%LZ`,o=l6(r.timezone,i),s=a.match(c6);u6(i,o);for(let t=0,r=s.length;t<r;t++){let r=s[t];Y(r in s6,`$dateToString: invalid format specifier ${r}`);let{name:c,padding:l}=s6[r],u=Sbe[r],d;if(u)d=f6(u(e,i,n),l);else switch(c){case`timezone`:d=cbe(o);break;case`minute_offset`:d=o.toString();break;case`abbr_month`:case`full_month`:{let e=c.startsWith(`abbr`)?`short`:`long`;d=i.toLocaleString(`en-US`,{month:e});break}}a=a.replace(r,d)}return a},P6=9466848e5,F6=(e,t)=>{let n=e%t;return n<0&&(n+=t),n},wbe={day:_6,month:h6,quarter:g6,year:m6},Tbe=/(mon(day)?|tue(sday)?|wed(nesday)?|thu(rsday)?|fri(day)?|sat(urday)?|sun(day)?)/i,Ebe=(e,t,n)=>{let{date:r,unit:i,binSize:a,timezone:o,startOfWeek:s}=$(e,t,null,n);if(Q(r)||Q(i))return null;let c=(s??`sun`).toLowerCase().substring(0,3);Y(_4(r),`$dateTrunc: 'date' must resolve to a valid Date object.`),Y(X3.includes(i),`$dateTrunc: unit is invalid.`),Y(i!=`week`||Tbe.test(c),`$dateTrunc: startOfWeek '${c}' is not a valid.`),Y(Q(a)||a>0,`$dateTrunc requires 'binSize' to be greater than 0, but got value 0.`);let l=a??1;switch(i){case`millisecond`:case`second`:case`minute`:case`hour`:{let e=l*i6[i],t=r.getTime()-P6;return new Date(r.getTime()-F6(t,e))}default:{Y(l<=1e11,`dateTrunc unsupported binSize value`);let e=new Date(r),t=new Date(P6),n=0;if(i==`week`){let r=(7-$3(t,c))%7;t.setTime(t.getTime()+r*i6.day),n=v6(t,e,c)}else n=wbe[i](t,e);let a=b6(t,i,n-F6(n,l),o);return u6(a,-l6(o,a)),a}}},Dbe=(e,t,n)=>r6(d6(e,t,n)),Obe=(e,t,n)=>t,kbe=(e,t,n)=>p3($(e,t.input,null,n),{input:`$$CURRENT`},n),Abe=(e,t,n)=>{let r=$(e,t,null,n),[i,a]=h4(r)?[r.field,r.input||e]:[r,e];return Q(a)?null:(Y(h4(a),`$getField expression 'input' must evaluate to an object`),Y(p4(i),`$getField expression 'field' must evaluate to a string`),a[i])},jbe=(e,t,n)=>Math.random(),Mbe=(e,t,n)=>Math.random()<=$(e,t,null,n),I6=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?{}:Z(r)?m3(r,t,n):s3(n.failOnError,`$mergeObjects`,Pve.obj)},Nbe=(e,t,n)=>{let r=$(e,t,null,n);if(Q(r))return null;if(!h4(r))return i3(n.failOnError,`$objectToArray`);let i=Object.entries(r),a=Array(i.length),o=0;for(let[e,t]of i)a[o++]={k:e,v:t};return a},L6=`$setField`,R6=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`field`,`value`),`$setField expects object { input, field, value }`);let{input:r,field:i,value:a}=$(e,t,null,n);if(Q(r))return null;let o=n.failOnError;if(!h4(r))return i3(o,`${L6} 'input'`);if(!p4(i))return a3(o,`${L6} 'field'`);let s={...r};return t.value==`$$REMOVE`?delete s[i]:s[i]=a,s},Pbe=(e,t,n)=>R6(e,{...t,value:`$$REMOVE`},n),Fbe=(e,t,n)=>f3($(e,t.input,null,n),{...t,input:`$$CURRENT`},n),Ibe=(e,t,n)=>{if(Z(t)){if(t.length===0)return!0;Y(t.length===1,`$allElementsTrue expects array(1)`),t=t[0]}let r=n.failOnError,i=$(e,t,null,n);return Z(i)?i.every(e=>y4(e,n.useStrictMode)):s3(r,`$allElementsTrue argument`)},Lbe=(e,t,n)=>{if(Z(t)){if(t.length===0)return!1;Y(t.length===1,`$anyElementTrue expects array(1)`),t=t[0]}let r=n.failOnError,i=$(e,t,null,n);return Z(i)?i.some(e=>y4(e,n.useStrictMode)):s3(r,`$anyElementTrue argument`)},z6=`$setDifference`,Rbe=(e,t,n)=>{Y(Z(t)&&t.length==2,`${z6} expects array(2)`);let r=$(e,t,null,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=Z(e)}if(!a)return s3(i,`${z6} arguments`);let o=u4.init();return r[0].forEach(e=>o.set(e,!0)),r[1].forEach(e=>o.delete(e)),Array.from(o.keys())},zbe=(e,t,n)=>{Y(Z(t),`$setEquals expects array`);let r=$(e,t,null,n),i=n.failOnError;if(!r.every(Z))return s3(i,`$setEquals arguments`);let a=u4.init();r[0].every((e,t)=>a.set(e,t));for(let e=1;e<r.length;e++){let t=r[e],n=new Set;for(let e=0;e<t.length;e++){let r=a.get(t[e])??-1;if(r===-1)return!1;n.add(r)}if(n.size!==a.size)return!1}return!0},B6=`$setIntersection`,Bbe=(e,t,n)=>{Y(Z(t),`${B6} expects array`);let r=$(e,t,null,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=Z(e)}return a?T4(r):s3(i,`${B6} arguments`)},V6=`$setIsSubset`,Vbe=(e,t,n)=>{Y(Z(t)&&t.length===2,`${V6} expects array(2)`);let r=$(e,t,null,n);if(!r.every(Z))return s3(n.failOnError,`${V6} arguments`);let[i,a]=r,o=u4.init(),s=new Set;i.every((e,t)=>o.set(e,t));for(let e of a)if(s.add(o.get(e)??-1),s.size>o.size)return!0;return s.delete(-1),s.size==o.size},Hbe=(e,t,n)=>{let r=$(e,t,null,n),i=n.failOnError;return Q(r)?null:Z(r)?Z(t)?r.every(Z)?D4(E4(r)):s3(i,`$setUnion arguments`):D4(r):s3(i,`$setUnion`)},Ube=(e,t,n)=>{Y(Z(t),`$concat expects array`);let r=n.failOnError,i=$(e,t,null,n),a=!0;for(let e of i){if(Q(e))return null;a&&=p4(e)}return a?i.join(``):s3(r,`$concat`,{type:`string`})},H6=`$indexOfBytes`,Wbe=(e,t,n)=>{Y(Z(t)&&t.length>1&&t.length<5,`${H6} expects array(4)`);let r=$(e,t,null,n),i=n.failOnError,a=r[0];if(Q(a))return null;if(!p4(a))return a3(i,`${H6} arg1 <string>`);let o=r[1];if(!p4(o))return a3(i,`${H6} arg2 <search>`);let s=r[2]??0,c=r[3]??a.length;if(!m4(s)||s<0)return o3(i,`${H6} arg3 <start>`,n3.index);if(!m4(c)||c<0)return o3(i,`${H6} arg4 <end>`,n3.index);if(s>c)return-1;let l=a.substring(s,c).indexOf(o);return l>-1?l+s:l},Gbe=[0,32,9,10,11,12,13,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202];function U6(e,t,n,r){let i=$(e,t,null,n),a=i.input;if(Q(a))return null;let o=Q(i.chars)?Gbe:i.chars.split(``).map(e=>e.codePointAt(0)),s=0,c=a.length-1;for(;r.left&&s<=c&&o.indexOf(a[s].codePointAt(0))!==-1;)s++;for(;r.right&&s<=c&&o.indexOf(a[c].codePointAt(0))!==-1;)c--;return a.substring(s,c+1)}function W6(e,t,n,r){let i=$(e,t,null,n);if(!p4(i.input))return[];let a=i.options;a&&(Y(a.indexOf(`x`)===-1,`extended capability option 'x' not supported`),Y(a.indexOf(`g`)===-1,`global option 'g' not supported`));let o=i.input,s=new RegExp(i.regex,a),c,l=[],u=0;for(;c=s.exec(o);){let e={match:c[0],idx:c.index+u,captures:[]};for(let t=1;t<c.length;t++)e.captures.push(c[t]||null);if(l.push(e),!r.global)break;u=c.index+c[0].length,o=o.substring(u)}return l}var Kbe=(e,t,n)=>U6(e,t,n,{left:!0,right:!1}),qbe=(e,t,n)=>{let r=W6(e,t,n,{global:!1});return Z(r)&&r.length>0?r[0]:null},Jbe=(e,t,n)=>W6(e,t,n,{global:!0}),Ybe=(e,t,n)=>W6(e,t,n,{global:!1}).length!=0,G6=`$replaceAll`,Xbe=(e,t,n)=>{Y(h4(t),`${G6} expects an object argument`);let r=n.failOnError,{input:i,find:a,replacement:o}=$(e,t,null,n);return Q(i)||Q(a)||Q(o)?null:p4(i)?p4(a)?p4(o)?i.replace(new RegExp(a,`g`),o):a3(r,`${G6} 'replacement'`):a3(r,`${G6} 'find'`):a3(r,`${G6} 'input'`)},K6=`$replaceOne`,Zbe=(e,t,n)=>{let r=n.failOnError,i=$(e,t,null,n),{input:a,find:o,replacement:s}=i;return Q(a)||Q(o)||Q(s)?null:p4(a)?p4(o)?p4(s)?i.input.replace(i.find,i.replacement):a3(r,`${K6} 'replacement'`):a3(r,`${K6} 'find'`):a3(r,`${K6} 'input'`)},Qbe=(e,t,n)=>U6(e,t,n,{left:!1,right:!0}),$be=(e,t,n)=>{Y(Z(t)&&t.length===2,`$split expects array(2)`);let r=$(e,t,null,n),i=n.failOnError;return Q(r[0])?null:r.every(p4)?r[0].split(r[1]):s3(i,`$split `,{size:2,type:`string`})},exe=(e,t,n)=>{Y(Z(t)&&t.length===2,`$strcasecmp expects array(2)`);let r=$(e,t,null,n),i=n.failOnError;if(r.every(Q))return 0;if(!r.every(p4))return s3(i,`$strcasecmp arguments`,{type:`string`});let[a,o]=r.map(e=>e.toLowerCase());return a4(a,o)},txe=(e,t,n)=>{let r=$(e,t,null,n);return p4(r)?~-encodeURI(r).split(/%..|./).length:a3(n.failOnError,`$strLenBytes`)},nxe=(e,t,n)=>{let r=$(e,t,null,n);return p4(r)?r.length:a3(n.failOnError,`$strLenCP`)},q6=`$substrBytes`,J6=(e,t,n)=>{Y(Z(t)&&t.length===3,`${q6} expects array(3)`);let[r,i,a]=$(e,t,null,n),o=n.failOnError,s=Q(r);if(!s&&!p4(r))return a3(o,`${q6} arg1 <string>`);if(!m4(i)||i<0)return o3(o,`${q6} arg2 <index>`,n3.index);if(!m4(a)||a<0)return o3(o,`${q6} arg3 <count>`,n3.index);if(s)return``;let c=0,l=null,u=null,d=`${q6} UTF-8 boundary falls inside a continuation byte`;for(let e=0;e<r.length;){let t=r.codePointAt(e),n=t<128?1:t<2048?2:t<65536?3:4,s=t>65535?2:1;if(l===null){if(i>c&&i<c+n)return r3(o,d);c===i&&(l=e)}let f=i+a;if(l!==null&&u===null){if(f>c&&f<c+n)return r3(o,d);if(c===f){u=e;break}}c+=n,e+=s}if(l===null)return i===c?``:r3(o,`${q6} byte index out of range`);if(u===null){if(i+a!==c)return r3(o,`${q6} count extends beyond UTF-8 length`);u=r.length}return r.slice(l,u)},rxe=J6,Y6=`$substrCP`,ixe=(e,t,n)=>{Y(Z(t)&&t.length===3,`${Y6} expects array(3)`);let[r,i,a]=$(e,t,null,n),o=Q(r),s=n.failOnError;return!o&&!p4(r)?a3(s,`${Y6} arg1 <string>`):m4(i)?m4(a)?o||i<0?``:a<0?r.substring(i):r.substring(i,i+a):o3(s,`${Y6} arg3 <count>`):o3(s,`${Y6} arg2 <index>`)},X6=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:p4(r)?!0:!!r},Z6=(e,t,n)=>{let r=$(e,t,null,n);if(_4(r))return r;if(Q(r))return null;let i=new Date(r);return Y(!isNaN(i.getTime()),`cannot convert '${r}' to date`),i},Q6=(e,t,n)=>{let r=$(e,t,null,n);if(Q(r))return null;if(_4(r))return r.getTime();if(r===!0)return 1;if(r===!1)return 0;let i=Number(r);return Y(X(i),`cannot convert '${r}' to double/decimal`),i},axe=2147483647,oxe=-2147483648,sxe=9007199254740991,cxe=-9007199254740991;function $6(e,t,n,r,i){let a=$(e,t,null,n);if(a===!0)return 1;if(a===!1)return 0;if(Q(a))return null;if(_4(a))return a.getTime();let o=Number(a);return Y(X(o)&&o>=r&&o<=i&&(!p4(a)||o.toString().indexOf(`.`)===-1),`cannot convert '${a}' to ${i==2147483647?`int`:`long`}`),Math.trunc(o)}var e8=(e,t,n)=>$6(e,t,n,oxe,axe),t8=(e,t,n)=>$6(e,t,n,cxe,sxe),n8=(e,t,n)=>{let r=$(e,t,null,n);return Q(r)?null:_4(r)?r.toISOString():t4(r)||v4(r)?String(r):r3(n.failOnError,`$toString cannot convert from object to string`)},lxe=(e,t,n)=>{Y(h4(t)&&S4(t,`input`,`to`),`$convert expects object { input, to, onError, onNull }`);let r=$(e,t.input,null,n);if(Q(r))return $(e,t.onNull,null,n)??null;let i=$(e,t.to,null,n);try{switch(i){case 2:case`string`:return n8(e,r,n);case 8:case`boolean`:case`bool`:return X6(e,r,n);case 9:case`date`:return Z6(e,r,n);case 1:case 19:case`double`:case`decimal`:case`number`:return Q6(e,r,n);case 16:case`int`:return e8(e,r,n);case 18:case`long`:return t8(e,r,n)}}catch{}return t.onError===void 0?r3(n.failOnError,`$convert cannot convert from object to ${t.to} with no onError value`):$(e,t.onError,null,n)},uxe=(e,t,n)=>X($(e,t,null,n)),dxe=Q6,fxe=(e,t,n)=>{let r=$(e,t,null,n);if(n.useStrictMode){if(r===void 0)return`missing`;if(r===!0||r===!1)return`bool`;if(X(r))return r%1==0?r>=-2147483648&&r<=2147483647?`int`:`long`:`double`;if(v4(r))return`regex`}return d4(r)},pxe=(e,t,n)=>{Z(t)&&t.length===1&&(t=t[0]);let r=n8(e,t,n);return r===null?r:r.toLowerCase()},mxe=(e,t,n)=>{Z(t)&&t.length===1&&(t=t[0]);let r=n8(e,t,n);return r===null?r:r.toUpperCase()},hxe=(e,t,n)=>U6(e,t,n,{left:!0,right:!0}),gxe=(e,t,n)=>Q2($(e,t,null,n));function r8(e,t,n,r,i){let a={undefined:null,null:null,NaN:NaN,Infinity:Error(),"-Infinity":Error(),...i},o=n.failOnError,s=r.name,c=$(e,t,null,n);if(c in a){let e=a[c];return e instanceof Error?o3(o,`$${s} invalid input '${c}'`):e}return X(c)?r(c):o3(o,`$${s}`)}var _xe=(e,t,n)=>r8(e,t,n,Math.acos,{Infinity:1/0,0:Error()}),vxe=(e,t,n)=>r8(e,t,n,Math.acosh,{Infinity:1/0,0:Error()}),yxe=(e,t,n)=>r8(e,t,n,Math.asin),bxe=(e,t,n)=>r8(e,t,n,Math.asinh,{Infinity:1/0,"-Infinity":-1/0}),xxe=(e,t,n)=>r8(e,t,n,Math.atan),Sxe=(e,t,n)=>{let[r,i]=$(e,t,null,n);return isNaN(r)||Q(r)?r:isNaN(i)||Q(i)?i:Math.atan2(r,i)},Cxe=(e,t,n)=>r8(e,t,n,Math.atanh,{1:1/0,"-1":-1/0}),wxe=(e,t,n)=>r8(e,t,n,Math.cos),Txe=(e,t,n)=>r8(e,t,n,Math.cosh,{"-Infinity":1/0,Infinity:1/0}),Exe=e=>Math.PI/180*e,Dxe=(e,t,n)=>r8(e,t,n,Exe,{Infinity:1/0,"-Infinity":1/0}),Oxe=e=>180/Math.PI*e,kxe=(e,t,n)=>r8(e,t,n,Oxe,{Infinity:1/0,"-Infinity":1/0}),Axe=(e,t,n)=>r8(e,t,n,Math.sin),jxe=(e,t,n)=>r8(e,t,n,Math.sinh,{"-Infinity":-1/0,Infinity:1/0}),Mxe=(e,t,n)=>r8(e,t,n,Math.tan),Nxe=(e,t,n)=>r8(e,t,n,Math.tanh,{Infinity:1,"-Infinity":-1}),Pxe=(e,t,n)=>{let r={};for(let[i,a]of Object.entries(t.vars))r[i]=$(e,a,null,n);return $(e,t.in,null,V4.init(n).update({variables:r}))},Fxe=e({$abs:()=>Hve,$acos:()=>_xe,$acosh:()=>vxe,$add:()=>Uve,$allElementsTrue:()=>Ibe,$and:()=>kye,$anyElementTrue:()=>Lbe,$arrayElemAt:()=>aye,$arrayToObject:()=>oye,$asin:()=>yxe,$asinh:()=>bxe,$atan:()=>xxe,$atan2:()=>Sxe,$atanh:()=>Cxe,$bitAnd:()=>Tye,$bitNot:()=>Eye,$bitOr:()=>Dye,$bitXor:()=>Oye,$ceil:()=>Wve,$cmp:()=>Mye,$concat:()=>Ube,$concatArrays:()=>sye,$cond:()=>ebe,$convert:()=>lxe,$cos:()=>wxe,$cosh:()=>Txe,$dateAdd:()=>x6,$dateDiff:()=>dbe,$dateFromParts:()=>mbe,$dateFromString:()=>ybe,$dateSubtract:()=>bbe,$dateToParts:()=>xbe,$dateToString:()=>Cbe,$dateTrunc:()=>Ebe,$dayOfMonth:()=>S6,$dayOfWeek:()=>C6,$dayOfYear:()=>w6,$degreesToRadians:()=>Dxe,$divide:()=>Gve,$eq:()=>Jye,$exp:()=>Kve,$filter:()=>cye,$first:()=>lye,$firstN:()=>uye,$floor:()=>qve,$function:()=>Y3,$getField:()=>Abe,$gt:()=>Yye,$gte:()=>Xye,$hour:()=>T6,$ifNull:()=>J3,$in:()=>dye,$indexOfArray:()=>fye,$indexOfBytes:()=>Wbe,$isArray:()=>pye,$isNumber:()=>uxe,$isoDayOfWeek:()=>E6,$isoWeek:()=>D6,$isoWeekYear:()=>Dbe,$last:()=>mye,$lastN:()=>hye,$let:()=>Pxe,$literal:()=>Obe,$ln:()=>Jve,$log:()=>Yve,$log10:()=>Xve,$lt:()=>Zye,$lte:()=>Qye,$ltrim:()=>Kbe,$map:()=>gye,$maxN:()=>_ye,$median:()=>kbe,$mergeObjects:()=>I6,$millisecond:()=>O6,$minN:()=>vye,$minute:()=>k6,$mod:()=>Zve,$month:()=>A6,$multiply:()=>Qve,$ne:()=>$ye,$not:()=>Aye,$objectToArray:()=>Nbe,$or:()=>jye,$percentile:()=>Fbe,$pow:()=>$ve,$radiansToDegrees:()=>kxe,$rand:()=>jbe,$range:()=>yye,$reduce:()=>bye,$regexFind:()=>qbe,$regexFindAll:()=>Jbe,$regexMatch:()=>Ybe,$replaceAll:()=>Xbe,$replaceOne:()=>Zbe,$reverseArray:()=>xye,$round:()=>eye,$rtrim:()=>Qbe,$sampleRate:()=>Mbe,$second:()=>j6,$setDifference:()=>Rbe,$setEquals:()=>zbe,$setField:()=>R6,$setIntersection:()=>Bbe,$setIsSubset:()=>Vbe,$setUnion:()=>Hbe,$sigmoid:()=>tye,$sin:()=>Axe,$sinh:()=>jxe,$size:()=>Sye,$slice:()=>C3,$sortArray:()=>Cye,$split:()=>$be,$sqrt:()=>nye,$strLenBytes:()=>txe,$strLenCP:()=>nxe,$strcasecmp:()=>exe,$substr:()=>rxe,$substrBytes:()=>J6,$substrCP:()=>ixe,$subtract:()=>rye,$switch:()=>tbe,$tan:()=>Mxe,$tanh:()=>Nxe,$toBool:()=>X6,$toDate:()=>Z6,$toDecimal:()=>dxe,$toDouble:()=>Q6,$toHashedIndexKey:()=>gxe,$toInt:()=>e8,$toLong:()=>t8,$toLower:()=>pxe,$toString:()=>n8,$toUpper:()=>mxe,$trim:()=>hxe,$trunc:()=>iye,$type:()=>fxe,$unsetField:()=>Pbe,$week:()=>M6,$year:()=>N6,$zip:()=>wye}),i8=(e,t,n)=>{let r=Object.keys(t);return r.length===0?e:e.map((e=>{let i={...e};for(let a of r){let r=$(e,t[a],null,n);r===void 0?I4(i,a):F4(i,a,r)}return i}))},Ixe=(e,t,n)=>{let r=t.boundaries.slice(),i=t.default,a=r[0],o=r[r.length-1],s=t.output||{count:{$sum:1}};Y(r.length>1,`$bucket: must specify at least two boundaries.`),Y(r.every((e,t)=>t===0||d4(e)===d4(r[t-1])&&s4(e,r[t-1])>0),`$bucket: bounds must be of same type and in ascending order`),Y(Q(i)||d4(i)!==d4(a)||s4(i,o)>=0||s4(i,a)<0,`$bucket: 'default' expression must be out of boundaries range`);let c=()=>{let c=new Map;for(let e=0;e<r.length-1;e++)c.set(r[e],[]);return Q(i)||c.set(i,[]),e.each(e=>{let s=$(e,t.groupBy,null,n);if(Q(s)||s4(s,a)<0||s4(s,o)>=0)Y(!Q(i),`$bucket require a default for out of range values`),c.get(i).push(e);else{Y(s4(s,a)>=0&&s4(s,o)<0,`$bucket 'groupBy' expression must resolve to a value in range of boundaries`);let t=z4(r,s),n=r[Math.max(0,t-1)];c.get(n).push(e)}}),r.pop(),Q(i)||(c.get(i).length?r.push(i):c.delete(i)),Y(c.size===r.length,`bounds and groups must be of equal size.`),K4(r).map(e=>({...$(c.get(e),s,null,n),_id:e}))},l;return K4(()=>(l||=c(),l.next()))},Lxe=(e,t,n)=>{let{buckets:r,groupBy:i,output:a,granularity:o}=t,s=a??{count:{$sum:1}};Y(r>0,`$bucketAuto: 'buckets' field must be greater than 0, but found: ${r}`),o&&Y(/^(POWERSOF2|1-2-5|E(6|12|24|48|96|192)|R(5|10|20|40|80))$/.test(o),`$bucketAuto: invalid granularity '${o}'.`);let c=new Map,l=o?(e,t)=>{}:(e,t)=>c.set(e,t),u=e.map(e=>{let t=$(e,i,null,n)??null;return Y(!o||X(t),`$bucketAuto: groupBy values must be numeric when granularity is specified.`),l(e,t??null),[t??null,e]}).collect();u.sort((e,t)=>Q(e[0])?-1:Q(t[0])?1:s4(e[0],t[0]));let d;d=o?o==`POWERSOF2`?zxe(u,r):Vxe(u,r,o):Rxe(u,r,c);let f=!1;return K4(()=>{if(f)return{done:!0};let{min:e,max:t,bucket:r,done:i}=d();f=i;let a=$(r,s,null,n);for(let[e,t]of Object.entries(a))Z(t)&&(a[e]=t.filter(e=>!Q(e)));return{done:!1,value:{...a,_id:{min:e,max:t}}}})};function Rxe(e,t,n){let r=e.length,i=Math.max(1,Math.round(e.length/t)),a=0,o=0;return()=>{let s=++o==t,c=[];for(;a<r&&(s||c.length<i||a>0&&l4(e[a-1][0],e[a][0]));)c.push(e[a++][1]);let l=n.get(c[0]),u;return u=a<r?e[a][0]:n.get(c[c.length-1]),Y(Q(u)||Q(l)||l<=u,`error: $bucketAuto boundary must be in order.`),{min:l,max:u,bucket:c,done:a>=r}}}function zxe(e,t){let n=e.length,r=Math.max(1,Math.round(e.length/t)),i=e=>e===0?0:2**(Math.floor(Math.log2(e))+1),a=0,o=0,s=0;return()=>{let t=[],c=i(s);for(o=a>0?s:0;t.length<r&&a<n&&(s===0||e[a][0]<c);)t.push(e[a++][1]);for(s=s==0?i(e[a-1][0]):c;a<n&&e[a][0]<s;)t.push(e[a++][1]);return{min:o,max:s,bucket:t,done:a>=n}}}var Bxe={R5:[10,16,25,40,63],R10:[100,125,160,200,250,315,400,500,630,800],R20:[100,112,125,140,160,180,200,224,250,280,315,355,400,450,500,560,630,710,800,900],R40:[100,106,112,118,125,132,140,150,160,170,180,190,200,212,224,236,250,265,280,300,315,355,375,400,425,450,475,500,530,560,600,630,670,710,750,800,850,900,950],R80:[103,109,115,122,128,136,145,155,165,175,185,195,206,218,230,243,258,272,290,307,325,345,365,387,412,437,462,487,515,545,575,615,650,690,730,775,825,875,925,975],"1-2-5":[10,20,50],E6:[10,15,22,33,47,68],E12:[10,12,15,18,22,27,33,39,47,56,68,82],E24:[10,11,12,13,15,16,18,20,22,24,27,30,33,36,39,43,47,51,56,62,68,75,82,91],E48:[100,105,110,115,121,127,133,140,147,154,162,169,178,187,196,205,215,226,237,249,261,274,287,301,316,332,348,365,383,402,422,442,464,487,511,536,562,590,619,649,681,715,750,787,825,866,909,953],E96:[100,102,105,107,110,113,115,118,121,124,127,130,133,137,140,143,147,150,154,158,162,165,169,174,178,182,187,191,196,200,205,210,215,221,226,232,237,243,249,255,261,267,274,280,287,294,301,309,316,324,332,340,348,357,365,374,383,392,402,412,422,432,442,453,464,475,487,499,511,523,536,549,562,576,590,604,619,634,649,665,681,698,715,732,750,768,787,806,825,845,866,887,909,931,953,976],E192:[100,101,102,104,105,106,107,109,110,111,113,114,115,117,118,120,121,123,124,126,127,129,130,132,133,135,137,138,140,142,143,145,147,149,150,152,154,156,158,160,162,164,165,167,169,172,174,176,178,180,182,184,187,189,191,193,196,198,200,203,205,208,210,213,215,218,221,223,226,229,232,234,237,240,243,246,249,252,255,258,261,264,267,271,274,277,280,284,287,291,294,298,301,305,309,312,316,320,324,328,332,336,340,344,348,352,357,361,365,370,374,379,383,388,392,397,402,407,412,417,422,427,432,437,442,448,453,459,464,470,475,481,487,493,499,505,511,517,523,530,536,542,549,556,562,569,576,583,590,597,604,612,619,626,634,642,649,657,665,673,681,690,698,706,715,723,732,741,750,759,768,777,787,796,806,816,825,835,845,856,866,876,887,898,909,920,931,942,953,965,976,988]},a8=(e,t)=>{if(e==0)return 0;let n=Bxe[t],r=n[0],i=n[n.length-1],a=1;for(;e>=i*a;)a*=10;let o=0;for(;e<r*a;)if(o=r*a,a/=10,e>=i*a)return o;Y(e>=r*a&&e<i*a,`$bucketAuto: number out of range of series.`);let s=z4(n,e,(e,t)=>(t*=a,e<t?-1:e>t?1:0)),c=n[s]*a;return e==c?n[s+1]*a:c};function Vxe(e,t,n){let r=e.length,i=Math.max(1,Math.round(e.length/t)),a=0,o=0,s=0,c=0;return()=>{let l=++o==t,u=[];for(s=a>0?c:0;a<r&&(l||u.length<i);)u.push(e[a++][1]);c=a8(e[a-1][0],n);let d=u.length;for(;a<r&&(l||e[a][0]<c);)u.push(e[a++][1]);return d!=u.length&&(c=a8(e[a-1][0],n)),Y(s<c,`$bucketAuto: ${s} < ${c}.`),{min:s,max:c,bucket:u,done:a>=r}}}var Hxe=(e,t,n)=>(Y(p4(t)&&!b4(t)&&t.indexOf(`.`)===-1&&t.trim()[0]!==`$`,`Invalid expression value for $count`),K4([{[t]:e.size()}])),Uxe=(e,t,n)=>{let{step:r,bounds:i,unit:a}=t.range;a?(Y(X3.includes(a),``),Y(Number.isInteger(r)&&r>0,`The step parameter in a range statement must be a whole number when densifying a date range.`)):Y(X(r)&&r>0,`The step parameter in a range statement must be a strictly positive numeric value.`),Z(i)&&(Y(!!i&&i.length===2,`A bounding array in a range statement must have exactly two elements.`),Y((i.every(X)||i.every(_4))&&i[0]<i[1],`A bounding array must be an ascending array of either two dates or two numbers.`),Y(a&&!i.some(X),`Numeric bounds may not have unit parameter.`)),t.partitionByFields&&Y(Z(t.partitionByFields),"$densify: `partitionByFields` must be an array of strings"),e=Z4(e,{[t.field]:1},n);let o=e=>X(e)?e+r:x6(null,{startDate:e,unit:a,amount:r},n),s=!!a&&X3.includes(a),c=e=>{let n=A4(e,t.field);return Y(Q(n)||_4(n)&&s||X(n)&&!s,`$densify: Densify field type must be numeric with 'unit' unspecified, or a date with 'unit' specified.`),n},l=[],u=K4(()=>{let t=e.next();return Q(c(t.value))?t:(l.push(t),{done:!0})}),d=u4.init(),[f,p]=Z(i)?i:[i,i],m,h=e=>{m=m===void 0||m<e?e:m},g=[],_=K4(()=>{let n=l.length>0?l.pop():e.next();if(n.done)return n;let r=g;Z(t.partitionByFields)&&(r=t.partitionByFields.map(e=>A4(n.value,e)),Y(r.every(p4),`$densify: Partition fields must evaluate to string values.`)),Y(h4(n.value),`$densify: collection must contain documents`);let i=c(n.value);d.has(r)||(f==`full`?(d.has(g)||d.set(g,i),d.set(r,d.get(g))):f==`partition`?d.set(r,i):d.set(r,f));let a=d.get(r);if(i<=a||p!=`full`&&p!=`partition`&&a>=p)return a<=i&&d.set(r,o(a)),h(i),n;d.set(r,o(a)),h(a);let s={[t.field]:a};return r&&r.forEach((e,n)=>{s[t.partitionByFields[n]]=e}),l.push(n),{done:!1,value:s}});if(f!==`full`)return q4(u,_);let v=-1,y;return q4(u,_,K4(()=>{if(v===-1){let e=d.get(g);d.delete(g),y=Array.from(d.keys()),y.length===0&&(y.push(g),d.set(g,e)),v++}do{let e=y[v],n=d.get(e);if(n<m){d.set(e,o(n));let r={[t.field]:n};return e.forEach((e,n)=>{r[t.partitionByFields[n]]=e}),{done:!1,value:r}}v++}while(v<y.length);return{done:!0}}))},Wxe=(e,t,n)=>(n.processingMode&B4.CLONE_INPUT||(n={...V4.init(n).options,processingMode:B4.CLONE_INPUT}),e.transform((e=>{let r={};for(let[i,a]of Object.entries(t))r[i]=new Y4(a,n).run(e);return[r]}))),o8=new WeakMap;function s8(e,t,n,r){o8.has(e)||o8.set(e,{});let i=o8.get(e);t.field in i||(i[t.field]=n());let a=!1;try{let e=r(i[t.field]);return a=!0,e}finally{a?t.documentNumber===e.length&&(delete i[t.field],Object.keys(i).length===0&&o8.delete(e)):o8.delete(e)}}function c8(e,t,n,r,i){return s8(t,n,()=>{let e=X4(t,`$`+Object.keys(n.parentExpr.sortBy)[0],r),i=O4(e,((t,n)=>e[n])),a=0,o=0;for(let e of i.keys()){let t=i.get(e).length;i.set(e,[a++,o]),o+=t}return{values:e,groups:i}},({values:e,groups:r})=>{if(r.size==t.length)return n.documentNumber;let a=e[n.documentNumber-1],[o,s]=r.get(a);return(i?o:s)+1})}var Gxe=(e,t,n,r,i)=>t+(i-e)*((r-t)/(n-e)),l8=(e,t,n,r)=>s8(t,n,()=>{let e=X4(t,[`$`+Object.keys(n.parentExpr.sortBy)[0],n.inputExpr],r).filter((([e,t])=>X(+e)));if(e.length!==t.length)return null;let i=-1,a=0;for(;a<e.length;){for(;i+1<e.length&&X(e[i+1][1]);)i++,a=i;for(;a+1<e.length&&!X(e[a+1][1]);)a++;if(a+1>=e.length)break;for(a++;i+1<a;)e[i+1][1]=Gxe(e[i][0],e[i][1],e[a][0],e[a][1],e[i+1][0]),i++;i=a}return e.map(([e,t])=>t)},e=>e[n.documentNumber-1]),u8=(e,t,n,r)=>s8(t,n,()=>{let e=X4(t,n.inputExpr,r);for(let t=1;t<e.length;t++)Q(e[t])&&(e[t]=e[t-1]);return e},e=>e[n.documentNumber-1]),d8=`_id`,f8=(e,t,n)=>{Y(S4(t,d8),`$group specification must include an '_id'`);let r=t[d8],i=V4.init(n),a=Object.keys(t).filter(e=>e!=d8);return e.transform((e=>{let o=O4(e,e=>$(e,r,null,n)),s=-1,c=Array.from(o.keys());return()=>{if(++s===o.size)return{done:!0};let e=c[s],n={};e!==void 0&&(n[d8]=e);for(let r of a)n[r]=$(o.get(e),t[r],null,i.update({root:null,groupId:e}));return{value:n,done:!1}}}))},p8=new Set([`$denseRank`,`$documentNumber`,`$first`,`$last`,`$linearFill`,`$rank`,`$shift`]),Kxe=new Set([`$denseRank`,`$expMovingAvg`,`$linearFill`,`$locf`,`$rank`,`$shift`]),qxe=e=>{let t=e?.documents||e?.range;return!t||t[0]===`unbounded`&&t[1]===`unbounded`},m8=(e,t,n)=>{n=V4.init(n),n.context.addExpressionOps({$function:Y3});for(let e of Object.values(t.output)){let t=Object.keys(e),r=t.find(L4),i=n.context;if(Y(!!i.getOperator(H4.WINDOW,r)||!!i.getOperator(H4.ACCUMULATOR,r),`'${r}' is not a valid window operator`),Y(t.length>0&&t.length<=2&&(t.length==1||t.includes(`window`)),`'output' option should have a single window operator.`),e?.window){let{documents:t,range:n}=e.window;Y((!!t^+!!n)==1,`'window' option supports only one of 'documents' or 'range'.`)}}return t.sortBy&&(e=Z4(e,t.sortBy,n)),e=f8(e,{_id:t.partitionBy,items:{$push:`$$CURRENT`}},n),e.transform((e=>{let r=[],i=[];for(let[e,r]of Object.entries(t.output)){let a=Object.keys(r).find(L4),o={operatorName:a,func:{left:n.context.getOperator(H4.ACCUMULATOR,a),right:n.context.getOperator(H4.WINDOW,a)},args:r[a],field:e,window:r.window};Y(!!t.sortBy||!(p8.has(a)||!o.window),`${p8.has(a)?`'${a}'`:`bounded window operation`} requires a sortBy.`),Y(!o.window||!Kxe.has(a),`${a} does not accept a 'window' field.`),i.push(o)}return e.forEach((e=>{let a=e.items,o=K4(a),s={};for(let e of i){let{func:r,args:i,field:c,window:l}=e,u=e=>{let a=-1;return o=>{if(++a,r.left)return r.left(e(o,a),i,n);if(r.right)return r.right(o,e(o,a),{parentExpr:t,inputExpr:i,documentNumber:a+1,field:c},n)}};if(l){let{documents:e,range:r,unit:i}=l,o=e||r;if(!qxe(l)){let[r,l]=o,d=e=>r==`current`?e:r==`unbounded`?0:Math.max(r+e,0),f=e=>l==`current`?e+1:l==`unbounded`?a.length:l+e+1;s[c]=u((s,c)=>{if(e||o.every(p4))return a.slice(d(c),f(c));let u=Object.keys(t.sortBy)[0],p,m;if(i){let e=e=>x6(s,{startDate:new Date(s[u]),unit:i,amount:e},n).getTime();p=X(r)?e(r):-1/0,m=X(l)?e(l):1/0}else{let e=s[u];p=X(r)?e+r:-1/0,m=X(l)?e+l:1/0}let h=r==`current`?c:0,g=l==`current`?c+1:a.length,_=[];for(;h<g;){let e=a[h++],t=+e[u];t>=p&&t<=m&&_.push(e)}return _})}}s[c]||(s[c]=u(e=>a)),o=i8(o,{[c]:{$function:{body:e=>s[c](e),args:[`$$CURRENT`]}}},n)}r.push(o)})),q4(...r)}))},Jxe={locf:`$locf`,linear:`$linearFill`},Yxe=(e,t,n)=>{Y(!t.sortBy||h4(t.sortBy),`sortBy must be an object.`),Y(!!t.sortBy||Object.values(t.output).every(e=>S4(e,`value`)),`sortBy required if any output field specifies a 'method'.`),Y(!(t.partitionBy&&t.partitionByFields),`specify either partitionBy or partitionByFields.`),Y(!t.partitionByFields||t?.partitionByFields?.every(e=>e[0]!==`$`),`fields in partitionByFields cannot begin with '$'.`),n.context.addExpressionOps({$ifNull:J3}),n.context.addWindowOps({$locf:u8,$linearFill:l8});let r=t.partitionBy||t?.partitionByFields?.map(e=>`$`+e),i={},a={};for(let[e,n]of Object.entries(t.output))if(S4(n,`value`))i[e]={$ifNull:[`$$CURRENT.${e}`,n.value]};else{let t=Jxe[n.method];Y(!!t,`invalid fill method '${n.method}'.`),a[e]={[t]:`$`+e}}return Object.keys(a).length>0&&(e=m8(e,{sortBy:t.sortBy||{},partitionBy:r,output:a},n)),Object.keys(i).length>0&&(e=i8(e,i,n)),e},h8=(e,t,n)=>{let r=p4(t.from)?n?.collectionResolver(t.from):t.from,{let:i,foreignField:a,localField:o}=t,s=e=>[!0,[]],{documents:c,pipeline:l}=D3(t.pipeline??[],n);if(Y(!r!=!c,"$lookup: must specify single join input with `expr.from` or `expr.pipeline`."),r??=c,Y(Z(r),`$lookup: join collection must resolve to an array.`),a&&o){let n=u4.init();for(let e of r)x4(A4(e,a)??null).forEach(t=>{let r=n.get(t),i=r??[];i.push(e),i!==r&&n.set(t,i)});if(s=e=>{let t=A4(e,o)??null;if(Z(t)){if(l.length)return[t.some(e=>n.has(e)),null];let e=Array.from(new Set(E4(t.map(e=>n.get(e)))));return[e.length>0,e]}let r=n.get(t)??null;return[r!==null,r??[]]},l.length===0)return e.map(e=>({...e,[t.as]:s(e).pop()}))}let u=new Y4(l,n),d=V4.init(n);return e.map(e=>{let a=$(e,i,null,n);d.update({root:null,variables:a});let[o,c]=s(e);return{...e,[t.as]:o?u.run(r,d):c}})},Xxe=(e,t,n)=>{let r=p4(t.from)?n?.collectionResolver(t.from):t.from,{connectFromField:i,connectToField:a,as:o,maxDepth:s,depthField:c,restrictSearchWithMatch:l}=t,u=l?{pipeline:[{$match:l}]}:{};return e.map(e=>{let l={};F4(l,i,$(e,t.startWith,null,n));let d=[l],f=-1,p=u4.init();do{f++,d=E4(h8(K4(d),{from:r,localField:i,foreignField:a,as:o,...u},n).map(e=>e[o]).collect());let e=p.size;if(d.forEach(e=>p.set(e,p.get(e)??f)),e==p.size)break}while(Q(s)||f<s);let m=Array(p.size),h=0;return p.forEach((e,t)=>{m[h++]=Object.assign(c?{[c]:e}:{},t)}),{...e,[o]:m}})},Zxe=(e,t,n)=>{let r=new N3(t,n);return e.filter(e=>r.test(e))},Qxe=(e,t,n)=>{let r=p4(t.into)?n?.collectionResolver(t.into):t.into;Y(Z(r),`$merge: option 'into' must resolve to an array`);let i=t.on||n.idKey,a=p4(i)?e=>Q2(A4(e,i)):e=>Q2(i.map(t=>A4(e,t))),o=u4.init();for(let e=0;e<r.length;e++){let t=r[e],n=a(t);Y(!o.has(n),`$merge: 'into' collection must have unique entries for the 'on' field.`),o.set(n,[t,e])}let s=V4.init(n);return e.map(e=>{let n=a(e);if(o.has(n)){let[i,a]=o.get(n),c=$(i,t.let||{new:`$$ROOT`},null,s.update({root:e}));if(Z(t.whenMatched))r[a]=new Y4(t.whenMatched,s.update({root:null,variables:c})).run([i])[0];else switch(t.whenMatched){case`replace`:r[a]=e;break;case`fail`:throw new $2(`$merge: failed due to matching as specified by 'whenMatched' option.`);case`keepExisting`:break;default:r[a]=I6(i,[i,e],s.update({root:e,variables:c}));break}}else switch(t.whenNotMatched){case`discard`:break;case`fail`:throw new $2(`$merge: failed due to matching as specified by 'whenMatched' option.`);default:r.push(e);break}return e})},$xe=(e,t,n)=>{let r=p4(t)?n?.collectionResolver(t):t;return Y(Z(r),`expression must resolve to an array`),e.map(e=>(r.push(w4(e)),e))},eSe=(e,t,n)=>{let r=V4.init(n);return e.map(e=>g8(e,t,r.update({root:e})))};function g8(e,t,n){let r=$(e,t,null,n);switch(r){case`$$KEEP`:return e;case`$$PRUNE`:return;case`$$DESCEND`:{if(!S4(t,`$cond`))return e;let r={};for(let[i,a]of Object.entries(e))if(Z(a)){let e=[];for(let r of a)h4(r)&&(r=g8(r,t,n.update({root:r}))),Q(r)||e.push(r);r[i]=e}else if(h4(a)){let e=g8(a,t,n.update({root:a}));Q(e)||(r[i]=e)}else r[i]=a;return r}default:return r}}var tSe=(e,t,n)=>e.map(e=>(e=$(e,t.newRoot,null,n),Y(h4(e),`$replaceRoot expression must return an object`),e)),nSe=(e,t,n)=>e.map(e=>(e=$(e,t,null,n),Y(h4(e),`$replaceWith expression must return an object`),e)),rSe=(e,t,n)=>e.transform(e=>{let n=e.length,r=-1;return()=>++r===t.size?{done:!0}:{value:e[Math.floor(Math.random()*n)],done:!1}}),iSe=i8,aSe=(e,t,n)=>Z4(f8(e,{_id:t,count:{$sum:1}},n),{count:-1},n),oSe=(e,t,n)=>{let{coll:r,pipeline:i}=p4(t)||Z(t)?{coll:t}:t,a=p4(r)?n.collectionResolver(r):r,{documents:o,pipeline:s}=D3(i??[],n);Y(!a!=!o,"$unionWith: must specify single collection input with `expr.coll` or `expr.pipeline`.");let c=a??o;return q4(e,s?new Y4(s,n).stream(c):K4(c))},sSe=(e,t,n)=>{t=x4(t);let r={};for(let e of t)r[e]=0;return k3(e,r,n)},cSe=(e,t,n)=>{p4(t)&&(t={path:t});let r=t.path.substring(1),i=t?.includeArrayIndex||!1,a=t.preserveNullAndEmptyArrays||!1,o=(e,t)=>(i!==!1&&(e[i]=t),e),s;return K4(()=>{for(;;){if(s instanceof J4){let e=s.next();if(!e.done)return e}let t=e.next();if(t.done)return t;let n=t.value;if(s=A4(n,r),Z(s)){if(s.length===0&&a===!0)return s=null,I4(n,r),{value:o(n,null),done:!1};s=K4(s).map(((e,t)=>{let i=j4(n,r,{preserveKeys:!0});return F4(i,r,e),o(i,t)}))}else if(!b4(s)||a===!0)return{value:o(n,null),done:!1}}})},lSe=e({$addFields:()=>i8,$bucket:()=>Ixe,$bucketAuto:()=>Lxe,$count:()=>Hxe,$densify:()=>Uxe,$documents:()=>E3,$facet:()=>Wxe,$fill:()=>Yxe,$graphLookup:()=>Xxe,$group:()=>f8,$limit:()=>T3,$lookup:()=>h8,$match:()=>Zxe,$merge:()=>Qxe,$out:()=>$xe,$project:()=>k3,$redact:()=>eSe,$replaceRoot:()=>tSe,$replaceWith:()=>nSe,$sample:()=>rSe,$set:()=>iSe,$setWindowFields:()=>m8,$skip:()=>M3,$sort:()=>Z4,$sortByCount:()=>aSe,$unionWith:()=>oSe,$unset:()=>sSe,$unwind:()=>cSe}),uSe=(e,t,n,r)=>{let i=A4(e,n),a=new N3(t,r);if(!Z(i))return;let o=[];for(let e=0;e<i.length;e++)if(a.test(i[e])){if(r.useStrictMode)return[i[e]];o.push(i[e])}return o.length>0?o:void 0},dSe=(e,t,n,r)=>{let i=A4(e,n);return Z(i)?C3(e,Z(t)?[i,...t]:[i,t],r):i},fSe=e({$elemMatch:()=>uSe,$slice:()=>dSe}),pSe=(e,t,n)=>P3(e,t,n,Uye),mSe=(e,t,n)=>P3(e,t,n,U3),hSe=(e,t,n)=>P3(e,t,n,Wye),_8=(e,t,n)=>P3(e,t,null,(e,t)=>{let r=0;if(Z(t))for(let e of t)r|=1<<e;else r=t;return n(e&r,r)}),gSe=(e,t,n)=>_8(e,t,(e,t)=>e==0),_Se=(e,t,n)=>_8(e,t,(e,t)=>e==t),vSe=(e,t,n)=>_8(e,t,(e,t)=>e<t),ySe=(e,t,n)=>_8(e,t,(e,t)=>e>0),bSe=(e,t,n)=>P3(e,t,n,I3),xSe=(e,t,n)=>P3(e,t,n,V3),SSe=(e,t,n)=>P3(e,t,n,H3),CSe=(e,t,n)=>P3(e,t,n,R3),wSe=(e,t,n)=>P3(e,t,n,z3),TSe=(e,t,n)=>P3(e,t,n,B3),ESe=(e,t,n)=>P3(e,t,n,L3),DSe=(e,t,n)=>P3(e,t,n,Bye),OSe=(e,t,n)=>{let r=e.includes(`.`),i=!!t;return!r||e.match(/\.\d+$/)?t=>A4(t,e)!==void 0===i:t=>{let n=A4(j4(t,e,{preserveIndex:!0}),e.substring(0,e.lastIndexOf(`.`)));return Z(n)?n.some(e=>e!==void 0)===i:n!==void 0===i}},kSe=(e,t,n)=>P3(e,t,n,qye);function ASe(e,t,n){return e=>y4($(e,t,null,n),n.useStrictMode)}function jSe(e,t,n){Y(!!n?.jsonSchemaValidator,`$jsonSchema: must configure 'jsonSchemaValidator' option to this operator.`);let r=n?.jsonSchemaValidator(t);return e=>r(e)}var MSe=(e,t,n)=>P3(e,t,n,Vye),NSe=(e,t,n)=>P3(e,t,n,Hye);function PSe(e,t,n){Y(n.scriptEnabled,`$where requires 'scriptEnabled' option to be true`);let r=t;return Y(yve(r),`$where only accepts a Function objects`),e=>y4(r.call(e),n?.useStrictMode)}var FSe=(e,t,n)=>{Y(Z(t),`Invalid expression: $and expects value to be an Array.`);let r=t.map(e=>new N3(e,n));return e=>r.every(t=>t.test(e))},v8=(e,t,n)=>{Y(Z(t),`Invalid expression. $or expects value to be an Array`);let r=t.map(e=>new N3(e,n));return e=>r.some(t=>t.test(e))},ISe=(e,t,n)=>{Y(Z(t),`Invalid expression. $nor expects value to be an array.`);let r=v8(`$or`,t,n);return e=>!r(e)},LSe=(e,t,n)=>{let r={};r[e]=R4(t);let i=new N3(r,n);return e=>!i.test(e)},RSe=e({$all:()=>pSe,$and:()=>FSe,$bitsAllClear:()=>gSe,$bitsAllSet:()=>_Se,$bitsAnyClear:()=>vSe,$bitsAnySet:()=>ySe,$elemMatch:()=>mSe,$eq:()=>bSe,$exists:()=>OSe,$expr:()=>ASe,$gt:()=>xSe,$gte:()=>SSe,$in:()=>CSe,$jsonSchema:()=>jSe,$lt:()=>wSe,$lte:()=>TSe,$mod:()=>MSe,$ne:()=>ESe,$nin:()=>DSe,$nor:()=>ISe,$not:()=>LSe,$or:()=>v8,$regex:()=>NSe,$size:()=>hSe,$type:()=>kSe,$where:()=>PSe}),zSe=(e,t,n,r)=>c8(e,t,n,r,!0),BSe=(e,t,n,r)=>{if(t.length<2)return null;let{input:i,unit:a}=n.inputExpr,o=`$`+Object.keys(n.parentExpr.sortBy)[0],s=X4([t[0],t[t.length-1]],[o,i],r).filter((([e,t])=>X(+e)&&X(+t)));if(s.length!==2)return null;let[[c,l],[u,d]]=s,f=(u-c)/Math.max(i6[a],1);return(d-l)/f},VSe=(e,t,n,r)=>n.documentNumber,HSe=(e,t,n,r)=>{let{input:i,N:a,alpha:o}=n.inputExpr;return Y(!(a&&o),`$expMovingAvg: must provide either 'N' or 'alpha' field.`),Y(!a||X(a)&&a>0,`$expMovingAvg: 'N' must be greater than zero. Got ${a}.`),Y(!o||X(o)&&o>0&&o<1,`$expMovingAvg: 'alpha' must be between 0 and 1 (exclusive), found alpha: ${o}`),s8(t,n,()=>{let e=a==null?o:2/(a+1),n=X4(t,i,r);for(let t=0;t<n.length;t++){if(t===0){X(n[t])||(n[t]=null);continue}if(!X(n[t])){n[t]=n[t-1];continue}X(n[t-1])&&(n[t]=n[t]*e+n[t-1]*(1-e))}return n},e=>e[n.documentNumber-1])},USe=(e,t,n,r)=>{let{input:i,unit:a}=n.inputExpr,o=X4(t,[`$`+Object.keys(n.parentExpr.sortBy)[0],i],r).filter((([e,t])=>X(+e)&&X(+t)));if(o.length!==t.length)return null;let s=0,c=t.length;for(let e=1;e<c;e++){let[t,n]=o[e-1],[r,i]=o[e],c=(r-t)/Math.max(i6[a],1);s+=.5*(n+i)*c}return s},WSe=(e,t,n,r)=>s8(t,n,()=>{let e=n.inputExpr,i=e.min||0,a=e.max||1,o=X4(t,e.input||n.inputExpr,r);Y(Z(o)&&o.length>0&&o.every(X),`$minMaxScaler: input must be a numeric array`);let s=o[0],c=o[0];for(let e of o)e<s?s=e:e>c&&(c=e);let l=a-i,u=c-s;return Y(u!==0,`$minMaxScaler: input range must not be zero`),{min:i,scale:l,rmin:s,range:u,nums:o}},e=>{let{min:t,rmin:r,scale:i,range:a,nums:o}=e;return(o[n.documentNumber-1]-r)/a*i+t}),GSe=(e,t,n,r)=>c8(e,t,n,r,!1),KSe=(e,t,n,r)=>{let i=n.inputExpr,a=n.documentNumber-1+i.by;return a<0||a>t.length-1?i.default?$(e,i.default,null,r):null:$(t[a],i.output,null,r)},qSe=e({$denseRank:()=>zSe,$derivative:()=>BSe,$documentNumber:()=>VSe,$expMovingAvg:()=>HSe,$integral:()=>USe,$linearFill:()=>l8,$locf:()=>u8,$minMaxScaler:()=>WSe,$rank:()=>GSe,$shift:()=>KSe}),y8=U4.init({accumulator:Vve,expression:Fxe,pipeline:lSe,projection:fSe,query:RSe,window:qSe}),b8=e=>Object.assign({...e,context:e?.context?U4.from(y8,e?.context):y8}),x8=class extends N3{constructor(e,t){super(e,b8(t))}},JSe=class extends Y4{constructor(e,t){super(e,b8(t))}},YSe=Object.defineProperty,XSe=Object.getOwnPropertyNames,S8=(e,t)=>function(){return e&&(t=(0,e[XSe(e)[0]])(e=0)),t},C8=(e,t)=>{for(var n in t)YSe(e,n,{get:t[n],enumerable:!0})},w8={};C8(w8,{LocalStoragePersistenceAdapter:()=>E8});var T8,E8,D8=S8({"src/persistence/local-storage-adapter.ts"(){T8=class e{constructor(e){this.storageKey=e?.key||`objectstack:memory-db`}async load(){try{let e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):null}catch{return null}}async save(t){let n=JSON.stringify(t);n.length>e.SIZE_WARNING_BYTES&&console.warn(`[ObjectStack] localStorage persistence data size (${(n.length/1024/1024).toFixed(2)}MB) is approaching the ~5MB limit. Consider using a different persistence strategy.`);try{localStorage.setItem(this.storageKey,n)}catch(e){console.error(`[ObjectStack] Failed to persist data to localStorage:`,e?.message||e)}}async flush(){}},T8.SIZE_WARNING_BYTES=4.5*1024*1024,E8=T8}}),O8={};C8(O8,{FileSystemPersistenceAdapter:()=>k8});var k8,A8=S8({"src/persistence/file-adapter.ts"(){k8=class{constructor(e){this.dirty=!1,this.timer=null,this.currentDb=null,this.filePath=e?.path||Ud(`.objectstack`,`data`,`memory-driver.json`),this.autoSaveInterval=e?.autoSaveInterval??2e3}async load(){try{if(!Hd(this.filePath))return null;let e=Vd(this.filePath,`utf-8`);return JSON.parse(e)}catch{return null}}async save(e){this.currentDb=e,this.dirty=!0}async flush(){!this.dirty||!this.currentDb||(await this.writeToDisk(this.currentDb),this.dirty=!1)}startAutoSave(){this.timer||(this.timer=setInterval(async()=>{this.dirty&&this.currentDb&&(await this.writeToDisk(this.currentDb),this.dirty=!1)},this.autoSaveInterval),this.timer&&this.timer.unref())}async stopAutoSave(){this.timer&&=(clearInterval(this.timer),null),await this.flush()}async writeToDisk(e){this.filePath;let t=this.filePath+`.tmp`;JSON.stringify(e,null,2),(void 0)(t,this.filePath)}}}});function j8(e,t){return t.includes(`.`)?t.split(`.`).reduce((e,t)=>e?e[t]:void 0,e):e[t]}var M8=class e{constructor(e){this.name=`com.objectstack.driver.memory`,this.type=`driver`,this.version=`1.0.0`,this.idCounters=new Map,this.transactions=new Map,this.persistenceAdapter=null,this.supports={create:!0,read:!0,update:!0,delete:!0,bulkCreate:!0,bulkUpdate:!0,bulkDelete:!0,transactions:!0,savepoints:!1,queryFilters:!0,queryAggregations:!0,querySorting:!0,queryPagination:!0,queryWindowFunctions:!1,querySubqueries:!1,queryCTE:!1,joins:!1,fullTextSearch:!1,jsonQuery:!1,geospatialQuery:!1,streaming:!0,jsonFields:!0,arrayFields:!0,vectorSearch:!1,schemaSync:!0,batchSchemaSync:!1,migrations:!1,indexes:!1,connectionPooling:!1,preparedStatements:!1,queryCache:!1},this.db={},this.config=e||{},this.logger=e?.logger||nf({level:`info`,format:`pretty`}),this.logger.debug(`InMemory driver instance created`)}install(e){this.logger.debug(`Installing InMemory driver via plugin hook`),e.engine&&e.engine.ql&&typeof e.engine.ql.registerDriver==`function`?(e.engine.ql.registerDriver(this),this.logger.info(`InMemory driver registered with ObjectQL engine`)):this.logger.warn(`Could not register driver - ObjectQL engine not found in context`)}async connect(){if(await this.initPersistence(),this.persistenceAdapter){let e=await this.persistenceAdapter.load();if(e){for(let[t,n]of Object.entries(e)){this.db[t]=n;for(let e of n)if(e.id&&typeof e.id==`string`){let n=e.id.split(`-`),r=n[n.length-1],i=parseInt(r,10);isNaN(i)||i>(this.idCounters.get(t)||0)&&this.idCounters.set(t,i)}}this.logger.info(`InMemory Database restored from persistence`,{tables:Object.keys(e).length})}}if(this.config.initialData){for(let[e,t]of Object.entries(this.config.initialData)){let n=this.getTable(e);for(let r of t){let t=r.id||this.generateId(e);n.push({...r,id:t})}}this.logger.info(`InMemory Database Connected with initial data`,{tables:Object.keys(this.config.initialData).length})}else this.logger.info(`InMemory Database Connected (Virtual)`);this.persistenceAdapter?.startAutoSave&&this.persistenceAdapter.startAutoSave()}async disconnect(){this.persistenceAdapter&&(this.persistenceAdapter.stopAutoSave&&await this.persistenceAdapter.stopAutoSave(),await this.persistenceAdapter.flush());let e=Object.keys(this.db).length,t=Object.values(this.db).reduce((e,t)=>e+t.length,0);this.db={},this.logger.info(`InMemory Database Disconnected & Cleared`,{tableCount:e,recordCount:t})}async checkHealth(){return this.logger.debug(`Health check performed`,{tableCount:Object.keys(this.db).length,status:`healthy`}),!0}async execute(e,t){return this.logger.warn(`Raw execution not supported in InMemory driver`,{command:e}),null}async find(e,t,n){this.logger.debug(`Find operation`,{object:e,query:t});let r=[...this.getTable(e)];if(t.where){let e=this.convertToMongoQuery(t.where);e&&Object.keys(e).length>0&&(r=new x8(e).find(r).all())}if((t.groupBy||t.aggregations&&t.aggregations.length>0)&&(r=this.performAggregation(r,t)),t.orderBy){let e=Array.isArray(t.orderBy)?t.orderBy:[t.orderBy];r=this.applySort(r,e)}return t.offset&&(r=r.slice(t.offset)),t.limit&&(r=r.slice(0,t.limit)),t.fields&&Array.isArray(t.fields)&&t.fields.length>0&&(r=r.map(e=>this.projectFields(e,t.fields))),this.logger.debug(`Find completed`,{object:e,resultCount:r.length}),r}async*findStream(e,t,n){this.logger.debug(`FindStream operation`,{object:e});let r=await this.find(e,t,n);for(let e of r)yield e}async findOne(e,t,n){this.logger.debug(`FindOne operation`,{object:e,query:t});let r=(await this.find(e,{...t,limit:1},n))[0]||null;return this.logger.debug(`FindOne completed`,{object:e,found:!!r}),r}async create(e,t,n){this.logger.debug(`Create operation`,{object:e,hasData:!!t});let r=this.getTable(e),i={id:t.id||this.generateId(e),...t,created_at:t.created_at||new Date().toISOString(),updated_at:t.updated_at||new Date().toISOString()};return r.push(i),this.markDirty(),this.logger.debug(`Record created`,{object:e,id:i.id,tableSize:r.length}),{...i}}async update(e,t,n,r){this.logger.debug(`Update operation`,{object:e,id:t});let i=this.getTable(e),a=i.findIndex(e=>e.id==t);if(a===-1){if(this.config.strictMode)throw this.logger.warn(`Record not found for update`,{object:e,id:t}),Error(`Record with ID ${t} not found in ${e}`);return null}let o={...i[a],...n,id:i[a].id,created_at:i[a].created_at,updated_at:new Date().toISOString()};return i[a]=o,this.markDirty(),this.logger.debug(`Record updated`,{object:e,id:t}),{...o}}async upsert(e,t,n,r){this.logger.debug(`Upsert operation`,{object:e,conflictKeys:n});let i=this.getTable(e),a=null;return t.id?a=i.find(e=>e.id===t.id):n&&n.length>0&&(a=i.find(e=>n.every(n=>e[n]===t[n]))),a?(this.logger.debug(`Record exists, updating`,{object:e,id:a.id}),this.update(e,a.id,t,r)):(this.logger.debug(`Record does not exist, creating`,{object:e}),this.create(e,t,r))}async delete(e,t,n){this.logger.debug(`Delete operation`,{object:e,id:t});let r=this.getTable(e),i=r.findIndex(e=>e.id==t);if(i===-1){if(this.config.strictMode)throw Error(`Record with ID ${t} not found in ${e}`);return this.logger.warn(`Record not found for deletion`,{object:e,id:t}),!1}return r.splice(i,1),this.markDirty(),this.logger.debug(`Record deleted`,{object:e,id:t,tableSize:r.length}),!0}async count(e,t,n){let r=this.getTable(e);if(t?.where){let e=this.convertToMongoQuery(t.where);e&&Object.keys(e).length>0&&(r=new x8(e).find(r).all())}let i=r.length;return this.logger.debug(`Count operation`,{object:e,count:i}),i}async bulkCreate(e,t,n){this.logger.debug(`BulkCreate operation`,{object:e,count:t.length});let r=await Promise.all(t.map(t=>this.create(e,t,n)));return this.logger.debug(`BulkCreate completed`,{object:e,count:r.length}),r}async updateMany(e,t,n,r){this.logger.debug(`UpdateMany operation`,{object:e,query:t});let i=this.getTable(e),a=i;if(t&&t.where){let e=this.convertToMongoQuery(t.where);e&&Object.keys(e).length>0&&(a=new x8(e).find(a).all())}let o=a.length;for(let e of a){let t=i.findIndex(t=>t.id===e.id);t!==-1&&(i[t]={...i[t],...n,updated_at:new Date().toISOString()})}return o>0&&this.markDirty(),this.logger.debug(`UpdateMany completed`,{object:e,count:o}),o}async deleteMany(e,t,n){this.logger.debug(`DeleteMany operation`,{object:e,query:t});let r=this.getTable(e),i=r.length;if(t&&t.where){let n=this.convertToMongoQuery(t.where);if(n&&Object.keys(n).length>0){let t=new x8(n).find(r).all(),i=new Set(t.map(e=>e.id));this.db[e]=r.filter(e=>!i.has(e.id))}else this.db[e]=[]}else this.db[e]=[];let a=i-this.db[e].length;return a>0&&this.markDirty(),this.logger.debug(`DeleteMany completed`,{object:e,count:a}),a}async bulkUpdate(e,t,n){this.logger.debug(`BulkUpdate operation`,{object:e,count:t.length});let r=await Promise.all(t.map(t=>this.update(e,t.id,t.data,n)));return this.logger.debug(`BulkUpdate completed`,{object:e,count:r.length}),r}async bulkDelete(e,t,n){this.logger.debug(`BulkDelete operation`,{object:e,count:t.length}),await Promise.all(t.map(t=>this.delete(e,t,n))),this.logger.debug(`BulkDelete completed`,{object:e,count:t.length})}async beginTransaction(){let e=`tx_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,t={};for(let[e,n]of Object.entries(this.db))t[e]=n.map(e=>({...e}));let n={id:e,snapshot:t};return this.transactions.set(e,n),this.logger.debug(`Transaction started`,{txId:e}),{id:e}}async commit(e){let t=e?.id;if(!t||!this.transactions.has(t)){this.logger.warn(`Commit called with unknown transaction`);return}this.transactions.delete(t),this.logger.debug(`Transaction committed`,{txId:t})}async rollback(e){let t=e?.id;if(!t||!this.transactions.has(t)){this.logger.warn(`Rollback called with unknown transaction`);return}this.db=this.transactions.get(t).snapshot,this.transactions.delete(t),this.markDirty(),this.logger.debug(`Transaction rolled back`,{txId:t})}async clear(){this.db={},this.idCounters.clear(),this.markDirty(),this.logger.debug(`All data cleared`)}getSize(){return Object.values(this.db).reduce((e,t)=>e+t.length,0)}async distinct(e,t,n){let r=this.getTable(e);if(n?.where){let e=this.convertToMongoQuery(n.where);e&&Object.keys(e).length>0&&(r=new x8(e).find(r).all())}let i=new Set;for(let e of r){let n=j8(e,t);n!=null&&i.add(n)}return Array.from(i)}async aggregate(e,t,n){this.logger.debug(`Aggregate operation`,{object:e,stageCount:t.length});let r=this.getTable(e).map(e=>({...e})),i=new JSe(t).run(r);return this.logger.debug(`Aggregate completed`,{object:e,resultCount:i.length}),i}convertToMongoQuery(e){if(!e)return{};if(!Array.isArray(e)&&typeof e==`object`){if(e.type===`comparison`)return this.convertConditionToMongo(e.field,e.operator,e.value)||{};if(e.type===`logical`){let t=e.conditions?.map(e=>this.convertToMongoQuery(e))||[];return t.length===0?{}:t.length===1?t[0]:{[e.operator===`or`?`$or`:`$and`]:t}}return this.normalizeFilterCondition(e)}if(!Array.isArray(e)||e.length===0)return{};let t=[{logic:`and`,conditions:[]}],n=`and`;for(let r of e)if(typeof r==`string`){let e=r.toLowerCase();e!==n&&(n=e,t.push({logic:n,conditions:[]}))}else if(Array.isArray(r)){let[e,n,i]=r,a=this.convertConditionToMongo(e,n,i);a&&t[t.length-1].conditions.push(a)}let r=[];for(let e of t)if(e.conditions.length!==0)if(e.conditions.length===1)r.push(e.conditions[0]);else{let t=e.logic===`or`?`$or`:`$and`;r.push({[t]:e.conditions})}return r.length===0?{}:r.length===1?r[0]:{$and:r}}convertConditionToMongo(e,t,n){switch(t){case`=`:case`==`:return{[e]:n};case`!=`:case`<>`:return{[e]:{$ne:n}};case`>`:return{[e]:{$gt:n}};case`>=`:return{[e]:{$gte:n}};case`<`:return{[e]:{$lt:n}};case`<=`:return{[e]:{$lte:n}};case`in`:return{[e]:{$in:n}};case`nin`:case`not in`:return{[e]:{$nin:n}};case`contains`:case`like`:return{[e]:{$regex:new RegExp(this.escapeRegex(n),`i`)}};case`notcontains`:case`not_contains`:return{[e]:{$not:{$regex:new RegExp(this.escapeRegex(n),`i`)}}};case`startswith`:case`starts_with`:return{[e]:{$regex:RegExp(`^${this.escapeRegex(n)}`,`i`)}};case`endswith`:case`ends_with`:return{[e]:{$regex:RegExp(`${this.escapeRegex(n)}$`,`i`)}};case`between`:return Array.isArray(n)&&n.length===2?{[e]:{$gte:n[0],$lte:n[1]}}:null;default:return null}}normalizeFilterCondition(e){let t={},n=[];for(let r of Object.keys(e)){let i=e[r];if(r===`$and`||r===`$or`){t[r]=Array.isArray(i)?i.map(e=>this.normalizeFilterCondition(e)):i;continue}if(r===`$not`){t[r]=i&&typeof i==`object`?this.normalizeFilterCondition(i):i;continue}if(r.startsWith(`$`)){t[r]=i;continue}if(i&&typeof i==`object`&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp)){let e=this.normalizeFieldOperators(i);if(e._multiRegex){let t=e._multiRegex;delete e._multiRegex;for(let i of t)n.push({[r]:{...e,...i}})}else t[r]=e}else t[r]=i}if(n.length>0){let e=t.$and,r=Array.isArray(e)?e:[];if(Object.keys(t).filter(e=>e!==`$and`).length>0){let e={...t};delete e.$and,r.push(e)}return r.push(...n),{$and:r}}return t}normalizeFieldOperators(e){let t={},n=[];for(let r of Object.keys(e)){let i=e[r];switch(r){case`$contains`:n.push({$regex:new RegExp(this.escapeRegex(i),`i`)});break;case`$notContains`:t.$not={$regex:new RegExp(this.escapeRegex(i),`i`)};break;case`$startsWith`:n.push({$regex:RegExp(`^${this.escapeRegex(i)}`,`i`)});break;case`$endsWith`:n.push({$regex:RegExp(`${this.escapeRegex(i)}$`,`i`)});break;case`$between`:Array.isArray(i)&&i.length===2&&(t.$gte=i[0],t.$lte=i[1]);break;case`$null`:i===!0?t.$eq=null:t.$ne=null;break;default:t[r]=i;break}}return n.length===1?Object.assign(t,n[0]):n.length>1&&(t._multiRegex=n),t}escapeRegex(e){return String(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}performAggregation(e,t){let{groupBy:n,aggregations:r}=t,i=new Map;if(n&&n.length>0)for(let t of e){let e=n.map(e=>{let n=j8(t,e);return n==null?`null`:String(n)}),r=JSON.stringify(e);i.has(r)||i.set(r,[]),i.get(r).push(t)}else i.set(`all`,e);let a=[];for(let[e,t]of i.entries()){let e={};if(n&&n.length>0&&t.length>0){let r=t[0];for(let t of n)this.setValueByPath(e,t,j8(r,t))}if(r)for(let n of r){let r=this.computeAggregate(t,n);e[n.alias]=r}a.push(e)}return a}computeAggregate(e,t){let{function:n,field:r}=t,i=r?e.map(e=>j8(e,r)):[];switch(n){case`count`:return!r||r===`*`?e.length:i.filter(e=>e!=null).length;case`sum`:case`avg`:{let e=i.filter(e=>typeof e==`number`),t=e.reduce((e,t)=>e+t,0);return n===`sum`?t:e.length>0?t/e.length:null}case`min`:{let e=i.filter(e=>e!=null);return e.length===0?null:e.reduce((e,t)=>t<e?t:e,e[0])}case`max`:{let e=i.filter(e=>e!=null);return e.length===0?null:e.reduce((e,t)=>t>e?t:e,e[0])}default:return null}}setValueByPath(e,t,n){let r=t.split(`.`),i=e;for(let e=0;e<r.length-1;e++){let t=r[e];i[t]||(i[t]={}),i=i[t]}i[r[r.length-1]]=n}async syncSchema(e,t,n){this.db[e]||(this.db[e]=[],this.logger.info(`Created in-memory table`,{object:e}))}async dropTable(e,t){if(this.db[e]){let t=this.db[e].length;delete this.db[e],this.logger.info(`Dropped in-memory table`,{object:e,recordCount:t})}}applySort(e,t){let n=[...e];for(let e=t.length-1;e>=0;e--){let r=t[e],i,a;if(typeof r==`object`&&!Array.isArray(r))i=r.field,a=r.order||r.direction||`asc`;else if(Array.isArray(r))[i,a]=r;else continue;n.sort((e,t)=>{let n=j8(e,i),r=j8(t,i);return n==null&&r==null?0:n==null?1:r==null?-1:n<r?a===`desc`?1:-1:n>r?a===`desc`?-1:1:0})}return n}projectFields(e,t){let n={};for(let r of t){let t=j8(e,r);t!==void 0&&(n[r]=t)}return!t.includes(`id`)&&e.id!==void 0&&(n.id=e.id),n}getTable(e){return this.db[e]||(this.db[e]=[]),this.db[e]}generateId(e){let t=e||`_global`,n=(this.idCounters.get(t)||0)+1;return this.idCounters.set(t,n),`${t}-${Date.now()}-${n}`}markDirty(){this.persistenceAdapter&&this.persistenceAdapter.save(this.db)}async flush(){this.persistenceAdapter&&await this.persistenceAdapter.flush()}isBrowserEnvironment(){return globalThis.localStorage!==void 0}isServerlessEnvironment(){if(globalThis.process===void 0)return!1;let e={};return!!(e.VERCEL||e.VERCEL_ENV||e.AWS_LAMBDA_FUNCTION_NAME||e.NETLIFY||e.FUNCTIONS_WORKER_RUNTIME||e.K_SERVICE||e.FUNCTION_TARGET||e.DENO_DEPLOYMENT_ID)}async initPersistence(){let t=this.config.persistence===void 0?`auto`:this.config.persistence;if(t!==!1){if(typeof t==`string`)if(t===`auto`)if(this.isBrowserEnvironment()){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(D8(),w8));this.persistenceAdapter=new e,this.logger.debug(`Auto-detected browser environment, using localStorage persistence`)}else if(this.isServerlessEnvironment())this.logger.warn(e.SERVERLESS_PERSISTENCE_WARNING);else{let{FileSystemPersistenceAdapter:e}=await Promise.resolve().then(()=>(A8(),O8));this.persistenceAdapter=new e,this.logger.debug(`Auto-detected Node.js environment, using file persistence`)}else if(t===`file`){let{FileSystemPersistenceAdapter:e}=await Promise.resolve().then(()=>(A8(),O8));this.persistenceAdapter=new e}else if(t===`local`){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(D8(),w8));this.persistenceAdapter=new e}else throw Error(`Unknown persistence type: "${t}". Use 'file', 'local', or 'auto'.`);else if(`adapter`in t&&t.adapter)this.persistenceAdapter=t.adapter;else if(`type`in t){if(t.type===`auto`)if(this.isBrowserEnvironment()){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(D8(),w8));this.persistenceAdapter=new e({key:t.key}),this.logger.debug(`Auto-detected browser environment, using localStorage persistence`)}else if(this.isServerlessEnvironment())this.logger.warn(e.SERVERLESS_PERSISTENCE_WARNING);else{let{FileSystemPersistenceAdapter:e}=await Promise.resolve().then(()=>(A8(),O8));this.persistenceAdapter=new e({path:t.path,autoSaveInterval:t.autoSaveInterval}),this.logger.debug(`Auto-detected Node.js environment, using file persistence`)}else if(t.type===`file`){let{FileSystemPersistenceAdapter:e}=await Promise.resolve().then(()=>(A8(),O8));this.persistenceAdapter=new e({path:t.path,autoSaveInterval:t.autoSaveInterval})}else if(t.type===`local`){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(D8(),w8));this.persistenceAdapter=new e({key:t.key})}}this.persistenceAdapter&&this.logger.debug(`Persistence adapter initialized`)}}};M8.SERVERLESS_PERSISTENCE_WARNING=`Serverless environment detected — file-system persistence is disabled in auto mode. Data will NOT be persisted across function invocations. Set persistence: false to silence this warning, or provide a custom adapter (e.g. Upstash Redis, Vercel KV) via persistence: { adapter: yourAdapter }.`;var ZSe=M8;A8(),D8();var QSe=/(%?)(%([sdijo]))/g;function $Se(e,t){switch(t){case`s`:return e;case`d`:case`i`:return Number(e);case`j`:return JSON.stringify(e);case`o`:{if(typeof e==`string`)return e;let t=JSON.stringify(e);return t===`{}`||t===`[]`||/^\[object .+?\]$/.test(t)?e:t}}}function N8(e,...t){if(t.length===0)return e;let n=0,r=e.replace(QSe,(e,r,i,a)=>{let o=t[n],s=$Se(o,a);return r?e:(n++,s)});return n<t.length&&(r+=` ${t.slice(n).join(` `)}`),r=r.replace(/%{2,2}/g,`%`),r}var eCe=2;function tCe(e){if(!e.stack)return;let t=e.stack.split(`
|
|
101
101
|
`);t.splice(1,eCe),e.stack=t.join(`
|
|
102
102
|
`)}var nCe=class extends Error{constructor(e,...t){super(e),this.message=e,this.name=`Invariant Violation`,this.message=N8(e,...t),tCe(this)}},P8=(e,t,...n)=>{if(!e)throw new nCe(t,...n)};P8.as=(e,t,n,...r)=>{if(!t){let t=r.length===0?n:N8(n,...r),i;try{i=Reflect.construct(e,[t])}catch{i=e(t)}throw i}};var rCe=`[MSW]`;function F8(e,...t){return`${rCe} ${N8(e,...t)}`}function iCe(e,...t){console.warn(F8(e,...t))}function aCe(e,...t){console.error(F8(e,...t))}var I8={formatMessage:F8,warn:iCe,error:aCe},L8=class extends Error{constructor(e){super(e),this.name=`InternalError`}},oCe=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name=`MaxListenersExceededWarning`}},R8=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=R8.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){let n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){let n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,`name`,{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){let n=this._getListeners(e);return n.forEach(e=>{e.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent(`newListener`,e,t);let n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;let t=new oCe(this,e,this.listenerCount(e));console.warn(t)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){let n=this._getListeners(e);if(n.length>0){let r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){let n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent(`removeListener`,e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},z8=R8;z8.defaultMaxListeners=10;function sCe(e,t){let n=e.emit;if(n._isPiped)return;let r=function(e,...r){return t.emit(e,...r),n.call(this,e,...r)};r._isPiped=!0,e.emit=r}function cCe(e){let t=[...e];return Object.freeze(t),t}var lCe=class{subscriptions=[];dispose(){let e;for(;e=this.subscriptions.shift();)e()}},uCe=class{constructor(e){this.initialHandlers=e,this.handlers=[...e]}handlers;prepend(e){this.handlers.unshift(...e)}reset(e){this.handlers=e.length>0?[...e]:[...this.initialHandlers]}currentHandlers(){return this.handlers}},dCe=class extends lCe{handlersController;emitter;publicEmitter;events;constructor(...e){super(),P8(this.validateHandlers(e),I8.formatMessage(`Failed to apply given request handlers: invalid input. Did you forget to spread the request handlers Array?`)),this.handlersController=new uCe(e),this.emitter=new z8,this.publicEmitter=new z8,sCe(this.emitter,this.publicEmitter),this.events=this.createLifeCycleEvents(),this.subscriptions.push(()=>{this.emitter.removeAllListeners(),this.publicEmitter.removeAllListeners()})}validateHandlers(e){return e.every(e=>!Array.isArray(e))}use(...e){P8(this.validateHandlers(e),I8.formatMessage(`Failed to call "use()" with the given request handlers: invalid input. Did you forget to spread the array of request handlers?`)),this.handlersController.prepend(e)}restoreHandlers(){this.handlersController.currentHandlers().forEach(e=>{`isUsed`in e&&(e.isUsed=!1)})}resetHandlers(...e){this.handlersController.reset(e)}listHandlers(){return cCe(this.handlersController.currentHandlers())}createLifeCycleEvents(){return{on:(...e)=>this.publicEmitter.on(...e),removeListener:(...e)=>this.publicEmitter.removeListener(...e),removeAllListeners:(...e)=>this.publicEmitter.removeAllListeners(...e)}}},fCe=/[/\\]msw[/\\]src[/\\](.+)/,pCe=/(node_modules)?[/\\]lib[/\\](core|browser|node|native|iife)[/\\]|^[^/\\]*$/;function mCe(e){let t=e.stack;if(!t)return;let n=t.split(`
|
|
103
103
|
`).slice(1).find(e=>!(fCe.test(e)||pCe.test(e)));if(n)return n.replace(/\s*at [^()]*\(([^)]+)\)/,`$1`).replace(/^@/,``)}function hCe(e){return e?Reflect.has(e,Symbol.iterator)||Reflect.has(e,Symbol.asyncIterator):!1}var B8=class e{static cache=new WeakMap;__kind;info;isUsed;resolver;resolverIterator;resolverIteratorResult;options;constructor(e){this.resolver=e.resolver,this.options=e.options;let t=mCe(Error());this.info={...e.info,callFrame:t},this.isUsed=!1,this.__kind=`RequestHandler`}async parse(e){return{}}async test(e){let t=await this.parse({request:e.request,resolutionContext:e.resolutionContext});return this.predicate({request:e.request,parsedResult:t,resolutionContext:e.resolutionContext})}extendResolverArgs(e){return{}}cloneRequestOrGetFromCache(t){let n=e.cache.get(t);if(n!==void 0)return n;let r=t.clone();return e.cache.set(t,r),r}async run(e){if(this.isUsed&&this.options?.once)return null;let t=this.cloneRequestOrGetFromCache(e.request),n=await this.parse({request:e.request,resolutionContext:e.resolutionContext});if(!await this.predicate({request:e.request,parsedResult:n,resolutionContext:e.resolutionContext})||this.isUsed&&this.options?.once)return null;this.isUsed=!0;let r=await this.wrapResolver(this.resolver)({...this.extendResolverArgs({request:e.request,parsedResult:n}),requestId:e.requestId,request:e.request}).catch(e=>{if(e instanceof Response)return e;throw e});return this.createExecutionResult({request:t,requestId:e.requestId,response:r,parsedResult:n})}wrapResolver(e){return async t=>{if(!this.resolverIterator){let n=await e(t);if(!hCe(n))return n;this.resolverIterator=Symbol.iterator in n?n[Symbol.iterator]():n[Symbol.asyncIterator]()}this.isUsed=!1;let{done:n,value:r}=await this.resolverIterator.next(),i=await r;return i&&(this.resolverIteratorResult=i.clone()),n?(this.isUsed=!0,this.resolverIteratorResult?.clone()):i}}createExecutionResult(e){return{handler:this,request:e.request,requestId:e.requestId,response:e.response,parsedResult:e.parsedResult}}};function gCe(e,t){return e.toLowerCase()===t.toLowerCase()}function _Ce(e){return e<300?`#69AB32`:e<400?`#F0BB4B`:`#E95F5D`}function V8(e){let t=new Date,n=`${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}:${t.getSeconds().toString().padStart(2,`0`)}`;return e?.milliseconds?`${n}.${t.getMilliseconds().toString().padStart(3,`0`)}`:n}async function vCe(e){let t=await e.clone().text();return{url:new URL(e.url),method:e.method,headers:Object.fromEntries(e.headers.entries()),body:t}}var yCe=Object.create,H8=Object.defineProperty,bCe=Object.getOwnPropertyDescriptor,U8=Object.getOwnPropertyNames,xCe=Object.getPrototypeOf,SCe=Object.prototype.hasOwnProperty,W8=(e,t)=>function(){return t||(0,e[U8(e)[0]])((t={exports:{}}).exports,t),t.exports},CCe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of U8(t))!SCe.call(e,i)&&i!==n&&H8(e,i,{get:()=>t[i],enumerable:!(r=bCe(t,i))||r.enumerable});return e},wCe=(e,t,n)=>(n=e==null?{}:yCe(xCe(e)),CCe(t||!e||!e.__esModule?H8(n,`default`,{value:e,enumerable:!0}):n,e)),TCe=W8({"node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json"(e,t){t.exports={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`}}}),G8=wCe(W8({"node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js"(e,t){var n=TCe();t.exports=s,s.message=n,s.code=r(n),s.codes=i(n),s.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},s.empty={204:!0,205:!0,304:!0},s.retry={502:!0,503:!0,504:!0};function r(e){var t={};return Object.keys(e).forEach(function(n){var r=e[n],i=Number(n);t[r.toLowerCase()]=i}),t}function i(e){return Object.keys(e).map(function(e){return Number(e)})}function a(e){var t=e.toLowerCase();if(!Object.prototype.hasOwnProperty.call(s.code,t))throw Error(`invalid status message: "`+e+`"`);return s.code[t]}function o(e){if(!Object.prototype.hasOwnProperty.call(s.message,e))throw Error(`invalid status code: `+e);return s.message[e]}function s(e){if(typeof e==`number`)return o(e);if(typeof e!=`string`)throw TypeError(`code must be a number or string`);var t=parseInt(e,10);return isNaN(t)?a(e):o(t)}}})(),1),K8=G8.default||G8;K8.message;var q8=K8,{message:ECe}=q8;async function DCe(e){let t=e.clone(),n=await t.text(),r=t.status||200;return{status:r,statusText:t.statusText||ECe[r]||`OK`,headers:Object.fromEntries(t.headers.entries()),body:n}}function OCe(e){for(var t=[],n=0;n<e.length;){var r=e[n];if(r===`*`||r===`+`||r===`?`){t.push({type:`MODIFIER`,index:n,value:e[n++]});continue}if(r===`\\`){t.push({type:`ESCAPED_CHAR`,index:n++,value:e[n++]});continue}if(r===`{`){t.push({type:`OPEN`,index:n,value:e[n++]});continue}if(r===`}`){t.push({type:`CLOSE`,index:n,value:e[n++]});continue}if(r===`:`){for(var i=``,a=n+1;a<e.length;){var o=e.charCodeAt(a);if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){i+=e[a++];continue}break}if(!i)throw TypeError(`Missing parameter name at ${n}`);t.push({type:`NAME`,index:n,value:i}),n=a;continue}if(r===`(`){var s=1,c=``,a=n+1;if(e[a]===`?`)throw TypeError(`Pattern cannot start with "?" at ${a}`);for(;a<e.length;){if(e[a]===`\\`){c+=e[a++]+e[a++];continue}if(e[a]===`)`){if(s--,s===0){a++;break}}else if(e[a]===`(`&&(s++,e[a+1]!==`?`))throw TypeError(`Capturing groups are not allowed at ${a}`);c+=e[a++]}if(s)throw TypeError(`Unbalanced pattern at ${n}`);if(!c)throw TypeError(`Missing pattern at ${n}`);t.push({type:`PATTERN`,index:n,value:c}),n=a;continue}t.push({type:`CHAR`,index:n,value:e[n++]})}return t.push({type:`END`,index:n,value:``}),t}function kCe(e,t){t===void 0&&(t={});for(var n=OCe(e),r=t.prefixes,i=r===void 0?`./`:r,a=t.delimiter,o=a===void 0?`/#?`:a,s=[],c=0,l=0,u=``,d=function(e){if(l<n.length&&n[l].type===e)return n[l++].value},f=function(e){var t=d(e);if(t!==void 0)return t;var r=n[l],i=r.type,a=r.index;throw TypeError(`Unexpected ${i} at ${a}, expected ${e}`)},p=function(){for(var e=``,t;t=d(`CHAR`)||d(`ESCAPED_CHAR`);)e+=t;return e},m=function(e){for(var t=0,n=o;t<n.length;t++){var r=n[t];if(e.indexOf(r)>-1)return!0}return!1},h=function(e){var t=s[s.length-1],n=e||(t&&typeof t==`string`?t:``);if(t&&!n)throw TypeError(`Must have text between two parameters, missing text after "${t.name}"`);return!n||m(n)?`[^${J8(o)}]+?`:`(?:(?!${J8(n)})[^${J8(o)}])+?`};l<n.length;){var g=d(`CHAR`),_=d(`NAME`),v=d(`PATTERN`);if(_||v){var y=g||``;i.indexOf(y)===-1&&(u+=y,y=``),u&&=(s.push(u),``),s.push({name:_||c++,prefix:y,suffix:``,pattern:v||h(y),modifier:d(`MODIFIER`)||``});continue}var b=g||d(`ESCAPED_CHAR`);if(b){u+=b;continue}if(u&&=(s.push(u),``),d(`OPEN`)){var y=p(),x=d(`NAME`)||``,S=d(`PATTERN`)||``,C=p();f(`CLOSE`),s.push({name:x||(S?c++:``),pattern:x&&!S?h(y):S,prefix:y,suffix:C,modifier:d(`MODIFIER`)||``});continue}f(`END`)}return s}function ACe(e,t){var n=[];return jCe(X8(e,n,t),n,t)}function jCe(e,t,n){n===void 0&&(n={});var r=n.decode,i=r===void 0?function(e){return e}:r;return function(n){var r=e.exec(n);if(!r)return!1;for(var a=r[0],o=r.index,s=Object.create(null),c=function(e){if(r[e]===void 0)return`continue`;var n=t[e-1];n.modifier===`*`||n.modifier===`+`?s[n.name]=r[e].split(n.prefix+n.suffix).map(function(e){return i(e,n)}):s[n.name]=i(r[e],n)},l=1;l<r.length;l++)c(l);return{path:a,index:o,params:s}}}function J8(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,`\\$1`)}function Y8(e){return e&&e.sensitive?``:`i`}function MCe(e,t){if(!t)return e;for(var n=/\((?:\?<(.*?)>)?(?!\?)/g,r=0,i=n.exec(e.source);i;)t.push({name:i[1]||r++,prefix:``,suffix:``,modifier:``,pattern:``}),i=n.exec(e.source);return e}function NCe(e,t,n){var r=e.map(function(e){return X8(e,t,n).source});return RegExp(`(?:${r.join(`|`)})`,Y8(n))}function PCe(e,t,n){return FCe(kCe(e,n),t,n)}function FCe(e,t,n){n===void 0&&(n={});for(var r=n.strict,i=r===void 0?!1:r,a=n.start,o=a===void 0?!0:a,s=n.end,c=s===void 0?!0:s,l=n.encode,u=l===void 0?function(e){return e}:l,d=n.delimiter,f=d===void 0?`/#?`:d,p=n.endsWith,m=`[${J8(p===void 0?``:p)}]|\$`,h=`[${J8(f)}]`,g=o?`^`:``,_=0,v=e;_<v.length;_++){var y=v[_];if(typeof y==`string`)g+=J8(u(y));else{var b=J8(u(y.prefix)),x=J8(u(y.suffix));if(y.pattern)if(t&&t.push(y),b||x)if(y.modifier===`+`||y.modifier===`*`){var S=y.modifier===`*`?`?`:``;g+=`(?:${b}((?:${y.pattern})(?:${x}${b}(?:${y.pattern}))*)${x})${S}`}else g+=`(?:${b}(${y.pattern})${x})${y.modifier}`;else{if(y.modifier===`+`||y.modifier===`*`)throw TypeError(`Can not repeat "${y.name}" without a prefix and suffix`);g+=`(${y.pattern})${y.modifier}`}else g+=`(?:${b}${x})${y.modifier}`}}if(c)i||(g+=`${h}?`),g+=n.endsWith?`(?=${m})`:`$`;else{var C=e[e.length-1],w=typeof C==`string`?h.indexOf(C[C.length-1])>-1:C===void 0;i||(g+=`(?:${h}(?=${m}))?`),w||(g+=`(?=${h}|${m})`)}return new RegExp(g,Y8(n))}function X8(e,t,n){return e instanceof RegExp?MCe(e,t):Array.isArray(e)?NCe(e,t,n):PCe(e,t,n)}function ICe(){let e=(t,n)=>{e.state=`pending`,e.resolve=n=>e.state===`pending`?(e.result=n,t(n instanceof Promise?n:Promise.resolve(n).then(t=>(e.state=`fulfilled`,t)))):void 0,e.reject=t=>{if(e.state===`pending`)return queueMicrotask(()=>{e.state=`rejected`}),n(e.rejectionReason=t)}};return e}var Z8=class extends Promise{#e;resolve;reject;constructor(e=null){let t=ICe();super((n,r)=>{t(n,r),e?.(t.resolve,t.reject)}),this.#e=t,this.resolve=this.#e.resolve,this.reject=this.#e.reject}get state(){return this.#e.state}get rejectionReason(){return this.#e.rejectionReason}then(e,t){return this.#t(super.then(e,t))}catch(e){return this.#t(super.catch(e))}finally(e){return this.#t(super.finally(e))}#t(e){return Object.defineProperties(e,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})}},Q8=class e extends Error{constructor(t){super(t),this.name=`InterceptorError`,Object.setPrototypeOf(this,e.prototype)}};(class e{static{this.PENDING=0}static{this.PASSTHROUGH=1}static{this.RESPONSE=2}static{this.ERROR=3}constructor(t,n){this.request=t,this.source=n,this.readyState=e.PENDING,this.handled=new Z8}get#e(){return this.handled}async passthrough(){P8.as(Q8,this.readyState===e.PENDING,`Failed to passthrough the "%s %s" request: the request has already been handled`,this.request.method,this.request.url),this.readyState=e.PASSTHROUGH,await this.source.passthrough(),this.#e.resolve()}respondWith(t){P8.as(Q8,this.readyState===e.PENDING,`Failed to respond to the "%s %s" request with "%d %s": the request has already been handled (%d)`,this.request.method,this.request.url,t.status,t.statusText||`OK`,this.readyState),this.readyState=e.RESPONSE,this.#e.resolve(),this.source.respondWith(t)}errorWith(t){P8.as(Q8,this.readyState===e.PENDING,`Failed to error the "%s %s" request with "%s": the request has already been handled (%d)`,this.request.method,this.request.url,t?.toString(),this.readyState),this.readyState=e.ERROR,this.source.errorWith(t),this.#e.resolve()}});function LCe(e){try{return new URL(e),!0}catch{return!1}}function $8(e,t){let n=Object.getOwnPropertySymbols(t).find(t=>t.description===e);if(n)return Reflect.get(t,n)}var RCe=class e extends Response{static{this.STATUS_CODES_WITHOUT_BODY=[101,103,204,205,304]}static{this.STATUS_CODES_WITH_REDIRECT=[301,302,303,307,308]}static isConfigurableStatusCode(e){return e>=200&&e<=599}static isRedirectResponse(t){return e.STATUS_CODES_WITH_REDIRECT.includes(t)}static isResponseWithBody(t){return!e.STATUS_CODES_WITHOUT_BODY.includes(t)}static setUrl(e,t){if(!e||e===`about:`||!LCe(e))return;let n=$8(`state`,t);n?n.urlList.push(new URL(e)):Object.defineProperty(t,`url`,{value:e,enumerable:!0,configurable:!0,writable:!1})}static parseRawHeaders(e){let t=new Headers;for(let n=0;n<e.length;n+=2)t.append(e[n],e[n+1]);return t}constructor(t,n={}){let r=n.status??200,i=e.isConfigurableStatusCode(r)?r:200,a=e.isResponseWithBody(r)?t:null;if(super(a,{status:i,statusText:n.statusText,headers:n.headers}),r!==i){let e=$8(`state`,this);e?e.status=r:Object.defineProperty(this,`status`,{value:r,enumerable:!0,configurable:!0,writable:!1})}e.setUrl(n.url,this)}};function e5(){if(typeof navigator<`u`&&navigator.product===`ReactNative`)return!0;if(typeof process<`u`){let e=process.type;return e===`renderer`||e===`worker`?!1:!!(process.versions&&process.versions.node)}return!1}var zCe=Object.defineProperty,BCe=(e,t)=>{for(var n in t)zCe(e,n,{get:t[n],enumerable:!0})},t5={};BCe(t5,{blue:()=>HCe,gray:()=>n5,green:()=>WCe,red:()=>UCe,yellow:()=>VCe});function VCe(e){return`\x1B[33m${e}\x1B[0m`}function HCe(e){return`\x1B[34m${e}\x1B[0m`}function n5(e){return`\x1B[90m${e}\x1B[0m`}function UCe(e){return`\x1B[31m${e}\x1B[0m`}function WCe(e){return`\x1B[32m${e}\x1B[0m`}var r5=e5(),i5=class{constructor(e){this.name=e,this.prefix=`[${this.name}]`;let t=o5(`DEBUG`),n=o5(`LOG_LEVEL`);t===`1`||t===`true`||t!==void 0&&this.name.startsWith(t)?(this.debug=s5(n,`debug`)?a5:this.debug,this.info=s5(n,`info`)?a5:this.info,this.success=s5(n,`success`)?a5:this.success,this.warning=s5(n,`warning`)?a5:this.warning,this.error=s5(n,`error`)?a5:this.error):(this.info=a5,this.success=a5,this.warning=a5,this.error=a5,this.only=a5)}prefix;extend(e){return new i5(`${this.name}:${e}`)}debug(e,...t){this.logEntry({level:`debug`,message:n5(e),positionals:t,prefix:this.prefix,colors:{prefix:`gray`}})}info(e,...t){this.logEntry({level:`info`,message:e,positionals:t,prefix:this.prefix,colors:{prefix:`blue`}});let n=new GCe;return(e,...t)=>{n.measure(),this.logEntry({level:`info`,message:`${e} ${n5(`${n.deltaTime}ms`)}`,positionals:t,prefix:this.prefix,colors:{prefix:`blue`}})}}success(e,...t){this.logEntry({level:`info`,message:e,positionals:t,prefix:`\u2714 ${this.prefix}`,colors:{timestamp:`green`,prefix:`green`}})}warning(e,...t){this.logEntry({level:`warning`,message:e,positionals:t,prefix:`\u26A0 ${this.prefix}`,colors:{timestamp:`yellow`,prefix:`yellow`}})}error(e,...t){this.logEntry({level:`error`,message:e,positionals:t,prefix:`\u2716 ${this.prefix}`,colors:{timestamp:`red`,prefix:`red`}})}only(e){e()}createEntry(e,t){return{timestamp:new Date,level:e,message:t}}logEntry(e){let{level:t,message:n,prefix:r,colors:i,positionals:a=[]}=e,o=this.createEntry(t,n),s=i?.timestamp||`gray`,c=i?.prefix||`gray`,l={timestamp:t5[s],prefix:t5[c]};this.getWriter(t)([l.timestamp(this.formatTimestamp(o.timestamp))].concat(r==null?[]:l.prefix(r),c5(n)).join(` `),...a.map(c5))}formatTimestamp(e){return`${e.toLocaleTimeString(`en-GB`)}:${e.getMilliseconds()}`}getWriter(e){switch(e){case`debug`:case`success`:case`info`:return KCe;case`warning`:return qCe;case`error`:return JCe}}},GCe=class{startTime;endTime;deltaTime;constructor(){this.startTime=performance.now()}measure(){this.endTime=performance.now(),this.deltaTime=(this.endTime-this.startTime).toFixed(2)}},a5=()=>void 0;function KCe(e,...t){if(r5){process.stdout.write(N8(e,...t)+`
|